Bug 895898

Summary: RFE: Allow interface to be specified with libvirt attach-method
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: leiwang, wshi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 892272 Environment:
Last Closed: 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:
Bug Depends On:    
Bug Blocks: 892272    

Description Richard W.M. Jones 2013-01-16 09:00:04 UTC
+++ This bug was initially created as a clone of Bug #892272 +++

Description of problem:

Specify QEMU interface emulation  with add-drive-with-if(add-drive $file iface:ide) break libguestfs, the parameter translate to libvirt xml file is incorrect, 

supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [00023ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [00023ms] visiting /usr/lib64/guestfs/supermin.d/ntfs.hostfiles
supermin helper [00024ms] visiting /usr/lib64/guestfs/supermin.d/ntfs.img
supermin helper [00024ms] visiting /usr/lib64/guestfs/supermin.d/udev-rules.img
supermin helper [00024ms] adding kernel modules
supermin helper [00053ms] finished creating appliance
libguestfs: checksum of existing appliance: 138a4a0202de035445cab9d54cd31237b2f29cfabc109ad06528b04c1e9b
20fd
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -b /var/tmp/.guestfs-0/root.26443
libguestfs: command: run: \ -o backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfslrGiSI/snapshot2
Formatting '/tmp/libguestfslrGiSI/snapshot2', fmt=qcow2 size=4294967296 backing_file='/var/tmp/.guestfs-
0/root.26443' backing_fmt='raw' encryption=off cluster_size=65536 lazy_refcounts=off 
libguestfs: [00090ms] create libvirt XML
libguestfs: error: 'iface' parameter is not supported by the libvirt attach-method
libguestfs: trace: launch = -1 (error)




the correct xml should be like below, 

    <disk type='file' snapshot='external'>
      <driver name="tap" type="aio" cache="default"/>
      <source file='/var/lib/xen/images/fv0' startupPolicy='optional'>
        <seclabel relabel='no'/>
      </source>
      <target dev='hda' bus='ide'/>
      <iotune>
        <total_bytes_sec>10000000</total_bytes_sec>
        <read_iops_sec>400000</read_iops_sec>
        <write_iops_sec>100000</write_iops_sec>
      </iotune>
      <boot order='2'/>
      <encryption type='...'>


Version-Release number of selected component (if applicable):
libguestfs-1.20.1-4.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. #guestfish -x -v 
2. #add-drive $file iface:ide 
3. #run
  
Actual results:


Expected results:


Additional info:

Comment 1 Richard W.M. Jones 2013-01-21 10:46:52 UTC
The error message is pretty clear that specifying an interface
is not supported when using libvirt as the back end:

libguestfs: error: 'iface' parameter is not supported by the libvirt attach-method

As you say, it could be supported if we spent some time enhancing
the libvirt attach-method.  The question is whether there is any
pressing reason to do so.

The only place I'm aware that our software might need to specify
the interface is in virt-v2v:

http://git.fedorahosted.org/cgit/virt-v2v.git/tree/lib/Sys/VirtConvert/GuestfsHandle.pm#n82

and that was required because some ancient mkinitrd got
completely confused by /dev/vd* drives.

Matt - is this still necessary?  Are there other reasons we might
want to support iface/interface selection in RHEL 7?

Comment 2 Richard W.M. Jones 2013-01-21 10:47:49 UTC
(In reply to comment #1)
> and that was required because some ancient mkinitrd got
> completely confused by /dev/vd* drives.

.. and note that we plan to use virtio-scsi, which uses the
/dev/sd* naming scheme.

Comment 3 Matthew Booth 2013-01-24 13:28:17 UTC
I have no other reasons to support this. However, at some point I need to check exactly what this breaks. Unfortunately I didn't document it at the time :(