Bug 829562 - virsh attach-disk --cache does not work
virsh attach-disk --cache does not work
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.3
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-06 23:19 EDT by Huang Wenlong
Modified: 2013-10-20 17:45 EDT (History)
8 users (show)

See Also:
Fixed In Version: libvirt-0.9.13-3.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 02:16:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 16:18:26 EST

  None (edit)
Description Huang Wenlong 2012-06-06 23:19:31 EDT
Description of problem:
virsh attach-disk --cache  does not work
you can put any words like "--cache sdsfg" ,virsh attach disk still succeeds 
but there is no "cache" for the new disk 
Version-Release number of selected component (if applicable):
libvirt-0.9.10-21.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create image
# qemu-img create /var/lib/libvirt/images/local.img 1G
Formatting '/var/lib/libvirt/images/local.img', fmt=raw size=1073741824

2.attach disk
# virsh attach-disk 5 /var/lib/libvirt/images/local.img vdb --cache none
Disk attached successfully
3.check xml
...
  <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/var/lib/libvirt/images/local.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
...


Actual results:
--cache does not work

Expected results:
--cache works and xml contain cache=none

Additional info:
if sourcetype=file  --cache does not work either
Comment 2 Peter Krempa 2012-06-14 07:51:47 EDT
Fixed upstream:

commit 5b4740265cf1e9cd00165e54e1f5e81f9008bc63
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Wed Jun 13 16:55:51 2012 +0200

    virsh: Don't generate invalid XML in attach-disk command
    
    The attach-disk command used with parameter --cache created an invalid
    XML snippet as the beginning of the <driver> element was not printed
    when used solely with --cache and no other attribute to driver.
Comment 4 Wayne Sun 2012-07-25 02:46:16 EDT
pkgs:
libvirt-0.9.13-3.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.297.el6_3.x86_64
kernel-2.6.32-280.el6.x86_64

steps:
1.
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     aaa                            running

2. create img
# qemu-img create /var/lib/libvirt/images/foo.img 1G
Formatting '/var/lib/libvirt/images/foo.img', fmt=raw size=1073741824 

3. attach with --cache
# virsh attach-disk aaa /var/lib/libvirt/images/foo.img vdb --cache none
Disk attached successfully

check domain xml
# virsh dumpxml aaa
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/foo.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
...

4. try other modes
# virsh attach-disk aaa /var/lib/libvirt/images/fooo.img vdc --cache writeback
Disk attached successfully

check domain xml
# virsh dumpxml aaa
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/var/lib/libvirt/images/fooo.img'/>
      <target dev='vdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
...

# qemu-img create /var/lib/libvirt/images/foo1.img 1G
Formatting '/var/lib/libvirt/images/foo1.img', fmt=raw size=1073741824 
# virsh attach-disk aaa /var/lib/libvirt/images/foo1.img vdd --cache writethrough
Disk attached successfully

# virsh dumpxml aaa
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writethrough'/>
      <source file='/var/lib/libvirt/images/foo1.img'/>
      <target dev='vdd' bus='virtio'/>
      <alias name='virtio-disk3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...


5. try with invalid mode
# qemu-img create /var/lib/libvirt/images/fooo.img 1G
Formatting '/var/lib/libvirt/images/fooo.img', fmt=raw size=1073741824 

# virsh attach-disk aaa /var/lib/libvirt/images/fooo.img vdc --cache nabab
error: Failed to attach disk
error: internal error unknown disk cache mode 'nabab'

This is working.
Comment 5 errata-xmlrpc 2013-02-21 02:16:40 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0276.html

Note You need to log in before you can comment on or make changes to this bug.