Bug 1342337
| Summary: | Should remind a warning about disk image has a partition when using virt-p2v-make-disk | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | mxie <mxie> |
| 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.3 | CC: | juzhou, mzhan, ptoscano, rjones, tzheng, xiaodwan |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Unspecified | ||
| Whiteboard: | P2V | ||
| Fixed In Version: | libguestfs-1.32.5-7.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-03 18:00:53 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: | |||
|
Description
mxie@redhat.com
2016-06-03 03:16:06 UTC
I posted a patch for this yesterday. The new output has a warning which reads: virt-builder: warning: output device (/dev/sdb1) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition https://www.redhat.com/archives/libguestfs/2016-June/msg00002.html I can reproduce this issue with build: # rpm -q virt-v2v virt-p2v virt-v2v-1.32.4-3.el7.x86_64 virt-p2v-1.32.4-3.el7.noarch Then try to verify with new build: virt-v2v-1.32.5-6.el7.x86_64 virt-p2v-1.32.5-6.el7.noarch Steps: 1. Prepare a USB device with 1 partition # fdisk -l /dev/sdb Disk /dev/sdb: 16.0 GB, 16022241280 bytes, 31293440 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x8f3f3a11 Device Boot Start End Blocks Id System /dev/sdb1 2048 31293439 15645696 83 Linux 2. Use virt-p2v-make-disk creates a bootable disk image or USB key containing virt-p2v to this USB device. # virt-p2v-make-disk -o /dev/sdb1 virt-builder: warning: output device (/dev/sdb1) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition [ 2.6] Downloading: http://libguestfs.org/download/builder/fedora-24.xz [ 12.8] Planning how to build this image [ 12.8] Uncompressing [ 19.5] Resizing (using virt-resize) to expand the disk to 14.9G [ 508.2] Opening the new disk [ 510.8] Setting a random seed [ 510.8] Updating packages [ 721.2] Installing packages: pcre libxml2 gtk2 /usr/bin/ssh /usr/bin/qemu-nbd curl ethtool hwdata pciutils hdparm smartmontools util-linux xterm /usr/bin/xinit /usr/bin/Xorg xorg-x11-drivers xorg-x11-fonts-Type1 dejavu-sans-fonts dejavu-sans-mono-fonts mesa-dri-drivers metacity NetworkManager nm-connection-editor network-manager-applet dbus-x11 net-tools @hardware-support [1014.4] Uploading: /usr/share/virt-p2v/issue to /etc/issue [1014.4] Uploading: /usr/share/virt-p2v/issue to /etc/issue.net [1014.4] Making directory: /usr/libexec [1014.4] Uploading: /usr/libexec/virt-p2v to /usr/libexec [1014.4] Changing permissions of /usr/libexec/virt-p2v to 0755 [1014.4] Uploading: /usr/share/virt-p2v/launch-virt-p2v to /usr/bin/ [1014.4] Changing permissions of /usr/bin/launch-virt-p2v to 0755 [1014.4] Uploading: /usr/share/virt-p2v/p2v.service to /etc/systemd/system/ [1014.4] Making directory: /etc/systemd/system/default.target.wants [1014.4] Linking: /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target [1014.5] Linking: /etc/systemd/system/default.target.wants/p2v.service -> /etc/systemd/system/p2v.service [1014.5] Editing: /usr/lib/systemd/system/getty@.service [1014.6] Editing: /etc/systemd/logind.conf [1014.6] Editing: /etc/selinux/config [1014.6] Uploading: /tmp/tmp.TCh3Ea6cfq/p2v.conf to /etc/dracut.conf.d/ [1014.6] Running: /tmp/tmp.TCh3Ea6cfq/post-install [1134.3] Setting passwords [1180.1] Finishing off Output file: /dev/sdb1 Output size: 14.9G Output format: raw Total usable space: 14.3G Free space: 12.9G (90%) Result: After step2, We can get a clear warning when output device is a partition: virt-builder: warning: output device (/dev/sdb1) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition Then try with "--no-warn-if-partition" but failed. # virt-p2v-make-disk -o /dev/sdb1 --no-warn-if-partition virt-p2v-make-disk: unrecognized option '--no-warn-if-partition' virt-p2v-make-disk: problem parsing the command line arguments So rjones, please help me have a look about option '--no-warn-if-partition', how make it work, thanks. Moving back to ASSIGNED. I will add --no-warn-if-partition to virt-p2v-make-disk too. Added this option to virt-p2v-make-disk in this commit: https://github.com/libguestfs/libguestfs/commit/07137ea565653ca22e055cef09a08add6ad5f1c9 Verify bug with new build:
virt-v2v-1.32.5-7.el7.x86_64
Steps:
1.Check --no-warn-if-partition info in virt-builder manual page
# man virt-builder
--no-warn-if-partition
Do not emit a warning if the output device is a partition. This warning avoids a common user
error when writing to a USB key or external drive, when you should normally write to the whole
device (--outputĀ /dev/sdX), not to a partition on the device (--outputĀ /dev/sdX1). Use this
option to suppress this warning.
2. Prepare a USB device with 1 partition
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sdb1 2048 31293439 15645696 83 Linux
3. Use virt-p2v-make-disk to build p2v to USB key without parameter "--no-warn-if-partition", there is a warning about partition and the building process will not show details info like before
# virt-p2v-make-disk -o /dev/sdb1
virt-builder: warning: output device (/dev/sdb1) is a partition. If you
are writing to a USB key or external drive then you probably need to write
to the whole device, not to a partition. If this warning is wrong then you
can disable it with --no-warn-if-partition
[ 2.8] Downloading: http://libguestfs.org/download/builder/fedora-24.xz
3.4%
4. Use virt-p2v-make-disk to build p2v to USB key with parameter "--no-warn-if-partition", there is no a warning about partition
# virt-p2v-make-disk -o /dev/sdb1 --no-warn-if-partition
[ 3.1] Downloading: http://libguestfs.org/download/builder/fedora-24.xz
0.8%
Result now:
According to step4's result,arameter "--no-warn-if-partition" works well
Hi rjones
I have some query with fixing method of this bug, because using virt-p2v-make-disk to build p2v to USB key which has partition, the host can't boot into the usb key after building, the building has no any meaning, besides ,building need a long time, it will waste customer's time, why not failed this building directly using error "output device (/dev/sdb1) is a partition" ? Thanks
I sort of agree with you. The problem is that only virt-builder knows that the output is a partition, but we want to allow virt-builder (in the general case) to write to partitions as well as whole block devices. virt-p2v-make-disk doesn't "know" that the output is a partition, so it cannot do anything here. There's no good answer here, but at least there is a warning. According to comment 9 and comment 10, the bug has been fixed, so move the bug from ON_QA to VERIFIED 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 |