Product SiteDocumentation Site

12.3.3. Managing storage controllers in a guest

Starting fromFedora X (was RHEL6.3), SCSI devices are also supported inside guests.
Unlike virtio disks, SCSI devices require the presence of a controller in the guest.
This section details the necessary steps to create a virtual SCSI controller (also known as "Host Bus Adapter", or HBA), and to add SCSI storage to the guest.
Procedure 12.3. Creating a virtual SCSI controller
  1. Display the configuration of the guest (Guest1) and look for a pre-existing SCSI controller:
    # virsh dumpxml Guest1 | grep controller.*scsi
    
    If a controller is present, the command will output one or more lines similar to the following:
    <controller type='scsi' model='virtio-scsi' index='0'>
    
  2. If the previous step did not show a controller, create the description for one in a new file and add it to the virtual machine, using the following steps:
    1. Create the controller by writing a <controller> element in a new file and save this file with an XML extension. NewHBA.xml, for example.
      <controller type='scsi' model='virtio-scsi'/>
      
    2. Associate the device in the NewHBA.xml you just created with your guest:
      # virsh attach-device --persistent Guest1 ~/NewHBA.xml
      
      In this example the --persistent option behaves the same as it does for disks. Refer to Procedure 12.2, “Adding physical block devices to guests” for more information.
  3. Add a new SCSI disk or CD-ROM. The new disk can be added using the methods in sections Section 12.3.1, “Adding file based storage to a guest” and Section 12.3.2, “Adding hard drives and other block devices to a guest”. In order to create a SCSI disk, specify a target device name that starts with sd.
    # virsh attach-disk Guest1 /var/lib/libvirt/images/FileName.img sdb --cache none
    
    Depending on the version of the driver in the guest, the new disk may not be detected immediately by a running guest. Follow the steps in the Fedora Storage Administration Guide (refer to the section entitled, Adding/Removing a Logical Unit Through rescan-scsi-bus.sh to scan the SCSI bus in the guest).