Bug 1545627
| Summary: | On devices with a partition table --force option on pvcreate is not effective due to device filtering and the error message is not clear | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Simone Tiraboschi <stirabos> |
| Component: | lvm2 | Assignee: | LVM and device-mapper development team <lvm-team> |
| lvm2 sub component: | Command-line tools | QA Contact: | cluster-qe <cluster-qe> |
| Status: | CLOSED NOTABUG | Docs Contact: | |
| Severity: | high | ||
| Priority: | unspecified | CC: | agk, heinzm, jbrassow, khakimi, mcsontos, msnitzer, nsoffer, pbalogh, prajnoha, stirabos, talayan, teigland, thornber, zkabelac |
| Version: | 7.5 | Keywords: | AutomationBlocker |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-01-09 17:28:46 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: | |||
| Bug Blocks: | 1527077 | ||
Why not using `wipefs` first to get rid of all metadata? Anyway, it works with a FS, so should work the same with partition tables I guess. (In reply to Marian Csontos from comment #2) > Why not using `wipefs` first to get rid of all metadata? 'wipefs'by default is not enough, you need 'wipefs -a' > Anyway, it works with a FS, so should work the same with partition tables I > guess. Yes, I think so. (In reply to Simone Tiraboschi from comment #3) > (In reply to Marian Csontos from comment #2) > > Why not using `wipefs` first to get rid of all metadata? > > 'wipefs'by default is not enough, you need 'wipefs -a' > > > Anyway, it works with a FS, so should work the same with partition tables I > > guess. > > Yes, I think so. I don't understand this discussion... are you saying that you have a solution and we can close this bug, or something else? (In reply to Jonathan Earl Brassow from comment #4) > (In reply to Simone Tiraboschi from comment #3) > > (In reply to Marian Csontos from comment #2) > > > Why not using `wipefs` first to get rid of all metadata? > > > > 'wipefs'by default is not enough, you need 'wipefs -a' > > > > > Anyway, it works with a FS, so should work the same with partition tables I > > > guess. > > > > Yes, I think so. > > I don't understand this discussion... are you saying that you have a > solution and we can close this bug, or something else? No, I'm just saying that I agree that if --force works when the device contains a FS, I'd expect the same behavior if the device contains a partition table. The issue is that all the devices containing a partition table get filtered out before applying --force option. (In reply to Simone Tiraboschi from comment #5) > (In reply to Jonathan Earl Brassow from comment #4) > > (In reply to Simone Tiraboschi from comment #3) > > > (In reply to Marian Csontos from comment #2) > > > > Why not using `wipefs` first to get rid of all metadata? > > > > > > 'wipefs'by default is not enough, you need 'wipefs -a' > > > > > > > Anyway, it works with a FS, so should work the same with partition tables I > > > > guess. > > > > > > Yes, I think so. > > > > I don't understand this discussion... are you saying that you have a > > solution and we can close this bug, or something else? > > No, I'm just saying that I agree that if --force works when the device > contains a FS, I'd expect the same behavior if the device contains a > partition table. > > The issue is that all the devices containing a partition table get filtered > out before applying --force option. This is correct logic for lvm2. Lvm2 doesn't check all partitions when it's manipulating with a single device. In other words - this is 'rather' huge change for lvm2 internals to introduce some 'bypass' for elimination of partition tables skipping for --force option. You can think of lvm2 being a 'consumer' of 'device list' where 'partitioned' devices are ignored - the option '--force' is not meant to bypass core logic of device scanning ATM. Lvm2 would need to be enhanced first to detect it's safe to drop partition table. I see 2 options here: 1) decrease the necessary verbose setting to see the "partition" message below -vvv, but at least requiring -v 2) close WONTFIX Kobi, why this blocks automation? why don't you wipe the first 1MiB of a LUN before adding it? added AutomationBlocker because in any case, we had to do force clean of hosted engine environment (force clean - reprovision the host without correct cleanup) we failed in the next deploy even with the force key OVEHOSTED_ENGINE/forceCreateVG in the answer file. Our policy is: It is safer to err on side of caution and ask user if data loss is possible. There is a difference between wiping single FS and all partitions - when wiping all partitions we would need to go through all partitions and check their content. What if there are other PVs on those partitions? What if ...? This does not look like a job for LVM but for a management tool. If you want to clean a system, use `wipefs -a $DISK` but LVM is not a universal tool for managing ALL block devices including partitions. If you still wish to go down that road, use pvcreate --force with --yes which should work, but it is always dangerous combination to use in scripts. The only thing WE will do is improve the warning. additional info:
The user get the following error when trying to deploy HE on FC SD manually and its not clean:
[ INFO ] TASK [Add Fibre Channel storage domain]
[ ERROR ] TypeError: 'NoneType' object is not iterable
[ ERROR ] fatal: [localhost]: FAILED! => {"changed": false, "msg": "'NoneType' object is not iterable"}
Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs)[nfs]:
Can we plan this to be fixed in upcoming releases? I agree with Zdenek and Marian, clearing partitions with pvcreate -f doesn't look right; wipefs -a or dd work fine for this. |
Description of problem: If the selected device already contains a partition table the device is filtered out. A pvcreate command, also if with --force, will fail due to device filtering. The real issue ("Skipping: Partition table signature found") will appear only if with -vvv (-v or -vv are not enough). Reproducible with this: DEVICE=/dev/vdc ( echo o # Create a new empty DOS partition table echo n # Add a new partition echo p # Primary partition echo 1 # Partition number echo # First sector (Accept default: 1) echo # Last sector (Accept default: last) echo w # Write changes ) | sudo fdisk $DEVICE partprobe pvcreate $DEVICE pvcreate -vvv $DEVICE 2>&1 | grep $DEVICE | grep "Partition table" dd oflag=direct if=/dev/zero of=$DEVICE bs=1M count=1 pvcreate $DEVICE echo $? Which results in: [root@myhost ~]# DEVICE=/dev/vdb [root@myhost ~]# ( > echo o # Create a new empty DOS partition table > echo n # Add a new partition > echo p # Primary partition > echo 1 # Partition number > echo # First sector (Accept default: 1) > echo # Last sector (Accept default: varies) > echo w # Write changes > ) | sudo fdisk $DEVICE Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xe95ff291. Command (m for help): Building a new DOS disklabel with disk identifier 0x71d3c804. Command (m for help): Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Partition number (1-4, default 1): First sector (2048-20971519, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): Using default value 20971519 Partition 1 of type Linux and of size 10 GiB is set Command (m for help): The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@myhost ~]# partprobe [root@myhost ~]# pvcreate $DEVICE Device /dev/vdb not found (or ignored by filtering). [root@myhost ~]# pvcreate -vvv $DEVICE 2>&1 | grep $DEVICE | grep "Partition table" /dev/vdb: Skipping: Partition table signature found [root@myhost ~]# dd oflag=direct if=/dev/zero of=$DEVICE bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1,0 MB) copied, 0,00252575 s, 415 MB/s [root@myhost ~]# pvcreate $DEVICE Physical volume "/dev/vdb" successfully created. [root@myhost ~]# echo $? 0 Version-Release number of selected component (if applicable): lvm2-2.02.171-8.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. Test with the provided snippet 2. 3. Actual results: pvcreate --force fails with: Device /dev/vdb not found (or ignored by filtering). pvcreate --force -vvv shows also: /dev/vdb: Skipping: Partition table signature found The user has to manually wipe out the first block with: dd oflag=direct if=/dev/zero of=/dev/vdb bs=1M count=1 Then pvcreate will work as expected (no --force is needed in that case) Expected results: pvcreate --force works also if the device already contains a partition table ignoring that specific filtering Additional info: