Esempio n. 1
0
 /// <summary>
 /// Creates a copy of the virtual machine at the state at which this snapshot was taken.
 /// </summary>
 /// <param name="cloneType">Virtual Machine clone type.</param>
 /// <param name="destConfigPathName">The path name of the virtual machine configuration file that will be created.</param>
 /// <param name="timeoutInSeconds">Timeout in seconds.</param>
 public void Clone(VMWareVirtualMachineCloneType cloneType, string destConfigPathName, int timeoutInSeconds)
 {
     try
     {
         VMWareJobCallback callback = new VMWareJobCallback();
         using (VMWareJob job = new VMWareJob(_vm.Clone(
                                                  _handle, (int)cloneType, destConfigPathName, 0, null, callback),
                                              callback))
         {
             job.Wait(timeoutInSeconds);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(
                   string.Format("Failed to clone virtual machine snapshot: cloneType=\"{0}\" destConfigPathName=\"{1}\" timeoutInSeconds={2}",
                                 Enum.GetName(cloneType.GetType(), cloneType), destConfigPathName, timeoutInSeconds), ex);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Creates a copy of the virtual machine at the state at which this snapshot was taken.
 /// </summary>
 /// <param name="cloneType">Virtual Machine clone type.</param>
 /// <param name="destConfigPathName">The path name of the virtual machine configuration file that will be created.</param>
 public void Clone(VMWareVirtualMachineCloneType cloneType, string destConfigPathName)
 {
     Clone(cloneType, destConfigPathName, VMWareInterop.Timeouts.CloneTimeout);
 }