mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Propagate test mode to clvmd to skip activation and changes to held locks.
This commit is contained in:
parent
3cac20f850
commit
0ebd0960b4
@ -1,5 +1,6 @@
|
||||
Version 2.02.86 -
|
||||
=================================
|
||||
Propagate test mode to clvmd to skip activation and changes to held locks.
|
||||
Defer writing PV labels to vg_write.
|
||||
Store label_sector only in struct physical_volume.
|
||||
Permit --available with lvcreate so non-snapshot LVs need not be activated.
|
||||
|
@ -80,6 +80,9 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
unsigned char lock_cmd;
|
||||
unsigned char lock_flags;
|
||||
|
||||
/* Reset test mode before we start */
|
||||
init_test(0);
|
||||
|
||||
/* Do the command */
|
||||
switch (msg->cmd) {
|
||||
/* Just a test message */
|
||||
@ -109,6 +112,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
lockname = &args[2];
|
||||
/* Check to see if the VG is in use by LVM1 */
|
||||
status = do_check_lvm1(lockname);
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
do_lock_vg(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
@ -117,6 +122,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
lock_cmd = args[0] & (LCK_NONBLOCK | LCK_HOLD | LCK_SCOPE_MASK | LCK_TYPE_MASK);
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = do_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
/* Replace EIO with something less scary */
|
||||
if (status == EIO) {
|
||||
@ -251,6 +258,7 @@ int do_pre_command(struct local_client *client)
|
||||
int status = 0;
|
||||
char *lockname;
|
||||
|
||||
init_test(0);
|
||||
switch (header->cmd) {
|
||||
case CLVMD_CMD_TEST:
|
||||
status = sync_lock("CLVMD_TEST", LCK_EXCL, 0, &lockid);
|
||||
@ -269,6 +277,8 @@ int do_pre_command(struct local_client *client)
|
||||
lock_cmd = args[0];
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = pre_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
@ -300,6 +310,7 @@ int do_post_command(struct local_client *client)
|
||||
char *args = header->node + strlen(header->node) + 1;
|
||||
char *lockname;
|
||||
|
||||
init_test(0);
|
||||
switch (header->cmd) {
|
||||
case CLVMD_CMD_TEST:
|
||||
status =
|
||||
@ -311,6 +322,8 @@ int do_post_command(struct local_client *client)
|
||||
lock_cmd = args[0];
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = post_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
|
@ -137,6 +137,7 @@ static const char *decode_flags(unsigned char flags)
|
||||
flags & LCK_MIRROR_NOSYNC_MODE ? "MIRROR_NOSYNC|" : "",
|
||||
flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR|" : "",
|
||||
flags & LCK_ORIGIN_ONLY_MODE ? "ORIGIN_ONLY|" : "",
|
||||
flags & LCK_TEST_MODE ? "TEST|" : "",
|
||||
flags & LCK_CONVERT ? "CONVERT|" : "");
|
||||
|
||||
if (len > 1)
|
||||
@ -235,6 +236,9 @@ static int hold_lock(char *resource, int mode, int flags)
|
||||
int saved_errno;
|
||||
struct lv_info *lvi;
|
||||
|
||||
if (test_mode())
|
||||
return 0;
|
||||
|
||||
/* Mask off invalid options */
|
||||
flags &= LCKF_NOQUEUE | LCKF_CONVERT;
|
||||
|
||||
@ -298,6 +302,9 @@ static int hold_unlock(char *resource)
|
||||
int status;
|
||||
int saved_errno;
|
||||
|
||||
if (test_mode())
|
||||
return 0;
|
||||
|
||||
if (!(lvi = lookup_info(resource))) {
|
||||
DEBUGLOG("hold_unlock, lock not already held\n");
|
||||
return 0;
|
||||
|
@ -329,6 +329,9 @@ static int _lock_for_cluster(struct cmd_context *cmd, unsigned char clvmd_cmd,
|
||||
if (mirror_in_sync())
|
||||
args[1] |= LCK_MIRROR_NOSYNC_MODE;
|
||||
|
||||
if (test_mode())
|
||||
args[1] |= LCK_TEST_MODE;
|
||||
|
||||
/*
|
||||
* Must handle tri-state return from dmeventd_monitor_mode.
|
||||
* But DMEVENTD_MONITOR_IGNORE is not propagated across the cluster.
|
||||
|
@ -106,6 +106,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
|
||||
#define LCK_DMEVENTD_MONITOR_MODE 0x04 /* Register with dmeventd */
|
||||
#define LCK_CONVERT 0x08 /* Convert existing lock */
|
||||
#define LCK_ORIGIN_ONLY_MODE 0x20 /* Same as above */
|
||||
#define LCK_TEST_MODE 0x10 /* Test mode: No activation */
|
||||
|
||||
/*
|
||||
* Special cases of VG locks.
|
||||
|
Loading…
Reference in New Issue
Block a user