mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: display 'unknown' value for active/active_locally/active_remotely/active_exclusively if info bypassed
Before the patch: $ lvs -o name,active vg/lvol1 --driverloaded n WARNING: Activation disabled. No device-mapper interaction will beattempted. LV Active lvol1 active With this patch applied: $ lvs -o name,active vg/lvol1 --driverloaded n WARNING: Activation disabled. No device-mapper interaction will be attempted. LV Active lvol1 unknown The same for active_{locally,remotely,exclusively} fields. Also, rename headings for these fields (ActLocal/ActRemote/ActExcl).
This commit is contained in:
parent
52af0dfbc0
commit
c9ae21798e
@ -910,6 +910,11 @@ char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
if (!activation()) {
|
||||
s = "unknown";
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vg_is_clustered(lv->vg)) {
|
||||
//const struct logical_volume *lvo = lv;
|
||||
lv = lv_lock_holder(lv);
|
||||
@ -927,7 +932,7 @@ char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
else /* locally active */
|
||||
s = lv_is_active_but_not_locally(lv) ?
|
||||
"remotely" : "locally";
|
||||
|
||||
out:
|
||||
return dm_pool_strdup(mem, s);
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ FIELD(LVS, lv, STR, "TargetType", lvid, 10, lvtargettype, lv_target_type, "Kerne
|
||||
FIELD(LVS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
|
||||
FIELD(LVS, lv, BIN, "SkipAct", lvid, 15, lvskipactivation, lv_skip_activation, "Set if LV is skipped on activation.", 0)
|
||||
FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActiveLoc", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActiveRem", lvid, 10, lvactiveremotely, lv_active_remotely, "Set if the LV is active remotely.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActiveExcl", lvid, 10, lvactiveexclusively, lv_active_exclusively, "Set if the LV is active exclusively.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActLocal", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActRemote", lvid, 10, lvactiveremotely, lv_active_remotely, "Set if the LV is active remotely.", 0)
|
||||
FIELD(LVS, lv, BIN, "ActExcl", lvid, 10, lvactiveexclusively, lv_active_exclusively, "Set if the LV is active exclusively.", 0)
|
||||
FIELD(LVS, lv, NUM, "Maj", major, 3, int32, lv_major, "Persistent major number or -1 if not persistent.", 0)
|
||||
FIELD(LVS, lv, NUM, "Min", minor, 3, int32, lv_minor, "Persistent minor number or -1 if not persistent.", 0)
|
||||
FIELD(LVS, lv, SIZ, "Rahead", lvid, 6, lvreadahead, lv_read_ahead, "Read ahead setting in current units.", 0)
|
||||
|
@ -1454,6 +1454,9 @@ static int _lvactivelocally_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
int active_locally;
|
||||
|
||||
if (!activation())
|
||||
return _binary_undef_disp(rh, mem, field, private);
|
||||
|
||||
if (vg_is_clustered(lv->vg)) {
|
||||
lv = lv_lock_holder(lv);
|
||||
active_locally = lv_is_active_locally(lv);
|
||||
@ -1470,6 +1473,9 @@ static int _lvactiveremotely_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
int active_remotely;
|
||||
|
||||
if (!activation())
|
||||
return _binary_undef_disp(rh, mem, field, private);
|
||||
|
||||
if (vg_is_clustered(lv->vg)) {
|
||||
lv = lv_lock_holder(lv);
|
||||
active_remotely = lv_is_active_but_not_locally(lv);
|
||||
@ -1486,6 +1492,9 @@ static int _lvactiveexclusively_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
int active_exclusively;
|
||||
|
||||
if (!activation())
|
||||
return _binary_undef_disp(rh, mem, field, private);
|
||||
|
||||
if (vg_is_clustered(lv->vg)) {
|
||||
lv = lv_lock_holder(lv);
|
||||
active_exclusively = lv_is_active_exclusive(lv);
|
||||
|
Loading…
Reference in New Issue
Block a user