コード例 #1
0
        public ManagedObjectReference CreateVM(VirtualMachineConfigSpec config, ManagedObjectReference pool, ManagedObjectReference host)
        {
            ManagedObjectReference result;

            try
            {
                ManagedObjectReference taskReference = this.CreateVM_Task(config, pool, host);
                result = (ManagedObjectReference)this.Client.WaitForTask(taskReference);
            }
            catch (FaultException ex)
            {
                throw FaultUtility.HandleFault(ex);
            }
            return(result);
        }
コード例 #2
0
        public ManagedObjectReference CreateChildVM(VirtualMachineConfigSpec config, ManagedObjectReference host)
        {
            ManagedObjectReference result;

            try
            {
                VersionUtils.RequiresVersion(this.Client, VimVersion.Vim4);
                ManagedObjectReference taskReference = this.CreateChildVM_Task(config, host);
                result = (ManagedObjectReference)this.Client.WaitForTask(taskReference);
            }
            catch (FaultException ex)
            {
                throw FaultUtility.HandleFault(ex);
            }
            return(result);
        }
コード例 #3
0
        public ManagedObjectReference CreateVM_Task(VirtualMachineConfigSpec config, ManagedObjectReference pool, ManagedObjectReference host)
        {
            ManagedObjectReference result;

            try
            {
                CreateVMRequestType createVMRequestType = new CreateVMRequestType();
                createVMRequestType._this  = (VimApi_65.ManagedObjectReference)VIConvert.ToWsdlType(this.MoRef);
                createVMRequestType.config = (VimApi_65.VirtualMachineConfigSpec)VIConvert.ToWsdlType(config);
                createVMRequestType.pool   = (VimApi_65.ManagedObjectReference)VIConvert.ToWsdlType(pool);
                createVMRequestType.host   = (VimApi_65.ManagedObjectReference)VIConvert.ToWsdlType(host);
                result = (ManagedObjectReference)VIConvert.ToVim(this.VimServiceProxy.CreateVM_Task(new CreateVM_TaskRequest(createVMRequestType)).CreateVM_TaskResponse.returnval);
            }
            catch (FaultException ex)
            {
                throw FaultUtility.HandleFault(ex);
            }
            return(result);
        }