[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
This commit is contained in:
Raymond Truong
2022-03-11 09:49:44 -08:00
committed by GitHub
parent ebdfea25ad
commit 94b4437a6a

View File

@@ -352,13 +352,21 @@ export class MigrationStateModel implements Model, vscode.Disposable {
public async getSkuRecommendations(): Promise<SkuRecommendation> {
try {
const serverInfo = await azdata.connection.getServerInfo(this.sourceConnectionId);
const machineName = (<any>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 = (<any>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,