Ce contenu n'est pas disponible dans la langue sélectionnée.
3.14. Detaching a Virtual Disk
This Ruby example detaches a disk from a virtual machine.
# 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)
# 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)
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.
Rendre l’open source plus inclusif
Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.
À propos de Red Hat
Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.