diff options
author | David Teigland <teigland@redhat.com> | 2015-05-22 16:01:54 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-06-02 11:39:34 -0500 |
commit | 220b4a78e87b34b841d7fc1c18e197d7395cf88d (patch) | |
tree | 5729a9a02426a66bc4c90f84076f5a29f8358c3f | |
parent | fffe2d76288468c554c159930acc9b4c19dd6b67 (diff) | |
download | lvm2-220b4a78e87b34b841d7fc1c18e197d7395cf88d.tar.gz |
report: display lock_type and lock_args
-o locktype,lockargs can be used to display
the lock_type and lock_args of VGs or LVs.
-rw-r--r-- | lib/metadata/lv.c | 12 | ||||
-rw-r--r-- | lib/metadata/lv.h | 2 | ||||
-rw-r--r-- | lib/metadata/vg.c | 10 | ||||
-rw-r--r-- | lib/metadata/vg.h | 2 | ||||
-rw-r--r-- | lib/report/columns.h | 4 | ||||
-rw-r--r-- | lib/report/properties.c | 8 | ||||
-rw-r--r-- | lib/report/report.c | 40 |
7 files changed, 78 insertions, 0 deletions
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 6316cd867..8813f24a5 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -1020,6 +1020,18 @@ char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv) return dm_pool_strdup(mem, profile_name); } +char *lv_lock_type_dup(struct dm_pool *mem, const struct logical_volume *lv) +{ + const char *lock_type = lv->lock_type ? lv->lock_type : ""; + return dm_pool_strdup(mem, lock_type); +} + +char *lv_lock_args_dup(struct dm_pool *mem, const struct logical_volume *lv) +{ + const char *lock_args = lv->lock_args ? lv->lock_args : ""; + return dm_pool_strdup(mem, lock_args); +} + /* For given LV find recursively the LV which holds lock for it */ const struct logical_volume *lv_lock_holder(const struct logical_volume *lv) { diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h index 2765b465f..ad17da5d5 100644 --- a/lib/metadata/lv.h +++ b/lib/metadata/lv.h @@ -105,6 +105,8 @@ const struct logical_volume *lv_lock_holder(const struct logical_volume *lv); const struct logical_volume *lv_ondisk(const struct logical_volume *lv); struct profile *lv_config_profile(const struct logical_volume *lv); char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv); +char *lv_lock_type_dup(struct dm_pool *mem, const struct logical_volume *lv); +char *lv_lock_args_dup(struct dm_pool *mem, const struct logical_volume *lv); int lv_mirror_image_in_sync(const struct logical_volume *lv); int lv_raid_image_in_sync(const struct logical_volume *lv); int lv_raid_healthy(const struct logical_volume *lv); diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c index 32901e3be..9d7724fc2 100644 --- a/lib/metadata/vg.c +++ b/lib/metadata/vg.c @@ -135,6 +135,16 @@ char *vg_system_id_dup(const struct volume_group *vg) return dm_pool_strdup(vg->vgmem, vg->system_id ? : vg->lvm1_system_id ? : ""); } +char *vg_lock_type_dup(const struct volume_group *vg) +{ + return dm_pool_strdup(vg->vgmem, vg->lock_type ? : vg->lock_type ? : ""); +} + +char *vg_lock_args_dup(const struct volume_group *vg) +{ + return dm_pool_strdup(vg->vgmem, vg->lock_args ? : vg->lock_args ? : ""); +} + char *vg_uuid_dup(const struct volume_group *vg) { return id_format_and_copy(vg->vgmem, &vg->id); diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h index 779e5ed4c..27b50110d 100644 --- a/lib/metadata/vg.h +++ b/lib/metadata/vg.h @@ -156,6 +156,8 @@ void free_orphan_vg(struct volume_group *vg); char *vg_fmt_dup(const struct volume_group *vg); char *vg_name_dup(const struct volume_group *vg); char *vg_system_id_dup(const struct volume_group *vg); +char *vg_lock_type_dup(const struct volume_group *vg); +char *vg_lock_args_dup(const struct volume_group *vg); uint32_t vg_seqno(const struct volume_group *vg); uint64_t vg_status(const struct volume_group *vg); int vg_set_alloc_policy(struct volume_group *vg, alloc_policy_t alloc); diff --git a/lib/report/columns.h b/lib/report/columns.h index 06282c5b4..0e01bd82c 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -84,6 +84,8 @@ FIELD(LVS, lv, STR, "Meta", lvid, 4, metadatalv, metadata_lv, "For thin and cach FIELD(LVS, lv, STR, "Pool", lvid, 4, poollv, pool_lv, "For thin volumes, the thin pool LV for this volume.", 0) FIELD(LVS, lv, STR_LIST, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0) FIELD(LVS, lv, STR, "LProfile", lvid, 8, lvprofile, lv_profile, "Configuration profile attached to this LV.", 0) +FIELD(LVS, lv, STR, "Lock Type", lvid, 9, lvlocktype, lv_locktype, "Lock type of the LV used by lvmlockd.", 0) +FIELD(LVS, lv, STR, "Lock Args", lvid, 9, lvlockargs, lv_lockargs, "Lock args of the LV used by lvmlockd.", 0) FIELD(LVS, lv, STR, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0) FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) FIELD(LVS, lv, STR_LIST, "Modules", lvid, 7, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0) @@ -143,6 +145,8 @@ FIELD(VGS, vg, SIZ, "VSize", cmd, 5, vgsize, vg_size, "Total size of VG in curre FIELD(VGS, vg, SIZ, "VFree", cmd, 5, vgfree, vg_free, "Total amount of free space in current units.", 0) FIELD(VGS, vg, STR, "SYS ID", cmd, 6, vgsystemid, vg_sysid, "System ID of the VG indicating which host owns it.", 0) FIELD(VGS, vg, STR, "System ID", cmd, 9, vgsystemid, vg_systemid, "System ID of the VG indicating which host owns it.", 0) +FIELD(VGS, vg, STR, "Lock Type", cmd, 9, vglocktype, vg_locktype, "Lock type of the VG used by lvmlockd.", 0) +FIELD(VGS, vg, STR, "Lock Args", cmd, 9, vglockargs, vg_lockargs, "Lock args of the VG used by lvmlockd.", 0) FIELD(VGS, vg, SIZ, "Ext", extent_size, 3, size32, vg_extent_size, "Size of Physical Extents in current units.", 0) FIELD(VGS, vg, NUM, "#Ext", extent_count, 4, uint32, vg_extent_count, "Total number of Physical Extents.", 0) FIELD(VGS, vg, NUM, "Free", free_count, 4, uint32, vg_free_count, "Total number of unallocated Physical Extents.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index b0a91a7da..4b9b7b299 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -350,6 +350,10 @@ GET_LV_STR_PROPERTY_FN(lv_active, lv_active_dup(lv->vg->vgmem, lv)) #define _lv_active_set prop_not_implemented_set GET_LV_STR_PROPERTY_FN(lv_profile, lv_profile_dup(lv->vg->vgmem, lv)) #define _lv_profile_set prop_not_implemented_set +GET_LV_STR_PROPERTY_FN(lv_locktype, lv_lock_type_dup(lv->vg->vgmem, lv)) +#define _lv_locktype_set prop_not_implemented_set +GET_LV_STR_PROPERTY_FN(lv_lockargs, lv_lock_args_dup(lv->vg->vgmem, lv)) +#define _lv_lockargs_set prop_not_implemented_set /* VG */ GET_VG_STR_PROPERTY_FN(vg_fmt, vg_fmt_dup(vg)) @@ -368,6 +372,10 @@ GET_VG_STR_PROPERTY_FN(vg_sysid, vg_system_id_dup(vg)) #define _vg_sysid_set prop_not_implemented_set GET_VG_STR_PROPERTY_FN(vg_systemid, vg_system_id_dup(vg)) #define _vg_systemid_set prop_not_implemented_set +GET_VG_STR_PROPERTY_FN(vg_locktype, vg_lock_type_dup(vg)) +#define _vg_locktype_set prop_not_implemented_set +GET_VG_STR_PROPERTY_FN(vg_lockargs, vg_lock_args_dup(vg)) +#define _vg_lockargs_set prop_not_implemented_set GET_VG_NUM_PROPERTY_FN(vg_extent_size, (SECTOR_SIZE * vg->extent_size)) #define _vg_extent_size_set prop_not_implemented_set GET_VG_NUM_PROPERTY_FN(vg_extent_count, vg->extent_count) diff --git a/lib/report/report.c b/lib/report/report.c index a1076690a..426517323 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -369,6 +369,26 @@ static int _lvprofile_disp(struct dm_report *rh, struct dm_pool *mem, return _field_set_value(field, "", NULL); } +static int _lvlocktype_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + const char *repstr = lv->lock_type ? lv->lock_type : ""; + + return _string_disp(rh, mem, field, &repstr, private); +} + +static int _lvlockargs_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct logical_volume *lv = (const struct logical_volume *) data; + const char *repstr = lv->lock_args ? lv->lock_args : ""; + + return _string_disp(rh, mem, field, &repstr, private); +} + static int _vgfmt_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) @@ -1100,6 +1120,26 @@ static int _vgsystemid_disp(struct dm_report *rh, struct dm_pool *mem, return _string_disp(rh, mem, field, &repstr, private); } +static int _vglocktype_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; + const char *repstr = vg->lock_type ? vg->lock_type : ""; + + return _string_disp(rh, mem, field, &repstr, private); +} + +static int _vglockargs_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; + const char *repstr = vg->lock_args ? vg->lock_args : ""; + + return _string_disp(rh, mem, field, &repstr, private); +} + static int _uuid_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private __attribute__((unused))) |