[SQL Migration] Remove faulty SQL VM state validation (#19623)

* Remove VM state validation

* Remove string too

* Remove a few more references
This commit is contained in:
Raymond Truong
2022-06-07 17:17:44 -07:00
committed by GitHub
parent 487b3450bb
commit f07b4bf668
3 changed files with 5 additions and 34 deletions

View File

@@ -620,19 +620,10 @@ export async function getVirtualMachinesDropdownValues(virtualMachines: azure.Sq
if (location && resourceGroup) { if (location && resourceGroup) {
virtualMachines.forEach((virtualMachine) => { virtualMachines.forEach((virtualMachine) => {
if (virtualMachine.location.toLowerCase() === location.name.toLowerCase() && azure.getResourceGroupFromId(virtualMachine.id).toLowerCase() === resourceGroup.name.toLowerCase()) { if (virtualMachine.location.toLowerCase() === location.name.toLowerCase() && azure.getResourceGroupFromId(virtualMachine.id).toLowerCase() === resourceGroup.name.toLowerCase()) {
let virtualMachineValue: CategoryValue; virtualMachineValues.push({
if (virtualMachine.properties.provisioningState === ProvisioningState.Succeeded) { name: virtualMachine.id,
virtualMachineValue = { displayName: virtualMachine.name
name: virtualMachine.id, });
displayName: virtualMachine.name
};
} else {
virtualMachineValue = {
name: virtualMachine.id,
displayName: constants.UNAVAILABLE_TARGET_PREFIX(virtualMachine.name)
};
}
virtualMachineValues.push(virtualMachineValue);
} }
}); });
} }

View File

@@ -303,9 +303,6 @@ export function ACCOUNT_ACCESS_ERROR(account: AzureAccount, error: Error) {
export function MI_NOT_READY_ERROR(miName: string, state: string): string { export function MI_NOT_READY_ERROR(miName: string, state: string): string {
return localize('sql.migration.mi.not.ready', "The managed instance '{0}' is unavailable for migration because it is currently in the '{1}' state. To continue, select an available managed instance.", miName, state); return localize('sql.migration.mi.not.ready', "The managed instance '{0}' is unavailable for migration because it is currently in the '{1}' state. To continue, select an available managed instance.", miName, state);
} }
export function VM_NOT_READY_ERROR(miName: string, state: string): string {
return localize('sql.migration.vm.not.ready', "The virtual machine '{0}' is unavailable for migration because it is currently in the '{1}' state. To continue, select an available virtual machine.", miName, state);
}
export const SELECT_AN_ACCOUNT = localize('sql.migration.select.service.select.a.', "Sign into Azure and select an account"); export const SELECT_AN_ACCOUNT = localize('sql.migration.select.service.select.a.', "Sign into Azure and select an account");
export const SELECT_A_TENANT = localize('sql.migration.select.service.select.a.tenant', "Select a tenant"); export const SELECT_A_TENANT = localize('sql.migration.select.service.select.a.tenant', "Select a tenant");

View File

@@ -14,7 +14,6 @@ import { WIZARD_INPUT_COMPONENT_WIDTH } from './wizardController';
import * as utils from '../api/utils'; import * as utils from '../api/utils';
import { azureResource } from 'azurecore'; import { azureResource } from 'azurecore';
import { SqlVMServer } from '../api/azure'; import { SqlVMServer } from '../api/azure';
import { ProvisioningState } from '../models/migrationLocalStorage';
export class TargetSelectionPage extends MigrationWizardPage { export class TargetSelectionPage extends MigrationWizardPage {
private _view!: azdata.ModelView; private _view!: azdata.ModelView;
@@ -149,10 +148,6 @@ export class TargetSelectionPage extends MigrationWizardPage {
errors.push(constants.INVALID_VIRTUAL_MACHINE_ERROR); errors.push(constants.INVALID_VIRTUAL_MACHINE_ERROR);
break; break;
} }
if (targetVm.properties.provisioningState !== ProvisioningState.Succeeded) {
errors.push(constants.VM_NOT_READY_ERROR(targetVm.name, targetVm.properties.provisioningState));
break;
}
break; break;
} }
} }
@@ -408,21 +403,9 @@ export class TargetSelectionPage extends MigrationWizardPage {
switch (this.migrationStateModel._targetType) { switch (this.migrationStateModel._targetType) {
case MigrationTargetType.SQLVM: case MigrationTargetType.SQLVM:
const selectedVm = this.migrationStateModel._targetSqlVirtualMachines.find(vm => vm.name === value || constants.UNAVAILABLE_TARGET_PREFIX(vm.name) === value); const selectedVm = this.migrationStateModel._targetSqlVirtualMachines.find(vm => vm.name === value);
if (selectedVm) { if (selectedVm) {
this.migrationStateModel._targetServerInstance = utils.deepClone(selectedVm)! as SqlVMServer; this.migrationStateModel._targetServerInstance = utils.deepClone(selectedVm)! as SqlVMServer;
if (this.migrationStateModel._targetServerInstance.properties.provisioningState !== ProvisioningState.Succeeded) {
this.wizard.message = {
text: constants.VM_NOT_READY_ERROR(this.migrationStateModel._targetServerInstance.name, this.migrationStateModel._targetServerInstance.properties.provisioningState),
level: azdata.window.MessageLevel.Error
};
} else {
this.wizard.message = {
text: '',
level: azdata.window.MessageLevel.Error
};
}
} }
break; break;