]> sourceware.org Git - lvm2.git/log
lvm2.git
8 years agotools: add 'lvm lastlog' command for interactive query and display of last command...
Peter Rajnoha [Fri, 20 May 2016 13:30:58 +0000 (15:30 +0200)]
tools: add 'lvm lastlog' command for interactive query and display of last command's log

If we're running in lvm shell, we can keep last command's log report
for further query with possible different selection criteria for easy
log lookup.

8 years agorefactor: move 'interactive' field from struct command_line to struct cmd_context...
Peter Rajnoha [Fri, 20 May 2016 12:23:43 +0000 (14:23 +0200)]
refactor: move 'interactive' field from struct command_line to struct cmd_context as 'is_interactive' switch

8 years agolog: annotate processing code with report_current_object_cmdlog
Peter Rajnoha [Mon, 23 May 2016 13:27:09 +0000 (15:27 +0200)]
log: annotate processing code with report_current_object_cmdlog

8 years agolog: annotate processing code with log_set_report_{context,object_type,id_and_name}
Peter Rajnoha [Fri, 20 May 2016 11:26:02 +0000 (13:26 +0200)]
log: annotate processing code with log_set_report_{context,object_type,id_and_name}

8 years agoreport: add 'multiple_output' arg to report_init
Peter Rajnoha [Thu, 12 May 2016 12:37:38 +0000 (14:37 +0200)]
report: add 'multiple_output' arg to report_init

Some reports may be reported several times with possible different
selection criteria, just like command log report.

8 years agolibdm: report: add dm_report_set_selection
Peter Rajnoha [Thu, 12 May 2016 13:04:37 +0000 (15:04 +0200)]
libdm: report: add dm_report_set_selection

Since we can do repeated dm_report_output calls now, we also like
to be able to set selection for each of these outputs.

8 years agolibdm: report: add DM_REPORT_OUTPUT_MULTIPLE_TIMES report flag to keep report data...
Peter Rajnoha [Thu, 12 May 2016 12:34:04 +0000 (14:34 +0200)]
libdm: report: add DM_REPORT_OUTPUT_MULTIPLE_TIMES report flag to keep report data even after output is done

The DM_REPORT_OUTPUT_MULTIPLE_TIMES instructs reporting code to
keep rows even after dm_report_output call - the rows are not
destroyed in this case which makes it possible to call dm_report_output
multiple times.

8 years agorefactor: move field width calculation and sort preparation from _do_report_object...
Peter Rajnoha [Thu, 12 May 2016 12:07:05 +0000 (14:07 +0200)]
refactor: move field width calculation and sort preparation from _do_report_object to dm_report_output

This also prepares code for repeated dm_report_output calls.

8 years agolibdm: report: remember special field to display selection status in struct row's...
Peter Rajnoha [Thu, 12 May 2016 12:03:32 +0000 (14:03 +0200)]
libdm: report: remember special field to display selection status in struct row's field_sel_status variable

This allows for moving parts of the code from dm_report_object to
dm_report_output which is important for subsequent patches that allow
for repeated dm_report_output, not destroying rows on each
dm_report_output call.

8 years agolog: also pass log_print through report and add log_print_bypass_report for use in...
Peter Rajnoha [Thu, 19 May 2016 10:19:48 +0000 (12:19 +0200)]
log: also pass log_print through report and add log_print_bypass_report for use in libdm-report for direct print without report

log_print is used during cmd line processing to log the result of the
operation (e.g. "Volume group vg successfully changed" and similar).

We don't want output from log_print to be interleaved with current
reports from group where log is reported as well. Also, the information
printed by log_print belongs to the log report too, so it should be
rerouted to log report if it's set.

Since the code in libdm-report which is responsible for doing the report
output uses log_print too, we need to use a different kind of log_print
which bypasses any log report currently used for logging (...simply,
we can't call log_print to output the log report itself which in turn
would again reroute to report - the report would never get on output
this way).

8 years agoreport: add report_current_object_cmdlog fn as a shortcut for reporting current objec...
Peter Rajnoha [Mon, 23 May 2016 13:09:05 +0000 (15:09 +0200)]
report: add report_current_object_cmdlog fn as a shortcut for reporting current object's log item

8 years agolog: log warnings and errors via report if set; add log_set_report* fns
Peter Rajnoha [Tue, 3 May 2016 09:46:52 +0000 (11:46 +0200)]
log: log warnings and errors via report if set; add log_set_report* fns

This patch adds structures and functions to reroute error and warning
logs to log report, if it's set.

There are 5 new functions:
  - log_set_report
    Set log report where logging will be rerouted.

  - log_set_report_context
    Set context globally so any report_cmdlog call will use it.

  - log_set_report_object_type
    Set object type globally so any report_cmdlog call will use it.

  - log_set_report_object_name_and_id
    Set object ID and name globally so any report_cmdlog call will use it.

  - log_set_report_object_group_and_group_id
    Set object group ID and name globally so any report_cmdlog call will use it.

These functions will be called during LVM command processing so any logs
which are rerouted to log report contain proper information about current
processing state.

8 years agotoollib: make it possible to also process internal VGs, add 'include_internal' switch...
Peter Rajnoha [Tue, 3 May 2016 09:46:28 +0000 (11:46 +0200)]
toollib: make it possible to also process internal VGs, add 'include_internal' switch to process_each_vg fn

