Bug 803577

Summary: virsh attach-disk should detect disk source file type when sourcetype is not specified
Product: Red Hat Enterprise Linux 6 Reporter: Huang Wenlong <whuang>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cwei, dallan, dyuan, gsun, jyang, mzhan, rwu, sathnaga86, weizhan
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:08:40 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:

Description Huang Wenlong 2012-03-15 06:10:23 UTC
Description of problem:
virsh attach-disk should detect disk source file type when sourcetype is not specified


Version-Release number of selected component (if applicable):
libvirt-0.9.10-4.el6.x86_64
qemu-kvm-0.12.1.2-2.241.el6.x86_64



How reproducible:
100%

Steps to Reproduce:

1.create a file img
#qemu-img create /var/lib/libvirt/images/hotplug.img 1G

2.hotplug file  disk to guest
# virsh attach-disk $domain_name  /var/lib/libvirt/images/hotplug.img vdb

3. check xml of domain disk type should be file not block .
#virsh dumpxml $domain_name

...
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/var/lib/libvirt/images/hotplug.img'/>
<target dev='vdb' bus='virtio'/>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
...


Actual results:
do not detect disk source file type

Expected results:
detect disk source file type


Additional info:

Comment 2 Osier Yang 2012-03-15 09:49:06 UTC
commit 6227a220ccdd0193a1912f3a0010a72d91f06818
Author: Osier Yang <jyang>
Date:   Thu Mar 15 18:16:52 2012 +0800

    virsh: A bit smarter attach-disk
    
    Detects the file type of source path if no "--sourcetype" and
    "driver" is specified, instead of always set the disk type as
    "block".

Patch comitted to upstream

Comment 4 Osier Yang 2012-05-28 08:56:03 UTC
Per comment 2, move to POST.

Comment 7 weizhang 2012-07-25 03:58:43 UTC
Verify pass on
libvirt-0.9.13-3.el6.x86_64
kernel-2.6.32-289.el6.x86_64
qemu-kvm-0.12.1.2-2.298.el6.x86_64

# virsh attach-disk vr-rhel6u3-x86_64-kvm /dev/sdb1 vdc
# virsh attach-disk vr-rhel6u3-x86_64-kvm /var/lib/libvirt/images/attch.img vdb
# virsh dumpxml vr-rhel6u3-x86_64-kvm
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/attch.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sdb1'/>
      <target dev='vdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
...

Comment 8 errata-xmlrpc 2013-02-21 07:08: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