Fedora Account System
Red Hat Associate
Red Hat Customer
Add new lvm2 report type so it's possible to issue warnings, errors and processing status using reporting infrastructure as an alternative and more enhanced way of displaying messages and status. As such, each warning/error/status message will be logged as one line in report and as a report, it will have several fields which users can choose to display or not, similarly to existing report/<report_type>_cols lvm.conf setting and -o|--options command line argument. When several object are processed (PVs, VGs, LVs, segments, ...), it should be possible to easily match the error/warning/status line with the object that is processed. This allows users to easily match status with object that is processed (compared to current state where only overall status/return code is returned and matching errors and warnings with objects requires parsing the message itself). Also, it allows higher level tools using lvm2 tools to categorize status and any messages issued during lvm2 command processing so they can be presented to users by higher level tools easily. The new "status" is going to be a subreport of the current report group and as such, it will also allow for reporting this status in any format that is currently used for the group (see also bug #1334655 and bug #1334659).
LVM2 supports so called "log report" since lvm2 2.02.158. There are several new configuration settings and command line options to support this feature: - log/report_command_log lvm.conf setting to enable/disable log report - log/command_log_{cols,sort} to set fields reported in log report - log/command_log_selection" lvm.conf setting to define automatic selection used for log report For more information, see "man 7 lvmreport". Example: [0] rhel7-a/~ # lvmconfig --type diff report { compact_output=1 } log { report_command_log=1 command_log_selection="all" } (reporting command - the command log is appended to lvs main report) [0] rhel7-a/~ # lvs Logical Volume ============== LV VG Attr LSize root rhel -wi-ao---- 9.02g swap rhel -wi-ao---- 500.00m Command Log =========== Seq LogType Context ObjType ObjName ObjID ObjGrp ObjGrpID Msg Errno RetCode 1 status processing lv root yWDUvw-9zpE-n2EI-TeoN-POzW-3wHt-B4uDpX rhel LDTYQz-81Zb-qwBC-Arek-EZ3t-Qnjd-Yu4yWT success 0 1 2 status processing lv swap JcSyXd-KByX-2sKE-QDuQ-T10R-Q5kI-mn8OcA rhel LDTYQz-81Zb-qwBC-Arek-EZ3t-Qnjd-Yu4yWT success 0 1 3 status processing vg rhel LDTYQz-81Zb-qwBC-Arek-EZ3t-Qnjd-Yu4yWT success 0 1 (non-reporting command - there's only log report) [0] rhel7-a/~ # vgcreate vg /dev/sda Command Log =========== Seq LogType Context ObjType ObjName ObjID ObjGrp ObjGrpID Msg Errno RetCode 1 status processing pv /dev/vda2 2cBtQX-IKw0-vsJi-ZLB3-pUfS-w48b-2kA4H9 rhel LDTYQz-81Zb-qwBC-Arek-EZ3t-Qnjd-Yu4yWT success 0 1 2 status processing vg rhel LDTYQz-81Zb-qwBC-Arek-EZ3t-Qnjd-Yu4yWT success 0 1 3 status processing orphan lvm1 success 0 1 4 status processing orphan pool success 0 1 5 status processing pv /dev/sda XEP0SI-mFGo-C1UT-WvaF-UYIw-5ZfL-DLGWB1 success 0 1 6 status processing orphan lvm2 success 0 1 7 print processing Volume group "vg" successfully created 0 0 (changing log/command_log_selection back to default command_log_selection = "!(log_type=status && message=success)" - so we don't display "success", just error states) [0] rhel7-a/~ # lvmconfig --type diff report { compact_output=1 } log { report_command_log=1 } [0] rhel7-a/~ # lvs Logical Volume ============== LV VG Attr LSize root rhel -wi-ao---- 9.02g swap rhel -wi-ao---- 500.00m Command Log =========== Seq LogType Context ObjType ObjName ObjID ObjGrp ObjGrpID Msg Errno RetCode [0] rhel7-a/~ # lvs vg/i_dont_exist Command Log =========== Seq LogType Context ObjType ObjName ObjID ObjGrp ObjGrpID Msg Errno RetCode 1 error processing lv i_dont_exist vg Hafilo-sFEy-vLz0-bLk7-vvPs-UmsF-hcF13b Failed to find logical volume "vg/i_dont_exist" -1 0 2 status processing lv i_dont_exist vg Hafilo-sFEy-vLz0-bLk7-vvPs-UmsF-hcF13b failure -1 5 3 status processing vg vg Hafilo-sFEy-vLz0-bLk7-vvPs-UmsF-hcF13b failure -1 5 [0] rhel7-a/~ # lvmconfig --type diff report { compact_output=1 } log { report_command_log=1 command_log_cols="log_type,log_context,log_object_type,log_object_name,log_message" } [0] rhel7-a/~ # lvs vg/i_dont_exist Command Log =========== LogType Context ObjType ObjName Msg error processing lv i_dont_exist Failed to find logical volume "vg/i_dont_exist" status processing lv i_dont_exist failure status processing vg vg failure