Bug 829562
| Summary: | virsh attach-disk --cache does not work | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Huang Wenlong <whuang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.3 | CC: | acathrow, cwei, dallan, dyasny, dyuan, gsun, mzhan, sputhenp |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| 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 07:16:40 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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.
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.
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 |
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