Bug 1318999

Summary: RFE: virt-v2v should support floppy disks
Product: Red Hat Enterprise Linux 7 Reporter: mxie <mxie>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.3CC: juzhou, keanli, mzhan, ptoscano, rjones, tzheng, xiaodwan
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-23 14:43:23 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:
Attachments:
Description Flags
virt-v2v-floppy-7.3.log
none
screenshot
none
libvirt-floppy.log none

Description mxie@redhat.com 2016-03-18 11:28:39 UTC
Created attachment 1137744 [details]
virt-v2v-floppy-7.3.log

Description of problem:
V2V can't recognize the floppy device name "fda"

Version-Release number of selected component (if applicable):
libvirt-1.3.2-1.el7.x86_64
kernel:3.10.0-365.el7.x86_64
qemu-kvm-1.5.3-109.el7.x86_64
libguestfs-winsupport-7.2-1.el7.x86_64
virtio-win-1.8.0-4.el7.noarch
virt-v2v-1.32.3-1.el7.x86_644
libguestfs-1.32.3-1.el7.x86_64
RHEVM3.6 : 3.6.3.2-0.1.el6

How reproducible:
100%

Steps to Reproduce:
1.Prepare a guest which has added floppy device  
# virsh dumpxml rhel6.7
 ...
  <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/rhel6.7.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.img'/>
      <target dev='fda' bus='fdc'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

...

2.Convert the floppy guest to rhev usig virt-v2v,details log pls refer to virt-v2v-floppy-rhel7.3.log
# virt-v2v -o rhev -os 10.73.2.1:/home/nfs_export -n ovirtmgmt -b ovirtmgmt rhel6.7 -on floppy-7.3 -of qcow2
[   0.0] Opening the source -i libvirt rhel6.7
virt-v2v: warning: <target dev='fda'> was ignored because the device name 
could not be recognized
[   0.0] Creating an overlay to protect the source from being modified
[   0.5] Initializing the target -o rhev -os 10.73.2.1:/home/nfs_export
virt-v2v: warning: cannot write files to the NFS server as 36:36, even 
though we appear to be running as root. This probably means the NFS client 
or idmapd is not configured properly.

You will have to chown the files that virt-v2v creates after the run, 
otherwise RHEV-M will not be able to import the VM.
[   0.6] Opening the overlay
[   3.4] Inspecting the overlay
[  11.0] Checking for sufficient free disk space in the guest
[  11.0] Estimating space required on target for each disk
[  11.0] Converting Red Hat Enterprise Linux Server release 6.7 (Santiago) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  40.2] Mapping filesystem data to avoid copying unused and blank areas
[  40.4] Closing the overlay
[  40.6] Checking if the guest needs BIOS or UEFI to boot
[  40.6] Assigning disks to buses
[  40.6] Copying disk 1/1 to /tmp/v2v.bwT9y0/005ee5bc-b28e-4d57-b287-7fb95875756c/images/673ae990-7176-4064-a06c-1fcfa5489e10/db41ef48-732a-4f70-88f8-a07be67a5e9a (qcow2)
    (100.00/100%)
[  88.9] Creating output metadata
[  89.0] Finishing off

3.After conversion, can't find any floppy device on guest at rhev, pls refer to screenshot
 
Actual results:
As above description

Expected results:
V2V can recognize the floppy device name "fda" and could find floppy device on guest after conversion

Addtional info:

Comment 1 mxie@redhat.com 2016-03-18 11:29:10 UTC
Created attachment 1137745 [details]
screenshot

Comment 3 Richard W.M. Jones 2016-03-18 12:19:28 UTC
We agreed on IRC to keep this open as a tracking bug for the
feature, but not to implement it unless customers ask for it.

Comment 4 Richard W.M. Jones 2016-06-23 14:43:23 UTC

*** This bug has been marked as a duplicate of bug 1309706 ***

Comment 5 zhoujunqin 2016-07-08 10:07:26 UTC
I can reproduce this issue with build:
libguestfs-1.32.5-5.el7.x86_64
virt-v2v-1.32.5-5.el7.x86_64

Steps:
1. Prepare a guest which has added floppy device  
# virsh dumpxml 6test1
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' io='threads'/>
      <source file='/var/lib/libvirt/images/6test1.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='floppy'>
      <driver name='qemu' type='qcow2'/>
      <source file='/tmp/floopy.img'/>
      <target dev='fda' bus='fdc'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...

2. Convert it to rhev
# virt-v2v -o rhev -os 10.73.72.63:/home/nfs_export 6test1 --print-source
[   0.0] Opening the source -i libvirt 6test1
virt-v2v: warning: <target dev='fda'> was ignored because the device name 
could not be recognized
Source guest information (--print-source option):

    source name: 6test1
