RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1240538 - Add direct support for time in LVM reports and LVM selection criteria
Summary: Add direct support for time in LVM reports and LVM selection criteria
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.2
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1163895
TreeView+ depends on / blocked
 
Reported: 2015-07-07 08:17 UTC by Peter Rajnoha
Modified: 2023-03-08 07:27 UTC (History)
10 users (show)

Fixed In Version: lvm2-2.02.125-1.el7
Doc Type: Bug Fix
Doc Text:
There are several changes in this release to provide better support for time reporting fields and selection based on these time fields in LVM2: - The lv_time reporting field is now recognized as proper time field, not just a string as it was before. - There's a new report/time_format lvm.conf setting to set the exact time format for time reporting fields (currently only lv_time field). See comments for report/time_format in /etc/lvm/lvm.conf file for more information about the formatting options that are supported. - Also, users can use time expressions in their selection criteria provided by -S|--select now. It's possible to define complete time specification (YYYY-MM-DD) or its subset: Recognized operators: "since" as an alias for ">=" "after" as an alias for ">" "until" as an alias for "<=" "before" as an alias for "<" The time specification: 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 Alternatively, time can be expressed in the form which resembles to human language more: Then using free-form time expressions: - weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat") - labels for points in time ("noon", "midnight") - labels for a day relative to current day ("today", "yesterday") - points back in time with relative offset from today (N is a number) ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago") ( "N" "secs"/"mins"/"hrs" ... "ago") ( "N" "s"/"m"/"h" ... "ago") - time specification either in hh:mm:ss format or with AM/PM suffixes - month names ("January" - "December" or abbreviated as "Jan" - "Dec")
Clone Of:
Environment:
Last Closed: 2015-11-19 12:46:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2147 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2015-11-19 11:11:07 UTC

Description Peter Rajnoha 2015-07-07 08:17:33 UTC
This is part of solution for original bug #1163895 so all the parts can be properly tested.

This bug is about extending reporting code to support time values and also to support time expressions for selection criteria (the -S/--select option).

Currently, there's only one reporting field which displays time. Before these changes, it was internally represented as string value only which did not allow more advanced matching when such field was used in selection criteria. Before, either the whole string matched or it matched regex. Also we couldn't define time in more natural way (e.g. yesterday, 3 weeks ago...) and we couldn't define time ranges.

We have extended support for time values in reporting and selection code so time is now properly recognized. For better readability of selection expressions, we have also added aliases for comparison operators that can be used with time values:

  "since" as an alias for ">="
  "after" as an alias for ">"
  "until" as an alias for "<="
  "before" as an alias for "<"

There are two basic ways how to define time so that LVM recognizes it:

===

A) Subset of strict stanardized format (subset of ISO 8601) which is directly recognized in libdevmapper for new DM_REPORT_FIELD_TYPE_TIME type:

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
  (No support for timezone names here as they may be ambiguous!)

Note:
The full date/time specification is YYYY-MM-DD hh:mm:ss. Users are able to leave date/time parts from right to left. Whenever these parts are left out, a range is assumed automatically with second granularity. For example:

  "2015-07-07 9:51" means range of "2015-07-07 9:51:00" - "2015-07-07 9:51:59"
  "2015-07" means range of "2015-07-01 0:00:00" - "2015-07-31 23:59:59"
  "2015" means range of "2015-01-01 0:00:00" - "2015-12-31 23:59:59"
  ...

When used in selection criteria:
  lvs -S 'time since "2015-07-07 9:51"'
  lvs -S 'time = "2015-07""
  lvs -S 'time = "2015"'
  ...

===

B) An extension for date/time recognition (currently for the lv_time field only) which allows more free-form specification and it can be combined with these entities:

  - weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat")
  - labels for points in time ("noon", "midnight")
  - labels for a day relative to current day ("today", "yesterday")
  - points back in time with relative offset from today (N is a number)
    ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago")
    ( "N" "secs"/"mins"/"hrs" ... "ago")
    ( "N" "s"/"m"/"h" ... "ago")
  - time specification either in hh:mm:ss format or with AM/PM suffixes
  - month names ("January" - "December" or abbreviated as "Jan" - "Dec")

For example:
   lvs -S 'time since "yesterday 9AM"'
   lvs -S 'time since "Feb 3 years 2 months ago"'
   lvs -S 'time = "February 2015"'
   lvs -S 'time since "Jan 15 2015" && time until yesterday'
   lvs -S 'time since "today 6AM"'
   ...and lots of other combinations from the set above (LVM will error out with a proper error message pointing to the problematic part if time was not recognized properly or if it finds the time expression ambiguous).

=======


We have also provided new report/time_format lvm.conf option with which it's possible to define the way the time is displayed for time reporting fields. The format is described in lvm.conf comments (it's actually a restricted subset of formatting sequences which is also known from strftime function [man 3 strftime] and date command [man 1 date]).

For example:
  $ lvmconfig --type full report/time_format
  time_format="%a %Y-%m-%d %T %z %Z [%s]"

  $lvs -o name,time vg/lvol1
  LV    Time                                           
  lvol1 Tue 2015-07-07 09:25:24 +0200 CEST [1436253924]

Comment 7 errata-xmlrpc 2015-11-19 12:46:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2147.html


Note You need to log in before you can comment on or make changes to this bug.