From 1aae1d81f2f30308d78f0c752670047b321903df Mon Sep 17 00:00:00 2001 From: junierch <109680247+junierch@users.noreply.github.com> Date: Thu, 3 Nov 2022 15:46:05 -0400 Subject: [PATCH] [SKU Recommendation] Remove the creation of malformed SqlDB recommendations (#1681) * Remove the creation of malformed SqlDB recommendations when creating an SKU recommendation report. * format line --- .../Migration/MigrationService.cs | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs b/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs index 05cf0cdd..f0c9e035 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs @@ -344,26 +344,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration prefs.EligibleSkuCategories = GetEligibleSkuCategories("AzureSqlDatabase", parameters.IncludePreviewSkus); resultSet.sqlDbResults = provider.GetSkuRecommendation(prefs, req); - if (resultSet.sqlDbResults.Count < parameters.DatabaseAllowList.Count) - { - // if there are fewer recommendations than expected, find which databases didn't have a result generated and create a result with a null SKU - List databasesWithRecommendation = resultSet.sqlDbResults.Select(db => db.DatabaseName).ToList(); - foreach (var databaseWithoutRecommendation in parameters.DatabaseAllowList.Where(db => !databasesWithRecommendation.Contains(db))) - { - resultSet.sqlDbResults.Add(new SkuRecommendationResult() - { - //SqlInstanceName = sqlDbResults.FirstOrDefault().SqlInstanceName, - SqlInstanceName = parameters.TargetSqlInstance, - DatabaseName = databaseWithoutRecommendation, - TargetSku = null, - MonthlyCost = null, - Ranking = -1, - PositiveJustifications = null, - NegativeJustifications = null, - }); - } - } - sqlDbStopwatch.Stop(); resultSet.sqlDbDurationInMs = sqlDbStopwatch.ElapsedMilliseconds; @@ -479,26 +459,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration DbSkuRecParams DbSkuRecParams = new DbSkuRecParams(pi.SqlDbSpec, elasticaggregator.DatabaseTs, pi.DbLookupTable, Convert.ToDouble(parameters.ScalingFactor) / 100.0, parameters.TargetSqlInstance); resultSet.sqlDbResults = pi.ElasticStrategyGetSkuRecommendation(MiSkuRecParams, DbSkuRecParams, req); - if (resultSet.sqlDbResults.Count < parameters.DatabaseAllowList.Count) - { - // if there are fewer recommendations than expected, find which databases didn't have a result generated and create a result with a null SKU - List databasesWithRecommendation = resultSet.sqlDbResults.Select(db => db.DatabaseName).ToList(); - foreach (var databaseWithoutRecommendation in parameters.DatabaseAllowList.Where(db => !databasesWithRecommendation.Contains(db))) - { - resultSet.sqlDbResults.Add(new SkuRecommendationResult() - { - //SqlInstanceName = sqlDbResults.FirstOrDefault().SqlInstanceName, - SqlInstanceName = parameters.TargetSqlInstance, - DatabaseName = databaseWithoutRecommendation, - TargetSku = null, - MonthlyCost = null, - Ranking = -1, - PositiveJustifications = null, - NegativeJustifications = null, - }); - } - } - sqlDbStopwatch.Stop(); resultSet.sqlDbDurationInMs = sqlDbStopwatch.ElapsedMilliseconds; @@ -754,6 +714,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration AzureSqlPaaSServiceTier.GeneralPurpose, ComputeTier.Provisioned, AzureSqlPaaSHardwareType.Gen5)); + eligibleSkuCategories.Add(new AzureSqlSkuPaaSCategory( AzureSqlTargetPlatform.AzureSqlDatabase, AzureSqlPurchasingModel.vCore,