hypervisor type: kvm
         memory: 1073741824 (bytes)
       nr vCPUs: 8
   CPU features: apic,acpi
       firmware: unknown
        display: spice
          sound: ich6
disks:
	/var/lib/libvirt/images/6test1.img (raw) [virtio]
removable media:
	Floppy
NICs:
	Network "dfadf" mac: 52:54:00:30:dd:e3


Then try to verify this bug with new build:
libguestfs-1.32.5-10.el7.x86_64
virt-v2v-1.32.5-10.el7.x86_64
libvirt-2.0.0-1.el7.x86_64
qemu-kvm-1.5.3-116.el7.x86_64

Steps:
1. Test conversion with option '--print-source'
# virt-v2v -o rhev -os 10.73.72.63:/home/nfs_export 6test1  -n ovirtmgmt -b ovirtmgmt -on jt2 -of qcow2 --print-source
[   0.0] Opening the source -i libvirt 6test1
Source guest information (--print-source option):

    source name: 6test1
hypervisor type: kvm
         memory: 1073741824 (bytes)
       nr vCPUs: 8
   CPU features: apic,acpi
       firmware: unknown
        display: spice
          sound: ich6
disks:
	/var/lib/libvirt/images/6test1.img (raw) [virtio]
removable media:
	Floppy in slot 0
NICs:
	Network "dfadf" mac: 52:54:00:30:dd:e3


Result:
1.1 No warning: '<target dev='fda'> was ignored because the device name could not be recognized' shows.
1.2 It seems Floppy also be removed.

2. Convert to rhevm.
# virt-v2v -o rhev -os 10.73.72.63:/home/nfs_export 6test1  -n ovirtmgmt -b ovirtmgmt -on jt2 -of qcow2 
[   0.0] Opening the source -i libvirt 6test1
[   0.0] Creating an overlay to protect the source from being modified
[   0.2] Initializing the target -o rhev -os 10.73.72.63:/home/nfs_export
[   0.4] Opening the overlay
[  47.4] Inspecting the overlay
[  58.9] Checking for sufficient free disk space in the guest
[  58.9] Estimating space required on target for each disk
[  58.9] Converting Red Hat Enterprise Linux Server release 6.8 (Santiago) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  90.8] Mapping filesystem data to avoid copying unused and blank areas
[  90.9] Closing the overlay
[  91.0] Checking if the guest needs BIOS or UEFI to boot
[  91.0] Assigning disks to buses
[  91.0] Copying disk 1/1 to /tmp/v2v.t56A1H/d67d5cf2-4931-4e57-99a1-b50207f10f30/images/40aa1db2-9b78-4b08-8455-4ec4d04383e5/8c92dda8-1ca3-4cc5-bedb-8b054800fb61 (qcow2)
    (100.00/100%)
[ 440.8] Creating output metadata
[ 440.9] Finishing off

Result:
After conversion finished, then import image and check after guest boot up, not find floppy device.

So rjones, is this result i get as expected? from bug summary, it shows floppy is supported, thanks.

Comment 6 Richard W.M. Jones 2016-07-08 10:20:06 UTC
The good thing is:

(1) The warning has gone.

(2) "Floppy in slot 0" is shown, which means the floppy was assigned
to a slot in the output.

Now what is missing is that when outputting to RHEV we ignore
all removable devices (CDs, floppies).  This is the same as what
old virt-v2v did so it's not a regression:

https://github.com/libguestfs/libguestfs/blob/master/v2v/OVF.ml#L354

I don't intend to fix that unless a customer finds the bug and
complains about it.

Output to libvirt should now add a floppy device, looking like this:

    <disk device='floppy' type='file'>
      <driver name='qemu' type='raw'/>
      <target dev='fda'/>       <--- note should be fdX, NOT hdX
    </disk>

Comment 7 zhoujunqin 2016-07-12 02:35:17 UTC
(In reply to Richard W.M. Jones from comment #6)
> The good thing is:
> 
> (1) The warning has gone.
> 
> (2) "Floppy in slot 0" is shown, which means the floppy was assigned
> to a slot in the output.
> 
> Now what is missing is that when outputting to RHEV we ignore
> all removable devices (CDs, floppies).  This is the same as what
> old virt-v2v did so it's not a regression:
> 
> https://github.com/libguestfs/libguestfs/blob/master/v2v/OVF.ml#L354
> 
> I don't intend to fix that unless a customer finds the bug and
> complains about it.
> 
> Output to libvirt should now add a floppy device, looking like this:
> 
>     <disk device='floppy' type='file'>
>       <driver name='qemu' type='raw'/>
>       <target dev='fda'/>       <--- note should be fdX, NOT hdX
>     </disk>

ok, got it, thanks.

Comment 9 mxie@redhat.com 2016-09-18 09:24:56 UTC
Created attachment 1202130 [details]
libvirt-floppy.log