更新:首选的解决方案是使用.NET的VmWare工具包,并实现以下功能
我们现在需要执行的任务之一(如果可能)是将虚拟硬盘从非持久模式切换到持久模式,反之亦然。
我试着寻找正确的API调用,但还没有找到。有人知道这是否可以通过API调用来实现吗?
发布于 2012-03-13 07:50:51
尽管我还没有执行过这个确切的操作,但我已经通过ReconfigVm任务执行了类似的操作:http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure
您将需要使用更新后的VirtualDevice设置VirtualMachineConfigSpec,其VirtualDeviceBackingInfo在其diskMode属性中具有所需的持久性类型。数据对象的文档如下所示:
http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.ConfigSpec.html
http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.device.VirtualDevice.html
http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.device.VirtualDevice.BackingInfo.html
发布于 2012-03-11 07:20:12
根据VMware vSphere PowerCLI Cmdlets Reference的说法,这应该可以完成这项工作:
Get-HardDisk -VM $myVM | Set-HardDisk -Persistence "Independent(Non)Persistent"https://stackoverflow.com/questions/9532854
复制相似问题