Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to skip tracking for migration #26219

Open
wants to merge 6 commits into
base: akshikagupta/dev/display-arc-resource-and-assessment
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions extensions/sql-migration/src/constants/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,17 @@ export const SELECT_A_SQL_SERVER_INSTANCE = localize('sql.migration.select.a.sql
export const INVALID_SQL_SERVER_INSTANCE_ERROR = localize('sql.migration.invalid.sql.server.instance.error', "To continue, select a valid SQL Server instance.");
export const SQL_SERVER_INSTANCE_NOT_FOUND = localize('sql.migration.sql.server.instance.not.found', "No SQL Server instance found.");
export const SQL_SERVER_INSTANCE_DETAILS = localize('sql.migration.sql.server.instance.details', "SQL Server instance details");
export const SQL_SERVER_INSTANCE_EXISTS = localize('sql.migration.sql.server.instance.exists', "SQL Server instance already exists with same name. Verify the host and instance name or check if the SQL Server is enabled by Azure Arc, and make appropriate selection.");
export const SQL_SERVER_INSTANCE_EXISTS = localize('sql.migration.sql.server.instance.exists', "SQL Server instance already exists with same name. Verify the selected details or check if the SQL Server is enabled by Azure Arc, and make appropriate selection.");
export const SQL_SERVER_INSTANCE_EXISTS_IN_LOCATION = (location: string): string => {
return localize('sql.migration.sql.server.instance.exists.in.location', "SQL Server instance already exists in location {0} under selected resource group. Check if the SQL Server is enabled by Azure Arc, and make appropriate selection.", location);
}
export const REGISTER_ARC_RESOURCE_PROVIDER_UNAUTHORIZED_ERROR = localize('sql.migration.register.arc.resource.provider.unauthorized.error', "Failed to create SQL Server instance. Insufficient permissions to register resource provider Microsoft.AzureArcData.");
export const TRACK_MIGRATION_PROCESS_IN_AZURE_PORTAL = localize('sql.migration.track.migration.in.portal', "Do you want to track the migration process in Azure Portal?");

// Arc resource info tooltip
export const ARC_RESOURCE_ACCOUNT_INFO = localize('sql.migration.arc.subscription', "Select the Azure account under which your SQL Server subscription, resource group, location and resource resides.");
export const ARC_RESOURCE_SUBSCRIPTION_INFO = localize('sql.migration.arc.subscription', "Select the Azure subscription under which your SQL Server resource group, location and resource resides.");
export const ARC_RESOURCE_LOCATION_INFO = localize('sql.migration.arc.location', "Select the Azure region under which your SQL Server resource group and resource resides.");
export const ARC_RESOURCE_LOCATION_INFO = localize('sql.migration.arc.location', "Select the Azure region under which your resource resides.");
export const ARC_RESOURCE_RESOURCE_GROUP_INFO = localize('sql.migration.arc.resource_group', "Select the Azure rsource group under which your SQL Server resource resides.");
export const ARC_RESOURCE_INFO = localize('sql.migration.arc.resource', "Select the SQL Server enabled by Azure Arc residing in above subscription, location and resource group.");
export const NON_ARC_RESOURCE_SUBSCRIPTION_INFO = localize('sql.migration.non.arc.subscription', "Select the Azure subscription for creating Arc SQL Server that will be used for tracking the migration.");
Expand Down Expand Up @@ -783,6 +784,7 @@ export const NO_BLOBFOLDERS_FOUND = localize('sql.migration.no.blobFolders.found
export const INVALID_SUBSCRIPTION_ERROR = localize('sql.migration.invalid.subscription.error', "To continue, select a valid subscription.");
export const INVALID_LOCATION_ERROR = localize('sql.migration.invalid.location.error', "To continue, select a valid location.");
export const INVALID_RESOURCE_GROUP_ERROR = localize('sql.migration.invalid.resourceGroup.error', "To continue, select a valid resource group.");
export const INVALID_SOURCE_INFRASTRUCTURE_TYPE_ERROR = localize('sql.migration.invalid.resourceGroup.error', "To continue, select a valid source infrastructure type.");
export const INVALID_STORAGE_ACCOUNT_ERROR = localize('sql.migration.invalid.storageAccount.error', "To continue, select a valid storage account.");
export const MISSING_TARGET_USERNAME_ERROR = localize('sql.migration.missing.targetUserName.error', "To continue, enter a valid target user name.");
export const MISSING_TARGET_PASSWORD_ERROR = localize('sql.migration.missing.targetPassword.error', "To continue, enter a valid target password.");
Expand Down Expand Up @@ -1537,6 +1539,7 @@ export const SourceInfrastructureTypeLookup: LookupTable<string> = {
[SourceInfrastructureType.VirtualMachine]: localize('sql.migration.status.vm', 'Virtual Machine'),
[SourceInfrastructureType.PhysicalServer]: localize('sql.migration.status.physicalserver', 'Physical Server'),
[SourceInfrastructureType.Other]: localize('sql.migration.status.other', 'Other'),
[SourceInfrastructureType.HyperV]: localize('sql.migration.status.other', 'Hyper V'),
};

export const StatusLookup: LookupTable<string | undefined> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function parseAssessmentReport(assessmentReport: any): any {
databaseAssessment: [],
sourceInfrastructureType: null,
isSqlServerEnabledByArc: null,
trackMigration: null,
arcResourceAzureAccount: null,
arcResourceSubscription: null,
arcResourceLocation: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class RestartMigrationDialog {

// DatabaseSelector
isSqlServerEnabledByArc: null,
trackMigration: null,
sourceInfrastructureType: null,
arcResourceAzureAccount: null,
arcResourceSubscription: null,
Expand Down
6 changes: 6 additions & 0 deletions extensions/sql-migration/src/models/stateMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export interface SavedInfo {
databaseList: string[];
sourceInfrastructureType: SourceInfrastructureType | null;
isSqlServerEnabledByArc: boolean | null;
trackMigration: boolean | null;
arcResourceAzureAccount: azdata.Account | null;
arcResourceSubscription: azurecore.azureResource.AzureResourceSubscription | null;
arcResourceLocation: azurecore.azureResource.AzureLocation | null;
Expand Down Expand Up @@ -204,6 +205,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {

public _sourceInfrastructureType!: SourceInfrastructureType;
public _isSqlServerEnabledByArc: boolean = false;
public _trackMigration: boolean = true;
public _arcResourceAzureAccount!: azdata.Account;
public _arcResourceSubscription!: azurecore.azureResource.AzureResourceSubscription;
public _arcResourceLocation!: azurecore.azureResource.AzureLocation;
Expand Down Expand Up @@ -1363,6 +1365,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
'sqlMigrationServiceId': Buffer.from(this._sqlMigrationService?.id!).toString('base64'),
'irRegistered': (this._nodeNames?.length > 0).toString(),
'wizardEntryPoint': wizardEntryPoint,
'migrationTracked': String(this._trackMigration)
},
{
});
Expand Down Expand Up @@ -1401,6 +1404,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
databaseAssessment: [],
sourceInfrastructureType: null,
isSqlServerEnabledByArc: null,
trackMigration: null,
arcResourceAzureAccount: null,
arcResourceSubscription: null,
arcResourceLocation: null,
Expand Down Expand Up @@ -1473,6 +1477,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
case Page.DatabaseSelector:
saveInfo.sourceInfrastructureType = this._sourceInfrastructureType;
saveInfo.isSqlServerEnabledByArc = this._isSqlServerEnabledByArc;
saveInfo.trackMigration = this._trackMigration;
saveInfo.arcResourceAzureAccount = deepClone(this._arcResourceAzureAccount);
saveInfo.arcResourceSubscription = this._arcResourceSubscription;
saveInfo.arcResourceLocation = this._arcResourceLocation;
Expand All @@ -1489,6 +1494,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {

this._sourceInfrastructureType = this.savedInfo.sourceInfrastructureType || undefined!;
this._isSqlServerEnabledByArc = this.savedInfo.isSqlServerEnabledByArc ?? false;
this._trackMigration = this.savedInfo.trackMigration ?? true;
this._arcResourceAzureAccount = this.savedInfo.arcResourceAzureAccount || undefined!;
this._arcResourceSubscription = this.savedInfo.arcResourceSubscription || undefined!;
this._arcResourceLocation = this.savedInfo.arcResourceLocation || undefined!;
Expand Down
1 change: 1 addition & 0 deletions extensions/sql-migration/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export function getTelemetryProps(migrationStateModel: MigrationStateModel): Tel
'targetType': migrationStateModel._targetType,
'sourceInfrastructureType': constants.SourceInfrastructureTypeLookup[migrationStateModel._sourceInfrastructureType],
'tenantId': tenantId,
'migrationTracked': String(migrationStateModel._trackMigration)
};
}

Expand Down
43 changes: 24 additions & 19 deletions extensions/sql-migration/src/wizard/databaseSelectorPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
constants.WIZARD_CANCEL_REASON_CHANGE_SOURCE_SQL_SERVER
]);

this._sourceSelection._updateNextButton();
this.wizard.registerNavigationValidator(async (pageChangeInfo) => {
this.wizard.message = {
text: '',
Expand All @@ -87,26 +86,32 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
errors.push(constants.SELECT_DATABASE_TO_CONTINUE);
}

if (!this.migrationStateModel._azureAccount) {
errors.push(constants.INVALID_ACCOUNT_ERROR);
}
if (this.migrationStateModel._isSqlServerEnabledByArc || this.migrationStateModel._trackMigration) {
if (!this.migrationStateModel._azureAccount) {
errors.push(constants.INVALID_ACCOUNT_ERROR);
}

if (!this.migrationStateModel._arcResourceSubscription ||
(<azdata.CategoryValue>this._sourceSelection._azureSubscriptionDropdown.value)?.displayName === constants.NO_SUBSCRIPTIONS_FOUND) {
errors.push(constants.INVALID_SUBSCRIPTION_ERROR);
}
if (!this.migrationStateModel._arcResourceLocation ||
(<azdata.CategoryValue>this._sourceSelection._azureLocationDropdown.value)?.displayName === constants.NO_LOCATION_FOUND) {
errors.push(constants.INVALID_LOCATION_ERROR);
}
if (!this.migrationStateModel._arcResourceResourceGroup ||
(<azdata.CategoryValue>this._sourceSelection._azureResourceGroupDropdown.value)?.displayName === constants.RESOURCE_GROUP_NOT_FOUND) {
errors.push(constants.INVALID_RESOURCE_GROUP_ERROR);
}
if (!this.migrationStateModel._arcResourceSubscription ||
(<azdata.CategoryValue>this._sourceSelection._azureSubscriptionDropdown.value)?.displayName === constants.NO_SUBSCRIPTIONS_FOUND) {
errors.push(constants.INVALID_SUBSCRIPTION_ERROR);
}
if (!this.migrationStateModel._arcResourceLocation ||
(<azdata.CategoryValue>this._sourceSelection._azureLocationDropdown.value)?.displayName === constants.NO_LOCATION_FOUND) {
errors.push(constants.INVALID_LOCATION_ERROR);
}
if (!this.migrationStateModel._arcResourceResourceGroup ||
(<azdata.CategoryValue>this._sourceSelection._azureResourceGroupDropdown.value)?.displayName === constants.RESOURCE_GROUP_NOT_FOUND) {
errors.push(constants.INVALID_RESOURCE_GROUP_ERROR);
}

if (this.migrationStateModel._isSqlServerEnabledByArc && (!this.migrationStateModel._arcSqlServer ||
(<azdata.CategoryValue>this._sourceSelection._azureArcSqlServerDropdown.value)?.displayName === constants.SQL_SERVER_INSTANCE_NOT_FOUND)) {
errors.push(constants.INVALID_SQL_SERVER_INSTANCE_ERROR);
if (!this.migrationStateModel._isSqlServerEnabledByArc && !this.migrationStateModel._sourceInfrastructureType) {
errors.push(constants.INVALID_SOURCE_INFRASTRUCTURE_TYPE_ERROR);
}

if (this.migrationStateModel._isSqlServerEnabledByArc && (!this.migrationStateModel._arcSqlServer ||
(<azdata.CategoryValue>this._sourceSelection._azureArcSqlServerDropdown.value)?.displayName === constants.SQL_SERVER_INSTANCE_NOT_FOUND)) {
errors.push(constants.INVALID_SQL_SERVER_INSTANCE_ERROR);
}
}

if (errors.length > 0) {
Expand Down
Loading