public AvailabilitySet(AzureContext azureContext, Asm.VirtualMachine asmVirtualMachine) : base(Guid.Empty) { _AzureContext = azureContext; if (asmVirtualMachine.AvailabilitySetName != String.Empty) { TargetName = asmVirtualMachine.AvailabilitySetName; } else { TargetName = asmVirtualMachine.CloudServiceName; } }
public NetworkInterface(Asm.VirtualMachine virtualMachine, Asm.NetworkInterface networkInterface, List <VirtualNetwork> virtualNetworks, List <NetworkSecurityGroup> networkSecurityGroups, TargetSettings targetSettings) { _SourceNetworkInterface = networkInterface; this.SetTargetName(networkInterface.Name, targetSettings); this.IsPrimary = networkInterface.IsPrimary; this.EnableIPForwarding = networkInterface.EnableIpForwarding; foreach (Asm.NetworkInterfaceIpConfiguration asmNetworkInterfaceIpConfiguration in networkInterface.NetworkInterfaceIpConfigurations) { NetworkInterfaceIpConfiguration migrationNetworkInterfaceIpConfiguration = new NetworkInterfaceIpConfiguration(asmNetworkInterfaceIpConfiguration, virtualNetworks, targetSettings); this.TargetNetworkInterfaceIpConfigurations.Add(migrationNetworkInterfaceIpConfiguration); } if (virtualMachine.NetworkSecurityGroup != null) { this.NetworkSecurityGroup = NetworkSecurityGroup.SeekNetworkSecurityGroup(networkSecurityGroups, virtualMachine.NetworkSecurityGroup.ToString()); } }
public NetworkInterface(AzureContext azureContext, Asm.VirtualMachine virtualMachine, Asm.NetworkInterface networkInterface, List <VirtualNetwork> virtualNetworks, List <NetworkSecurityGroup> networkSecurityGroups) { _AzureContext = azureContext; _SourceNetworkInterface = networkInterface; this.TargetName = networkInterface.Name; this.IsPrimary = networkInterface.IsPrimary; foreach (Asm.NetworkInterfaceIpConfiguration asmNetworkInterfaceIpConfiguration in networkInterface.NetworkInterfaceIpConfigurations) { Azure.MigrationTarget.NetworkInterfaceIpConfiguration migrationNetworkInterfaceIpConfiguration = new Azure.MigrationTarget.NetworkInterfaceIpConfiguration(_AzureContext, asmNetworkInterfaceIpConfiguration, virtualNetworks); this.TargetNetworkInterfaceIpConfigurations.Add(migrationNetworkInterfaceIpConfiguration); } if (virtualMachine.NetworkSecurityGroup != null) { this.NetworkSecurityGroup = NetworkSecurityGroup.SeekNetworkSecurityGroup(networkSecurityGroups, virtualMachine.NetworkSecurityGroup.ToString()); } }
public VirtualMachine(AzureContext azureContext, Asm.VirtualMachine virtualMachine, List <VirtualNetwork> targetVirtualNetworks, List <StorageAccount> targetStorageAccounts, List <NetworkSecurityGroup> networkSecurityGroups) { this._AzureContext = azureContext; this.Source = virtualMachine; this.TargetName = virtualMachine.RoleName; this._TargetSize = virtualMachine.RoleSize; this.OSVirtualHardDisk = new Disk(virtualMachine.OSVirtualHardDisk); this.OSVirtualHardDiskOS = virtualMachine.OSVirtualHardDiskOS; this.OSVirtualHardDisk.TargetStorageAccount = SeekTargetStorageAccount(targetStorageAccounts, virtualMachine.OSVirtualHardDisk.StorageAccountName); foreach (Asm.Disk asmDataDisk in virtualMachine.DataDisks) { Disk targetDataDisk = new Disk(asmDataDisk); targetDataDisk.TargetStorageAccount = SeekTargetStorageAccount(targetStorageAccounts, asmDataDisk.StorageAccountName); this.DataDisks.Add(targetDataDisk); } foreach (Asm.NetworkInterface asmNetworkInterface in virtualMachine.NetworkInterfaces) { Azure.MigrationTarget.NetworkInterface migrationNetworkInterface = new Azure.MigrationTarget.NetworkInterface(_AzureContext, virtualMachine, asmNetworkInterface, targetVirtualNetworks, networkSecurityGroups); this.NetworkInterfaces.Add(migrationNetworkInterface); } }
public VirtualMachine(Asm.VirtualMachine virtualMachine, TargetSettings targetSettings) : base(ArmConst.MicrosoftCompute, ArmConst.VirtualMachines) { this.Source = virtualMachine; this.SetTargetName(virtualMachine.RoleName, targetSettings); this.OSVirtualHardDisk = new Disk(virtualMachine.OSVirtualHardDisk, this, targetSettings); this.OSVirtualHardDiskOS = virtualMachine.OSVirtualHardDiskOS; if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk) { this.OSVirtualHardDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.AsmTargetStorageAccounts, virtualMachine.OSVirtualHardDisk.StorageAccountName); } foreach (Asm.Disk asmDataDisk in virtualMachine.DataDisks) { Disk targetDataDisk = new Disk(asmDataDisk, this, targetSettings); EnsureDataDiskTargetLunIsNotNull(ref targetDataDisk); if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk) { targetDataDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.AsmTargetStorageAccounts, asmDataDisk.StorageAccountName); } this.DataDisks.Add(targetDataDisk); } foreach (Asm.NetworkInterface asmNetworkInterface in virtualMachine.NetworkInterfaces) { NetworkInterface migrationNetworkInterface = new NetworkInterface(virtualMachine, asmNetworkInterface, virtualMachine.AzureSubscription.AsmTargetVirtualNetworks, virtualMachine.AzureSubscription.AsmTargetNetworkSecurityGroups, targetSettings); migrationNetworkInterface.ParentVirtualMachine = this; this.NetworkInterfaces.Add(migrationNetworkInterface); } #region Seek ARM Target Size // Get ARM Based Location (that matches location of Source ASM VM Arm.Location armLocation = virtualMachine.AzureSubscription.GetAzureARMLocation(virtualMachine.Location); if (armLocation != null) { this.TargetSize = armLocation.SeekVmSize(virtualMachine.RoleSize.Name); if (this.TargetSize == null) { // if not found, defer to alternate matching options Dictionary <string, string> VMSizeTable = new Dictionary <string, string>(); VMSizeTable.Add("ExtraSmall", "Standard_A0"); VMSizeTable.Add("Small", "Standard_A1"); VMSizeTable.Add("Medium", "Standard_A2"); VMSizeTable.Add("Large", "Standard_A3"); VMSizeTable.Add("ExtraLarge", "Standard_A4"); VMSizeTable.Add("A5", "Standard_A5"); VMSizeTable.Add("A6", "Standard_A6"); VMSizeTable.Add("A7", "Standard_A7"); VMSizeTable.Add("A8", "Standard_A8"); VMSizeTable.Add("A9", "Standard_A9"); VMSizeTable.Add("A10", "Standard_A10"); VMSizeTable.Add("A11", "Standard_A11"); if (VMSizeTable.ContainsKey(virtualMachine.RoleSize.Name)) { this.TargetSize = armLocation.SeekVmSize(VMSizeTable[virtualMachine.RoleSize.Name]); } } } #endregion }
public VirtualMachine(AzureContext azureContext, Asm.VirtualMachine virtualMachine, List <VirtualNetwork> targetVirtualNetworks, List <StorageAccount> targetStorageAccounts, List <NetworkSecurityGroup> networkSecurityGroups) { this._AzureContext = azureContext; this.Source = virtualMachine; this.TargetName = virtualMachine.RoleName; this.OSVirtualHardDisk = new Disk(virtualMachine.OSVirtualHardDisk); this.OSVirtualHardDiskOS = virtualMachine.OSVirtualHardDiskOS; this.OSVirtualHardDisk.TargetStorageAccount = SeekTargetStorageAccount(targetStorageAccounts, virtualMachine.OSVirtualHardDisk.StorageAccountName); foreach (Asm.Disk asmDataDisk in virtualMachine.DataDisks) { Disk targetDataDisk = new Disk(asmDataDisk); targetDataDisk.TargetStorageAccount = SeekTargetStorageAccount(targetStorageAccounts, asmDataDisk.StorageAccountName); this.DataDisks.Add(targetDataDisk); } foreach (Asm.NetworkInterface asmNetworkInterface in virtualMachine.NetworkInterfaces) { Azure.MigrationTarget.NetworkInterface migrationNetworkInterface = new Azure.MigrationTarget.NetworkInterface(_AzureContext, virtualMachine, asmNetworkInterface, targetVirtualNetworks, networkSecurityGroups); this.NetworkInterfaces.Add(migrationNetworkInterface); } #region Seek ARM Target Size // Get ARM Based Location (that matches location of Source ASM VM Arm.Location armLocation = _AzureContext.AzureRetriever.GetAzureARMLocation(virtualMachine.Location).Result; if (armLocation != null) { // First, try to seek matching ARM VM Size by name if (armLocation.VMSizes != null) { this.TargetSize = armLocation.VMSizes.Where(a => a.Name == virtualMachine.RoleSize.Name).FirstOrDefault(); if (this.TargetSize == null) { // if not found, defer to alternate matching options Dictionary <string, string> VMSizeTable = new Dictionary <string, string>(); VMSizeTable.Add("ExtraSmall", "Standard_A0"); VMSizeTable.Add("Small", "Standard_A1"); VMSizeTable.Add("Medium", "Standard_A2"); VMSizeTable.Add("Large", "Standard_A3"); VMSizeTable.Add("ExtraLarge", "Standard_A4"); VMSizeTable.Add("A5", "Standard_A5"); VMSizeTable.Add("A6", "Standard_A6"); VMSizeTable.Add("A7", "Standard_A7"); VMSizeTable.Add("A8", "Standard_A8"); VMSizeTable.Add("A9", "Standard_A9"); VMSizeTable.Add("A10", "Standard_A10"); VMSizeTable.Add("A11", "Standard_A11"); if (VMSizeTable.ContainsKey(virtualMachine.RoleSize.Name)) { this.TargetSize = armLocation.VMSizes.Where(a => a.Name == VMSizeTable[virtualMachine.RoleSize.Name]).FirstOrDefault(); } } } } #endregion }