3.14. 分离虚拟磁盘
这个 Ruby 示例从虚拟机中分离磁盘。
# Find the virtual machine: vm = vms_service.list(search: 'name=myvm').first # Detach the first disk from the virtual machine: vm_service = vms_service.vm_service(vm.id) attachments_service = vm_service.disk_attachments_service attachment = attachments_service.list.first # Remove the attachment. The default behavior is that the disk is detached # from the virtual machine, but not deleted from the system. If you wish to # delete the disk, change the `detach_only` parameter to `false`. attachment.remove(detach_only: true)
如需更多信息,请参阅 VmService:disk_attachments_service。