summaryrefslogtreecommitdiff
path: root/tools/pvresize.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-03-10 13:28:47 -0600
committerDavid Teigland <teigland@redhat.com>2016-03-10 13:37:42 -0600
commit0f10823ec910c0a6015b20580f5aa26f209cea04 (patch)
tree0a0efd339c235ae85c29ccea936f2341e517debd /tools/pvresize.c
parent9f4451193b8db4bd9c894248f50da9319704293e (diff)
downloadlvm2-0f10823ec910c0a6015b20580f5aa26f209cea04.tar.gz
pvchange, pvresize: move exported VG check
Allow pvchange and pvresize to process exported VGs, and have them check for the exported state in their single function. Previously, the exported VG state would trigger a failure in vg_read()/ignore_vg() because the VGs are being read with READ_FOR_UPDATE. Because these commands read all VGs to search for the intended PVs, any exported VG would trigger a failure, even if it was not related to the intended PV.
Diffstat (limited to 'tools/pvresize.c')
-rw-r--r--tools/pvresize.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/pvresize.c b/tools/pvresize.c
index 13122907e..9931cc684 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -36,6 +36,11 @@ static int _pvresize_single(struct cmd_context *cmd,
}
params->total++;
+ if (vg && vg_is_exported(vg)) {
+ log_error("Volume group %s is exported", vg->name);
+ return ECMD_FAILED;
+ }
+
/*
* Needed to change a property on an orphan PV.
* i.e. the global lock is only needed for orphans.
@@ -89,8 +94,7 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv)
handle->custom_handle = &params;
- ret = process_each_pv(cmd, argc, argv, NULL, 0, READ_FOR_UPDATE, handle,
- _pvresize_single);
+ ret = process_each_pv(cmd, argc, argv, NULL, 0, READ_FOR_UPDATE | READ_ALLOW_EXPORTED, handle, _pvresize_single);
log_print_unless_silent("%d physical volume(s) resized / %d physical volume(s) "
"not resized", params.done, params.total - params.done);