vgextend: fix dev_read_reservation message 1953168728
authorDavid Teigland <teigland@redhat.com>
Mon, 28 Jul 2025 18:35:16 +0000 (13:35 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 28 Jul 2025 18:35:16 +0000 (13:35 -0500)
Common vgextend commands were logging a message about
dev_read_reservation when PR was not being used.

Only attempt PR work from vgextend when either the
PR require or autostart settings are enabled on the VG.

lib/device/persist.c
man/lvmpersist.8_main
tools/vgextend.c

index 2e76bb75e67e2727d76ceded328b9830f43332fb..be897fadab8f7c5e36491de107757486b42546f4 100644 (file)
@@ -545,10 +545,12 @@ static int dev_find_key(struct cmd_context *cmd, struct device *dev, int may_fai
                ret = dev_find_key_nvme(cmd, dev, may_fail, find_key, found_key,
                                         find_host_id, found_host_id_key,
                                         find_all, found_count, found_all);
-       else
+       else if (dev_is_scsi(cmd, dev) || dev_is_mpath(cmd, dev))
                ret = dev_find_key_scsi(cmd, dev, may_fail, find_key, found_key,
                                         find_host_id, found_host_id_key,
                                         find_all, found_count, found_all);
+       else
+               return_0;
 
        if (ret && found_all && found_count && *found_all && *found_count > 1) {
                qsort(*found_all, *found_count, sizeof(uint64_t), _compare_uint64);
@@ -1688,7 +1690,7 @@ int persist_start_extend(struct cmd_context *cmd, struct volume_group *vg)
         * is registered on any device.  If so, then PR is in use.  If not, PR
         * not in use.
         */
-       if (!dev_find_key(cmd, check_dev, 0, our_key_val, &found, 0, NULL, 0, NULL, NULL))
+       if (!dev_find_key(cmd, check_dev, 1, our_key_val, &found, 0, NULL, 0, NULL, NULL))
                return 1;
        if (!found)
                return 1;
index 57ed43f9692ce1138957c4bf531565f379d8b4b6..11972254e1dc868f249266a6f40abf8fe1f1da7f 100644 (file)
@@ -396,9 +396,10 @@ during lockstart.)
 .SS vgextend
 .P
 For local VGs, vgextend starts PR on the new devices before adding them to
-the VG.  For shared VGs, the user must use lvmpersist to start PR on the
-new devices, from all hosts, before running vgextend.  vgextend verifies
-that the reservation and keys on the new devices match the existing devices.
+the VG (the require or autostart setting must be enabled.)  For shared
+VGs, the user must use lvmpersist to start PR on the new devices, from all
+hosts, before running vgextend.  vgextend verifies that the reservation
+and keys on the new devices match the existing devices.
 .P
 .SS vgremove
 The vgremove command stops PR on the VG's devices only if "require" or
index 86e833dabaa167993dedb970b0f4e08d1ca79a0b..c28719ea63843c25b87f601ff07aff3783bca2e4 100644 (file)
@@ -99,7 +99,8 @@ static int _vgextend_single(struct cmd_context *cmd, const char *vg_name,
                goto_out;
 
        /* If the VG is using PR, then get PR on new devs. */
-       if (!persist_start_extend(cmd, vg))
+       if ((vg->pr & (VG_PR_REQUIRE|VG_PR_AUTOSTART)) &&
+           !persist_start_extend(cmd, vg))
                goto_out;
 
        if (arg_is_set(cmd, metadataignore_ARG)) {
This page took 0.06937 seconds and 5 git commands to generate.