Example #1
0
        public TaskInfoState ConsolidateVMDisks()
        {
            ManagedObjectReference morTask = _vimService.ConsolidateVMDisks_Task(_morThis);
            MyVMTask myTask = new MyVMTask(_vimService, _pc, morTask);
            TaskInfo ti     = null;

            return(myTask.Wait(3000, -1, out ti));
        }
Example #2
0
        public TaskInfoState ReconfigVM(VirtualMachineConfigSpec spec)
        {
            ManagedObjectReference morTask = _vimService.ReconfigVM_Task(_morThis, spec);
            MyVMTask      myTask           = new MyVMTask(_vimService, _pc, morTask);
            TaskInfo      ti    = null;
            TaskInfoState state = myTask.Wait(3000, -1, out ti);

            return(state);
        }
Example #3
0
        public TaskInfoState RemoveSnapshot(string snapshot, bool removeChildren, bool consolidate)
        {
            ManagedObjectReference morSnapshot = new ManagedObjectReference
            {
                @type = "VirtualMachineSnapshot",
                Value = snapshot
            };
            ManagedObjectReference morTask = _vimService.RemoveSnapshot_Task(morSnapshot, removeChildren, consolidate);
            MyVMTask      myTask           = new MyVMTask(_vimService, _pc, morTask);
            TaskInfo      ti    = null;
            TaskInfoState state = myTask.Wait(3000, -1, out ti);

            return(state);
        }
Example #4
0
        public TaskInfoState CreateSnapshot(string name, string description, bool memory, bool quiesce, out string snapshotOut)
        {
            snapshotOut = string.Empty;
            ManagedObjectReference morTask = _vimService.CreateSnapshot_Task(_morThis, name, description, memory, quiesce);
            MyVMTask      myTask           = new MyVMTask(_vimService, _pc, morTask);
            TaskInfo      ti    = null;
            TaskInfoState state = myTask.Wait(3000, -1, out ti);

            if (state == TaskInfoState.success)
            {
                ManagedObjectReference morSnapshot = (ManagedObjectReference)(ti.result);
                snapshotOut = morSnapshot?.Value;
            }
            return(state);
        }