File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ public class StartAzureSqlServerUpgrade : AzureSqlServerUpgradeCmdletBase<AzureS
53
53
HelpMessage = "Determines the collection of recommended elastic pool properties for server upgrade" ) ]
54
54
public UpgradeRecommendedElasticPoolProperties [ ] ElasticPoolCollection { get ; set ; }
55
55
56
+ private const int StorageMbPerDtuBasic = 100 ;
57
+ private const int StorageMbPerDtuStandard = 1024 ;
58
+ private const int StorageMbPerDtuPremium = 512 ;
59
+
56
60
/// <summary>
57
61
/// Check to see if the server already exists in this resource group.
58
62
/// </summary>
@@ -82,6 +86,26 @@ public class StartAzureSqlServerUpgrade : AzureSqlServerUpgradeCmdletBase<AzureS
82
86
/// <returns>The generated model from user input</returns>
83
87
protected override IEnumerable < AzureSqlServerUpgradeStartModel > ApplyUserInputToModel ( IEnumerable < AzureSqlServerUpgradeStartModel > models )
84
88
{
89
+ // Ignore user input and recalculate StorageMb based on Dtu and coefficient of the edition
90
+ foreach ( var elasticPoolProperties in ElasticPoolCollection )
91
+ {
92
+ switch ( elasticPoolProperties . Edition . ToLower ( ) )
93
+ {
94
+ case "basic" :
95
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuBasic ;
96
+ break ;
97
+ case "standard" :
98
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuStandard ;
99
+ break ;
100
+ case "premium" :
101
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuPremium ;
102
+ break ;
103
+ default :
104
+ throw new PSArgumentException ( string . Format ( "Edition {0} is invalid" , elasticPoolProperties . Edition ) ) ;
105
+ }
106
+
107
+ }
108
+
85
109
var newEntity = new List < AzureSqlServerUpgradeStartModel > ( ) ;
86
110
newEntity . Add ( new AzureSqlServerUpgradeStartModel
87
111
{
You can’t perform that action at this time.
0 commit comments