2010-08-20 16:44:58 +04:00
/*
2017-03-01 20:50:35 +03:00
* Copyright ( C ) 2010 - 2017 Red Hat , Inc . All rights reserved .
2010-08-20 16:44:58 +04:00
*
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v .2 .1 .
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 13:49:46 +03:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2010-08-20 16:44:58 +04:00
*/
2018-05-14 12:30:20 +03:00
# include "lib/misc/lib.h"
# include "lib/report/properties.h"
# include "lib/activate/activate.h"
# include "lib/metadata/metadata.h"
2010-08-20 16:44:58 +04:00
2013-07-12 21:09:44 +04:00
2010-09-30 18:08:46 +04:00
# define GET_VG_NUM_PROPERTY_FN(NAME, VALUE) \
GET_NUM_PROPERTY_FN ( NAME , VALUE , volume_group , vg )
# define GET_PV_NUM_PROPERTY_FN(NAME, VALUE) \
GET_NUM_PROPERTY_FN ( NAME , VALUE , physical_volume , pv )
# define GET_LV_NUM_PROPERTY_FN(NAME, VALUE) \
GET_NUM_PROPERTY_FN ( NAME , VALUE , logical_volume , lv )
2010-11-17 23:08:14 +03:00
# define GET_LVSEG_NUM_PROPERTY_FN(NAME, VALUE) \
GET_NUM_PROPERTY_FN ( NAME , VALUE , lv_segment , lvseg )
2010-11-17 23:11:27 +03:00
# define GET_PVSEG_NUM_PROPERTY_FN(NAME, VALUE) \
GET_NUM_PROPERTY_FN ( NAME , VALUE , pv_segment , pvseg )
2010-09-30 18:08:46 +04:00
2010-11-17 22:15:10 +03:00
# define SET_VG_NUM_PROPERTY_FN(NAME, SETFN) \
SET_NUM_PROPERTY_FN ( NAME , SETFN , volume_group , vg )
# define SET_PV_NUM_PROPERTY_FN(NAME, SETFN) \
SET_NUM_PROPERTY_FN ( NAME , SETFN , physical_volume , pv )
# define SET_LV_NUM_PROPERTY_FN(NAME, SETFN) \
SET_NUM_PROPERTY_FN ( NAME , SETFN , logical_volume , lv )
2010-09-30 18:08:46 +04:00
# define GET_VG_STR_PROPERTY_FN(NAME, VALUE) \
GET_STR_PROPERTY_FN ( NAME , VALUE , volume_group , vg )
# define GET_PV_STR_PROPERTY_FN(NAME, VALUE) \
GET_STR_PROPERTY_FN ( NAME , VALUE , physical_volume , pv )
# define GET_LV_STR_PROPERTY_FN(NAME, VALUE) \
GET_STR_PROPERTY_FN ( NAME , VALUE , logical_volume , lv )
2010-11-17 23:08:14 +03:00
# define GET_LVSEG_STR_PROPERTY_FN(NAME, VALUE) \
GET_STR_PROPERTY_FN ( NAME , VALUE , lv_segment , lvseg )
2010-11-17 23:11:27 +03:00
# define GET_PVSEG_STR_PROPERTY_FN(NAME, VALUE) \
GET_STR_PROPERTY_FN ( NAME , VALUE , pv_segment , pvseg )
2010-08-20 17:02:39 +04:00
2014-06-09 14:08:27 +04:00
static dm_percent_t _copy_percent ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2014-06-09 14:08:27 +04:00
dm_percent_t percent ;
2013-07-09 05:06:29 +04:00
if ( ! lv_mirror_percent ( lv - > vg - > cmd , lv , 0 , & percent , NULL ) )
2014-06-09 14:08:27 +04:00
percent = DM_PERCENT_INVALID ;
2013-07-09 05:06:29 +04:00
return percent ;
2010-12-15 02:20:58 +03:00
}
2013-07-19 04:30:02 +04:00
static uint64_t _raidmismatchcount ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2013-04-12 00:33:59 +04:00
uint64_t cnt ;
if ( ! lv_raid_mismatch_count ( lv , & cnt ) )
return 0 ;
return cnt ;
}
2013-07-19 04:30:02 +04:00
static char * _raidsyncaction ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2013-04-12 00:33:59 +04:00
char * action ;
if ( ! lv_raid_sync_action ( lv , & action ) )
return 0 ;
2013-07-09 05:06:29 +04:00
2013-04-12 00:33:59 +04:00
return action ;
}
2013-07-19 04:30:02 +04:00
static uint32_t _raidwritebehind ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
RAID: Add writemostly/writebehind support for RAID1
'lvchange' is used to alter a RAID 1 logical volume's write-mostly and
write-behind characteristics. The '--writemostly' parameter takes a
PV as an argument with an optional trailing character to specify whether
to set ('y'), unset ('n'), or toggle ('t') the value. If no trailing
character is given, it will set the flag.
Synopsis:
lvchange [--writemostly <PV>:{t|y|n}] [--writebehind <count>] vg/lv
Example:
lvchange --writemostly /dev/sdb1:y --writebehind 512 vg/raid1_lv
The last character in the 'lv_attr' field is used to show whether a device
has the WriteMostly flag set. It is signified with a 'w'. If the device
has failed, the 'p'artial flag has priority.
Example ("nosync" raid1 with mismatch_cnt and writemostly):
[~]# lvs -a --segment vg
LV VG Attr #Str Type SSize
raid1 vg Rwi---r-m 2 raid1 500.00m
[raid1_rimage_0] vg Iwi---r-- 1 linear 500.00m
[raid1_rimage_1] vg Iwi---r-w 1 linear 500.00m
[raid1_rmeta_0] vg ewi---r-- 1 linear 4.00m
[raid1_rmeta_1] vg ewi---r-- 1 linear 4.00m
Example (raid1 with mismatch_cnt, writemostly - but failed drive):
[~]# lvs -a --segment vg
LV VG Attr #Str Type SSize
raid1 vg rwi---r-p 2 raid1 500.00m
[raid1_rimage_0] vg Iwi---r-- 1 linear 500.00m
[raid1_rimage_1] vg Iwi---r-p 1 linear 500.00m
[raid1_rmeta_0] vg ewi---r-- 1 linear 4.00m
[raid1_rmeta_1] vg ewi---r-p 1 linear 4.00m
A new reportable field has been added for writebehind as well. If
write-behind has not been set or the LV is not RAID1, the field will
be blank.
Example (writebehind is set):
[~]# lvs -a -o name,attr,writebehind vg
LV Attr WBehind
lv rwi-a-r-- 512
[lv_rimage_0] iwi-aor-w
[lv_rimage_1] iwi-aor--
[lv_rmeta_0] ewi-aor--
[lv_rmeta_1] ewi-aor--
Example (writebehind is not set):
[~]# lvs -a -o name,attr,writebehind vg
LV Attr WBehind
lv rwi-a-r--
[lv_rimage_0] iwi-aor-w
[lv_rimage_1] iwi-aor--
[lv_rmeta_0] ewi-aor--
[lv_rmeta_1] ewi-aor--
2013-04-15 22:59:46 +04:00
return first_seg ( lv ) - > writebehind ;
}
2013-07-19 04:30:02 +04:00
static uint32_t _raidminrecoveryrate ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2013-05-31 20:25:52 +04:00
return first_seg ( lv ) - > min_recovery_rate ;
}
2013-07-19 04:30:02 +04:00
static uint32_t _raidmaxrecoveryrate ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2013-05-31 20:25:52 +04:00
return first_seg ( lv ) - > max_recovery_rate ;
}
2020-09-01 22:39:34 +03:00
static const char * _raidintegritymode ( const struct logical_volume * lv )
{
2021-03-09 18:32:36 +03:00
struct integrity_settings * settings = NULL ;
2020-09-01 22:39:34 +03:00
if ( lv_raid_has_integrity ( ( struct logical_volume * ) lv ) )
lv_get_raid_integrity_settings ( ( struct logical_volume * ) lv , & settings ) ;
else if ( lv_is_integrity ( lv ) )
settings = & first_seg ( lv ) - > integrity_settings ;
2021-03-09 18:32:36 +03:00
if ( settings ) {
switch ( settings - > mode [ 0 ] ) {
case ' B ' : return " bitmap " ;
case ' J ' : return " journal " ;
}
}
2020-09-01 22:39:34 +03:00
return " unknown " ;
}
static uint32_t _raidintegrityblocksize ( const struct logical_volume * lv )
{
2021-03-09 18:32:36 +03:00
struct integrity_settings * settings = NULL ;
2020-09-01 22:39:34 +03:00
if ( lv_raid_has_integrity ( ( struct logical_volume * ) lv ) )
lv_get_raid_integrity_settings ( ( struct logical_volume * ) lv , & settings ) ;
else if ( lv_is_integrity ( lv ) )
settings = & first_seg ( lv ) - > integrity_settings ;
else
return 0 ;
2021-03-09 18:32:36 +03:00
return ( settings ) ? settings - > block_size : 0 ;
2020-09-01 22:39:34 +03:00
}
2020-09-02 00:15:31 +03:00
static uint64_t _integritymismatches ( const struct logical_volume * lv )
{
uint64_t cnt ;
if ( ! lv_integrity_mismatches ( lv - > vg - > cmd , lv , & cnt ) )
return 0 ;
return cnt ;
}
2014-06-09 14:08:27 +04:00
static dm_percent_t _snap_percent ( const struct logical_volume * lv )
2013-07-09 05:06:29 +04:00
{
2014-06-09 14:08:27 +04:00
dm_percent_t percent ;
2012-10-08 14:06:30 +04:00
2013-07-09 05:06:29 +04:00
if ( ! lv_is_cow ( lv ) | | ! lv_snapshot_percent ( lv , & percent ) )
2014-06-09 14:08:27 +04:00
percent = DM_PERCENT_INVALID ;
2012-10-08 14:06:30 +04:00
2013-07-09 05:06:29 +04:00
return percent ;
2010-12-15 02:20:58 +03:00
}
2014-06-09 14:08:27 +04:00
static dm_percent_t _data_percent ( const struct logical_volume * lv )
2012-01-19 19:34:32 +04:00
{
2020-09-27 02:11:47 +03:00
dm_percent_t percent = DM_PERCENT_INVALID ;
struct lv_status_cache * cache_status ;
struct lv_status_thin * thin_status ;
struct lv_status_thin_pool * thin_pool_status ;
2012-01-19 19:34:32 +04:00
2012-10-05 11:56:50 +04:00
if ( lv_is_cow ( lv ) )
return _snap_percent ( lv ) ;
2016-05-24 16:19:01 +03:00
if ( lv_is_cache ( lv ) | | lv_is_used_cache_pool ( lv ) ) {
2020-09-27 02:11:47 +03:00
if ( ! lv_cache_status ( lv , & cache_status ) )
stack ;
else {
percent = cache_status - > data_usage ;
dm_pool_destroy ( cache_status - > mem ) ;
}
} else if ( lv_is_thin_volume ( lv ) ) {
if ( ! lv_thin_status ( lv , 0 , & thin_status ) )
2014-11-03 14:38:29 +03:00
stack ;
2020-09-27 02:11:47 +03:00
else {
percent = thin_status - > usage ;
dm_pool_destroy ( thin_status - > mem ) ;
}
} else if ( lv_is_thin_pool ( lv ) ) {
if ( ! lv_thin_pool_status ( lv , 0 , & thin_pool_status ) )
stack ;
else {
2020-10-16 18:51:23 +03:00
percent = thin_pool_status - > data_usage ;
2020-09-27 02:11:47 +03:00
dm_pool_destroy ( thin_pool_status - > mem ) ;
2014-11-03 14:38:29 +03:00
}
}
2020-09-27 02:11:47 +03:00
return percent ;
2012-01-19 19:34:32 +04:00
}
2014-06-09 14:08:27 +04:00
static dm_percent_t _metadata_percent ( const struct logical_volume * lv )
2012-01-19 19:34:32 +04:00
{
2020-09-27 02:11:47 +03:00
dm_percent_t percent = DM_PERCENT_INVALID ;
struct lv_status_cache * cache_status ;
struct lv_status_thin_pool * thin_pool_status ;
2014-11-03 14:38:29 +03:00
2016-05-24 16:19:01 +03:00
if ( lv_is_cache ( lv ) | | lv_is_used_cache_pool ( lv ) ) {
2020-09-27 02:11:47 +03:00
if ( ! lv_cache_status ( lv , & cache_status ) )
stack ;
else {
percent = cache_status - > metadata_usage ;
dm_pool_destroy ( cache_status - > mem ) ;
}
} else if ( lv_is_thin_pool ( lv ) ) {
if ( ! lv_thin_pool_status ( lv , 0 , & thin_pool_status ) )
2014-11-03 14:38:29 +03:00
stack ;
2020-09-27 02:11:47 +03:00
else {
percent = thin_pool_status - > metadata_usage ;
dm_pool_destroy ( thin_pool_status - > mem ) ;
2014-11-03 14:38:29 +03:00
}
}
2020-09-27 02:11:47 +03:00
return percent ;
2012-01-19 19:34:32 +04:00
}
2010-08-20 16:44:58 +04:00
/* PV */
2010-09-30 18:09:33 +04:00
GET_PV_STR_PROPERTY_FN ( pv_fmt , pv_fmt_dup ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_fmt_set prop_not_implemented_set
2015-09-21 14:38:53 +03:00
GET_PV_STR_PROPERTY_FN ( pv_uuid , pv_uuid_dup ( pv - > vg - > vgmem , pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_uuid_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( dev_size , SECTOR_SIZE * pv_dev_size ( pv ) )
2013-07-12 21:09:44 +04:00
# define _dev_size_set prop_not_implemented_set
2015-09-21 14:38:53 +03:00
GET_PV_STR_PROPERTY_FN ( pv_name , pv_name_dup ( pv - > vg - > vgmem , pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_name_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_mda_free , SECTOR_SIZE * pv_mda_free ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_mda_free_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_mda_size , SECTOR_SIZE * pv_mda_size ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_mda_size_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pe_start , SECTOR_SIZE * pv - > pe_start )
2013-07-12 21:09:44 +04:00
# define _pe_start_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_size , SECTOR_SIZE * pv_size_field ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_size_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_free , SECTOR_SIZE * pv_free ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_free_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_used , SECTOR_SIZE * pv_used ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_used_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_STR_PROPERTY_FN ( pv_attr , pv_attr_dup ( pv - > vg - > vgmem , pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_attr_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_pe_count , pv - > pe_count )
2013-07-12 21:09:44 +04:00
# define _pv_pe_count_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_pe_alloc_count , pv - > pe_alloc_count )
2013-07-12 21:09:44 +04:00
# define _pv_pe_alloc_count_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_STR_PROPERTY_FN ( pv_tags , pv_tags_dup ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_tags_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_mda_count , pv_mda_count ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_mda_count_set prop_not_implemented_set
2010-09-30 18:09:33 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_mda_used_count , pv_mda_used_count ( pv ) )
2013-07-12 21:09:44 +04:00
# define _pv_mda_used_count_set prop_not_implemented_set
2013-07-19 04:30:02 +04:00
GET_PV_NUM_PROPERTY_FN ( pv_ba_start , SECTOR_SIZE * pv - > ba_start )
# define _pv_ba_start_set prop_not_implemented_set
GET_PV_NUM_PROPERTY_FN ( pv_ba_size , SECTOR_SIZE * pv - > ba_size )
# define _pv_ba_size_set prop_not_implemented_set
device usage based on devices file
The LVM devices file lists devices that lvm can use. The default
file is /etc/lvm/devices/system.devices, and the lvmdevices(8)
command is used to add or remove device entries. If the file
does not exist, or if lvm.conf includes use_devicesfile=0, then
lvm will not use a devices file. When the devices file is in use,
the regex filter is not used, and the filter settings in lvm.conf
or on the command line are ignored.
LVM records devices in the devices file using hardware-specific
IDs, such as the WWID, and attempts to use subsystem-specific
IDs for virtual device types. These device IDs are also written
in the VG metadata. When no hardware or virtual ID is available,
lvm falls back using the unstable device name as the device ID.
When devnames are used, lvm performs extra scanning to find
devices if their devname changes, e.g. after reboot.
When proper device IDs are used, an lvm command will not look
at devices outside the devices file, but when devnames are used
as a fallback, lvm will scan devices outside the devices file
to locate PVs on renamed devices. A config setting
search_for_devnames can be used to control the scanning for
renamed devname entries.
Related to the devices file, the new command option
--devices <devnames> allows a list of devices to be specified for
the command to use, overriding the devices file. The listed
devices act as a sort of devices file in terms of limiting which
devices lvm will see and use. Devices that are not listed will
appear to be missing to the lvm command.
Multiple devices files can be kept in /etc/lvm/devices, which
allows lvm to be used with different sets of devices, e.g.
system devices do not need to be exposed to a specific application,
and the application can use lvm on its own set of devices that are
not exposed to the system. The option --devicesfile <filename> is
used to select the devices file to use with the command. Without
the option set, the default system devices file is used.
Setting --devicesfile "" causes lvm to not use a devices file.
An existing, empty devices file means lvm will see no devices.
The new command vgimportdevices adds PVs from a VG to the devices
file and updates the VG metadata to include the device IDs.
vgimportdevices -a will import all VGs into the system devices file.
LVM commands run by dmeventd not use a devices file by default,
and will look at all devices on the system. A devices file can
be created for dmeventd (/etc/lvm/devices/dmeventd.devices) If
this file exists, lvm commands run by dmeventd will use it.
Internal implementaion:
- device_ids_read - read the devices file
. add struct dev_use (du) to cmd->use_devices for each devices file entry
- dev_cache_scan - get /dev entries
. add struct device (dev) to dev_cache for each device on the system
- device_ids_match - match devices file entries to /dev entries
. match each du on cmd->use_devices to a dev in dev_cache, using device ID
. on match, set du->dev, dev->id, dev->flags MATCHED_USE_ID
- label_scan - read lvm headers and metadata from devices
. filters are applied, those that do not need data from the device
. filter-deviceid skips devs without MATCHED_USE_ID, i.e.
skips /dev entries that are not listed in the devices file
. read lvm label from dev
. filters are applied, those that use data from the device
. read lvm metadata from dev
. add info/vginfo structs for PVs/VGs (info is "lvmcache")
- device_ids_find_renamed_devs - handle devices with unstable devname ID
where devname changed
. this step only needed when devs do not have proper device IDs,
and their dev names change, e.g. after reboot sdb becomes sdc.
. detect incorrect match because PVID in the devices file entry
does not match the PVID found when the device was read above
. undo incorrect match between du and dev above
. search system devices for new location of PVID
. update devices file with new devnames for PVIDs on renamed devices
. label_scan the renamed devs
- continue with command processing
2020-06-23 21:25:41 +03:00
GET_PV_STR_PROPERTY_FN ( pv_device_id , pv - > device_id )
# define _pv_device_id_set prop_not_implemented_set
GET_PV_STR_PROPERTY_FN ( pv_device_id_type , pv - > device_id_type )
# define _pv_device_id_type_set prop_not_implemented_set
2010-08-20 16:44:58 +04:00
2014-07-02 13:09:14 +04:00
# define _pv_allocatable_set prop_not_implemented_set
# define _pv_allocatable_get prop_not_implemented_get
# define _pv_exported_set prop_not_implemented_set
# define _pv_exported_get prop_not_implemented_get
# define _pv_missing_set prop_not_implemented_set
# define _pv_missing_get prop_not_implemented_get
2015-03-17 11:49:08 +03:00
# define _pv_ext_vsn_get prop_not_implemented_get
# define _pv_ext_vsn_set prop_not_implemented_set
2015-03-10 18:10:16 +03:00
# define _pv_in_use_get prop_not_implemented_get
# define _pv_in_use_set prop_not_implemented_set
2016-04-29 22:42:14 +03:00
# define _pv_duplicate_get prop_not_implemented_get
# define _pv_duplicate_set prop_not_implemented_set
2016-03-23 12:52:46 +03:00
# define _pv_major_get prop_not_implemented_get
2016-03-22 03:12:08 +03:00
# define _pv_major_set prop_not_implemented_set
2016-03-23 12:52:46 +03:00
# define _pv_minor_get prop_not_implemented_get
2016-03-22 03:12:08 +03:00
# define _pv_minor_set prop_not_implemented_set
2014-07-02 13:09:14 +04:00
# define _vg_permissions_set prop_not_implemented_set
# define _vg_permissions_get prop_not_implemented_get
# define _vg_extendable_set prop_not_implemented_set
# define _vg_extendable_get prop_not_implemented_get
# define _vg_exported_set prop_not_implemented_set
# define _vg_exported_get prop_not_implemented_get
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.
2021-04-02 01:20:00 +03:00
# define _vg_autoactivation_set prop_not_implemented_set
# define _vg_autoactivation_get prop_not_implemented_get
2014-07-02 13:09:14 +04:00
# 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
# define _vg_allocation_policy_get prop_not_implemented_get
# define _vg_clustered_set prop_not_implemented_set
# define _vg_clustered_get prop_not_implemented_get
2018-05-31 18:23:03 +03:00
# define _vg_shared_set prop_not_implemented_set
# define _vg_shared_get prop_not_implemented_get
2014-07-02 13:09:14 +04:00
Add lv_layout_and_type fn, lv_layout and lv_type reporting fields.
The lv_layout and lv_type fields together help with LV identification.
We can do basic identification using the lv_attr field which provides
very condensed view. In contrast to that, the new lv_layout and lv_type
fields provide more detialed information on exact layout and type used
for LVs.
For top-level LVs which are pure types not combined with any
other LV types, the lv_layout value is equal to lv_type value.
For non-top-level LVs which may be combined with other types,
the lv_layout describes the underlying layout used, while the
lv_type describes the use/type/usage of the LV.
These two new fields are both string lists so selection (-S/--select)
criteria can be defined using the list operators easily:
[] for strict matching
{} for subset matching.
For example, let's consider this:
$ lvs -a -o name,vg_name,lv_attr,layout,type
LV VG Attr Layout Type
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
pool vg twi-a-tz-- pool,thin pool,thin
[pool_tdata] vg rwi-aor--- level10,raid data,pool,thin
[pool_tdata_rimage_0] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_1] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_2] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_3] vg iwi-aor--- linear image,raid
[pool_tdata_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_1] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_2] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_3] vg ewi-aor--- linear metadata,raid
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
[pool_tmeta_rimage_0] vg iwi-aor--- linear image,raid
[pool_tmeta_rimage_1] vg iwi-aor--- linear image,raid
[pool_tmeta_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tmeta_rmeta_1] vg ewi-aor--- linear metadata,raid
thin_snap1 vg Vwi---tz-k thin snapshot,thin
thin_snap2 vg Vwi---tz-k thin snapshot,thin
thin_vol1 vg Vwi-a-tz-- thin thin
thin_vol2 vg Vwi-a-tz-- thin multiple,origin,thin
Which is a situation with thin pool, thin volumes and thin snapshots.
We can see internal 'pool_tdata' volume that makes up thin pool has
actually a level10 raid layout and the internal 'pool_tmeta' has
level1 raid layout. Also, we can see that 'thin_snap1' and 'thin_snap2'
are both thin snapshots while 'thin_vol1' is thin origin (having
multiple snapshots).
Such reporting scheme provides much better base for selection criteria
in addition to providing more detailed information, for example:
$ lvs -a -o name,vg_name,lv_attr,layout,type -S 'type=metadata'
LV VG Attr Layout Type
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
[pool_tdata_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_1] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_2] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_3] vg ewi-aor--- linear metadata,raid
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
[pool_tmeta_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tmeta_rmeta_1] vg ewi-aor--- linear metadata,raid
(selected all LVs which are related to metadata of any type)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={metadata,thin}'
LV VG Attr Layout Type
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs which hold metadata related to thin)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={thin,snapshot}'
LV VG Attr Layout Type
thin_snap1 vg Vwi---tz-k thin snapshot,thin
thin_snap2 vg Vwi---tz-k thin snapshot,thin
(selected all LVs which are thin snapshots)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout=raid'
LV VG Attr Layout Type
[pool_tdata] vg rwi-aor--- level10,raid data,pool,thin
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs with raid layout, any raid layout)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout={raid,level1}'
LV VG Attr Layout Type
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs with raid level1 layout exactly)
And so on...
2014-08-13 12:03:45 +04:00
# define _lv_layout_set prop_not_implemented_set
# define _lv_layout_get prop_not_implemented_get
2014-08-25 11:07:03 +04:00
# define _lv_role_set prop_not_implemented_set
# define _lv_role_get prop_not_implemented_get
2014-07-02 13:09:14 +04:00
# define _lv_initial_image_sync_set prop_not_implemented_set
# define _lv_initial_image_sync_get prop_not_implemented_get
# define _lv_image_synced_get prop_not_implemented_get
# define _lv_image_synced_set prop_not_implemented_set
# define _lv_image_synced_get prop_not_implemented_get
# define _lv_merging_set prop_not_implemented_set
# define _lv_merging_get prop_not_implemented_get
# define _lv_converting_set prop_not_implemented_set
# define _lv_converting_get prop_not_implemented_get
# define _lv_permissions_set prop_not_implemented_set
# define _lv_permissions_get prop_not_implemented_get
# define _lv_allocation_policy_set prop_not_implemented_set
# define _lv_allocation_policy_get prop_not_implemented_get
# define _lv_allocation_locked_set prop_not_implemented_set
# define _lv_allocation_locked_get prop_not_implemented_get
2014-07-09 16:28:50 +04:00
# define _lv_active_locally_set prop_not_implemented_set
# define _lv_active_locally_get prop_not_implemented_get
# define _lv_active_remotely_set prop_not_implemented_set
# define _lv_active_remotely_get prop_not_implemented_get
# define _lv_active_exclusively_set prop_not_implemented_set
# define _lv_active_exclusively_get prop_not_implemented_get
2014-07-02 13:09:14 +04:00
# define _lv_fixed_minor_set prop_not_implemented_set
# define _lv_fixed_minor_get prop_not_implemented_get
# define _lv_merge_failed_set prop_not_implemented_set
# define _lv_merge_failed_get prop_not_implemented_get
# define _lv_snapshot_invalid_set prop_not_implemented_set
# define _lv_snapshot_invalid_get prop_not_implemented_get
# define _lv_suspended_set prop_not_implemented_set
# define _lv_suspended_get prop_not_implemented_get
# define _lv_live_table_set prop_not_implemented_set
# define _lv_live_table_get prop_not_implemented_get
# define _lv_inactive_table_set prop_not_implemented_set
# define _lv_inactive_table_get prop_not_implemented_get
# define _lv_device_open_set prop_not_implemented_set
# define _lv_device_open_get prop_not_implemented_get
# define _lv_health_status_set prop_not_implemented_set
# define _lv_health_status_get prop_not_implemented_get
# define _lv_skip_activation_set prop_not_implemented_set
# define _lv_skip_activation_get prop_not_implemented_get
2016-02-18 15:19:25 +03:00
# define _lv_check_needed_set prop_not_implemented_set
# define _lv_check_needed_get prop_not_implemented_get
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.
2021-04-02 01:20:00 +03:00
# define _lv_autoactivation_set prop_not_implemented_set
# define _lv_autoactivation_get prop_not_implemented_get
2016-03-01 17:23:43 +03:00
# define _lv_historical_set prop_not_implemented_set
# define _lv_historical_get prop_not_implemented_get
2014-07-02 13:09:14 +04:00
2014-10-24 15:39:56 +04:00
# define _cache_total_blocks_set prop_not_implemented_set
# define _cache_total_blocks_get prop_not_implemented_get
# define _cache_used_blocks_set prop_not_implemented_set
# define _cache_used_blocks_get prop_not_implemented_get
# define _cache_dirty_blocks_set prop_not_implemented_set
# define _cache_dirty_blocks_get prop_not_implemented_get
# define _cache_read_hits_set prop_not_implemented_set
# define _cache_read_hits_get prop_not_implemented_get
# define _cache_read_misses_set prop_not_implemented_set
# define _cache_read_misses_get prop_not_implemented_get
# define _cache_write_hits_set prop_not_implemented_set
# define _cache_write_hits_get prop_not_implemented_get
# define _cache_write_misses_set prop_not_implemented_set
# define _cache_write_misses_get prop_not_implemented_get
2020-01-31 20:52:49 +03:00
# define _writecache_total_blocks_set prop_not_implemented_set
# define _writecache_total_blocks_get prop_not_implemented_get
# define _writecache_free_blocks_set prop_not_implemented_set
# define _writecache_free_blocks_get prop_not_implemented_get
# define _writecache_writeback_blocks_set prop_not_implemented_set
# define _writecache_writeback_blocks_get prop_not_implemented_get
# define _writecache_error_set prop_not_implemented_set
# define _writecache_error_get prop_not_implemented_get
2022-02-22 01:09:57 +03:00
# define _writecache_block_size_set prop_not_implemented_set
# define _writecache_block_size_get prop_not_implemented_get
2020-01-31 20:52:49 +03:00
2019-10-04 18:02:20 +03:00
# define _vdo_operating_mode_set prop_not_implemented_set
# define _vdo_operating_mode_get prop_not_implemented_get
# define _vdo_compression_state_set prop_not_implemented_set
# define _vdo_compression_state_get prop_not_implemented_get
# define _vdo_index_state_set prop_not_implemented_set
# define _vdo_index_state_get prop_not_implemented_get
# define _vdo_used_size_set prop_not_implemented_set
# define _vdo_used_size_get prop_not_implemented_get
# define _vdo_saving_percent_set prop_not_implemented_set
# define _vdo_saving_percent_get prop_not_implemented_get
# define _vdo_compression_set prop_not_implemented_set
# define _vdo_compression_get prop_not_implemented_get
# define _vdo_deduplication_set prop_not_implemented_set
# define _vdo_deduplication_get prop_not_implemented_get
# define _vdo_use_metadata_hints_set prop_not_implemented_set
# define _vdo_use_metadata_hints_get prop_not_implemented_get
# define _vdo_minimum_io_size_set prop_not_implemented_set
# define _vdo_minimum_io_size_get prop_not_implemented_get
# define _vdo_block_map_cache_size_set prop_not_implemented_set
# define _vdo_block_map_cache_size_get prop_not_implemented_get
# define _vdo_block_map_era_length_set prop_not_implemented_set
# define _vdo_block_map_era_length_get prop_not_implemented_get
# define _vdo_use_sparse_index_set prop_not_implemented_set
# define _vdo_use_sparse_index_get prop_not_implemented_get
# define _vdo_index_memory_size_set prop_not_implemented_set
# define _vdo_index_memory_size_get prop_not_implemented_get
# define _vdo_slab_size_set prop_not_implemented_set
# define _vdo_slab_size_get prop_not_implemented_get
# define _vdo_ack_threads_set prop_not_implemented_set
# define _vdo_ack_threads_get prop_not_implemented_get
# define _vdo_bio_threads_set prop_not_implemented_set
# define _vdo_bio_threads_get prop_not_implemented_get
# define _vdo_bio_rotation_set prop_not_implemented_set
# define _vdo_bio_rotation_get prop_not_implemented_get
# define _vdo_cpu_threads_set prop_not_implemented_set
# define _vdo_cpu_threads_get prop_not_implemented_get
# define _vdo_hash_zone_threads_set prop_not_implemented_set
# define _vdo_hash_zone_threads_get prop_not_implemented_get
# define _vdo_logical_threads_set prop_not_implemented_set
# define _vdo_logical_threads_get prop_not_implemented_get
# define _vdo_physical_threads_set prop_not_implemented_set
# define _vdo_physical_threads_get prop_not_implemented_get
# define _vdo_max_discard_set prop_not_implemented_set
# define _vdo_max_discard_get prop_not_implemented_get
# define _vdo_write_policy_set prop_not_implemented_set
# define _vdo_write_policy_get prop_not_implemented_get
# define _vdo_header_size_set prop_not_implemented_set
# define _vdo_header_size_get prop_not_implemented_get
2010-08-20 16:44:58 +04:00
/* LV */
2015-09-21 13:23:03 +03:00
GET_LV_STR_PROPERTY_FN ( lv_uuid , lv_uuid_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_uuid_set prop_not_implemented_set
2010-10-21 18:49:10 +04:00
GET_LV_STR_PROPERTY_FN ( lv_name , lv_name_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_name_set prop_not_implemented_set
2014-07-02 20:24:05 +04:00
GET_LV_STR_PROPERTY_FN ( lv_full_name , lv_fullname_dup ( lv - > vg - > vgmem , lv ) )
# define _lv_full_name_set prop_not_implemented_set
2010-10-12 20:11:34 +04:00
GET_LV_STR_PROPERTY_FN ( lv_path , lv_path_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_path_set prop_not_implemented_set
2014-07-02 20:24:05 +04:00
GET_LV_STR_PROPERTY_FN ( lv_dm_path , lv_dmpath_dup ( lv - > vg - > vgmem , lv ) )
# define _lv_dm_path_set prop_not_implemented_set
2014-07-04 02:49:34 +04:00
GET_LV_STR_PROPERTY_FN ( lv_parent , lv_parent_dup ( lv - > vg - > vgmem , lv ) )
# define _lv_parent_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_STR_PROPERTY_FN ( lv_attr , lv_attr_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_attr_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_major , lv - > major )
2013-07-12 21:09:44 +04:00
# define _lv_major_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_minor , lv - > minor )
2015-01-21 12:43:40 +03:00
# define _lv_when_full_get prop_not_implemented_get
# define _lv_when_full_set prop_not_implemented_set
2013-07-12 21:09:44 +04:00
# define _lv_minor_set prop_not_implemented_set
2010-10-21 18:49:31 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_read_ahead , lv - > read_ahead * SECTOR_SIZE )
2013-07-12 21:09:44 +04:00
# define _lv_read_ahead_set prop_not_implemented_set
2010-10-12 20:12:33 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_kernel_major , lv_kernel_major ( lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_kernel_major_set prop_not_implemented_set
2010-10-12 20:12:33 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_kernel_minor , lv_kernel_minor ( lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_kernel_minor_set prop_not_implemented_set
2010-10-21 18:49:31 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_kernel_read_ahead , lv_kernel_read_ahead ( lv ) * SECTOR_SIZE )
2013-07-12 21:09:44 +04:00
# define _lv_kernel_read_ahead_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_size , lv - > size * SECTOR_SIZE )
2013-07-12 21:09:44 +04:00
# define _lv_size_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_NUM_PROPERTY_FN ( seg_count , dm_list_size ( & lv - > segments ) )
2013-07-12 21:09:44 +04:00
# define _seg_count_set prop_not_implemented_set
2010-10-21 18:49:20 +04:00
GET_LV_STR_PROPERTY_FN ( origin , lv_origin_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _origin_set prop_not_implemented_set
2015-09-21 13:44:29 +03:00
GET_LV_STR_PROPERTY_FN ( origin_uuid , lv_origin_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _origin_uuid_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_LV_NUM_PROPERTY_FN ( origin_size , ( SECTOR_SIZE * lv_origin_size ( lv ) ) )
2013-07-12 21:09:44 +04:00
# define _origin_size_set prop_not_implemented_set
2015-04-24 15:19:23 +03:00
# define _lv_ancestors_set prop_not_implemented_set
# define _lv_ancestors_get prop_not_implemented_get
2016-03-01 17:24:40 +03:00
# define _lv_full_ancestors_set prop_not_implemented_set
# define _lv_full_ancestors_get prop_not_implemented_get
2015-04-24 15:19:23 +03:00
# define _lv_descendants_set prop_not_implemented_set
# define _lv_descendants_get prop_not_implemented_get
2016-03-01 17:24:48 +03:00
# define _lv_full_descendants_set prop_not_implemented_set
# define _lv_full_descendants_get prop_not_implemented_get
2010-12-15 02:20:58 +03:00
GET_LV_NUM_PROPERTY_FN ( snap_percent , _snap_percent ( lv ) )
2013-07-12 21:09:44 +04:00
# define _snap_percent_set prop_not_implemented_set
2010-12-15 02:20:58 +03:00
GET_LV_NUM_PROPERTY_FN ( copy_percent , _copy_percent ( lv ) )
2013-07-12 21:09:44 +04:00
# define _copy_percent_set prop_not_implemented_set
2012-10-24 06:19:27 +04:00
GET_LV_NUM_PROPERTY_FN ( sync_percent , _copy_percent ( lv ) )
2013-07-12 21:09:44 +04:00
# define _sync_percent_set prop_not_implemented_set
2013-07-19 04:30:02 +04:00
GET_LV_NUM_PROPERTY_FN ( raid_mismatch_count , _raidmismatchcount ( lv ) )
# define _raid_mismatch_count_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN ( raid_write_behind , _raidwritebehind ( lv ) )
# define _raid_write_behind_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN ( raid_min_recovery_rate , _raidminrecoveryrate ( lv ) )
# define _raid_min_recovery_rate_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN ( raid_max_recovery_rate , _raidmaxrecoveryrate ( lv ) )
# define _raid_max_recovery_rate_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN ( raid_sync_action , _raidsyncaction ( lv ) )
# define _raid_sync_action_set prop_not_implemented_set
2020-09-01 22:39:34 +03:00
GET_LV_STR_PROPERTY_FN ( raidintegritymode , _raidintegritymode ( lv ) )
# define _raidintegritymode_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN ( raidintegrityblocksize , _raidintegrityblocksize ( lv ) )
# define _raidintegrityblocksize_set prop_not_implemented_set
2020-09-02 00:15:31 +03:00
GET_LV_NUM_PROPERTY_FN ( integritymismatches , _integritymismatches ( lv ) )
# define _integritymismatches_set prop_not_implemented_set
2010-10-12 20:12:02 +04:00
GET_LV_STR_PROPERTY_FN ( move_pv , lv_move_pv_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _move_pv_set prop_not_implemented_set
2015-09-21 15:01:41 +03:00
GET_LV_STR_PROPERTY_FN ( move_pv_uuid , lv_move_pv_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _move_pv_uuid_set prop_not_implemented_set
2010-10-12 20:12:18 +04:00
GET_LV_STR_PROPERTY_FN ( convert_lv , lv_convert_lv_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _convert_lv_set prop_not_implemented_set
2015-09-21 15:10:21 +03:00
GET_LV_STR_PROPERTY_FN ( convert_lv_uuid , lv_convert_lv_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _convert_lv_uuid_set prop_not_implemented_set
2010-10-12 20:11:20 +04:00
GET_LV_STR_PROPERTY_FN ( lv_tags , lv_tags_dup ( lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_tags_set prop_not_implemented_set
2010-10-12 20:12:50 +04:00
GET_LV_STR_PROPERTY_FN ( mirror_log , lv_mirror_log_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _mirror_log_set prop_not_implemented_set
2015-09-21 14:16:48 +03:00
GET_LV_STR_PROPERTY_FN ( mirror_log_uuid , lv_mirror_log_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _mirror_log_uuid_set prop_not_implemented_set
2013-07-19 04:30:02 +04:00
GET_LV_STR_PROPERTY_FN ( lv_modules , lv_modules_dup ( lv - > vg - > vgmem , lv ) )
# define _lv_modules_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_STR_PROPERTY_FN ( data_lv , lv_data_lv_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _data_lv_set prop_not_implemented_set
2015-09-21 14:07:28 +03:00
GET_LV_STR_PROPERTY_FN ( data_lv_uuid , lv_data_lv_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _data_lv_uuid_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_STR_PROPERTY_FN ( metadata_lv , lv_metadata_lv_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _metadata_lv_set prop_not_implemented_set
2015-09-21 13:59:08 +03:00
GET_LV_STR_PROPERTY_FN ( metadata_lv_uuid , lv_metadata_lv_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _metadata_lv_uuid_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_STR_PROPERTY_FN ( pool_lv , lv_pool_lv_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _pool_lv_set prop_not_implemented_set
2015-09-21 13:28:58 +03:00
GET_LV_STR_PROPERTY_FN ( pool_lv_uuid , lv_pool_lv_uuid_dup ( lv - > vg - > vgmem , lv ) )
# define _pool_lv_uuid_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_NUM_PROPERTY_FN ( data_percent , _data_percent ( lv ) )
2013-07-12 21:09:44 +04:00
# define _data_percent_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_NUM_PROPERTY_FN ( metadata_percent , _metadata_percent ( lv ) )
2013-07-12 21:09:44 +04:00
# define _metadata_percent_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_NUM_PROPERTY_FN ( lv_metadata_size , lv_metadata_size ( lv ) * SECTOR_SIZE )
2013-07-12 21:09:44 +04:00
# define _lv_metadata_size_set prop_not_implemented_set
2016-03-01 17:23:23 +03:00
GET_LV_STR_PROPERTY_FN ( lv_time , lv_creation_time_dup ( lv - > vg - > vgmem , lv , 0 ) )
2013-07-12 21:09:44 +04:00
# define _lv_time_set prop_not_implemented_set
2016-03-01 17:23:23 +03:00
GET_LV_STR_PROPERTY_FN ( lv_time_removed , lv_removal_time_dup ( lv - > vg - > vgmem , lv , 0 ) )
# define _lv_time_removed_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LV_STR_PROPERTY_FN ( lv_host , lv_host_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_host_set prop_not_implemented_set
2013-04-25 14:12:05 +04:00
GET_LV_STR_PROPERTY_FN ( lv_active , lv_active_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_active_set prop_not_implemented_set
2013-07-02 16:34:52 +04:00
GET_LV_STR_PROPERTY_FN ( lv_profile , lv_profile_dup ( lv - > vg - > vgmem , lv ) )
2013-07-12 21:09:44 +04:00
# define _lv_profile_set prop_not_implemented_set
2015-03-05 23:00:44 +03:00
GET_LV_STR_PROPERTY_FN ( lv_lockargs , lv_lock_args_dup ( lv - > vg - > vgmem , lv ) )
# define _lv_lockargs_set prop_not_implemented_set
2010-08-20 16:44:58 +04:00
/* VG */
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_fmt , vg_fmt_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_fmt_set prop_not_implemented_set
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_uuid , vg_uuid_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_uuid_set prop_not_implemented_set
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_name , vg_name_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_name_set prop_not_implemented_set
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_attr , vg_attr_dup ( vg - > vgmem , vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_attr_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_size , ( SECTOR_SIZE * vg_size ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_size_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_free , ( SECTOR_SIZE * vg_free ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_free_set prop_not_implemented_set
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_sysid , vg_system_id_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_sysid_set prop_not_implemented_set
2014-10-24 21:29:04 +04:00
GET_VG_STR_PROPERTY_FN ( vg_systemid , vg_system_id_dup ( vg ) )
# define _vg_systemid_set prop_not_implemented_set
2016-03-08 22:50:22 +03:00
GET_VG_STR_PROPERTY_FN ( vg_lock_type , vg_lock_type_dup ( vg ) )
# define _vg_lock_type_set prop_not_implemented_set
GET_VG_STR_PROPERTY_FN ( vg_lock_args , vg_lock_args_dup ( vg ) )
# define _vg_lock_args_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_extent_size , ( SECTOR_SIZE * vg - > extent_size ) )
2013-07-12 21:09:44 +04:00
# define _vg_extent_size_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_extent_count , vg - > extent_count )
2013-07-12 21:09:44 +04:00
# define _vg_extent_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_free_count , vg - > free_count )
2013-07-12 21:09:44 +04:00
# define _vg_free_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( max_lv , vg - > max_lv )
2013-07-12 21:09:44 +04:00
# define _max_lv_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( max_pv , vg - > max_pv )
2013-07-12 21:09:44 +04:00
# define _max_pv_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( pv_count , vg - > pv_count )
2013-07-12 21:09:44 +04:00
# define _pv_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( lv_count , ( vg_visible_lvs ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _lv_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( snap_count , ( snapshot_count ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _snap_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_seqno , vg - > seqno )
2013-07-12 21:09:44 +04:00
# define _vg_seqno_set prop_not_implemented_set
2010-09-30 18:08:58 +04:00
GET_VG_STR_PROPERTY_FN ( vg_tags , vg_tags_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_tags_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_mda_count , ( vg_mda_count ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_mda_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_mda_used_count , ( vg_mda_used_count ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_mda_used_count_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_mda_free , ( SECTOR_SIZE * vg_mda_free ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_mda_free_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_mda_size , ( SECTOR_SIZE * vg_mda_size ( vg ) ) )
2013-07-12 21:09:44 +04:00
# define _vg_mda_size_set prop_not_implemented_set
2010-09-30 18:08:46 +04:00
GET_VG_NUM_PROPERTY_FN ( vg_mda_copies , ( vg_mda_copies ( vg ) ) )
2010-11-17 22:15:10 +03:00
SET_VG_NUM_PROPERTY_FN ( vg_mda_copies , vg_set_mda_copies )
2013-07-02 16:34:52 +04:00
GET_VG_STR_PROPERTY_FN ( vg_profile , vg_profile_dup ( vg ) )
2013-07-12 21:09:44 +04:00
# define _vg_profile_set prop_not_implemented_set
2015-10-09 17:20:29 +03:00
GET_VG_NUM_PROPERTY_FN ( vg_missing_pv_count , vg_missing_pv_count ( vg ) )
# define _vg_missing_pv_count_set prop_not_implemented_set
2010-08-20 16:44:58 +04:00
/* LVSEG */
2011-03-05 15:14:00 +03:00
GET_LVSEG_STR_PROPERTY_FN ( segtype , lvseg_segtype_dup ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2013-07-12 21:09:44 +04:00
# define _segtype_set prop_not_implemented_set
2017-03-01 20:50:35 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( data_copies , lvseg - > data_copies )
# define _data_copies_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN ( reshape_len , lvseg - > reshape_len )
# define _reshape_len_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN ( reshape_len_le , lvseg - > reshape_len )
# define _reshape_len_le_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN ( data_offset , lvseg - > data_offset )
# define _data_offset_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN ( new_data_offset , lvseg - > data_offset )
# define _new_data_offset_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN ( parity_chunks , lvseg - > data_offset )
# define _parity_chunks_set prop_not_implemented_set
2010-11-17 23:08:14 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( stripes , lvseg - > area_count )
2013-07-12 21:09:44 +04:00
# define _stripes_set prop_not_implemented_set
2017-03-01 21:30:52 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( data_stripes , lvseg - > area_count )
2017-03-01 20:50:35 +03:00
# define _data_stripes_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( stripe_size , ( SECTOR_SIZE * lvseg - > stripe_size ) )
2013-07-12 21:09:44 +04:00
# define _stripe_size_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( region_size , ( SECTOR_SIZE * lvseg - > region_size ) )
2013-07-12 21:09:44 +04:00
# define _region_size_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( chunk_size , ( SECTOR_SIZE * lvseg_chunksize ( lvseg ) ) )
2013-07-12 21:09:44 +04:00
# define _chunk_size_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( thin_count , dm_list_size ( & lvseg - > lv - > segs_using_this_lv ) )
2013-07-12 21:09:44 +04:00
# define _thin_count_set prop_not_implemented_set
2017-03-03 22:46:13 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( zero , ( lvseg - > zero_new_blocks = = THIN_ZERO_YES ) )
2013-07-12 21:09:44 +04:00
# define _zero_set prop_not_implemented_set
2012-01-19 19:34:32 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( transaction_id , lvseg - > transaction_id )
2013-07-12 21:09:44 +04:00
# define _transaction_id_set prop_not_implemented_set
2013-11-11 13:05:45 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( thin_id , lvseg - > device_id )
# define _thin_id_set prop_not_implemented_set
2012-11-27 14:02:49 +04:00
GET_LVSEG_STR_PROPERTY_FN ( discards , lvseg_discards_dup ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2013-07-12 21:09:44 +04:00
# define _discards_set prop_not_implemented_set
2016-01-14 18:54:12 +03:00
GET_LVSEG_STR_PROPERTY_FN ( kernel_discards , lvseg_kernel_discards_dup ( lvseg - > lv - > vg - > vgmem , lvseg ) )
# define _kernel_discards_set prop_not_implemented_set
2016-03-08 22:50:22 +03:00
GET_LVSEG_STR_PROPERTY_FN ( cache_mode , lvseg_cachemode_dup ( lvseg - > lv - > vg - > vgmem , lvseg ) )
# define _cache_mode_set prop_not_implemented_set
2017-02-23 19:41:59 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( cache_metadata_format , lvseg - > cache_metadata_format )
# define _cache_metadata_format_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( seg_start , ( SECTOR_SIZE * lvseg_start ( lvseg ) ) )
2013-07-12 21:09:44 +04:00
# define _seg_start_set prop_not_implemented_set
2010-11-17 23:08:14 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( seg_start_pe , lvseg - > le )
2013-07-12 21:09:44 +04:00
# define _seg_start_pe_set prop_not_implemented_set
2010-11-25 17:39:02 +03:00
GET_LVSEG_NUM_PROPERTY_FN ( seg_size , ( SECTOR_SIZE * lvseg_size ( lvseg ) ) )
2013-07-12 21:09:44 +04:00
# define _seg_size_set prop_not_implemented_set
2013-09-24 00:50:14 +04:00
GET_LVSEG_NUM_PROPERTY_FN ( seg_size_pe , lvseg - > len )
# define _seg_size_pe_set prop_not_implemented_set
2010-11-17 23:08:14 +03:00
GET_LVSEG_STR_PROPERTY_FN ( seg_tags , lvseg_tags_dup ( lvseg ) )
2013-07-12 21:09:44 +04:00
# define _seg_tags_set prop_not_implemented_set
2016-01-19 14:24:02 +03:00
GET_LVSEG_STR_PROPERTY_FN ( seg_pe_ranges , lvseg_seg_pe_ranges_str ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2013-07-12 21:09:44 +04:00
# define _seg_pe_ranges_set prop_not_implemented_set
2016-01-19 15:51:11 +03:00
GET_LVSEG_STR_PROPERTY_FN ( seg_le_ranges , lvseg_seg_le_ranges_str ( lvseg - > lv - > vg - > vgmem , lvseg ) )
# define _seg_le_ranges_set prop_not_implemented_set
2016-01-19 14:24:02 +03:00
GET_LVSEG_STR_PROPERTY_FN ( seg_metadata_le_ranges , lvseg_seg_metadata_le_ranges_str ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2015-10-02 12:09:28 +03:00
# define _seg_metadata_le_ranges_set prop_not_implemented_set
2016-01-19 14:24:02 +03:00
GET_LVSEG_STR_PROPERTY_FN ( devices , lvseg_devices_str ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2013-07-12 21:09:44 +04:00
# define _devices_set prop_not_implemented_set
2016-01-19 14:24:02 +03:00
GET_LVSEG_STR_PROPERTY_FN ( metadata_devices , lvseg_metadata_devices_str ( lvseg - > lv - > vg - > vgmem , lvseg ) )
2015-10-02 12:09:28 +03:00
# define _metadata_devices_set prop_not_implemented_set
2013-07-19 04:30:02 +04:00
GET_LVSEG_STR_PROPERTY_FN ( seg_monitor , lvseg_monitor_dup ( lvseg - > lv - > vg - > vgmem , lvseg ) )
# define _seg_monitor_set prop_not_implemented_set
2010-08-20 16:44:58 +04:00
2014-12-15 22:48:05 +03:00
# define _cache_policy_get prop_not_implemented_get
# define _cache_policy_set prop_not_implemented_set
# define _cache_settings_get prop_not_implemented_get
# define _cache_settings_set prop_not_implemented_set
report: add kernel_cache_settings field
Existing cache_settings field displays the settings which are
saved in metadata. Add new kernel_cache_settings fields to display
the settings which are currently used by kernel, including fields
for which default values are used.
This way users have complete view of the set of cache settings
supported (and which they can set) and their values which are used
at the moment by kernel.
For example:
$ lvs -o name,cache_policy,cache_settings,kernel_cache_settings vg
LV Cache Policy Cache Settings KCache Settings
cached1 mq migration_threshold=1024,write_promote_adjustment=2 migration_threshold=1024,random_threshold=4,sequential_threshold=512,discard_promote_adjustment=1,read_promote_adjustment=4,write_promote_adjustment=2
cached2 smq migration_threshold=1024 migration_threshold=1024
cached3 smq migration_threshold=2048
2016-01-18 16:32:17 +03:00
# define _kernel_cache_settings_get prop_not_implemented_get
# define _kernel_cache_settings_set prop_not_implemented_set
2016-03-02 13:12:46 +03:00
# define _kernel_cache_policy_get prop_not_implemented_get
# define _kernel_cache_policy_set prop_not_implemented_set
2017-02-23 19:41:59 +03:00
# define _kernel_metadata_format_get prop_not_implemented_get
# define _kernel_metadata_format_set prop_not_implemented_set
2014-12-15 22:48:05 +03:00
2010-08-20 16:44:58 +04:00
/* PVSEG */
2010-11-17 23:11:27 +03:00
GET_PVSEG_NUM_PROPERTY_FN ( pvseg_start , pvseg - > pe )
2013-07-12 21:09:44 +04:00
# define _pvseg_start_set prop_not_implemented_set
2012-11-29 13:29:03 +04:00
GET_PVSEG_NUM_PROPERTY_FN ( pvseg_size , ( SECTOR_SIZE * pvseg - > len ) )
2013-07-12 21:09:44 +04:00
# define _pvseg_size_set prop_not_implemented_set
2010-08-20 16:44:58 +04:00
2014-05-29 11:37:22 +04:00
2010-08-20 16:44:58 +04:00
struct lvm_property_type _properties [ ] = {
# include "columns.h"
2015-05-04 22:51:41 +03:00
{ 0 , " " , 0 , 0 , 0 , 0 , { . integer = 0 } , prop_not_implemented_get , prop_not_implemented_set } ,
2010-08-20 16:44:58 +04:00
} ;
# undef STR
# undef NUM
2014-07-02 13:09:14 +04:00
# undef BIN
2014-05-29 11:37:22 +04:00
# undef SIZ
2014-06-17 20:14:38 +04:00
# undef PCT
2014-05-29 11:41:36 +04:00
# undef STR_LIST
2015-05-04 22:51:41 +03:00
# undef SNUM
2010-08-20 16:44:58 +04:00
# undef FIELD
2010-11-17 23:08:14 +03:00
int lvseg_get_property ( const struct lv_segment * lvseg ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_get_property ( _properties , lvseg , prop , SEGS ) ;
2010-11-17 23:08:14 +03:00
}
2010-10-21 22:51:16 +04:00
int lv_get_property ( const struct logical_volume * lv ,
struct lvm_property_type * prop )
{
2015-01-30 13:13:49 +03:00
return prop_get_property ( _properties , lv , prop , LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS ) ;
2010-10-21 22:51:16 +04:00
}
2010-09-30 18:09:45 +04:00
int vg_get_property ( const struct volume_group * vg ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_get_property ( _properties , vg , prop , VGS ) ;
2010-09-30 18:09:45 +04:00
}
2010-11-17 23:11:27 +03:00
int pvseg_get_property ( const struct pv_segment * pvseg ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_get_property ( _properties , pvseg , prop , PVSEGS ) ;
2010-11-17 23:11:27 +03:00
}
2010-09-30 18:09:45 +04:00
int pv_get_property ( const struct physical_volume * pv ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_get_property ( _properties , pv , prop , PVS | LABEL ) ;
2010-09-30 18:09:45 +04:00
}
2010-11-17 22:15:10 +03:00
int lv_set_property ( struct logical_volume * lv ,
struct lvm_property_type * prop )
{
2015-01-30 13:13:49 +03:00
return prop_set_property ( _properties , lv , prop , LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS ) ;
2010-11-17 22:15:10 +03:00
}
int vg_set_property ( struct volume_group * vg ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_set_property ( _properties , vg , prop , VGS ) ;
2010-11-17 22:15:10 +03:00
}
int pv_set_property ( struct physical_volume * pv ,
struct lvm_property_type * prop )
{
2013-07-12 21:09:44 +04:00
return prop_set_property ( _properties , pv , prop , PVS | LABEL ) ;
2010-11-17 22:15:10 +03:00
}