Replacing a virtual DVD

The virtual server accesses a provided ISO image as a virtual DVD through the virtual SCSI-attached CD/DVD drive. You can remove a virtual DVD, and provide a different one.

Before you begin

Make sure that the virtual DVD drive is configured as a virtual SCSI device .

About this task

The guest is able to mount and to unmount the file system residing on a virtual DVD. You can remove the ISO image which represents the virtual DVD and provide a different one during the life time of the virtual server. If you try to remove an ISO image that is still in use by the guest, QEMU forces the guest to release the file system.

Procedure

  1. Optional: Remove the current ISO image by using the virsh change-media command with the --eject option:
    # virsh change-media <VS> <logical-device-name> --eject
  2. Provide a different ISO image by using the virsh change-media command with the --insert option:
    # virsh change-media <VS> <logical-device-name> --insert <iso-image>
    In case the current ISO image has not been removed before, it is replaced by the new one.
    <iso-image>
    Is the fully qualified path to the ISO image on the host.
    <logical-device-name>
    Identifies the virtual SCSI-attached CD/DVD drive by its logical device name, which was specified with the target dev attribute in the domain configuration-XML file.
    <VS>
    Is the name of the virtual server as defined in the domain configuration-XML file.

Example

After the guest has unmounted the file system on the virtual DVD, this example removes the currently provided virtual DVD from the virtual DVD drive:
# virsh domblklist vserv1
Target     Source
------------------------------------------------
vda        /dev/storage1/vs1_disk1
sda        /var/lib/libvirt/images/cd2.iso

# virsh change-media vserv1 sda --eject
Successfully ejected media.

# virsh domblklist vserv1
Target     Source
------------------------------------------------
vda        /dev/storage1/vs1_disk1
sda        -

If the virtual DVD is still in use by the guest, the change-media command with the --eject option forces the guest to unmount the file system.

This example inserts a virtual DVD, which is represented by the ISO image, into a virtual DVD drive:
# virsh change-media vserv1 sda --insert /var/lib/libvirt/images/cd2.iso
Successfully inserted media.