public async new Task InitializeChildrenAsync(AzureContext azureContext) { _SourceStorageAccount = azureContext.AzureSubscription.GetAzureARMStorageAccount(azureContext.AzureSubscription, StorageAccountName); this.SourceManagedDisk = await azureContext.AzureSubscription.GetAzureARMManagedDisk(this.ParentVirtualMachine, this.Name); }
public async Task InitializeChildrenAsync(AzureContext azureContext) { _SourceStorageAccount = azureContext.AzureRetriever.GetAzureARMStorageAccount(StorageAccountName); }
private void ValidateDiskStandards(MigrationTarget.Disk targetDisk) { if (targetDisk.DiskSizeInGB == 0) { this.AddAlert(AlertType.Error, "Disk '" + targetDisk.ToString() + "' does not have a Disk Size defined. Disk Size (not to exceed 4095 GB) is required.", targetDisk); } if (targetDisk.IsSmallerThanSourceDisk) { this.AddAlert(AlertType.Error, "Disk '" + targetDisk.ToString() + "' Size of " + targetDisk.DiskSizeInGB.ToString() + " GB cannot be smaller than the source Disk Size of " + targetDisk.SourceDisk.DiskSizeGb.ToString() + " GB.", targetDisk); } if (targetDisk.IsTargetLunDifferentThanSourceLun) { this.AddAlert(AlertType.Warning, "Disk '" + targetDisk.ToString() + "' target LUN " + targetDisk.Lun.ToString() + " does not match the source LUN " + targetDisk.SourceDisk.Lun.ToString() + ".", targetDisk); } if (targetDisk.SourceDisk != null && targetDisk.SourceDisk.GetType() == typeof(Azure.Arm.ClassicDisk)) { if (targetDisk.SourceDisk.IsEncrypted) { this.AddAlert(AlertType.Error, "Disk '" + targetDisk.ToString() + "' is encrypted. MigAz does not contain support for moving encrypted Azure Compute VMs.", targetDisk); } } if (targetDisk.TargetStorage == null) { this.AddAlert(AlertType.Error, "Disk '" + targetDisk.ToString() + "' Target Storage must be specified.", targetDisk); } else { if (targetDisk.TargetStorage.GetType() == typeof(Azure.Arm.StorageAccount)) { Arm.StorageAccount armStorageAccount = (Arm.StorageAccount)targetDisk.TargetStorage; if (armStorageAccount.Location.Name != this.ResourceGroup.TargetLocation.Name) { this.AddAlert(AlertType.Error, "Target Storage Account '" + armStorageAccount.Name + "' is not in the same region (" + armStorageAccount.Location.Name + ") as the Target Resource Group '" + this.ResourceGroup.ToString() + "' (" + this.ResourceGroup.TargetLocation.Name + ").", targetDisk); } } //else if (targetDisk.TargetStorage.GetType() == typeof(Azure.MigrationTarget.StorageAccount)) //{ // Azure.MigrationTarget.StorageAccount targetStorageAccount = (Azure.MigrationTarget.StorageAccount)targetDisk.TargetStorage; // bool targetStorageExists = false; // foreach (Azure.MigrationTarget.StorageAccount storageAccount in this.StorageAccounts) // { // if (storageAccount.ToString() == targetStorageAccount.ToString()) // { // targetStorageExists = true; // break; // } // } // if (!targetStorageExists) // this.AddAlert(AlertType.Error, "Target Storage Account '" + targetStorageAccount.ToString() + "' for Disk '" + targetDisk.ToString() + "' is invalid, as it is not included in the migration / template.", targetDisk); //} if (targetDisk.TargetStorage.GetType() == typeof(Azure.MigrationTarget.StorageAccount) || targetDisk.TargetStorage.GetType() == typeof(Azure.Arm.StorageAccount)) { if (targetDisk.TargetStorageAccountBlob == null || targetDisk.TargetStorageAccountBlob.Trim().Length == 0) { this.AddAlert(AlertType.Error, "Target Storage Blob Name is required.", targetDisk); } else if (!targetDisk.TargetStorageAccountBlob.ToLower().EndsWith(".vhd")) { this.AddAlert(AlertType.Error, "Target Storage Blob Name '" + targetDisk.TargetStorageAccountBlob + "' for Disk is invalid, as it must end with '.vhd'.", targetDisk); } } if (targetDisk.TargetStorage.StorageAccountType == StorageAccountType.Premium_LRS) { if (targetDisk.DiskSizeInGB > 0 && targetDisk.DiskSizeInGB < 32) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 32GB (P4), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 32 && targetDisk.DiskSizeInGB < 64) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 64GB (P6), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 64 && targetDisk.DiskSizeInGB < 128) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 128GB (P10), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 128 && targetDisk.DiskSizeInGB < 512) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 512GB (P20), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 512 && targetDisk.DiskSizeInGB < 1023) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 1023GB (P30), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 1023 && targetDisk.DiskSizeInGB < 2047) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 2047GB (P40), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } else if (targetDisk.DiskSizeInGB > 2047 && targetDisk.DiskSizeInGB < 4095) { this.AddAlert(AlertType.Recommendation, "Consider using disk size 4095GB (P50), as this disk will be billed at that capacity per Azure Premium Storage billing sizes.", targetDisk); } } } }
public async new Task InitializeChildrenAsync() { _SourceStorageAccount = this.AzureSubscription.GetAzureARMStorageAccount(this.StorageAccountName); }