Bug 627143
Summary: | can't successfully start guest with a hot-plugging disk after stopping | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Alex Jia <ajia> | |
Component: | libvirt | Assignee: | Osier Yang <jyang> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | medium | Docs Contact: | ||
Priority: | low | |||
Version: | 6.0 | CC: | ccui, dallan, dyuan, eblake, florin, jdenemar, llim, mfuruta, vbian, weizhan, xen-maint, yuzhang | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-0.8.7-1.el6 | Doc Type: | Bug Fix | |
Doc Text: |
If the user did not specify a disk driver when hot-plugging a disk with "virsh attach-disk", virsh set "phy" as the driver value by default. Because this value is not supported everywhere, the disk did not persist over domain shutdown, and could prevent domain startup. This update corrects virsh behavior such that the driver value is not set if it is not provided by the user.
|
Story Points: | --- | |
Clone Of: | ||||
: | 638071 1000432 (view as bug list) | Environment: | ||
Last Closed: | 2011-05-19 13:20:50 UTC | Type: | --- | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 638071, 1000432 |
Description
Alex Jia
2010-08-25 08:03:32 UTC
Libvirt haven't check image real format instead of passing default raw format to qemu-kvm, the following information is come from libvirtd.log: ...... 16:27:37.471: debug : qemuMonitorAddDrive:1897 : mon=0x1ef3890 drive=file=/var/lib/libvirt/images/mytest.qcow2,if=none,id=drive-virtio-disk1,format=raw ...... 16:27:37.471: debug : virJSONValueToString:1059 : result={"execute":"__com.redhat_drive_add","arguments":{"file":"/var/lib/libvirt/images/mytest.qcow2","id":"drive-virtio-disk1","format":"raw"}} 16:27:37.471: debug : qemuMonitorJSONCommandWithFd:217 : Send command '{"execute":"__com.redhat_drive_add","arguments":{"file":"/var/lib/libvirt/images/mytest.qcow2","id":"drive-virtio-disk1","format":"raw"}}' The error report: unsupported driver name 'phy', maybe it's the focal point. set driver name='qemu', keep type=raw # virsh edit demo ... <driver name='qemu' type='raw'/> ... # virsh start demo Domain demo started But when I only change 'raw' to 'qcow2', guest still start fail. # virsh edit demo ... <driver name='phy' type='qcow2'/> ... # virsh start demo error: Failed to start domain demo error: internal error unsupported driver name 'phy' for disk '/var/lib/libvirt/images/foo.img' (In reply to comment #2) > Libvirt haven't check image real format instead of passing default raw format > to qemu-kvm, the following information is come from libvirtd.log: > > ...... > 16:27:37.471: debug : qemuMonitorAddDrive:1897 : mon=0x1ef3890 > drive=file=/var/lib/libvirt/images/mytest.qcow2,if=none,id=drive-virtio-disk1,format=raw > ...... > 16:27:37.471: debug : virJSONValueToString:1059 : > result={"execute":"__com.redhat_drive_add","arguments":{"file":"/var/lib/libvirt/images/mytest.qcow2","id":"drive-virtio-disk1","format":"raw"}} > 16:27:37.471: debug : qemuMonitorJSONCommandWithFd:217 : Send command > '{"execute":"__com.redhat_drive_add","arguments":{"file":"/var/lib/libvirt/images/mytest.qcow2","id":"drive-virtio-disk1","format":"raw"}}' we can use 'subdriver=qcow2' in command attach-device, but it's not the workaround of the bug. # virsh attach-disk demo /var/lib/libvirt/images/foo.img vdb --subdriver qcow2 Disk attached successfully # virsh dumpxml demo ... <disk type='block' device='disk'> <driver name='phy' type='qcow2'/> <source dev='/var/lib/libvirt/images/foo.img'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> Find some mismatch between attach-disk and xml. Juxtapose the candidate of --driver in 'man virsh' and the actual value in xml, I think the value of --driver should be matched <disk type='phy' device='disk'>, but it pass the value to <driver name='phy' type='qcow2'>. # man virsh ... attach-disk domain-id source target optional --driver driver --subdriver subdriver --type type --mode mode Attach a new disk device to the domain. source and target are paths for the files and devices. >>>> driver can be file, tap or phy depending on the kind of access. <<< >>>> type can indicate cdrom or floppy as alternative to the disk default <<<, although this use only replaces the media within the existing virtual cdrom or floppy device; consider using update-device for this usage instead. mode can specify the two specific mode readonly or shareable. # virsh edit demo ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/RHEL-Server-6-64-virtio.qcow2'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cdrom1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> I test it on rc4 to attach a raw disk, it also has problem and cat not start #virsh attach-disk demo /var/lib/libvirt/images/foo.img vdb #virsh dumpxml demo ... <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/var/lib/libvirt/images/foo.img'/> <target dev='vdb' bus='virtio'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> ... FWIW I have the same problem on Fedora 14 beta. I have added a /dev/md0 device to my guest and it works fine until I shut down. To add insult to the injury, I can't detach the disk from the virsh console using 'detach-disk' because the domain isn't running. But I can't start the domain. Luckily, I can remove the device from virt-manager. Is there a Fedora 14 bug I should subscribe to in order to follow the progress? missed one upstream patch which is to address this problem: http://www.redhat.com/archives/libvir-list/2010-September/msg00156.html though it's not addressed completely, depends on user must use the new options introduced by this patch. - Osier patch pushed upstream: http://www.redhat.com/archives/libvir-list/2010-December/msg00097.html - Osier Hi Osier, Should the patch be backported into RHEL5.6/5.7 for Xen? Xen could handle the situation when no driver was given as a default(see BZ#658712), so it is ok for libvirt not to give a default driver value. Yufang Built into libvirt-0.8.7-1.el6 verify PASS on libvirt-0.8.7-1.el6 after start a guest do # virsh attach-disk test /var/lib/libvirt/images/foo.img vdb Disk attached successfully # virsh dumpxml test ... <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/var/lib/libvirt/images/foo.img'/> <target dev='vdb' bus='virtio'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> ... After shutdown, the device "foo.img" is removed. # virsh start test Domain test started no error occured. qemu-kvm-0.12.1.2-2.128.el6.x86_64 kernel-2.6.32-94.el6.x86_64 libvirt-0.8.7-1.el6 *** Bug 632580 has been marked as a duplicate of this bug. *** Blocked by new bug 676548 and will verify it later. Rechecked it on the following test environment according to comment 13. It is passed. Test environment: libvirt-0.8.7-6.el6 qemu-kvm-0.12.1.2-2.144.el6 kernel-2.6.32-113.el6 tested with libvirt-0.8.7-18.el6.x86_64 qemu-kvm-0.12.1.2-2.158.el6.x86_64 kernel-2.6.32-131.0.1.el6.x86_64 after hot-plug disk , shutdown guest works fine , and guest can be start after stop . So keep bug status as VERIFIED Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: virsh set a "phy" as the disk driver if user doesn't specify one when attaching a disk (virsh attach-disk), this breaks the domain start after attaching a disk without specifying the driver, this update fixed the problem. Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1 +1 @@ -virsh set a "phy" as the disk driver if user doesn't specify one when attaching a disk (virsh attach-disk), this breaks the domain start after attaching a disk without specifying the driver, this update fixed the problem.+virsh sets "phy" as the disk driver if user doesn't specify one when attaching a disk (virsh attach-disk), this breaks the domain start after attaching a disk without specifying the driver, this update fixed the problem. Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1 +1 @@ -virsh sets "phy" as the disk driver if user doesn't specify one when attaching a disk (virsh attach-disk), this breaks the domain start after attaching a disk without specifying the driver, this update fixed the problem.+If the user did not specify a disk driver when hot-plugging a disk with "virsh attach-disk", virsh set "phy" as the driver value by default. Because this value is not supported everywhere, the disk did not persist over domain shutdown, and could prevent domain startup. This update corrects virsh behavior such that the driver value is not set if it is not provided by the user. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0596.html |