1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

3707 Commits

Author SHA1 Message Date
Alasdair G Kergon
6f47e79a88 pre-release 2016-07-28 18:36:45 +01:00
Zdenek Kabelac
eaf7d06a82 lvconvert: support --zero for full cache pool conversion.
Add matching support for -Z option also we doing full conversion
to cache-pool.

Extending coversion message to show which pool type is created
and whether the metadata will be wiped or remain unmodified.
2016-07-27 16:20:57 +02:00
Zdenek Kabelac
3c377f8334 lvconvert: tune cache-pool zeroing
Follow-up to 27a767d5e8.
Tunning behavior in a way we always prompt when option --zero is NOT specified.
Without -Z lvm expects user wants to 'reset' cache-pool metadata
(they could have been splitted from some cached LV)

If user doesn't want to zero metadata he needs to specify -Zn.

User may also avoid prompting for zeroing by using -Zy for
cache-pool (basically equals using --yes  without -Z being given)
(unlike full convert case, there is no cache-pool being converted,
so there is not 'uncoditional' prompt in this case).
2016-07-27 16:20:57 +02:00
Zdenek Kabelac
5636bfd83d lvconvert: suppress zeroing warning when converting to thin
When volume was lvconvert-ed to a thin-volume with external origin,
then in case thin-pool was in non-zeroing mode
it's been printing WARNING about not zeroing thin volume - but
this is wanted and expected - so nothing to warn about.

So in this particular use case WARNING needs to be suppressed.

Adding parameter support for lvcreate_params.

So now lvconvert creates 'normal thin LV' in read-only mode
(so any read will 'return 0' for a moment)
then deactivate regular thin LV and reacreate in 'final R/RW' mode
thin LV with external origin and activate again.
2016-07-27 16:20:57 +02:00
Peter Rajnoha
070c0d31ab metadata: fix automatic updates of PV extension headers to newest version
Before, the automatic update from older to newer version of PV extension
header happened within vg_write call. This may have caused problems under
some circumnstances where there's a code in between vg_write and vg_commit
which may have failed. In such situation, we reverted precommitted metadata
and put back the state to working version of VG metadata.

However, we don't have revert for PV write operation at the moment. So
if we updated PV headers already and we reverted vg_write due to failure
in subsequent code (before vg_commit), we ended up with lost VG metadata
(because old metadata pointers got reset by the PV write operation).

To minimize problematic situations here, we should put vg_write and
vg_commit that is done after PV header rewrites as close to each
other as possible.

This patch moves the automatic PV header rewrite for new extension
header part from vg_write to _vg_read where it's done the same way
as we do any other VG repairs if detected during VG read operation
(under VG write lock).
2016-07-26 16:22:55 +02:00
Alasdair G Kergon
d180bf6311 lvconvert: --trackchanges requires --splitmirrors 1 2016-07-25 21:15:25 +01:00
Alasdair G Kergon
1efb1c2343 lvconvert: --trackchanges requires --splitmirrors 2016-07-25 19:32:10 +01:00
Peter Rajnoha
94141c7797 man: add note about 'lastlog' built-in command 2016-07-25 15:05:08 +02:00
Alasdair G Kergon
5397837a9f segtype: Fix unrecognised flag message.
Show in hex not decimal.
2016-07-25 12:59:50 +01:00
Zdenek Kabelac
27a767d5e8 lvconvert: reusing old cache pool metadata needs -Zn
When cache pool is reused for a new cached volume, there is
normally no need to 'keep' old cache-pool metadata as this
could cause major data lose.

Unlike with 'lvcreate -H -LX --cachepool' conversion, this lvconvert
path left the metadata unzeroed - partly for making easier some
debugging, but this was rather a bug.

So to keep possible reattach of 'unzeroed' metadata, user
now has to use 'lvconvert -Zn' for such conversion. In this case
the prompt will appear about possibe data loss and to proceed,
user has to confirm such operation. Without -Zn metadata are wiped.
2016-07-22 14:40:26 +02:00
Zdenek Kabelac
6dc4d03508 lvconvert: enable work with partial LVs
Fix printed message and enable handling of missing PVs.
2016-07-19 17:39:41 +02:00
Alasdair G Kergon
9c6a26f50a post-release 2016-07-15 22:02:58 +01:00
Alasdair G Kergon
3d717b52c1 pre-release 2016-07-15 21:55:38 +01:00
Zdenek Kabelac
e1112227d1 lvresize: fix zero size extension
Commit ca878a3426 changed behavior
or resize operation. Later the code has been futher changed
to skip fs resize completely when size of LV is already matching
and finaly at the most recent resize changeset for resize the
check for matching size has been eliminated as well so we ended
with a request call to resize fs to 0 size in some cases.

This commit reoders some test so the prompt happens just once before
resize of possibly 2 related volumes.

Also extra test for having LV already given size is added, and
whole metadata update is skipped for this case as the only
result would be an increment of seqno.

However the filesystem is still resized when requested,
so if the LV has some size and the resize is resolved to
the same size, the filesystem resize is called so in case FS
would not match, the resize will happen.
2016-07-13 21:52:04 +02:00
Zdenek Kabelac
34c55d98ee tests: add LVM_LOG_FILE_MAX_LINES
When logging to epoch files we would like to prevent creating too large
log files otherwise a spining command could fulfill available space
very easily and quickly.

