1.5 Virtual CD Readers

NOTE:Only limited support for virtual machine removable media is available in the original version of SUSE Linux 10 SP1. Much of the following information pertains to functionality available in the maintenance update scheduled for public release in Summer 2007.

If you are installing drivers from the SUSE Linux Enterprise Virtual Machine Driver Pack, proceed by completing one of the following:

  • If you have updated to virt-manager 0.3.1-0.24 or later, complete the instructions in Section 1.5.3, Adding Virtual CD Readers to set up the ISO image file as a virtual CD reader.

    The most recent virt-manager package is available through the SUSE Linux Enterprise 10 SP1 update channel.

  • If you are running an earlier version of virt-manager, you must set up the ISO image file as a virtual CD reader when you create the virtual machine or add a virtual CD reader based on the ISO image file following the instructions in Section 1.5.4, Adding Virtual CD Readers (Command Line Method).

Virtual CD readers can be set up when a virtual machine is created or added to an existing virtual machine. A virtual CD reader can be based on an physical CD/DVD or based on an ISO image. Virtual CD readers work differently depending on whether they are paravirtual or fully virtual.

1.5.1 Virtual CD Readers on Paravirtual Machines

A paravirtual machine can have up to 16 block devices comprised of virtual CD readers and virtual disks. On paravirtual machines, virtual CD readers present the CD as a virtual disk with read-only access. Unless you remove the virtual CD reader, the virtual machine assumes that the originally-inserted CD is still in the CD reader, even if you have ejected it. If it has been ejected, the virtual machine will not be able to access the CD (or any other newly-inserted CD) and will receive I/O errors. Virtual CD readers cannot be used to write data to a CD. They are configured as read-only devices.

After you have finished accessing a CD on a paravirtual machine, it is recommended that you remove the virtual CD reader from the virtual machine.

1.5.2 Virtual CD Readers on Fully Virtual Machines

A fully virtual machine can have up to four block devices comprised of virtual CD readers and virtual disks. A virtual CD reader on a fully virtual machine interacts with the inserted CD in the way you expect a physical CD reader to interact. For example, in a Windows XP virtual machine, the inserted CD appears in the Devices with Removable Storage section of My Computer.

When a CD is inserted in the physical CD reader on the host computer, all virtual machines with virtual CD readers based on the physical CD reader, such as /dev/cdrom/, are able to read the inserted CD. Assuming the operating system has automount functionality, the CD should automatically appear in the file system. Virtual CD readers cannot be used to write data to a CD. They are configured as read-only devices.

1.5.3 Adding Virtual CD Readers

Virtual CD readers can be based on a CD inserted into the CD reader or an ISO image file.

  1. Make sure that the virtual machine is running and the operating system has finished booting.

  2. Insert the desired CD into the physical CD reader or copy the desired ISO image to a location available to the virtual machine’s file system.

  3. Run Virtual Machine Manager.

  4. Select the virtual machine, then click Details.

  5. Click Hardware > Disk.

  6. Click CD-ROM.

  7. Specify the path to the physical CD reader, such as /dev/cdrom. If you are adding a virtual CD reader based on an ISO, specify the path to the ISO image file.

  8. Click OK to apply the changes.

    A new block device, such as /dev/xvdb, is added to the virtual machine.

  9. If the virtual machine is running Linux, complete the following:

    1. Open a terminal in the virtual machine and enter fdisk -l to verify that the device was properly added. You could also enter ls /sys/block to see all disks available to the virtual machine.

      The CD is recognized by the virtual machine as a virtual disk with a drive designation, for example,

      /dev/xvdb
      
    2. Enter the command to mount the CD or ISO image using its drive designation. For example, enter

      mount -o ro /dev/xvdb /cd1
      

      mounts the CD to a mount point named /cd1.

      The CD or ISO image file should be available to the virtual machine at the specified mount point.

  10. If the virtual machine is running Windows, reboot the virtual machine.

    Verify that the virtual CD reader appears in its My Computer section

1.5.4 Adding Virtual CD Readers (Command Line Method)

  1. Make sure that the virtual machine is running and that the operating system has finished booting.

  2. Insert the CD into the physical CD reader or copy the ISO image to the host.

  3. In a terminal on the host, enter the appropriate command

    • To set up an ISO image file, enter:

      xm block-attach vm_id file:/mycd.iso hdc:cdrom r
      

      where vm_id is the virtual machine ID, mycd.iso is the path to the ISO image file, and hdc is the drive designation presented to the virtual machine.

      If the virtual machine is paravirtual, replace the device designation with a vdb x device designation, such as

      xm block-attach vm_id file:/mycd.iso xvdb:cdrom r
      
    • To set up a physical CD reader, enter:

      xm block-attach vm_id phy:/dev/cdrom hdc:cdrom r
      

      where vm_id is the virtual machine ID, dev/cdrom is the path to the physical CD reader, hdc is the physical drive designation to be presented to the virtual machine, and cdrom is the name you specify for the device.

      If the virtual machine is paravirtual, replace the hdc drive designation with a vdb x drive designation, such as

      xm block-attach vm_id phy:/dev/cdrom xvdb:cdrom r
      
  4. (Conditional) If running full virtualization mode, reboot the virtual machine.

The CD or ISO image file should appear in the virtual machine’s operating system.

1.5.5 Removing Virtual CD Readers

  1. Make sure that the virtual machine is running and the operating system has finished booting.

  2. (Conditional) If the virtual CD reader is mounted, unmount it from within the virtual machine.

    HINT:You can enter fdisk -l in the virtual machine’s terminal to view its block devices.

  3. Run Virtual Machine Manager.

  4. Select the virtual machine, then click Details.

  5. Click Hardware > Disk.

  6. Select the virtual CD-ROM device to remove.

  7. Click Remove to remove the virtual CD-ROM device.

  8. Press the hardware eject button to eject the CD.

1.5.6 Switching CDs on a Paravirtual Machine

To switch between CDs or ISO images on a paravirtual machine requires you to remove (detach) the virtual CD reader that contains the original CD or points to the ISO image file and then add (attach) the virtual CD reader with the newly-inserted CD or the location of a new ISO image file.

NOTE:This procedure requires virt-manager version 0.3.1-0.19 or later.

  1. Make sure that the virtual machine is running and the operating system has finished booting.

  2. (Conditional) If the virtual CD reader is mounted, unmount it from within the virtual machine.

    HINT:You can enter fdisk -l in the virtual machine’s terminal to view its block devices.

  3. Run Virtual Machine Manager.

  4. Select the virtual machine, then click Details.

  5. Click Hardware > Disk.

  6. Select the virtual CD-ROM device that contains the CD or points to the ISO image file that you want to switch.

  7. Click Edit

  8. Press the hardware eject button to eject the CD.