CreateSnapshotForDisks() public method

we only support the Linux box now, if it's a windows, one AzureVMBackupException would be thrown.
public CreateSnapshotForDisks ( AzureVMBackupConfig vmConfig, string snapshotTag, VirtualMachineExtensionBaseCmdlet virtualMachineExtensionBaseCmdlet ) : void
vmConfig AzureVMBackupConfig
snapshotTag string
virtualMachineExtensionBaseCmdlet VirtualMachineExtensionBaseCmdlet
return void
コード例 #1
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil();

            AzureVMBackupConfig vmConfig = new AzureVMBackupConfig();
            vmConfig.ResourceGroupName = ResourceGroupName;
            vmConfig.VMName = this.VMName;
            vmConfig.ExtensionName = this.Name;
            vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType;

            azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig, Tag, this);
        }
コード例 #2
0
     private void CreateVMBackupForLinx()
     {
         try
         {
             AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil();
             AzureVMBackupConfig vmConfig = new AzureVMBackupConfig();
             vmConfig.ResourceGroupName = ResourceGroupName;
             vmConfig.VMName = VMName;
             vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType;
             string tag = string.Format("{0}{1}", "AzureEnc", Guid.NewGuid().ToString());
             // this would create shapshot only for Linux box. and we should wait for the snapshot found.
             azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig, tag, this);
             WriteWarning(string.Format("one snapshot for disks are created with tag,{0}, you can use {1}-{2} to remove it.", tag, VerbsCommon.Remove,
 ProfileNouns.AzureVMBackup));
         }
         catch (AzureVMBackupException e)
         {
             ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, e.ToString())),
                                                   "InvalidResult",
                                                   ErrorCategory.InvalidResult,
                                                   null));
         }
     }
コード例 #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil();

            AzureVMBackupConfig vmConfig = new AzureVMBackupConfig();
            vmConfig.ResourceGroupName = ResourceGroupName;
            vmConfig.VMName = VMName;
            vmConfig.ExtensionName = Name;
            vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType;

            azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig,Tag, this);
        }