Red Hat Bugzilla – Bug 1067115
Python SDK New Example (Detach a disk from a VM)
Last modified: 2016-01-26 20:58:10 EST
Title: Python New Example (Detach a disk from a VM) Describe the issue: ===================== Basically I have a direct_lun disk shared between multiple VMs. I ran into a issue where deleting the VM deleted the entire direct_lun disk removing it from all VMs using it. The logical step was to detach the disk but the disk object doesn't have a .detach() or .remove()... only delete which deletes it everywhere. After a bunch of digging, I found some help with how to do this and believe it should be added as a example. # Find the VM: vm = api.vms.get(name="myvm") disk = vm.disks.get(name="mylun") # Detach the disk: detach = ovirtsdk.xml.params.Action(detach=True) disk.delete(action=detach)
Documentation Link ------------------------------ https://documentation-devel.engineering.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.5-Beta/html-single/Technical_Guide/index.html#Example_Detaching_a_Disk_using_Python What Changed ------------------------------ Added the following topic to outline how to detach a disk using the Python SDK. Example: Detaching a Disk using Python [40943] Updated revision history [34616-651639] NVR ------------------------------ Red_Hat_Enterprise_Virtualization-Technical_Guide-3.5-Beta-en-US-3.5-3 Moving to ON_QA.