diff options
author | David Teigland <teigland@redhat.com> | 2021-04-01 17:20:00 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2021-04-07 15:32:49 -0500 |
commit | 0a28e3c44b05470061f15516e1c89a84fa2e8569 (patch) | |
tree | 887956f2093739bade20e57c94ecfc03f3bc463a /lib/report | |
parent | 6f6583afede02dddec41b85f896c9d4e73d87beb (diff) | |
download | lvm2-0a28e3c44b05470061f15516e1c89a84fa2e8569.tar.gz |
Add metadata-based autoactivation property for VG and LV
The autoactivation property can be specified in lvcreate
or vgcreate for new LVs/VGs, and the property can be changed
by lvchange or vgchange for existing LVs/VGs.
--setautoactivation y|n
enables|disables autoactivation of a VG or LV.
Autoactivation is enabled by default, which is consistent with
past behavior. The disabled state is stored as a new flag
in the VG metadata, and the absence of the flag allows
autoactivation.
If autoactivation is disabled for the VG, then no LVs in the VG
will be autoactivated (the LV autoactivation property will have
no effect.) When autoactivation is enabled for the VG, then
autoactivation can be controlled on individual LVs.
The state of this property can be reported for LVs/VGs using
the "-o autoactivation" option in lvs/vgs commands, which will
report "enabled", or "" for the disabled state.
Previous versions of lvm do not recognize this property. Since
autoactivation is enabled by default, the disabled setting will
have no effect in older lvm versions. If the VG is modified by
older lvm versions, the disabled state will also be dropped from
the metadata.
The autoactivation property is an alternative to using the lvm.conf
auto_activation_volume_list, which is still applied to to VGs/LVs
in addition to the new property.
If VG or LV autoactivation is disabled either in metadata or in
auto_activation_volume_list, it will not be autoactivated.
An autoactivation command will silently skip activating an LV
when the autoactivation property is disabled.
To determine the effective autoactivation behavior for a specific
LV, multiple settings would need to be checked:
the VG autoactivation property, the LV autoactivation property,
the auto_activation_volume_list. The "activation skip" property
would also be relevant, since it applies to both normal and auto
activation.
Diffstat (limited to 'lib/report')
-rw-r--r-- | lib/report/columns.h | 2 | ||||
-rw-r--r-- | lib/report/properties.c | 4 | ||||
-rw-r--r-- | lib/report/report.c | 17 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/report/columns.h b/lib/report/columns.h index 8d2f7a993..12b78b766 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -61,6 +61,7 @@ FIELD(LVS, lv, STR, "AllocPol", lvid, 10, lvallocationpolicy, lv_allocation_poli FIELD(LVS, lv, BIN, "AllocLock", lvid, 10, lvallocationlocked, lv_allocation_locked, "Set if LV is locked against allocation changes.", 0) FIELD(LVS, lv, BIN, "FixMin", lvid, 10, lvfixedminor, lv_fixed_minor, "Set if LV has fixed minor number assigned.", 0) FIELD(LVS, lv, BIN, "SkipAct", lvid, 15, lvskipactivation, lv_skip_activation, "Set if LV is skipped on activation.", 0) +FIELD(LVS, lv, BIN, "AutoAct", lvid, 0, lvautoactivation, lv_autoactivation, "Set if LV autoactivation is enabled.", 0) FIELD(LVS, lv, STR, "WhenFull", lvid, 15, lvwhenfull, lv_when_full, "For thin pools, behavior when full.", 0) FIELD(LVS, lv, STR, "Active", lvid, 0, lvactive, lv_active, "Active state of the LV.", 0) FIELD(LVS, lv, BIN, "ActLocal", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0) @@ -222,6 +223,7 @@ FIELD(VGS, vg, STR, "Attr", cmd, 5, vgstatus, vg_attr, "Various attributes - see FIELD(VGS, vg, STR, "VPerms", cmd, 10, vgpermissions, vg_permissions, "VG permissions.", 0) FIELD(VGS, vg, BIN, "Extendable", cmd, 0, vgextendable, vg_extendable, "Set if VG is extendable.", 0) FIELD(VGS, vg, BIN, "Exported", cmd, 10, vgexported, vg_exported, "Set if VG is exported.", 0) +FIELD(VGS, vg, BIN, "AutoAct", cmd, 0, vgautoactivation, vg_autoactivation, "Set if VG autoactivation is enabled.", 0) FIELD(VGS, vg, BIN, "Partial", cmd, 10, vgpartial, vg_partial, "Set if VG is partial.", 0) FIELD(VGS, vg, STR, "AllocPol", cmd, 10, vgallocationpolicy, vg_allocation_policy, "VG allocation policy.", 0) FIELD(VGS, vg, BIN, "Clustered", cmd, 10, vgclustered, vg_clustered, "Set if VG is clustered.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index f2174b83c..12ea890f4 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -269,6 +269,8 @@ GET_PV_STR_PROPERTY_FN(pv_device_id_type, pv->device_id_type) #define _vg_extendable_get prop_not_implemented_get #define _vg_exported_set prop_not_implemented_set #define _vg_exported_get prop_not_implemented_get +#define _vg_autoactivation_set prop_not_implemented_set +#define _vg_autoactivation_get prop_not_implemented_get #define _vg_partial_set prop_not_implemented_set #define _vg_partial_get prop_not_implemented_get #define _vg_allocation_policy_set prop_not_implemented_set @@ -323,6 +325,8 @@ GET_PV_STR_PROPERTY_FN(pv_device_id_type, pv->device_id_type) #define _lv_skip_activation_get prop_not_implemented_get #define _lv_check_needed_set prop_not_implemented_set #define _lv_check_needed_get prop_not_implemented_get +#define _lv_autoactivation_set prop_not_implemented_set +#define _lv_autoactivation_get prop_not_implemented_get #define _lv_historical_set prop_not_implemented_set #define _lv_historical_get prop_not_implemented_get diff --git a/lib/report/report.c b/lib/report/report.c index 2f5811a96..222d3f4b6 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -3573,6 +3573,15 @@ static int _vgexported_disp(struct dm_report *rh, struct dm_pool *mem, return _binary_disp(rh, mem, field, exported, GET_FIRST_RESERVED_NAME(vg_exported_y), private); } +static int _vgautoactivation_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct volume_group *vg = (const struct volume_group *)data; + int aa_yes = (vg->status & NOAUTOACTIVATE) ? 0 : 1; + return _binary_disp(rh, mem, field, aa_yes, "enabled", private); +} + static int _vgpartial_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) @@ -3969,6 +3978,14 @@ static int _lvskipactivation_disp(struct dm_report *rh, struct dm_pool *mem, return _binary_disp(rh, mem, field, skip_activation, "skip activation", private); } +static int _lvautoactivation_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + int aa_yes = (((const struct logical_volume *) data)->status & LV_NOAUTOACTIVATE) ? 0 : 1; + return _binary_disp(rh, mem, field, aa_yes, "enabled", private); +} + static int _lvhistorical_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) |