Beispiel #1
0
        public CBTQVMwithRef GetVm(string vmid)
        {
            var vmMor = new ManagedObjectReference();

            vmMor.type  = "VirtualMachine";
            vmMor.Value = vmid;

            var name = cb.getServiceUtil().getProp(vmMor, "name");

            CBTQVMwithRef vr = null;

            if (name != null)
            {
                vr = new CBTQVMwithRef(name, vmMor);
            }

            return(vr);
        }
Beispiel #2
0
 private ManagedObjectReference MkSnapExecute(CBTQVMwithRef vr, string snapname)
 {
     if (vr != null)
     {
         var d = DateTime.Now;
         ManagedObjectReference taskMor = cb.getConnection()._service.CreateSnapshot_Task(vr.Mor, snapname, String.Format("CBT Query Snapshot {0}", d.ToUniversalTime()), false, false);
         String res = cb.getServiceUtil().WaitForTask(taskMor);
         if (res.Equals("sucess"))
         {
             var info        = (TaskInfo)cb.getServiceUtil().GetDynamicProperty(taskMor, "info");
             var snapshotMor = (ManagedObjectReference)info.result;
             return(snapshotMor);
         }
         else
         {
             throw new Exception("Snapshot Creation failed " + res);
         }
     }
     throw new Exception("Could not find VM");
 }