summaryrefslogtreecommitdiff
path: root/lib/properties
Commit message (Collapse)AuthorAgeFilesLines
* build: Don't generate symlinks in include/ dirJoe Thornber2018-05-141-2/+2
| | | | | | | As we start refactoring the code to break dependencies (see doc/refactoring.txt), I want us to use full paths in the includes (eg, #include "base/data-struct/list.h"). This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in metadata/ from base/
* doc: change fsf addressZdenek Kabelac2016-01-212-2/+2
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* report: add support for time (basic)Peter Rajnoha2015-06-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for time values used in reporting fields. The raw values are always stored as number of seconds since epoch. The support that comes with this patch is the basic one which allows only for recognition of strictly formatted date and time in selection criteria (the format follows a subset of formats defined by ISO 8601): date time timezone date: YYYY-MM-DD (or shortly YYYYMMDD) YYYY-MM (shortly YYYYMM), auto DD=1 YYYY, auto MM=01 and DD=01 time: hh:mm:ss (or shortly hhmmss) hh:mm (or shortly hhmm), auto ss=0 hh (or shortly hh), auto mm=0, auto ss=0 timezone (always with + or - sign): +hh:mm or -hh:mm (or shortly +hhmm or -hhmm) +hh or -hh Or directly the time (number of seconds) since Epoch (1970-01-01 00:00:00 UTC) when the number value is prefixed by "@": @number_of_seconds_since_epoch This patch also adds aliases for comparison operators used together with time values which are more intuitive to use: since (as alias for >=) after (as alias for >) until (as alias for <=) before (as alias for <) For example: $ lvmconfig --type full report/time_format time_format="%Y-%m-%d %T %z %Z [%s]" $ lvs -o name,time vg LV Time lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541] lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543] lvol2 2015-04-26 14:52:20 +0200 CEST [1430052740] lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743] $ lvs vg -o name,time -S 'time since "2015-04-26 15:00" && time until "2015-06-30"' LV Time lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541] lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543] lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743] $ lvs vg -o name,time -S 'time since "2015-04-26 15:00" && time until "2015-06-30 6:00"' LV Time lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541] lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543] $ lvs vg -o name,time -S 'time since @1435519541' LV Time lvol0 2015-06-28 21:25:41 +0200 CEST [1435519541] lvol1 2015-06-30 03:25:43 +0200 CEST [1435627543] lvol3 2015-06-30 14:52:23 +0200 CEST [1435668743] This is basic time recognition support that is directly a part of libdevmapper. Recognition of more free-form expressions will be a part of subsequent patches.
* lvm2app: Correct missing string propertiesTony Asleson2015-05-061-1/+1
| | | | | | | | | | | | | | | Synopsis: STR_LIST needs to be treated as STR for properties. For any lvm property that was internally 'typed' as a string list we were failing to return a string in the property API. This was due to the fact that for the properties to work the value needs to either be evaulated as a string or a number. This change corrects the macro used to build the memory array of structures so that the string bitfield is set as needed to ensure that the value is a string. https://bugzilla.redhat.com/show_bug.cgi?id=1139920 Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lvm2app: Add signed numerical property valuesTony Asleson2015-05-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently lvm2app properties have the following structure: typedef struct lvm_property_value { uint32_t is_settable:1; uint32_t is_string:1; uint32_t is_integer:1; uint32_t is_valid:1; uint32_t padding:28; union { const char *string; uint64_t integer; } value; } lvm_property_value_t; which assumes that numerical values were in the range of 0 to 2**64-1. However, some of the properties were 'signed', like LV major/minor numbers and some reserved values for properties that represent percentages. Thus when the values were retrieved they were in two's complement notation. So for a -1 major number the API user would get a value of 18446744073709551615. The API user could cast the returned value to an int64_t to handle this, but that requires the API developer to look at the source code and determine when it should be done. This change modifies the return property structure to: typedef struct lvm_property_value { uint32_t is_settable:1; uint32_t is_string:1; uint32_t is_integer:1; uint32_t is_valid:1; uint32_t is_signed:1; uint32_t padding:27; union { const char *string; uint64_t integer; int64_t signed_integer; } value; } lvm_property_value_t; With this addition the API user can interrogate that the value is numerical, (is_integer = 1) and subsequently check if it's signed (is_signed = 1) too. If signed, then the API developer should use the union's signed_integer to avoid casting. This change maintains backwards compatibility as the structure size remains unchanged and integer value remains unchanged. Only the additional bit taken from the pad is utilized. Bugzilla reference: https://bugzilla.redhat.com/show_bug.cgi?id=838257 Signed-off-by: Tony Asleson <tasleson@redhat.com>
* report: add separate fields for PV/VG/LV attributesPeter Rajnoha2014-07-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Physical Volume Fields: pv_allocatable - Whether this device can be used for allocation. pv_exported - Whether this device is exported. pv_missing - Whether this device is missing in system. Volume Group Fields: vg_permissions - VG permissions. vg_extendable - Whether VG is extendable. vg_exported - Whether VG is exported. vg_partial - Whether VG is partial. vg_allocation_policy - VG allocation policy. vg_clustered - Whether VG is clustered. Logical Volume Fields: lv_volume_type - LV volume type. lv_initial_image_sync - Whether mirror/RAID images underwent initial resynchronization. lv_image_synced - Whether mirror/RAID image is synchronized. lv_merging - Whether snapshot LV is being merged to origin. lv_converting - Whether LV is being converted. lv_allocation_policy - LV allocation policy. lv_allocation_locked - Whether LV is locked against allocation changes. lv_fixed_minor - Whether LV has fixed minor number assigned. lv_merge_failed - Whether snapshot merge failed. lv_snapshot_invalid - Whether snapshot LV is invalid. lv_target_type - Kernel target type the LV is related to. lv_health_status - LV health status. lv_skip_activation - Whether LV is skipped on activation. Logical Volume Info Fields lv_permissions - LV permissions. lv_suspended - Whether LV is suspended. lv_live_table - Whether LV has live table present. lv_inactive_table - Whether LV has inactive table present. lv_device_open - Whether LV device is open.
* prop: update FIELD macro to accomodate the differentiation of number, size ↵Peter Rajnoha2014-06-171-1/+1
| | | | | | | | and percent field values The differentiation of the original number field into number, size and percent field types has been introduced with recent changes for report selection support.
* report: select: add support for percent selectionPeter Rajnoha2014-06-171-1/+2
|
* report: select: add DM_REPORT_FIELD_TYPE_STRING_LIST to make a difference ↵Peter Rajnoha2014-06-171-0/+1
| | | | | | | | between STRING and STRING_LIST The {pv,vg,lv,seg}_tags and lv_modules fields are reported as string lists using the new dm_report_field_string_list - so we just pass the list to the fn that takes care of reporting and item sorting itself.
* report: select: add DM_REPORT_FIELD_TYPE_SIZE to make a difference between ↵Peter Rajnoha2014-06-171-0/+1
| | | | | | | | NUMBER and SIZE This makes it easier to check against the fields (following patches for report selection) and check whether size units are allowed or not with the field value.
* lvm2app: Add thin and thin pool lv creationTony Asleson2013-07-121-0/+9
| | | | | | | | | | | | | | Add thin and thin pool lv creation support to lvm library This is Mohan's thinp patch, re-worked to include suggestions from Zdenek and Mohan. Rework of commit 4d5de8322b3a6050def60542b167b46d97b2824d which uses refactored properties handling. Based on work done by M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lib/properties: Common code for handling properties.Tony Asleson2013-07-122-0/+213
The common bits from lib/report/properties.[c|h] have been moved to lib/properties/prop_common.[c|h] to allow re-use of property handling functionality without polluting the report handling functionality. Signed-off-by: Tony Asleson <tasleson@redhat.com>