File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet Expand file tree Collapse file tree 1 file changed +27
-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,29 @@ 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
+ if ( ElasticPoolCollection != null )
90
+ {
91
+ // Ignore user input and recalculate StorageMb based on Dtu and coefficient of the edition
92
+ foreach ( var elasticPoolProperties in ElasticPoolCollection )
93
+ {
94
+ switch ( elasticPoolProperties . Edition . ToLower ( ) )
95
+ {
96
+ case "basic" :
97
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuBasic ;
98
+ break ;
99
+ case "standard" :
100
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuStandard ;
101
+ break ;
102
+ case "premium" :
103
+ elasticPoolProperties . StorageMb = elasticPoolProperties . Dtu * StorageMbPerDtuPremium ;
104
+ break ;
105
+ default :
106
+ throw new PSArgumentException ( string . Format ( "Edition {0} is invalid" , elasticPoolProperties . Edition ) ) ;
107
+ }
108
+
109
+ }
110
+ }
111
+
85
112
var newEntity = new List < AzureSqlServerUpgradeStartModel > ( ) ;
86
113
newEntity . Add ( new AzureSqlServerUpgradeStartModel
87
114
{
You can’t perform that action at this time.
0 commit comments