RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 829562 - virsh attach-disk --cache does not work
Summary: virsh attach-disk --cache does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-07 03:19 UTC by Huang Wenlong
Modified: 2018-11-30 19:57 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.9.13-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:16:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description Huang Wenlong 2012-06-07 03:19:31 UTC
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 11:51:47 UTC
Fixed upstream:

commit 5b4740265cf1e9cd00165e54e1f5e81f9008bc63
Author: Peter Krempa <pkrempa>
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 06:46:16 UTC
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 07:16:40 UTC
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.