mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
vgcreate: improve error message for multiple lock managers
If 'vgcreate --shared' finds both sanlock and dlm are running, print a more accurate error message: "Found multiple lock managers, select one with --lock-type." When neither is running, we still print: "Failed to detect a running lock manager to select lock type."
This commit is contained in:
parent
09981afc1c
commit
d99dd4086d
@ -2561,7 +2561,7 @@ int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_group *vg, int
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *lockd_running_lock_type(struct cmd_context *cmd)
|
||||
const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple)
|
||||
{
|
||||
daemon_reply reply;
|
||||
const char *lock_type = NULL;
|
||||
@ -2583,10 +2583,9 @@ const char *lockd_running_lock_type(struct cmd_context *cmd)
|
||||
|
||||
switch (result) {
|
||||
case -EXFULL:
|
||||
log_error("lvmlockd found multiple lock managers, use --lock-type to select one.");
|
||||
*found_multiple = 1;
|
||||
break;
|
||||
case -ENOLCK:
|
||||
log_error("lvmlockd found no lock manager running.");
|
||||
break;
|
||||
case LOCK_TYPE_SANLOCK:
|
||||
log_debug("lvmlockd found sanlock");
|
||||
|
@ -89,7 +89,7 @@ int lockd_init_lv_args(struct cmd_context *cmd, struct volume_group *vg,
|
||||
int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg,
|
||||
const char *lv_name, struct id *lv_id, const char *lock_args);
|
||||
|
||||
const char *lockd_running_lock_type(struct cmd_context *cmd);
|
||||
const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple);
|
||||
|
||||
int handle_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg);
|
||||
|
||||
@ -223,7 +223,7 @@ static inline int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline const char *lockd_running_lock_type(struct cmd_context *cmd)
|
||||
static inline const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple)
|
||||
{
|
||||
log_error("Using a shared lock type requires lvmlockd.");
|
||||
return NULL;
|
||||
|
@ -931,9 +931,14 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
} else if (arg_is_set(cmd, shared_ARG)) {
|
||||
int found_multiple = 0;
|
||||
|
||||
if (use_lvmlockd) {
|
||||
if (!(lock_type = lockd_running_lock_type(cmd))) {
|
||||
log_error("Failed to detect a running lock manager to select lock type.");
|
||||
if (!(lock_type = lockd_running_lock_type(cmd, &found_multiple))) {
|
||||
if (found_multiple)
|
||||
log_error("Found multiple lock managers, select one with --lock-type.");
|
||||
else
|
||||
log_error("Failed to detect a running lock manager to select lock type.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user