From 94b4437a6ab1be2e66b129aa2fe03af2d7a5461f Mon Sep 17 00:00:00 2001 From: Raymond Truong Date: Fri, 11 Mar 2022 09:49:44 -0800 Subject: [PATCH] [SQL Migration] Fix SKU recommendations not working for named (non-default) instances (#18697) * WIP * Change instance name from machine name to full instance name returned by assessment * Get full instance name from source connection profile instead of relying on assessment result * Combine correct machine name with correct instance name --- extensions/sql-migration/src/models/stateMachine.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/sql-migration/src/models/stateMachine.ts b/extensions/sql-migration/src/models/stateMachine.ts index bec5abb083..6d3e3381fb 100644 --- a/extensions/sql-migration/src/models/stateMachine.ts +++ b/extensions/sql-migration/src/models/stateMachine.ts @@ -352,13 +352,21 @@ export class MigrationStateModel implements Model, vscode.Disposable { public async getSkuRecommendations(): Promise { try { const serverInfo = await azdata.connection.getServerInfo(this.sourceConnectionId); - const machineName = (serverInfo)['machineName']; // get actual machine name instead of whatever the user entered as the server name (e.g. DESKTOP-xxx instead of localhost) + const machineName = (serverInfo)['machineName']; // contains the correct machine name but not necessarily the correct instance name + const instanceName = (await this.getSourceConnectionProfile()).serverName; // contains the correct instance name but not necessarily the correct machine name + + let fullInstanceName: string; + if (instanceName.includes('\\')) { + fullInstanceName = machineName + '\\' + instanceName.substring(instanceName.indexOf('\\') + 1); + } else { + fullInstanceName = machineName; + } const response = (await this.migrationService.getSkuRecommendations( this._skuRecommendationPerformanceLocation, this._performanceDataQueryIntervalInSeconds, this._recommendationTargetPlatforms.map(p => p.toString()), - machineName, + fullInstanceName, this._skuTargetPercentile, this._skuScalingFactor, this._defaultDataPointStartTime,