The lvm fullreport works per VG and as such, the vg, lv, pv, seg and
pvseg subreport is done for each VG. However, if the PV is not part of
any VG yet, we still want to display pv and pvseg subreports for these
"orphan" PVs - so enable this for lvm fullreport's process_each_vg call.

8 years agoreport: check report type and options used for full report's subreports
Peter Rajnoha [Tue, 3 May 2016 09:42:55 +0000 (11:42 +0200)]
report: check report type and options used for full report's subreports

If we have fullreport, make sure that the options/sort keys used for
each report doesn't change its type - we want to preserve the original
type so it's always 5 different subreports within fullreport (vg, lv, pv,
seg, pvseg). Since we have all report types within fullreport, users
should add fields under proper subreport type - this minimizes
duplication of info displayed on output.

8 years agoreport: recognize selection (-S|--select) for each subreport; make -S|--select groupable
Peter Rajnoha [Thu, 26 May 2016 13:20:27 +0000 (15:20 +0200)]
report: recognize selection (-S|--select) for each subreport; make -S|--select groupable

8 years agoreport: recognize list of keys to sort report by (-O|--sort) for each subreport;...
Peter Rajnoha [Thu, 26 May 2016 13:12:38 +0000 (15:12 +0200)]
report: recognize list of keys to sort report by (-O|--sort) for each subreport; make -O|--sort groupable

8 years agoreport: recognize list of fields to report (-o|--options) for each subreport
Peter Rajnoha [Wed, 4 May 2016 12:07:45 +0000 (14:07 +0200)]
report: recognize list of fields to report (-o|--options) for each subreport

8 years agoreport: add _get_report_idx_from_name and _should_process_report_idx helper fns
Peter Rajnoha [Thu, 26 May 2016 13:50:52 +0000 (15:50 +0200)]
report: add _get_report_idx_from_name and _should_process_report_idx helper fns

Prepare for recognition of cmd line options for each subreport within
one command.

8 years agoargs: add --configreport arg
Peter Rajnoha [Thu, 16 Jun 2016 13:49:18 +0000 (15:49 +0200)]
args: add --configreport arg

8 years agoargs: add priorities for grouping args
Peter Rajnoha [Fri, 17 Jun 2016 09:03:14 +0000 (11:03 +0200)]
args: add priorities for grouping args

Groupable args (the ones marked with ARG_GROUPABLE flag) start a new
group of args if:
  - this is the first time we hit such a groupable arg,
  - or if non-countable arg is repeated.

However, there may be cases where we want to give priorities when
forming groups and hence force new group creation if we hit an arg
with higher grouping priority.

For example, let's assume (for now) hypothetical sequence of args used:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name

Without giving any priorites, we end up with:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
     |                            | |                           | |          |
     \__________GROUP1___________/   \________GROUP2___________/   \_GROUP3_/

This is because we hit "-o" as the first groupable arg. The --configreport,
even though it's groupable too, it falls into the previous "-o" group.

While we may need to give priority to the --configreport arg that should
always start a new group in this scenario instead:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
      |         | |                            | |                           |
      \_GROUP1_/   \_________GROUP2___________/   \_________GROUP3__________/

So here "-o" started a new group but since "--configreport" has higher
priority than "-o", it starts fresh new group now and hence the rest of
the command line's args are grouped by --configreport now.

8 years agoconf: add report/{vgs,pvs,lvs,pvsegs,segs}_{cols,sort}_full config settings
Peter Rajnoha [Tue, 14 Jun 2016 10:38:40 +0000 (12:38 +0200)]
conf: add report/{vgs,pvs,lvs,pvsegs,segs}_{cols,sort}_full config settings

8 years agocommands: report: add lvm fullreport command
Peter Rajnoha [Tue, 3 May 2016 09:18:16 +0000 (11:18 +0200)]
commands: report: add lvm fullreport command

lvm fullreport executes 5 subreports (vg, pv, lv, pvseg, seg) per each VG
(and so taking one VG lock each time) within one command which makes it
easier to produce full report about LVM entities.

Since all 5 subreports for a VG are done under a VG lock, the output is
more consistent mainly in cases where LVM entities may be changed in
parallel.

8 years agocommands: recognize --reportformat option for other commands
Peter Rajnoha [Tue, 17 May 2016 11:32:56 +0000 (13:32 +0200)]
commands: recognize --reportformat option for other commands

Enables --reportformat option for all command using processing_handle
(and process_each_* fn variant), that is: lvchange, lvcreate, lvdisplay,
lvextend, lvreduce, lvremove, lvrename, lvresize, lvscan, pvchange,
pvresize, pvcreate, pvdisplay, pvmove, pvremove, pvscan, vgcfgbackup,
vgchange, vgck, vgconvert, vgcreate, vgdisplay, vgexport, vgextend,
vgimport, vgmknodes, vgreduce, vgremove, vgrename command.

8 years agocommands: recognize --reportformat option for pvs,vgs,lvs and devtypes command
Peter Rajnoha [Mon, 2 May 2016 12:39:32 +0000 (14:39 +0200)]
commands: recognize --reportformat option for pvs,vgs,lvs and devtypes command

Enables --reportformat options for pvs, vgs, lvs, devtypes command.

