summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2002-02-25 12:56:16 +0000
committerAlasdair Kergon <agk@redhat.com>2002-02-25 12:56:16 +0000
commit413cc9189e5a77a10ce227072855141cd7af79d7 (patch)
tree57a1288121d4c70292b06c23b05f3c6c1d346178 /tools
parentca73e23fd08850c916b9bf5671adfc68384ae466 (diff)
downloadlvm2-413cc9189e5a77a10ce227072855141cd7af79d7.tar.gz
lvm2-413cc9189e5a77a10ce227072855141cd7af79d7.tar.xz
lvm2-413cc9189e5a77a10ce227072855141cd7af79d7.zip
Begin conversion so LV id is passed to activation unit instead of
struct logical_volume.
Diffstat (limited to 'tools')
-rw-r--r--tools/lvchange.c41
-rw-r--r--tools/lvcreate.c4
-rw-r--r--tools/lvrename.c6
-rw-r--r--tools/lvresize.c18
-rw-r--r--tools/pvchange.c18
-rw-r--r--tools/toollib.c8
-rw-r--r--tools/vgcreate.c18
-rw-r--r--tools/vgextend.c14
-rw-r--r--tools/vgmerge.c20
-rw-r--r--tools/vgreduce.c12
-rw-r--r--tools/vgremove.c4
-rw-r--r--tools/vgrename.c22
12 files changed, 103 insertions, 82 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 25b2d4c5..2a7198a3 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -126,6 +126,7 @@ static int lvchange_permission(struct cmd_context *cmd,
struct logical_volume *lv)
{
int lv_access;
+ char lvidbuf[128];
lv_access = arg_int_value(cmd, permission_ARG, 0);
@@ -151,7 +152,10 @@ static int lvchange_permission(struct cmd_context *cmd,
lv->name);
}
- if (!lock_vol(lv, LCK_LV | LCK_WRITE)) {
+ if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
+ return 0;
+
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_WRITE)) {
log_error("Failed to lock %s", lv->name);
return 0;
}
@@ -159,14 +163,14 @@ static int lvchange_permission(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
- lock_vol(lv, LCK_LV | LCK_NONE);
+ lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE);
return 0;
}
backup(lv->vg);
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
- if (!lock_vol(lv, LCK_LV | LCK_NONE)) {
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@@ -228,6 +232,7 @@ static int lvchange_contiguous(struct cmd_context *cmd,
struct logical_volume *lv)
{
int lv_allocation = 0;
+ char lvidbuf[128];
if (strcmp(arg_str_value(cmd, contiguous_ARG, "n"), "n"))
lv_allocation |= ALLOC_CONTIGUOUS;
@@ -264,7 +269,10 @@ static int lvchange_contiguous(struct cmd_context *cmd,
lv->name);
}
- if (!lock_vol(lv, LCK_LV | LCK_WRITE)) {
+ if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
+ return 0;
+
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_WRITE)) {
log_error("Failed to lock %s", lv->name);
return 0;
}
@@ -272,14 +280,14 @@ static int lvchange_contiguous(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
- lock_vol(lv, LCK_LV | LCK_NONE);
+ lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
- if (!lock_vol(lv, LCK_LV | LCK_NONE)) {
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@@ -292,6 +300,7 @@ static int lvchange_readahead(struct cmd_context *cmd,
struct logical_volume *lv)
{
int read_ahead = 0;
+ char lvidbuf[128];
read_ahead = arg_int_value(cmd, readahead_ARG, 0);
@@ -313,7 +322,10 @@ static int lvchange_readahead(struct cmd_context *cmd,
log_verbose("Setting read ahead to %u for \"%s\"", read_ahead,
lv->name);
- if (!lock_vol(lv, LCK_LV | LCK_WRITE)) {
+ if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
+ return 0;
+
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_WRITE)) {
log_error("Failed to lock %s", lv->name);
return 0;
}
@@ -321,14 +333,14 @@ static int lvchange_readahead(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
- lock_vol(lv, LCK_LV | LCK_NONE);
+ lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
- if (!lock_vol(lv, LCK_LV | LCK_NONE)) {
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@@ -339,6 +351,8 @@ static int lvchange_readahead(struct cmd_context *cmd,
static int lvchange_persistent(struct cmd_context *cmd,
struct logical_volume *lv)
{
+ char lvidbuf[128];
+
if (!strcmp(arg_str_value(cmd, persistent_ARG, "n"), "n")) {
if (!(lv->status & FIXED_MINOR)) {
log_error("Minor number is already not persistent "
@@ -363,7 +377,10 @@ static int lvchange_persistent(struct cmd_context *cmd,
lv->minor, lv->name);
}
- if (!lock_vol(lv, LCK_LV | LCK_WRITE)) {
+ if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
+ return 0;
+
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_WRITE)) {
log_error("Failed to lock %s", lv->name);
return 0;
}
@@ -371,14 +388,14 @@ static int lvchange_persistent(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
- lock_vol(lv, LCK_LV | LCK_NONE);
+ lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
- if (!lock_vol(lv, LCK_LV | LCK_NONE)) {
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 14052547..03c7021f 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -437,7 +437,7 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
if (!_read_params(&lp, cmd, argc, argv))
return -EINVALID_CMD_LINE;
- if (!lock_vol(lp.vg_name, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, lp.vg_name, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", lp.vg_name);
return 0;
}
@@ -473,6 +473,6 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
r = 0;
out:
- lock_vol(lp.vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, lp.vg_name, LCK_VG | LCK_NONE);
return r;
}
diff --git a/tools/lvrename.c b/tools/lvrename.c
index f7d704f5..846feafb 100644
--- a/tools/lvrename.c
+++ b/tools/lvrename.c
@@ -87,7 +87,7 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Checking for existing volume group \"%s\"", vg_name);
- if (!lock_vol(vg_name, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, vg_name, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", vg_name);
return ECMD_FAILED;
}
@@ -152,7 +152,7 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
backup(lv->vg);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
log_print("Renamed \"%s\" to \"%s\" in volume group \"%s\"",
lv_name_old, lv_name_new, vg_name);
@@ -160,6 +160,6 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
return 0;
error:
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 5220d561..f34cd1a8 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -31,6 +31,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
uint32_t size_rest;
sign_t sign = SIGN_NONE;
char *lv_name, *vg_name;
+ char lvidbuf[128];
char *st;
char *dummy;
const char *cmd_name;
@@ -104,7 +105,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
/* does VG exist? */
log_verbose("Finding volume group %s", vg_name);
- if (!lock_vol(vg_name, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, vg_name, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", vg_name);
return ECMD_FAILED;
}
@@ -331,7 +332,10 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
goto error;
}
- if (!lock_vol(lv, LCK_LV | LCK_WRITE)) {
+ if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
+ goto error;
+
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_WRITE)) {
log_error("Can't get lock for %s", lv_name);
goto error;
}
@@ -339,28 +343,28 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
/* store vg on disk(s) */
if (!cmd->fid->ops->vg_write(cmd->fid, vg)) {
/* FIXME: Attempt reversion? */
- lock_vol(lv, LCK_LV | LCK_NONE);
+ lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE);
goto error;
}
backup(vg);
- if (!lock_vol(lv, LCK_LV | LCK_NONE)) {
+ if (!lock_vol(cmd, lvidbuf, LCK_LV | LCK_NONE)) {
log_error("Problem reactivating %s", lv_name);
goto error;
}
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
log_print("Logical volume %s successfully resized", lv_name);
return 0;
error:
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
error_cmdline:
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return EINVALID_CMD_LINE;
}
diff --git a/tools/pvchange.c b/tools/pvchange.c
index 358d88a7..eb68fff5 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -98,32 +98,32 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_verbose("Finding volume group of physical volume \"%s\"",
pv_name);
- if (!lock_vol(pv->vg_name, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, pv->vg_name, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", pv->vg_name);
return ECMD_FAILED;
}
if (!(vg = cmd->fid->ops->vg_read(cmd->fid, pv->vg_name))) {
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
log_error("Unable to find volume group of \"%s\"",
pv_name);
return 0;
}
if (vg->status & EXPORTED_VG) {
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
log_error("Volume group \"%s\" is exported", vg->name);
return ECMD_FAILED;
}
if (!(vg->status & LVM_WRITE)) {
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
log_error("Volume group \"%s\" is read-only", vg->name);
return ECMD_FAILED;
}
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
log_error
("Unable to find \"%s\" in volume group \"%s\"",
pv_name, vg->name);
@@ -139,7 +139,7 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_error("Physical volume \"%s\" is already allocatable",
pv_name);
if (*pv->vg_name)
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
return 0;
}
@@ -147,7 +147,7 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_error("Physical volume \"%s\" is already unallocatable",
pv_name);
if (*pv->vg_name)
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
return 0;
}
@@ -164,13 +164,13 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_verbose("Updating physical volume \"%s\"", pv_name);
if (*pv->vg_name) {
if (!(cmd->fid->ops->vg_write(cmd->fid, vg))) {
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
log_error("Failed to store physical volume \"%s\" in "
"volume group \"%s\"", pv_name, vg->name);
return 0;
}
backup(vg);
- lock_vol(pv->vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, pv->vg_name, LCK_VG | LCK_NONE);
} else {
if (!(cmd->fid->ops->pv_write(cmd->fid, pv))) {
log_error("Failed to store physical volume \"%s\"",
diff --git a/tools/toollib.c b/tools/toollib.c
index 9b5402bf..9b99357e 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -134,13 +134,13 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
log_verbose("Using volume group(s) on command line");
for (; opt < argc; opt++) {
vg_name = argv[opt];
- if (!lock_vol((void *) vg_name, LCK_VG | lock_type)) {
+ if (!lock_vol(cmd, (void *) vg_name, LCK_VG | lock_type)) {
log_error("Can't lock %s: skipping", vg_name);
continue;
}
if ((ret = process_single(cmd, vg_name)) > ret_max)
ret_max = ret;
- lock_vol((void *) vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, (void *) vg_name, LCK_VG | LCK_NONE);
}
} else {
log_verbose("Finding all volume groups");
@@ -150,7 +150,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
}
list_iterate(vgh, vgs) {
vg_name = list_item(vgh, struct name_list)->name;
- if (!lock_vol((void *) vg_name, LCK_VG | lock_type)) {
+ if (!lock_vol(cmd, (void *) vg_name, LCK_VG | lock_type)) {
log_error("Can't lock %s: skipping", vg_name);
continue;
}
@@ -158,7 +158,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
if (ret > ret_max)
ret_max = ret;
- lock_vol((void *) vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, (void *) vg_name, LCK_VG | LCK_NONE);
}
}
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index 5e2496fe..2124c168 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -92,32 +92,32 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
log_error("Warning: Setting maxphysicalvolumes to %d",
vg->max_pv);
- if (!lock_vol("", LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, "", LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
- if (!lock_vol(vg_name, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
+ if (!lock_vol(cmd, vg_name, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
log_error("Can't get lock for %s", vg_name);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (!archive(vg)) {
- lock_vol(vg_name, LCK_VG | LCK_NONE);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
/* Store VG on disk(s) */
if (!cmd->fid->ops->vg_write(cmd->fid, vg)) {
- lock_vol(vg_name, LCK_VG | LCK_NONE);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
- lock_vol(vg_name, LCK_VG | LCK_NONE);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
backup(vg);
diff --git a/tools/vgextend.c b/tools/vgextend.c
index bb4b4e27..0154a251 100644
--- a/tools/vgextend.c
+++ b/tools/vgextend.c
@@ -40,14 +40,14 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
argc--;
argv++;
- if (!lock_vol("", LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, "", LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
log_verbose("Checking for volume group \"%s\"", vg_name);
- if (!lock_vol(vg_name, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
- lock_vol("", LCK_VG | LCK_NONE);
+ if (!lock_vol(cmd, vg_name, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
log_error("Can't get lock for %s", vg_name);
goto error;
}
@@ -96,15 +96,15 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
backup(vg);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
log_print("Volume group \"%s\" successfully extended", vg_name);
return 0;
error:
- lock_vol(vg_name, LCK_VG | LCK_NONE);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
index 8c487728..29a6dad5 100644
--- a/tools/vgmerge.c
+++ b/tools/vgmerge.c
@@ -60,33 +60,33 @@ int vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
}
log_verbose("Checking for volume group \"%s\"", vg_name_to);
- if (!lock_vol(vg_name_to, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, vg_name_to, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", vg_name_to);
return ECMD_FAILED;
}
if (!(vg_to = cmd->fid->ops->vg_read(cmd->fid, vg_name_to))) {
log_error("Volume group \"%s\" doesn't exist", vg_name_to);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (vg_to->status & EXPORTED_VG) {
log_error("Volume group \"%s\" is exported", vg_to->name);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (!(vg_to->status & LVM_WRITE)) {
log_error("Volume group \"%s\" is read-only", vg_to->name);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
log_verbose("Checking for volume group \"%s\"", vg_name_from);
- if (!lock_vol(vg_name_from, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
+ if (!lock_vol(cmd, vg_name_from, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
log_error("Can't get lock for %s", vg_name_from);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
@@ -190,15 +190,15 @@ int vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
backup(vg_to);
- lock_vol(vg_name_from, LCK_VG | LCK_NONE);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_from, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
log_print("Volume group \"%s\" successfully merged into \"%s\"",
vg_from->name, vg_to->name);
return 0;
error:
- lock_vol(vg_name_from, LCK_VG | LCK_NONE);
- lock_vol(vg_name_to, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_from, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_to, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index e64f4d4f..fd86f4e5 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -51,32 +51,32 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
argc--;
log_verbose("Finding volume group \"%s\"", vg_name);
- if (!lock_vol(vg_name, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, vg_name, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", vg_name);
return ECMD_FAILED;
}
if (!(vg = cmd->fid->ops->vg_read(cmd->fid, vg_name))) {
log_error("Volume group \"%s\" doesn't exist", vg_name);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (vg->status & EXPORTED_VG) {
log_error("Volume group \"%s\" is exported", vg->name);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (!(vg->status & LVM_WRITE)) {
log_error("Volume group \"%s\" is read-only", vg_name);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (!(vg->status & RESIZEABLE_VG)) {
log_error("Volume group \"%s\" is not reducable", vg_name);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
@@ -84,7 +84,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
/* and update in batch here? */
ret = process_each_pv(cmd, argc, argv, vg, vgreduce_single);
- lock_vol(vg_name, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name, LCK_VG | LCK_NONE);
return ret;
diff --git a/tools/vgremove.c b/tools/vgremove.c
index d7bd16fe..e999ca06 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -26,7 +26,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
{
int ret;
- if (!lock_vol("", LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, "", LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
@@ -34,7 +34,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
ret = process_each_vg(cmd, argc, argv, LCK_WRITE | LCK_NONBLOCK,
&vgremove_single);
- lock_vol("", LCK_VG | LCK_NONE);
+ lock_vol(cmd, "", LCK_VG | LCK_NONE);
return ret;
}
diff --git a/tools/vgrename.c b/tools/vgrename.c
index e702cfb5..e7e27afb 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -69,25 +69,25 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
- if (!lock_vol(vg_name_old, LCK_VG | LCK_WRITE)) {
+ if (!lock_vol(cmd, vg_name_old, LCK_VG | LCK_WRITE)) {
log_error("Can't get lock for %s", vg_name_old);
return ECMD_FAILED;
}
if (!(vg_old = cmd->fid->ops->vg_read(cmd->fid, vg_name_old))) {
log_error("Volume group \"%s\" doesn't exist", vg_name_old);
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
if (vg_old->status & EXPORTED_VG) {
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
log_error("Volume group \"%s\" is exported", vg_old->name);
return ECMD_FAILED;
}
if (!(vg_old->status & LVM_WRITE)) {
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
log_error("Volume group \"%s\" is read-only", vg_old->name);
return ECMD_FAILED;
}
@@ -98,7 +98,7 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
/***** FIXME Handle this with multiple LV renames!
if (!force_ARG) {
log_error("Use -f to force the rename");
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}
*****/
@@ -106,8 +106,8 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Checking for new volume group \"%s\"", vg_name_new);
- if (!lock_vol(vg_name_new, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ if (!lock_vol(cmd, vg_name_new, LCK_VG | LCK_WRITE | LCK_NONBLOCK)) {
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
log_error("Can't get lock for %s", vg_name_new);
return ECMD_FAILED;
}
@@ -158,8 +158,8 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
backup(vg_old);
- lock_vol(vg_name_new, LCK_VG | LCK_NONE);
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_new, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
log_print("Volume group \"%s\" successfully renamed to \"%s\"",
vg_name_old, vg_name_new);
@@ -167,8 +167,8 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
return 0;
error:
- lock_vol(vg_name_new, LCK_VG | LCK_NONE);
- lock_vol(vg_name_old, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_new, LCK_VG | LCK_NONE);
+ lock_vol(cmd, vg_name_old, LCK_VG | LCK_NONE);
return ECMD_FAILED;
}