Este contenido no está disponible en el idioma seleccionado.
3.13. Attaching an ISO Image to a Virtual Machine
This Ruby example attaches a CD-ROM to a virtual machine and changes it to an ISO image in order to install the guest operating system.
Get the reference to the "vms" service:
Find the virtual machine:
Locate the service that manages the virtual machine:
Locate the service that manages the CDROM devices of the VM:
List the first CDROM device:
Locate the service that manages the CDROM device you just found:
Change the CD of the VM to 'my_iso_file.iso'. By default this
operation permanently changes the disk that is visible to the
virtual machine after the next boot, but it does not have any effect
on the currently running virtual machine. If you want to change the
disk that is visible to the current running virtual machine, change
the `current` parameter's value to `true`.
# Get the reference to the "vms" service:
vms_service = connection.system_service.vms_service
# Find the virtual machine:
vm = vms_service.list(search: 'name=myvm')[0]
# Locate the service that manages the virtual machine:
vm_service = vms_service.vm_service(vm.id)
# Locate the service that manages the CDROM devices of the VM:
cdroms_service = vm_service.cdroms_service
# List the first CDROM device:
cdrom = cdroms_service.list[0]
# Locate the service that manages the CDROM device you just found:
cdrom_service = cdroms_service.cdrom_service(cdrom.id)
# Change the CD of the VM to 'my_iso_file.iso'. By default this
# operation permanently changes the disk that is visible to the
# virtual machine after the next boot, but it does not have any effect
# on the currently running virtual machine. If you want to change the
# disk that is visible to the current running virtual machine, change
# the `current` parameter's value to `true`.
cdrom_service.update(
OvirtSDK4::Cdrom.new(
file: {
id: 'CentOS-7-x86_64-DVD-1511.iso'
}
),
current: false
)
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.
Hacer que el código abierto sea más inclusivo
Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.
Acerca de Red Hat
Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.