8 years agoreport: add current report to existing group
Peter Rajnoha [Mon, 2 May 2016 12:37:16 +0000 (14:37 +0200)]
report: add current report to existing group

Add any report (pvs/vgs/lvs) currently processed to current report group
which is part of processing handle and which already contains log
report. This way both log report and pvs/vgs/lvs report will be
reported as a whole within a group, thus having same output format as
selected by --reportformat option.

8 years agotoollib: add 'parent' field to processing_handle; init report format only if there...
Peter Rajnoha [Tue, 31 May 2016 10:24:05 +0000 (12:24 +0200)]
toollib: add 'parent' field to processing_handle; init report format only if there's no parent

If there's parent processing handle, we don't need to create completely
new report group and status report - we'll just reuse the one already
initialized for the parent.

Currently, the situation where this matter is when doing internal report
to do the selection for processing commands where we have parent processing
handle for the command itself and processing handle for the selection
part (that is selection for non-reporting tools).

8 years agotoollib: add report_group and log_rh to processing_handle and initialize cmd processi...
Peter Rajnoha [Mon, 23 May 2016 08:16:29 +0000 (10:16 +0200)]
toollib: add report_group and log_rh to processing_handle and initialize cmd processing log report

Wire up report group creation with log report in struct
processing_handle and call report_format_init during processing handle
initialization (init_processing_handle fn) and destroy it while
destroing processing handle (destroy_processing_handle fn).

This way, all the LVM command processing using processing handle
has access to log report via which the current command log
can be reported as items are processed.

8 years agoreport: separate common report and per-report args
Peter Rajnoha [Wed, 25 May 2016 11:41:42 +0000 (13:41 +0200)]
report: separate common report and per-report args

Separating common report and per-report arguments prepares the code for
handling several reports per one command (for example, the command log
report and LVM command report itself).

Each report can have sort keys, options (fields), list of fields to
compact and selection criteria set individually. Hooks for setting these
per report within one command will be a part of subsequent patches, this
patch only separates new struct single_report_args out of existing
struct report_args.

8 years agoconf: add log/report_command_log config setting
Peter Rajnoha [Tue, 14 Jun 2016 09:58:01 +0000 (11:58 +0200)]
conf: add log/report_command_log config setting

8 years agoconf: add report/output_format config setting
Peter Rajnoha [Tue, 24 May 2016 10:05:42 +0000 (12:05 +0200)]
conf: add report/output_format config setting

New report/output_format configuration sets the output format used
for all LVM commands globally. Currently, there are 2 formats
recognized:
   - basic (the classical basic output with columns and rows, used by default)
   - json (output is in json format)

8 years agotoollib: add report_format_init fn to create report group and to create/add log repor...
Peter Rajnoha [Mon, 2 May 2016 12:22:02 +0000 (14:22 +0200)]
toollib: add report_format_init fn to create report group and to create/add log report handle

Add new --reportformat option and new report_format_init function that
checks this option and creates new report group accordingly, also
preparing log report handle and adding it to the report group just
created.

8 years agoconf: add log/command_log_{sort,cols} config settings
Peter Rajnoha [Tue, 14 Jun 2016 11:10:29 +0000 (13:10 +0200)]
conf: add log/command_log_{sort,cols} config settings

8 years agoreport: add CMDLOG report type
Peter Rajnoha [Tue, 10 May 2016 13:15:48 +0000 (15:15 +0200)]
report: add CMDLOG report type

This is a preparation for new CMDLOG report type which is going to be
used for reporting LVM command log.

The new report type introduces several new fields (log_seq_num, log_type,
log_context, log_object_type, log_object_group, log_object_id, object_name,
log_message, log_errno, log_ret_code) as well as new configuration settings
to set this report type (report/command_log_sort and report/command_log_cols
lvm.conf settings).

This patch also introduces internal report_cmdlog helper function
which is a wrapper over dm_report_object to report command log via
CMDLOG report type and which is going to be used throughout the code
to report the log items.

8 years agolibdm: report: implement DM_REPORT_GROUP_JSON for JSON report output
Peter Rajnoha [Mon, 2 May 2016 12:21:40 +0000 (14:21 +0200)]
libdm: report: implement DM_REPORT_GROUP_JSON for JSON report output

This patch introduces DM_REPORT_GROUP_JSON report group type. When using
this group type and when pushing a report to such a group, these flags
are automatically unset:

   DM_REPORT_OUTPUT_ALIGNED
   DM_REPORT_OUTPUT_HEADINGS
   DM_REPORT_OUTPUT_COLUMNS_AS_ROWS

...and this flag is set:

   DM_REPORT_OUTPUT_BUFFERED

The whole group is encapsulated in { } for the outermost JSON object
and then each report is reported on output as array of objects where
each object is the row from report:

  {
     "report_name1": [
         {field1="value", field2="value",...},
         {field1="value", field2="value",...}
         ...
     ],
     "report_name2": [
         {field1="value", field2="value",...},
         {field1="value", field2="value",...}
         ...
     ]
     ...
  }

8 years agolibdm: report: implement DM_REPORT_GROUP_BASIC for extended report output
Peter Rajnoha [Mon, 23 May 2016 08:47:03 +0000 (10:47 +0200)]
libdm: report: implement DM_REPORT_GROUP_BASIC for extended report output

