mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-07 15:33:21 +03:00
o Lock mechanism for LV activation
o #defines for common lock flag combinations o Try out hyphens instead of colons in device-mapper names - does this make messages containing filenames easier to read?
This commit is contained in:
@@ -376,7 +376,7 @@ static struct logical_volume *_lv_from_lvid(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
if (!(lvl = find_lv_in_vg_by_uuid(vg, slash + 1))) {
|
||||
log_error("Can't find logical volume id %s", lvid);
|
||||
log_verbose("Can't find logical volume id %s", lvid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid)
|
||||
if (!(lv = _lv_from_lvid(cmd, lvid)))
|
||||
return 0;
|
||||
|
||||
if (lv_active(lv))
|
||||
if (lv_active(lv) > 0)
|
||||
lv_suspend(lv);
|
||||
return 1;
|
||||
}
|
||||
@@ -402,9 +402,35 @@ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid)
|
||||
if (!(lv = _lv_from_lvid(cmd, lvid)))
|
||||
return 0;
|
||||
|
||||
if (lv_active(lv))
|
||||
if ((lv_active(lv) > 0) && lv_suspended(lv))
|
||||
lv_reactivate(lv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lv_deactivate_if_active(struct cmd_context *cmd, const char *lvid)
|
||||
{
|
||||
struct logical_volume *lv;
|
||||
|
||||
if (!(lv = _lv_from_lvid(cmd, lvid)))
|
||||
return 0;
|
||||
|
||||
if (lv_active(lv) > 0)
|
||||
lv_deactivate(lv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lv_activate_if_inactive(struct cmd_context *cmd, const char *lvid)
|
||||
{
|
||||
struct logical_volume *lv;
|
||||
|
||||
if (!(lv = _lv_from_lvid(cmd, lvid)))
|
||||
return 0;
|
||||
|
||||
if (!lv_active(lv))
|
||||
lv_activate(lv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user