Bug 1229119
Summary: | Unrelated info in fstab makes virt-v2v fail with unclear error info | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | tingting zheng <tzheng> | ||||
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | ||||
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 7.2 | CC: | juzhou, mzhan, ptoscano, sherold, xiaodwan | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Unspecified | ||||||
Whiteboard: | V2V | ||||||
Fixed In Version: | libguestfs-1.32.0-2.el7 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-11-03 17:53:42 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: | |||||||
Bug Depends On: | 1218766 | ||||||
Bug Blocks: | 1288337 | ||||||
Attachments: |
|
The reproducer for this is: $ virt-builder centos-6 --run-command 'echo >>/etc/fstab; echo test >>/etc/fstab' $ virt-v2v -i disk centos-6.img -o null [...] [ 16.1] Converting CentOS release 6.6 (Final) to run on KVM virt-v2v: error: no grub1/grub-legacy or grub2 configuration file was found (In reply to Richard W.M. Jones from comment #2) > The reproducer for this is: > > $ virt-builder centos-6 --run-command 'echo >>/etc/fstab; echo test > >>/etc/fstab' > $ virt-v2v -i disk centos-6.img -o null > [...] > [ 16.1] Converting CentOS release 6.6 (Final) to run on KVM > virt-v2v: error: no grub1/grub-legacy or grub2 configuration file was found The invalid content in /etc/fstab causes the inspection code to not read any of the mountpoints listed there: as a consequence, /boot is not mounted from its partition, and grub is not detected. This has been fixed upstream with https://github.com/libguestfs/libguestfs/commit/279addeb7dd4f5f2446a3995eb7704980c08b5ff which is in libguestfs >= 1.31.18. The behaviour now is that guests with an invalid /etc/fstab will fail at the inspection stage, so when using the inspect-os API or the virt-inspector tool you will get an error. When trying to convert the guest using virt-v2v, the same error will cause the conversion to fail much earlier, and with a clearer information. With the patch, my test (comment 2) now fails like this: virt-v2v -i disk centos-6.img -o null [ 0.0] Opening the source -i disk centos-6.img [ 0.1] Creating an overlay to protect the source from being modified [ 0.3] Opening the overlay [ 12.8] Initializing the target -o null [ 12.8] Inspecting the overlay virt-v2v: error: libguestfs error: augeas could not parse /etc/fstab I can reproduce it with packages as below. # rpm -q libguestfs virt-v2v libguestfs-1.28.1-1.55.el7.x86_64 virt-v2v-1.28.1-1.55.el7.x86_64 And then verified it with latest version. # rpm -q libguestfs virt-v2v libguestfs-1.32.2-6.el7.x86_64 virt-v2v-1.32.2-6.el7.x86_64 Steps: 1. Prepare a guest, add some wrong info in /etc/fstab. eg: Add a new line with "test" 2. Run virt-v2v command. # virt-v2v -i disk rhel7.2-1030-clone.qcow2 -o null [ 0.0] Opening the source -i disk rhel7.2-1030-clone.qcow2 [ 0.0] Creating an overlay to protect the source from being modified [ 0.0] Opening the overlay [ 70.0] Initializing the target -o null [ 70.0] Inspecting the overlay [ 80.0] Checking for sufficient free disk space in the guest [ 80.0] Estimating space required on target for each disk [ 80.0] Converting Red Hat Enterprise Linux Server release 7.2 (Maipo) to run on KVM virt-v2v: error: no grub1/grub-legacy or grub2 configuration file was found If reporting bugs, run virt-v2v with debugging enabled and include the complete output: virt-v2v -v -x [...] [root@localhost images]# virt-v2v -i disk rhel7.2-1030-clone.qcow2 -o null [ 0.0] Opening the source -i disk rhel7.2-1030-clone.qcow2 [ 0.1] Creating an overlay to protect the source from being modified [ 0.5] Initializing the target -o null [ 0.5] Opening the overlay [ 55.9] Inspecting the overlay virt-v2v: error: libguestfs error: /etc/fstab:12:4: augeas parse failure: Iterated lens matched less than it should If reporting bugs, run virt-v2v with debugging enabled and include the complete output: virt-v2v -v -x [...] So move the bug from ON_QA to VERIFIED. How about these scenarios in the patch as below,it seems we didn't test cover such test scenarioes,Would you pls test it and add comments in the bug. Now guests with invalid files such as /etc/fstab, /etc/mdadm.conf, and /etc/sysconfig/network will cause the inspection to fail, instead of being reported with a single mount point ('/'). I tested /etc/mdadm.conf, the result is as below. virt-v2v: error: libguestfs error: /etc/mdadm.conf:1:0: augeas parse failure: Iterated lens matched less than it should And i also tested /etc/sysconfig/network, it's a blank file. I tried to add some invalid string into it, but it seems like this can't make the file invalid. And I think it's enough only cover one configure file because they use same logic. 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. https://rhn.redhat.com/errata/RHSA-2016-2576.html |
Created attachment 1036136 [details] Debug log Description: Unrelated info in fstab makes virt-v2v fail with unclear error info Version: libguestfs-1.28.1-1.37.el7.x86_64 virt-v2v-1.28.1-1.37.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Prepare a guest,add some wrong info in /etc/fstab. eg: Add a new line with "test" 2.Use virt-v2v to convert the guest,fail with the below error: # virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export -n rhevm rhel6.7-x64 [ 0.0] Opening the source -i libvirt rhel6.7-x64 [ 0.0] Creating an overlay to protect the source from being modified [ 0.0] Opening the overlay [ 105.0] Initializing the target -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_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. [ 106.0] Inspecting the overlay [ 118.0] Checking for sufficient free disk space in the guest [ 118.0] Estimating space required on target for each disk [ 118.0] Converting Red Hat Enterprise Linux Server release 6.7 Beta (Santiago) to run on KVM virt-v2v: error: no grub1/grub-legacy or grub2 configuration file was found If reporting bugs, run virt-v2v with debugging enabled and include the complete output: virt-v2v -v -x [...] Actual results: As description. Expected results: The results should be one of the below: 1.Virt-v2v ignore these unrelated info in /etc/fstab and Guest can be converted successfully. 2.Much more clear error info shows and virt-v2v fails. Additional info: Attached detailed log.