This patch introduces DM_REPORT_GROUP_BASIC report group type. This
type has exactly the classical output format as we know from before
introduction of report groups. However, in addition to that, it allows
to put several reports into a group - this is the very basic grouping
scheme that doesn't change the output format itself:

  Report: report1_name
  Header1  Header2 ...
  value    value   ...
  value    value   ...
  ...      ...     ...

  Report: report2_name
  Header1  Header2 ...
  value    value   ...
  value    value   ...
  ...      ...     ...

8 years agolibdm: report: implement DM_REPORT_GROUP_SINGLE for a group containing single report...
Peter Rajnoha [Thu, 16 Jun 2016 09:23:56 +0000 (11:23 +0200)]
libdm: report: implement DM_REPORT_GROUP_SINGLE for a group containing single report only

There's no change in output for this report group type - with this type,
we only make sure there's always only one report in a group at a time,
not more.

8 years agolibdm: report: introduce dm_report_group
Peter Rajnoha [Mon, 2 May 2016 12:21:05 +0000 (14:21 +0200)]
libdm: report: introduce dm_report_group

This patch introduces DM report group (represented by dm_report_group
structure) that is used to group several reports to make a whole. As a
whole, all the reports in the group follow the same settings and/or
formatting used on output and it controls that the output is properly
ordered (e.g. the output from different reports is not interleaved
which would break readability and/or syntax of target output format
used for the whole group).

To support this feature, there are 4 new functions:
  - dm_report_group_create
  - dm_report_group_push
  - dm_report_group_pop
  - dm_report_group_destroy

From the naming used (dm_report_group_push/pop), it's clear the reports
are pushed onto a stack. The rule then is that only the report on top
of the stack can be reported (that means calling dm_report_output).
This way we make sure that the output is not interleaved and provides
determinism and control over the output.

Different formats may allow or disallow some of the existing report
flags controlling output itself (DM_REPORT_OUTPUT_*) to be set or not so
once the report is pushed to a group, the grouping code makes sure that
all the reports have compatible flags set and then these flags are
restored once each report is popped from the report group stack.

We also allow to push/pop non-report item in which case such an item
creates a structure (e.g. to put several reports together with any
opening and/or closing lines needed on output which pose as extra
formatting structure besides formatting the reports).

The dm_report_group_push function accepts an argument to pass any
format-specific data needed (e.g. handle, name, structures passed
along while working with reports...).