Limit for to 100000 per command.
2016-07-11 12:43:28 +02:00
Alasdair G Kergon
f6b98ec7ca post-release 2016-07-06 17:04:25 +01:00
Alasdair G Kergon
8ca874bc1f pre-release 2016-07-06 16:55:44 +01:00
Alasdair G Kergon
fb0a671419 post-release 2016-07-06 01:14:33 +01:00
Alasdair G Kergon
6022715c81 pre-release 2016-07-06 00:59:28 +01:00
Alasdair G Kergon
d8c2677ab9 raid0: Add raid0_meta segment type. 2016-07-01 22:20:54 +01:00
Zdenek Kabelac
458918b319 thin: fix link validation for unused thin-pool
This patch fixes link validation for used thin-pool.
Udev rules correctly creates symlinks only for unused new thin-pool.
Such thin-pool can be used by foreing apps (like Docker) thus
has  /dev/vg/lv link.
However when thin-pool becomes used by thinLV - this link is no
longer exposed to user - but internal verfication missed this
and caused messages like this to be printed upon 'vgchange -ay':

The link /dev/vg/pool should have been created by udev but it was not
found. Falling back to direct link creation.

And same with 'vgchange -an':
The link /dev/vg/pool should have been removed by udev but it is still
present. Falling back to direct link removal.

This patch ensures only unused thin-pool has this link.
2016-07-01 00:44:46 +02:00
Alasdair G Kergon
aed8bc8ae7 macros: Use is_power_of_2. 2016-06-30 17:59:44 +01:00
Alasdair G Kergon
686acce23f lvconvert: Conversions between striped and raid0. 2016-06-28 23:44:15 +01:00
Alasdair G Kergon
79446ffad7 raid: Infrastructure for raid takeover. 2016-06-28 02:42:30 +01:00
David Teigland
5a327755b4 WHATS_NEW: add recent changes 2016-06-28 02:28:57 +01:00
Alasdair G Kergon
a46f524247 post-release 2016-06-25 20:47:49 +01:00
Alasdair G Kergon
887f071b25 pre-release 2016-06-25 20:35:14 +01:00
Alasdair G Kergon
e99a31c950 Revert "locking: trace errors from dir creation"
This reverts commit fa69ed0bc8.

This code sometimes expects to be presented with a read-only filesystem
(during some boot sequences for example) and copes appropriately with
this and it should not lead to expected error messages that might cause
unnecessary alarm.
2016-06-23 21:31:49 +01:00
Zdenek Kabelac
7092c6ba10 lvresize: support more resized LVs
Add code to support more LVs to be resized through a same code path
using a single lvresize_params struct.
(Now it's used for thin-pool metadata resize,
next user will be snapshot virtual resize).

Update code to adjust percent amount resize for use_policies.

Properly activate inactive thin-pool in case of any pool resize
as the command should not 'deffer' this operation to next activation.
2016-06-23 14:59:27 +02:00
Zdenek Kabelac
fa69ed0bc8 locking: trace errors from dir creation 2016-06-23 14:57:06 +02:00
Zdenek Kabelac
dc8c5c1886 monitoring: preserve monitoring status during update
Ignore monitoring during whole update (suspend/resume) of thin-pool.
2016-06-23 14:56:10 +02:00
Zdenek Kabelac
eb51be4fbe activation: _lv_active returns 0 on error
We have only 2 users of _lv_active() - one was already checking for ==1
while the other use (_lv_is_active()) could have take '-1' as a sign of having
an LV active. So return 0 and log_debug also the reason while detection
has failed (i.e. in case  --driverload n  - it's kind of expectable,
but might have confused user seeing just <backtrace>).
2016-06-23 14:55:35 +02:00
Zdenek Kabelac
af36f5ad36 activation: switch to warning
Since this function does not have a way to return error use correct
reporting level as warning.
2016-06-23 14:53:59 +02:00
Alasdair G Kergon
dfc516f9bf lvconvert: Refactor argument handling code.
Begin disentangling the different lvconvert modes of operation
from each other.
2016-06-22 18:40:22 +01:00
Peter Rajnoha
92caebab95 report: add --logonly arg to report only log for a command 2016-06-20 11:33:43 +02:00
Peter Rajnoha
1127b090bd conf: add log/command_log_selection config setting 2016-06-20 11:33:43 +02:00
Peter Rajnoha
cee1aedf12 log: use separate 'orphan' report object type for orphan VGs 2016-06-20 11:33:43 +02:00
Peter Rajnoha
89e2aef63a 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.
2016-06-20 11:33:43 +02:00
Peter Rajnoha
0ab1187740 log: annotate processing code with report_current_object_cmdlog 2016-06-20 11:33:43 +02:00
Peter Rajnoha
6ca28ca4c6 log: annotate processing code with log_set_report_{context,object_type,id_and_name} 2016-06-20 11:33:43 +02:00
Peter Rajnoha
f50d4011cd 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).
2016-06-20 11:33:42 +02:00
Peter Rajnoha
7d4a15e53a 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.
2016-06-20 11:33:42 +02:00
Peter Rajnoha
8cfc385491 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.
2016-06-20 11:33:42 +02:00
Peter Rajnoha
b864a06221 report: recognize selection (-S|--select) for each subreport; make -S|--select groupable 2016-06-20 11:33:42 +02:00
Peter Rajnoha
e081203f3e report: recognize list of keys to sort report by (-O|--sort) for each subreport; make -O|--sort groupable 2016-06-20 11:33:42 +02:00
Peter Rajnoha
28b4c48e2a args: add --configreport arg 2016-06-20 11:33:42 +02:00
Peter Rajnoha
d23c5b9318 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.
2016-06-20 11:33:42 +02:00
Peter Rajnoha
9c37b7ed7c conf: add report/{vgs,pvs,lvs,pvsegs,segs}_{cols,sort}_full config settings 2016-06-20 11:33:42 +02:00
Peter Rajnoha
26c43c6ce5 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.
2016-06-20 11:33:42 +02:00
Peter Rajnoha
c099f531fb 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.
2016-06-20 11:33:41 +02:00