Configuring a virtual SCSI-attached CD/DVD drive

The configuration of a virtual DVD drive as virtual SCSI device allows the virtual server to access various ISO images as virtual DVDs during its life cycle. You can replace a provided ISO image during virtual server operation.

Before you begin

You need a virtual HBA to connect to.
  • Either use a configured virtual HBA (see Configuring a virtual HBA), or
  • Connect to a new virtual HBA which will be automatically configured for you.

About this task

The virtual server accesses a virtual DVD as a virtual block device. You configure an ISO image, which represents the virtual DVD, and connect it through a controller as a virtual SCSI device. This allows the virtual server access to a virtual SCSI-attached CD/DVD drive, and to mount and unmount the file system which is contained on the currently provided virtual DVD.

You can remove the configured ISO image and provide a different one during the life cycle of the virtual server.

The virtual server can load it, and then reboot using the new ISO image.

Procedure

  1. Configure the virtual DVD.
    1. Configure the ISO image, which represents the virtual DVD, as a file of type cdrom (see <disk>).
      disk type attribute: file
      disk device attribute: cdrom
    2. Specify the user space process that implements the virtual DVD (see <driver> as child element of <disk>).
      driver name attribute: qemu
      driver io attribute: native
      driver type attribute: raw
      driver cache attribute: none
    3. Specify the ISO image as virtual block device (see <target> as child element of <disk>).
      target bus attribute: scsi
    4. Specify the virtual DVD as read-only using the readonly element (see <readonly>).
  2. Identify the ISO image on the host.

    Specify the fully qualified ISO image file name on the host (see <source> as child element of <disk>). If the virtual SCSI-attached CD/DVD drive is empty, omit this step.

    source file attribute: <iso-image>
  3. Identify the virtual SCSI-attached CD/DVD drive on the virtual server.
    1. Specify a unique logical device name (see <target> as child element of <disk>).
      target dev attribute: <logical-device-name>
      Do not confuse the logical device name with its device name on the virtual server.
    2. Optional: Connect to a virtual HBA and specify a freely selectable SCSI device name on the virtual server.
      address type attribute: drive
      address controller attribute: <controller-index>
      address bus attribute: 0
      address target attribute: <target>
      address unit attribute: <unit>
      (see <address> as child element of <hostdev> or <disk>)
      Where
      <controller-index>
      specifies the virtual HBA to which the SCSI device is connected.

      Enter the value of the controller index attribute of a configured virtual HBA or a new index value. The allocated index values must be contiguous without gaps. If you specify a new index value, a new virtual HBA is automatically configured.

      The virtual HBA is also called the SCSI host of the SCSI device on the virtual server.

      <target>
      is a freely selectable natural number: 0 ≤ <target> < 256
      <unit>
      determines the SCSI LUN on the virtual server according to the rules specified in the SCSI Architecture Model (SAM):
      0 ≤ <unit> < 256
      SCSI LUN := <unit>
      256 ≤ <unit> ≤ 16383
      SCSI LUN := 0x<unit> ∨ 0x4000
      Tip: Choose a value between 0 and 255, because these values are identically mapped to the SCSI LUN on the virtual server.

Example

<devices>
    ...
    <controller type="scsi" model="virtio-scsi" index="4"/>
    <disk type="file" device="cdrom">
        <driver name="qemu" type="raw" io="native" cache="none"/>
        <source file="/var/lib/libvirt/images/cd.iso"/>
        <target dev="sda" bus="scsi"/>
        <address type="drive" controller="4" bus="0" target="0" unit="0"/>
        <readonly/>
    </disk>
    ...
</devices>