From Fedora Project Wiki

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

Setup

  1. make sure install qemu-img:
    #yum install qemu-img
  2. if the guest is rhel5, execute the following command in guest before attach-disk:
    # modprobe acpiphp

How to test

  1. # virsh start demo
  2. # qemu-img create  foo.img 10M
  3. Create a disk desription file as following XML:
    # cat disk.xml
    <disk type='file' device='disk'>
          <driver name='qemu' type='raw'/>
          <source file=''/var/lib/libvirt/images/foo.img''/>
          <target dev='sda' bus='scsi'/>
    </disk>
  4. # virsh attach-device demo disk.xml
  5. Run command fdisk -l in guest
  6. Restart demo and check:
    # virsh shutdown demo
    # virsh start demo
    log in guest:
    # fdisk -l
  7. # virsh detach-disk demo sda
  8. Run command fdisk -l in guest

Expected Results

  1. step 4: Device attached successfully
  2. step 5: check the disk device is existing.
  3. step 6: boot successfully and check the disk device is existing.
  4. step 7: Disk detached successfully
  5. step 8: check the disk device is not existing.