diff options
author | David Teigland <teigland@redhat.com> | 2019-03-22 14:28:02 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2019-03-22 14:35:02 -0500 |
commit | 86b96ede2af32404d0b7b5f516a35dafc4da442e (patch) | |
tree | 13bc0cb71d166ee8e8807e7be5f7790c577a66a7 | |
parent | 85e68a8333722b7694d607652dd1f834fadfd8c4 (diff) | |
download | lvm2-86b96ede2af32404d0b7b5f516a35dafc4da442e.tar.gz |
lvextend: refresh shared LV using select option
Using --select 'lvname=LV && vgname=VG' avoids the problem
of the lvchange exit code not distinguishing an actual error
result vs the VG or LV not existing. (This is in case there
is an odd dlm/gfs2 setup where some nodes are running the dlm
but do not have access to the VG.)
-rw-r--r-- | daemons/lvmlockd/lvmlockd-dlm.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c index 385d53314..21aaa2d04 100644 --- a/daemons/lvmlockd/lvmlockd-dlm.c +++ b/daemons/lvmlockd/lvmlockd-dlm.c @@ -781,15 +781,47 @@ int lm_is_running_dlm(void) int lm_refresh_lv_start_dlm(struct action *act) { + char path[PATH_MAX]; char command[DLMC_RUN_COMMAND_LEN]; char run_uuid[DLMC_RUN_UUID_LEN]; + char *p, *vgname, *lvname; int rv; + /* split /dev/vgname/lvname into vgname and lvname strings */ + strncpy(path, act->path, strlen(act->path)); + + /* skip past dev */ + p = strchr(path + 1, '/'); + + /* skip past slashes */ + while (*p == '/') + p++; + + /* start of vgname */ + vgname = p; + + /* skip past vgname */ + while (*p != '/') + p++; + + /* terminate vgname */ + *p = '\0'; + p++; + + /* skip past slashes */ + while (*p == '/') + p++; + + lvname = p; + memset(command, 0, sizeof(command)); memset(run_uuid, 0, sizeof(run_uuid)); + /* todo: add --readonly */ + snprintf(command, DLMC_RUN_COMMAND_LEN, - "lvm lvchange --refresh --nolocking %s", act->path); + "lvm lvchange --refresh --partial --nolocking --select 'lvname=%s && vgname=%s'", + lvname, vgname); rv = dlmc_run_start(command, strlen(command), 0, DLMC_FLAG_RUN_START_NODE_NONE, |