|
|
4d51e5 |
From 9375aebad1db72267dd67e3ed768aa3b0e698d52 Mon Sep 17 00:00:00 2001
|
|
|
4d51e5 |
From: David Teigland <teigland@redhat.com>
|
|
|
4d51e5 |
Date: Tue, 18 Jan 2022 12:16:52 -0600
|
|
|
4d51e5 |
Subject: [PATCH 27/54] Revert "pvcreate: overwrite partition header with -f"
|
|
|
4d51e5 |
|
|
|
4d51e5 |
This reverts commit a5c37afdca97d6565ea02bc4bc7d52f360823cd3.
|
|
|
4d51e5 |
|
|
|
4d51e5 |
This commit did not properly recognize GPT cases.
|
|
|
4d51e5 |
---
|
|
|
4d51e5 |
lib/commands/toolcontext.h | 1 -
|
|
|
4d51e5 |
lib/filters/filter-partitioned.c | 3 ---
|
|
|
4d51e5 |
man/pvcreate.8_des | 7 +++----
|
|
|
4d51e5 |
test/shell/test-partition.sh | 12 ++----------
|
|
|
4d51e5 |
tools/toollib.c | 10 ----------
|
|
|
4d51e5 |
5 files changed, 5 insertions(+), 28 deletions(-)
|
|
|
4d51e5 |
|
|
|
4d51e5 |
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
|
|
|
4d51e5 |
index b83883fb8..356c79f8a 100644
|
|
|
4d51e5 |
--- a/lib/commands/toolcontext.h
|
|
|
4d51e5 |
+++ b/lib/commands/toolcontext.h
|
|
|
4d51e5 |
@@ -201,7 +201,6 @@ struct cmd_context {
|
|
|
4d51e5 |
unsigned ignore_device_name_mismatch:1; /* skip updating devices file names */
|
|
|
4d51e5 |
unsigned backup_disabled:1; /* skip repeated debug message */
|
|
|
4d51e5 |
unsigned event_activation:1; /* whether event_activation is set */
|
|
|
4d51e5 |
- unsigned filter_partitioned_skip:1; /* don't use filter-partitioned */
|
|
|
4d51e5 |
|
|
|
4d51e5 |
/*
|
|
|
4d51e5 |
* Devices and filtering.
|
|
|
4d51e5 |
diff --git a/lib/filters/filter-partitioned.c b/lib/filters/filter-partitioned.c
|
|
|
4d51e5 |
index 8f468a567..642553ef2 100644
|
|
|
4d51e5 |
--- a/lib/filters/filter-partitioned.c
|
|
|
4d51e5 |
+++ b/lib/filters/filter-partitioned.c
|
|
|
4d51e5 |
@@ -27,9 +27,6 @@ static int _passes_partitioned_filter(struct cmd_context *cmd, struct dev_filter
|
|
|
4d51e5 |
if (cmd->filter_nodata_only)
|
|
|
4d51e5 |
return 1;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
- if (cmd->filter_partitioned_skip)
|
|
|
4d51e5 |
- return 1;
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
dev->filtered_flags &= ~DEV_FILTERED_PARTITIONED;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
ret = dev_is_partitioned(cmd, dev);
|
|
|
4d51e5 |
diff --git a/man/pvcreate.8_des b/man/pvcreate.8_des
|
|
|
4d51e5 |
index 4048eb71c..69bd133aa 100644
|
|
|
4d51e5 |
--- a/man/pvcreate.8_des
|
|
|
4d51e5 |
+++ b/man/pvcreate.8_des
|
|
|
4d51e5 |
@@ -7,10 +7,9 @@ Use \fBvgcreate\fP(8) to create a new VG on the PV, or \fBvgextend\fP(8)
|
|
|
4d51e5 |
to add the PV to an existing VG. Use \fBpvremove\fP(8) to remove the LVM
|
|
|
4d51e5 |
disk label from the device.
|
|
|
4d51e5 |
.P
|
|
|
4d51e5 |
-The force option will create a PV without confirmation, and will overwrite
|
|
|
4d51e5 |
-partition headers. Repeating the force option (\fB-ff\fP) will override other
|
|
|
4d51e5 |
-checks that would normally prevent a pvcreate, e.g. if the PV is already in a
|
|
|
4d51e5 |
-VG.
|
|
|
4d51e5 |
+The force option will create a PV without confirmation. Repeating the
|
|
|
4d51e5 |
+force option (\fB-ff\fP) will forcibly create a PV, overriding checks that
|
|
|
4d51e5 |
+normally prevent it, e.g. if the PV is already in a VG.
|
|
|
4d51e5 |
.P
|
|
|
4d51e5 |
.B Metadata location, size, and alignment
|
|
|
4d51e5 |
.P
|
|
|
4d51e5 |
diff --git a/test/shell/test-partition.sh b/test/shell/test-partition.sh
|
|
|
4d51e5 |
index 3a45f9089..0e92f00db 100644
|
|
|
4d51e5 |
--- a/test/shell/test-partition.sh
|
|
|
4d51e5 |
+++ b/test/shell/test-partition.sh
|
|
|
4d51e5 |
@@ -16,6 +16,7 @@
|
|
|
4d51e5 |
#
|
|
|
4d51e5 |
|
|
|
4d51e5 |
|
|
|
4d51e5 |
+
|
|
|
4d51e5 |
SKIP_WITH_LVMPOLLD=1
|
|
|
4d51e5 |
|
|
|
4d51e5 |
LVM_TEST_CONFIG_DEVICES="types = [\"device-mapper\", 142]"
|
|
|
4d51e5 |
@@ -24,7 +25,7 @@ LVM_TEST_CONFIG_DEVICES="types = [\"device-mapper\", 142]"
|
|
|
4d51e5 |
|
|
|
4d51e5 |
which sfdisk || skip
|
|
|
4d51e5 |
|
|
|
4d51e5 |
-aux prepare_pvs 2 30
|
|
|
4d51e5 |
+aux prepare_pvs 1 30
|
|
|
4d51e5 |
|
|
|
4d51e5 |
pvs "$dev1"
|
|
|
4d51e5 |
|
|
|
4d51e5 |
@@ -32,12 +33,3 @@ pvs "$dev1"
|
|
|
4d51e5 |
echo "1 2" | sfdisk --force "$dev1"
|
|
|
4d51e5 |
|
|
|
4d51e5 |
not pvs "$dev1"
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
-wipefs -a "$dev2"
|
|
|
4d51e5 |
-echo "1 2" | sfdisk --force "$dev2"
|
|
|
4d51e5 |
-partprobe
|
|
|
4d51e5 |
-not pvcreate "$dev2"
|
|
|
4d51e5 |
-pvcreate -f "$dev2"
|
|
|
4d51e5 |
-pvs "$dev2"
|
|
|
4d51e5 |
-pvremove "$dev2"
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
diff --git a/tools/toollib.c b/tools/toollib.c
|
|
|
4d51e5 |
index 80d3de57c..d6f48aad2 100644
|
|
|
4d51e5 |
--- a/tools/toollib.c
|
|
|
4d51e5 |
+++ b/tools/toollib.c
|
|
|
4d51e5 |
@@ -5243,10 +5243,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
|
|
4d51e5 |
if (cmd->enable_devices_file && !pp->is_remove)
|
|
|
4d51e5 |
cmd->filter_deviceid_skip = 1;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
- /* pvcreate -f overwrites partitions */
|
|
|
4d51e5 |
- if (pp->force && !pp->is_remove)
|
|
|
4d51e5 |
- cmd->filter_partitioned_skip = 1;
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
log_debug("Scanning and filtering device args (%u).", dm_list_size(&scan_devs));
|
|
|
4d51e5 |
label_scan_devs(cmd, cmd->filter, &scan_devs);
|
|
|
4d51e5 |
|
|
|
4d51e5 |
@@ -5261,7 +5257,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
|
|
4d51e5 |
}
|
|
|
4d51e5 |
}
|
|
|
4d51e5 |
cmd->filter_deviceid_skip = 0;
|
|
|
4d51e5 |
- cmd->filter_partitioned_skip = 0;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
/*
|
|
|
4d51e5 |
* Can the command continue if some specified devices were not found?
|
|
|
4d51e5 |
@@ -5474,9 +5469,6 @@ do_command:
|
|
|
4d51e5 |
if (cmd->enable_devices_file && !pp->is_remove)
|
|
|
4d51e5 |
cmd->filter_deviceid_skip = 1;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
- if (pp->force && !pp->is_remove)
|
|
|
4d51e5 |
- cmd->filter_partitioned_skip = 1;
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
log_debug("Rescanning and filtering device args with exclusive open");
|
|
|
4d51e5 |
if (!label_scan_devs_excl(cmd, cmd->filter, &rescan_devs)) {
|
|
|
4d51e5 |
log_debug("Failed to rescan devs excl");
|
|
|
4d51e5 |
@@ -5490,9 +5482,7 @@ do_command:
|
|
|
4d51e5 |
dm_list_add(&pp->arg_fail, &pd->list);
|
|
|
4d51e5 |
}
|
|
|
4d51e5 |
}
|
|
|
4d51e5 |
-
|
|
|
4d51e5 |
cmd->filter_deviceid_skip = 0;
|
|
|
4d51e5 |
- cmd->filter_partitioned_skip = 0;
|
|
|
4d51e5 |
|
|
|
4d51e5 |
if (dm_list_empty(&pp->arg_process) && dm_list_empty(&remove_duplicates)) {
|
|
|
4d51e5 |
log_debug("No devices to process.");
|
|
|
4d51e5 |
--
|
|
|
4d51e5 |
2.34.3
|
|
|
4d51e5 |
|