We can call dm_report_output directly anytime we need (with the only
restriction that we can call dm_report_output only for the report that
is currently on top of the group's stack). Or we don't need to call
dm_report_output explicitly in which case all the reports in a stack are
reported on output automatically once we call dm_report_group_destroy.

8 years agovgreduce: fix location of lvmlockd global lock
David Teigland [Fri, 17 Jun 2016 17:10:43 +0000 (12:10 -0500)]
vgreduce: fix location of lvmlockd global lock

The lvmlockd global lock was missing the non-repair case,
which caused the new orphan PV created by vgreduce to
not be seen by other hosts.

8 years agolvmlockd: fix dropping PVs in rescanning VG
David Teigland [Fri, 17 Jun 2016 16:45:08 +0000 (11:45 -0500)]
lvmlockd: fix dropping PVs in rescanning VG

This fixes a problem in commit ae0a8740c.  The problem
in that commit was that all existing PVs are initially
dropped from lvmetad.  This works if the VG is updated
at the end, which replaces the dropped PVs, but if the
rescan finds that the VG seqno is unchanged, it leaves
the cached VG in place.  So, we should only drop the
existing PVs in lvmetad when the VG is going to be updated.

8 years agopost-release
Alasdair G Kergon [Fri, 17 Jun 2016 12:57:33 +0000 (13:57 +0100)]
post-release

8 years agopre-release v2_02_157
Alasdair G Kergon [Fri, 17 Jun 2016 12:48:39 +0000 (13:48 +0100)]
pre-release

8 years agotools: add missing destroy_processing_handle in pvscan and vgreduce code
Peter Rajnoha [Fri, 17 Jun 2016 11:29:33 +0000 (13:29 +0200)]
tools: add missing destroy_processing_handle in pvscan and vgreduce code

8 years agopvscan: don't activate LVs when use_lvmetad=0
David Teigland [Thu, 16 Jun 2016 17:04:05 +0000 (12:04 -0500)]
pvscan: don't activate LVs when use_lvmetad=0

commit 15da467b was meant to address the case where
use_lvmetad=1 in lvm.conf, and lvmetad is not available,
in which case, pvscan --cache -aay should activate LVs.

But the commit unintentionally also changed the case
where use_lvmetad=0 in lvm.conf, in which case
pvscan --cache -aay should not activate LVs, so fix
that here.

8 years agopvscan: fix lvmlockd global lock
David Teigland [Wed, 15 Jun 2016 21:51:36 +0000 (16:51 -0500)]
pvscan: fix lvmlockd global lock

This should have been removed when pvscan was
recently converted to use process_each_pv which
does the lvmlockd locking.

8 years agopvscan: do activation when lvmetad is not running
David Teigland [Wed, 15 Jun 2016 19:19:18 +0000 (14:19 -0500)]
pvscan: do activation when lvmetad is not running

When pvscan --cache -aay fails to connect to lvmetad it will
simply exit and do nothing.  Change this so that it will
skip the lvmetad cache step and do the activation step from
disk.

8 years agolvmlockd: fix rescanning VG
David Teigland [Tue, 14 Jun 2016 19:51:03 +0000 (14:51 -0500)]
lvmlockd: fix rescanning VG

Previously, new PVs that were added to the VG were not scanned.

8 years agopost-release
Alasdair G Kergon [Fri, 10 Jun 2016 23:14:00 +0000 (00:14 +0100)]
post-release

8 years agopre-release v2_02_156
Alasdair G Kergon [Fri, 10 Jun 2016 23:08:08 +0000 (00:08 +0100)]
pre-release

8 years agolvmdbusd: Remove duplicate test code
Tony Asleson [Fri, 10 Jun 2016 18:45:59 +0000 (13:45 -0500)]
lvmdbusd: Remove duplicate test code

8 years agolvmdbusd: Add test for DataLv & MetaDataLv
Tony Asleson [Fri, 10 Jun 2016 18:36:53 +0000 (13:36 -0500)]
lvmdbusd: Add test for DataLv & MetaDataLv

Added tests which expose an issue found with these properties.

8 years agolvmdbusd: Create correct LV object type
Tony Asleson [Fri, 10 Jun 2016 17:11:17 +0000 (12:11 -0500)]
lvmdbusd: Create correct LV object type

We were initially looking to see if an LV was hidden and if it was we were
creating an instance of a LvCommon object to represent it.  Thus if we
had a hidden cache pool for example we were missing the methods and
properties for the cache pool.  However, when we create the object path,
any hidden LVs, regardless of type/functionality will be placed in the
hidden path.

8 years agolvmdbusd: Add method get_object_path_by_lvm_id
Tony Asleson [Fri, 10 Jun 2016 17:05:52 +0000 (12:05 -0500)]
lvmdbusd: Add method get_object_path_by_lvm_id

The object manager method get_object_by_lvm_id was used in many cases for
the sole reason of getting the object path for the object.  Instead of
retrieving the object and then calling 'dbus_object_path' on the object, we
are adding a method which returns the object path.

8 years agolvmdbusd: Rename get_object_path_by_lvm_id
Tony Asleson [Fri, 10 Jun 2016 17:03:04 +0000 (12:03 -0500)]
lvmdbusd: Rename get_object_path_by_lvm_id

Renaming to get_object_path_by_uuid_lvm_id, to clarify that both the uuid
and the lvm id are required.

8 years agolvmdbusd: Change print statement to py3 syntax
Tony Asleson [Mon, 6 Jun 2016 20:06:50 +0000 (15:06 -0500)]
lvmdbusd: Change print statement to py3 syntax

8 years agolvmdbusd: Bug fix for missing LV properties
Tony Asleson [Fri, 10 Jun 2016 16:58:55 +0000 (11:58 -0500)]
lvmdbusd: Bug fix for missing LV properties

When we are processing the LVs we need to build up dbus objects from least
dependent to most dependent, so that we have information available when
constructing.

8 years agolvmdbusd: Add data_lv and metadata_lv to cache pool interface
Tony Asleson [Mon, 6 Jun 2016 20:03:02 +0000 (15:03 -0500)]
lvmdbusd: Add data_lv and metadata_lv to cache pool interface

See: https://bugzilla.redhat.com/show_bug.cgi?id=1342558

8 years agolvmdbusd: Add roles property to LV common interface
Tony Asleson [Fri, 3 Jun 2016 22:07:37 +0000 (17:07 -0500)]
lvmdbusd: Add roles property to LV common interface

See: https://bugzilla.redhat.com/show_bug.cgi?id=1342559

8 years agoWHATS_NEW: add recent changes
David Teigland [Fri, 10 Jun 2016 18:39:23 +0000 (13:39 -0500)]
WHATS_NEW: add recent changes

8 years agocleanup: typo in WHATS_NEW_DM
Zdenek Kabelac [Fri, 3 Jun 2016 13:33:27 +0000 (15:33 +0200)]
cleanup: typo in WHATS_NEW_DM

8 years agodisplay: yes no prompt improvement
Zdenek Kabelac [Wed, 8 Jun 2016 18:52:14 +0000 (20:52 +0200)]
display: yes no prompt improvement

Original code missed to catch all apperances of SIGINT.
Also enhance logging when running in shell without tty.
Accept this regex as valid input:
'^[ ^t]*([Yy]([Ee]([Ss]|)|)|[Nn]([Oo]|))[ ^t]*$'

8 years agolvmdump: also collect output from lsblk command when running lvmdump -s
Peter Rajnoha [Thu, 9 Jun 2016 11:51:09 +0000 (13:51 +0200)]
lvmdump: also collect output from lsblk command when running lvmdump -s

lsblk provides nice and quick overview of the storage/sysfs structure
that is useful for debugging - collect its output when running lvmdump -s.

8 years agovgcreate, pvcreate, vgextend: don't use a device with duplicates
David Teigland [Mon, 6 Jun 2016 20:39:51 +0000 (15:39 -0500)]
vgcreate, pvcreate, vgextend: don't use a device with duplicates

If duplicate orphan PVs exist, don't allow one of them to be
used for vgcreate/pvcreate/vgextend.

8 years agolvmcache: fix duplicate handling with multiple scans
David Teigland [Mon, 6 Jun 2016 20:20:55 +0000 (15:20 -0500)]
lvmcache: fix duplicate handling with multiple scans

Some commands scan labels to populate lvmcache multiple
times, i.e. lvmcache_init, scan labels to fill lvmcache,
lvmcache_destroy, then later repeat

Each time labels are scanned, duplicates are detected,
and preferred devices are chosen.  Each time this is done
within a single command, we want to choose the same
preferred devices.  So, check for existing preferences
when choosing preferred devices.

This also fixes a problem with the list of unused duplicate
devs when run in an lvm shell.  The devs had been allocated
from cmd memory, resulting in invalid list entries between
commands.

8 years agolvmcache: add optional dev arg to lvmcache_info_from_pvid
David Teigland [Mon, 6 Jun 2016 19:04:17 +0000 (14:04 -0500)]
lvmcache: add optional dev arg to lvmcache_info_from_pvid

A number of places are working on a specific dev when they
call lvmcache_info_from_pvid() to look up an info struct
based on a pvid.  In those cases, pass the dev being used
to lvmcache_info_from_pvid().  When a dev is specified,
lvmcache_info_from_pvid() will verify that the cached
info it's using matches the dev being processed before
returning the info.  Calling code will not mistakenly
get info for the wrong dev when duplicate devs exist.

This confusion was happening when scanning labels when
duplicate devs existed.  label_read for the first dev
would add an info struct to lvmcache for that dev/pvid.
label_read for the second dev would see the pvid in
lvmcache from first dev, and mistakenly conclude that
the label_read from the second dev can be skipped
because it's already been done.  By verifying that the
dev for the cached pvid matches the dev being read,
this mismatch is avoided and the label is actually read
from the second duplicate.

8 years agolvmetad: handle update failures
David Teigland [Fri, 20 May 2016 18:32:14 +0000 (13:32 -0500)]
lvmetad: handle update failures

If a command gets stuck during an lvmetad update, lvmetad
will cancel that update after the timeout.  The next command
to check the lvmetad will see that lvmetad needs to be
populated because lvmetad will return token of "none" after
a timed out update (same as when lvmetad is not populated
at all after starting.)

If a command gets an error during an lvmetad update, it
will now just quit and leave its updating token in place.
That update will be cancelled after the timeout.

8 years agolvmetad: remove disabled case for "scan error"
David Teigland [Wed, 25 May 2016 21:10:46 +0000 (16:10 -0500)]
lvmetad: remove disabled case for "scan error"

Failures while populating lvmetad will be handling
differently in a subsequent commit.

8 years agolvmetad: define special update in progress string
David Teigland [Thu, 19 May 2016 21:19:38 +0000 (16:19 -0500)]
lvmetad: define special update in progress string

8 years agoblkdeactivate: fix regression in blkdeactivate causing dm and md devices to be skipped.
Peter Rajnoha [Mon, 6 Jun 2016 12:57:41 +0000 (14:57 +0200)]
blkdeactivate: fix regression in blkdeactivate causing dm and md devices to be skipped.

Commit #5b3a4a9 caused the "name" variable to be cleared if
declaration and assignment is on two lines so put it back
so it's on one line for it to work again.

8 years agopost-release
Alasdair G Kergon [Fri, 3 Jun 2016 22:20:43 +0000 (23:20 +0100)]
post-release

8 years agopre-release v2_02_155
Alasdair G Kergon [Fri, 3 Jun 2016 22:16:50 +0000 (23:16 +0100)]
pre-release

8 years agopvmove: disallow tag args
David Teigland [Fri, 3 Jun 2016 14:56:48 +0000 (09:56 -0500)]
pvmove: disallow tag args

pvmove began processing tags unintentionally from commit,
6d7dc87cb pvmove: use toollib

pvmove works on a single PV, but tags can match multiple PVs.
If we allowed tags, but processed only the first matching PV,
then the resulting PV would be unpredictable.

Also, the current processing code does not allow us to simply
report an error and do nothing if more than one PV matches the tag,
because the command starts processing PVs as they are found,
so it's too late to do nothing if a second PV matches.

8 years agoman: fixed typo in lvcreate.8
Tobias Stoeckmann [Mon, 30 May 2016 21:13:40 +0000 (23:13 +0200)]
man: fixed typo in lvcreate.8

It's supposed to be "smaller than" instead of "smaller then".

8 years agocleanup: compile fixes for --disable-devmapper
Zdenek Kabelac [Fri, 3 Jun 2016 10:38:46 +0000 (12:38 +0200)]
cleanup: compile fixes for --disable-devmapper

Make lvm2 compilable when configured with: --disable-devmapper.

8 years agoman: lvmconfig: add note about --type diff and --mergedconfig
Peter Rajnoha [Thu, 2 Jun 2016 12:07:07 +0000 (14:07 +0200)]
man: lvmconfig: add note about --type diff and --mergedconfig

8 years agolvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used
Peter Rajnoha [Thu, 2 Jun 2016 11:41:55 +0000 (13:41 +0200)]
lvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used

If configuration consists of several sources in config cascade
("config cascade" defined in man lvmconfig(8)), lvmconfig displayed
only difference from defaults of the topmost config in the cascade.
Fix lvmconfig to display complete difference, considering all
the configuration in the cascade.

For example, before this patch:

(use_lvmetad=0 set in lvm.conf which differs from defaults)
$ lvmconfig --type diff
global {
use_lvmetad=0
}

(compact_output=1 set on cmd line)
$ lvmconfig --type diff --config report/compact_output=1
report {
compact_output=1
}

(headings=0 set in profile)
$ lvmconfig --type diff --commandprofile test
report {
headings=0
}

(difference in topmost configuration source is displayed)
$ lvmconfig --type diff --commandprofile test --config report/compact_output=1
report {
compact_output=1
}

With this patch applied (the config cascade is merged before looking for
difference from defaults in configuration):

$ lvmconfig --type diff
global {
use_lvmetad=0
}

$ lvmconfig --type diff --config report/compact_output=1
report {
compact_output=1
}
global {
use_lvmetad=0
}

$ lvmconfig --type diff --profile test
report {
headings=0
}
global {
use_lvmetad=0
}

$ lvmconfig --type diff --profile test --config report/compact_output=1
report {
headings=0
compact_output=1
}
global {
use_lvmetad=0
}

8 years agomake: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean
Peter Rajnoha [Thu, 2 Jun 2016 09:58:54 +0000 (11:58 +0200)]
make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean

8 years agocleanup: use display_name
Zdenek Kabelac [Wed, 1 Jun 2016 15:40:26 +0000 (17:40 +0200)]
cleanup: use display_name

8 years agotests: check losetup -P is correctly handled
Zdenek Kabelac [Wed, 1 Jun 2016 15:25:55 +0000 (17:25 +0200)]
tests: check losetup -P is correctly handled

Validate pvcreate will not overwrite partitioned loop device.

8 years agotests: extend prepare_loop
Zdenek Kabelac [Wed, 1 Jun 2016 15:25:06 +0000 (17:25 +0200)]
tests: extend prepare_loop

Treat args after size  as 'extra' params for losetup.

8 years agodevices: handle partscan loop devices
Zdenek Kabelac [Wed, 1 Jun 2016 14:39:47 +0000 (16:39 +0200)]
devices: handle partscan loop devices

Treat loop device created with 'losetup -P' as regular
partitioned device - so if it has partition table,
prevent its usage in commands like 'pvcreate'.

Before 'pvcreate /dev/loop0' could have erased and formated as PV,
after this patch, device is filtered out and cannot be used.

8 years agocoverity: fix warnings about missing return value check for sscanf
Peter Rajnoha [Tue, 31 May 2016 08:06:19 +0000 (10:06 +0200)]
coverity: fix warnings about missing return value check for sscanf

All the variables for sscanf in lvmlockctl.c and lvmlockd-sanlock.c are
zeroed before sscanf call so the failure is detected by seeing the zero
value instead of proper one in subsequent code - so use (void) for
sscanf calls to ignore return value here.

8 years agocoverity: missing check for id_write_format return value
Peter Rajnoha [Tue, 31 May 2016 07:56:10 +0000 (09:56 +0200)]
coverity: missing check for id_write_format return value

8 years agocoverity: blkdeactivate: separate format and args for printf and declare and assign...
Peter Rajnoha [Tue, 31 May 2016 07:39:06 +0000 (09:39 +0200)]
coverity: blkdeactivate: separate format and args for printf and declare and assign separately to avoid masking return values

8 years agocoverity: fix possible resource leak of descendants_buffer in _print_historical_lv fn
Peter Rajnoha [Tue, 31 May 2016 07:36:40 +0000 (09:36 +0200)]
coverity: fix possible resource leak of descendants_buffer in _print_historical_lv fn

8 years agotests: add dmstats to CLEAN_TARGETS for make clean
Peter Rajnoha [Tue, 31 May 2016 07:14:23 +0000 (09:14 +0200)]
tests: add dmstats to CLEAN_TARGETS for make clean

8 years agotoollib: properly reset selection handle on selection failure in select_match_{pv...
Peter Rajnoha [Tue, 31 May 2016 07:08:59 +0000 (09:08 +0200)]
toollib: properly reset selection handle on selection failure in select_match_{pv,vg,lv}

8 years agoreport: fix lvm devtypes internal error if -S is used with field name from pvs/vgs/lvs
Peter Rajnoha [Mon, 30 May 2016 14:37:05 +0000 (16:37 +0200)]
report: fix lvm devtypes internal error if -S is used with field name from pvs/vgs/lvs

Before this fix, when reporting 'lvm devtypes', the report was
initialized with incorrect reserved values - the ones used for
pvs/vgs/lvs report were used instead of NULL value (because devtypes
doesn't have any reserved values).

For example, trying to (incorrectly) use lv_name for the -S|--select
with lvm devtypes which doesn't have this field at all:

Before this patch (internal error issued):

$ lvm devtypes -S 'lv_name=lvol0'
  Internal error: _check_reserved_values_supported: field-specific reserved value of type 0x0 for field  not supported
  Internal error: dm_report_init_with_selection: trying to register unsupported reserved value type, skipping report selection
  DevType       MaxParts Description
  aoe                 16 ATA over Ethernet
  ataraid             16 ATA Raid
  bcache               1 bcache block device cache
  ...

With this patch applied (correct error displayed about
unrecognized selection field):

$ lvm devtypes -S 'lv_name=lvol0'
  Device Types Fields
  -------------------
    devtype_name           - Name of Device Type exactly as it appears in /proc/devices. [string]
    devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.) [number]
    devtype_description    - Description of Device Type. [string]

  Special Fields
  --------------
    selected               - Set if item passes selection criteria. [number]
    help                   - Show help. [unselectable number]
    ?                      - Show help. [unselectable number]

  Unrecognised selection field: lv_name
  Selection syntax error at 'lv_name=lvol0'.
  Use 'help' for selection to get more help.

8 years agotoollib: simplify internal selection calls for non-reporting tools
Peter Rajnoha [Mon, 30 May 2016 14:28:47 +0000 (16:28 +0200)]
toollib: simplify internal selection calls for non-reporting tools

Some of the variables were set superfluously - we can just use existing
"struct processing_handle" which includes "struct selection_handle".

8 years agotests: check thin is not flushed for status
Zdenek Kabelac [Fri, 27 May 2016 15:24:18 +0000 (17:24 +0200)]
tests: check thin is not flushed for status

We finally approach a moment where we generally avoid
flushing thin-pool with every lvs command...

8 years agosnapshot: for invalid snapshot show 100%
Zdenek Kabelac [Fri, 27 May 2016 15:16:14 +0000 (17:16 +0200)]
snapshot: for invalid snapshot show 100%

Recent commit 92eba53a797a011d1ce6fbd7bef88eab41af2072 started to report
empty "" data usage of invalid snapshot, restore 100% to be shown.

8 years agotests: stacked snapshot merge
Zdenek Kabelac [Fri, 27 May 2016 13:21:38 +0000 (15:21 +0200)]
tests: stacked snapshot merge

8 years agotests: check cache_mode change on cachepool
Zdenek Kabelac [Wed, 25 May 2016 14:24:58 +0000 (16:24 +0200)]
tests: check cache_mode change on cachepool

8 years agodebug: use display_lvname
Zdenek Kabelac [Fri, 20 May 2016 09:28:23 +0000 (11:28 +0200)]
debug: use display_lvname

8 years agocache: add log_error on error path
Zdenek Kabelac [Wed, 25 May 2016 14:27:12 +0000 (16:27 +0200)]
cache: add log_error on error path

Validate and report error when lv_cache_status is called
for inactive LV, or pending delete or unused cache_pool.

8 years agoreport: convert more options to use single status
Zdenek Kabelac [Wed, 25 May 2016 14:26:10 +0000 (16:26 +0200)]
report: convert more options to use single status

Convert fields into using a single status ioctl call per LV.
This is a bit tricky since when there are more complicated
stacks, at this moment its undefined which values should be shown.

It's clear we need to cache more then single ioctl per LV,
but also we need to define more explicitely relation between
reported values for snapshots.

This patch is not a final state, rather a transitional step.
It should not be giving more 'worst' values then previous
many-ioctl-calls-per-lv solution.

8 years agosnapshot: use seg_status for attrs
Zdenek Kabelac [Wed, 25 May 2016 14:19:59 +0000 (16:19 +0200)]
snapshot: use seg_status for attrs

8 years agolv: introduce lvseg_percent_with_info_and_seg_status
Zdenek Kabelac [Wed, 25 May 2016 14:18:38 +0000 (16:18 +0200)]
lv: introduce lvseg_percent_with_info_and_seg_status

Add function to obtain percentage value for cache lv_seg_status.
This API is rather evolving 'middle' step as the ultimate goal
is segment API fuctionality.

But first we need to be clear at reporting level which values
are needed to be reported for which LVs and segments.

8 years agolvstatus: enhance seg_status to handle snapshot
Zdenek Kabelac [Wed, 25 May 2016 14:14:46 +0000 (16:14 +0200)]
lvstatus: enhance seg_status to handle snapshot

Add more code to properly store status for snapshot segment
maintaining lvm2 fiction of COW and snapshot internal volumes.

The key issue here is however not though-through reporting
logic - as there is no single answer for whole line state.
It not counting with layer and we may need few more ioctl to
cover all reporting needs depending upon what is actually
needed.

In reality we need to 'cache' more ioctl status queries for
individual LVs and their segments (so they checked at most once).

The other 'hard' topic for conversion is mirror segment handling.

Also we definitelly need to relocate some logic into segment's methods,
yet it might be complex as we have not clear border between targets.

TODO: define more clearly how are reporting fields defined in case
we 'stack' volumes like   -   cache of stacked  thin LV snapshot origin.

8 years agorefresh: call resume after failing suspend
Zdenek Kabelac [Fri, 20 May 2016 11:20:54 +0000 (13:20 +0200)]
refresh: call resume after failing suspend

lv_refresh_suspend_resume() has escaped with fail ret code
after failing suspend and could have left many volumes in suspend state.

So always unconditionally call resume also  when suspend has failed.

8 years agocleanup: drop cmd and constify lv for lv_refresh_suspend_resume()
Zdenek Kabelac [Fri, 20 May 2016 08:55:05 +0000 (10:55 +0200)]
cleanup: drop cmd and constify lv for lv_refresh_suspend_resume()

Like with most other lv_manip* functions take just LV arg and get cmd
from embeded pointer when needed.

This page took 0.075502 seconds and 5 git commands to generate.