mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-06 17:18:29 +03:00
99d895014d
Normally, if there are partitions defined on top of device-mapper device, there should be a device-mapper device created for each partiton on top of the old one and once the underlying DM device is used by another devices (partition mappings in this case), it can't be used as a PV anymore. However, sometimes, it may happen the partition mappings are missing - either the partitioning tool is not creating them if it does not contain full support for device-mapper devices or the mappings were removed. Better safe than sorry - check for partition header on DM devs and filter them out as unsuitable for PVs in case the check is positive. Whatever the user is doing, let's do our best to prevent unwanted corruption (...by running pvcreate on top of such device that would corrupt the partition header).
33 lines
784 B
Bash
33 lines
784 B
Bash
#!/bin/sh
|
|
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# This copyrighted material is made available to anyone wishing to use,
|
|
# modify, copy, or redistribute it subject to the terms and conditions
|
|
# of the GNU General Public License v.2.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
# Testcase for bugzilla #621173
|
|
# excercises partition table scanning code path
|
|
#
|
|
|
|
|
|
LVM_TEST_CONFIG_DEVICES="types = [\"device-mapper\", 142]"
|
|
|
|
. lib/inittest
|
|
|
|
which sfdisk || skip
|
|
|
|
aux prepare_pvs 1 30
|
|
|
|
pvs "$dev1"
|
|
|
|
# create small partition table
|
|
echo "1 2" | sfdisk "$dev1"
|
|
|
|
aux notify_lvmetad "$dev1"
|
|
not pvs "$dev1"
|