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

12805 Commits

Author SHA1 Message Date
Zdenek Kabelac
adc1fe4b3f dmeventd: improved logged messages from thin plugin
Show better names in logged messages.
2016-07-04 17:40:24 +02:00
Bryn M. Reeves
52be93c54b dmsetup: fix timestamp leak
With a single report (--count=1) no timerfd is set up and the cycle
and current timestamps should be freed during the single call to
_update_interval_times().
2016-07-04 12:16:51 +01:00
Bryn M. Reeves
62dce13c7a dmstats: fix RgStart and RgSize field widths 2016-07-04 12:16:51 +01:00
Bryn M. Reeves
f27e95b25a docs: remove obsolete note from dmstats.8.in 2016-07-04 12:16:50 +01:00
Alasdair G Kergon
d8c2677ab9 raid0: Add raid0_meta segment type. 2016-07-01 22:20:54 +01:00
David Teigland
1df9822224 lvconvert: improve arg checks in new operation routing code
Use defines for segment types, and test args directly
instead of indirectly.
2016-07-01 11:24:41 -05:00
Zdenek Kabelac
b0d8a524a2 tests: test foreign users of thin-pool
Note: dmeventd should not need any notification and automatically
try to resize again when there is some metadata change.
2016-07-01 00:44:49 +02:00
Zdenek Kabelac
37a33d7414 cleanup: warns from older gcc 2016-07-01 00:44:48 +02:00
Zdenek Kabelac
3fd4584886 cleanup: lvchange uses display_lvname
Convert messages to report vg/lv name consistently.

Also drop unneeded 'info_obtaned' variable since the
obtained info is not reused in any code path.
2016-07-01 00:44:48 +02:00
Zdenek Kabelac
b9d3e8c8a8 cleanup: drop unused assignments
In all code paths we set a value for these variables, so drop
their initial unused assign.
2016-07-01 00:44:48 +02:00
Zdenek Kabelac
1e3411aa37 cleanup: add extra test for argc==0
Cleaup some compiler warning about posibility to allocate 0 size.
2016-07-01 00:44:48 +02: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
Zdenek Kabelac
2f638e07e8 dmeventd: thin plugin umount over 95%
Run umount code only when either thin data or metadata are
above 95% - so if there are resize failures with 60%.
system fill keep running.

Also umount will only be tried with lvm2 LVs.
Foreign users are ATM unsuppored.
2016-07-01 00:43:45 +02:00
David Teigland
103c188681 lvconvert: add comments describing conversions 2016-06-30 17:08:50 -05:00
Alasdair G Kergon
aed8bc8ae7 macros: Use is_power_of_2. 2016-06-30 17:59:44 +01:00
David Teigland
a8e39530ef lvconvert: add missing alias for a thin-pool conversion
The case of converting a cache volume to a thin pool missed
recognizing the --thinpool alias for --type thin-pool.
2016-06-30 10:09:54 -05:00
David Teigland
802ed9d459 lvconvert: remove unused code
This code became unused with the previous commit 2282f5.
2016-06-29 16:59:32 -05:00
David Teigland
2282f53ac7 lvconvert: rework routing of operations
Add new logic to identify each unique operation and route
it to the correct function to perform it.  The functions
that perform the conversions remain unchanged.

This new code checks every allowed combination of LV type
and requested operation, and for each valid combination
calls the function that performs that conversion.

The first stage of option validation which checks for
incompatible combinations of command line options, is done
done before process_each is called.  This is unchanged.
(This new code will allow that first stage validation to
be simplified in a future commit.)

The second stage of checking options against the specific
LV type is done by this new code.  For each valid combination
of operation + LV type, the new code calls an existing
function that implements it.

With this in place, the ad hoc checks for valid combinations
of LV types and operations can be removed from the existing
code in a future commit.

(The #if 0 is used to keep the patch clean, and the
disabled code will be removed by a following patch.)
2016-06-29 16:55:27 -05:00
Peter Rajnoha
eac0706761 libdm: do not issue 'Failed to create directory' message for failure in dm_create_dir
There are detailed messages inside _create_dir_recursive that
dm_create_dir calls (except EROFS which where the message is not
generated, like anywhere else in the code).
2016-06-29 15:58:18 +02:00
Alasdair G Kergon
686acce23f lvconvert: Conversions between striped and raid0. 2016-06-28 23:44:15 +01:00
Tony Asleson
6f216692b4 lvmdbustest: Comment out refresh check for LV create
When we test Vg.LvCreateRaid some of the hidden LVs volume type go from
'I' to 'i' between the time it takes us to create the LV and
the time it takes to call into refresh to verify the service is up to date.
This is a fairly rare occurance.
2016-06-28 13:36:32 -05:00
Tony Asleson
1d3532d0a7 lvmdbusd: Add --nojson command line option
Add ability to not use the JSON output even if available.
2016-06-28 13:32:39 -05:00
Tony Asleson
e6e5c3d3ec lvmdbusd: Remove WARNING for 'lvm help'
We call 'lvm help' to find out if fullreport is supported.  Lvm
dumps help to stderr.  Common code prints a warning if we exit
with 0, but have something in stderr so we are skipping the warning
message.
2016-06-28 12:54:48 -05:00
Tony Asleson
7c5a08521b lvmdbusd: Remove unneeded comment 2016-06-28 12:45:55 -05:00
Tony Asleson
9e3ad37828 lvmdbusd: Clean up ws 2016-06-28 12:45:28 -05:00
Tony Asleson
c11003c860 lvmdbusd: Remove unused imports and function parameter 2016-06-28 12:44:45 -05:00
Tony Asleson
dd5d865020 lvmdbusd: Fix hang when lvm compiled with 'enable-notify-dbus'
The following operations would hang if lvm was compiled with
'enable-notify-dbus' and the client specified -1 for the timeout:

* LV snapshot merge
* VG move
* LV move

This was caused because the implementation of these three dbus methods is
different.  Most of the dbus method calls are executed by gathering information
needed to fulfill it, placing that information on a thread safe queue and
returning.  The results later to be returned to the client with callbacks.
With this approach we can process an arbitrary number of commands without any
of them blocking other dbus commands.  However, the 3 dbus methods listed
above did not utilize this functionality because they were implemented with a
separate thread that handles the fork & exec of lvm.  This is done because these
operations can be very slow to complete.  However, because of this the lvm
command that we were waiting on is trying to call back into the dbus service to
notify it that something changed.  Because the code was blocking the process
that handles the incoming dbus activity the lvm command blocked.  We were stuck
until the client timed-out the connection, which then causes the service to
unblock and continue.  If the client did not have a timeout, we would have been
hung indefinitely.

The fix is to always utilize the worker queue on all dbus methods.  We need to
ensure that lvm is tested with 'enable-notify-dbus' enabled and disabled.
2016-06-28 12:09:28 -05:00
Tony Asleson
5274c2f11b lvmdbusd: request.py, initialize _job to None
_job is a job object, not a boolean so initialize it to None instead.
2016-06-28 12:09:28 -05:00
Tony Asleson
4f26eae40f lvmdbusd: Correct pv_seg_start -> pvseg_start
Code was using the incorrect column names for pvseg_start which only
became apparent when utilizing the JSON.
2016-06-28 12:09:28 -05:00
Tony Asleson
0aadd6b0fb lvmdbusd: Correct command line args for JSON
Use the updated syntax.
2016-06-28 12:09:28 -05:00
Tony Asleson
4b337b20d4 lvmdbusd: Remove sorting in db layer
When using the JSON this does not yield a totally sorted list as we don't
have a complete set of LVs, so remove this sort.
2016-06-28 12:09:28 -05:00
Tony Asleson
e514284c65 lvmdbusd: Add hidden in for json too 2016-06-28 12:09:28 -05:00
Tony Asleson
ec45be9976 lvmdbusd: Initial support for json output 2016-06-28 12:09:28 -05:00
Alasdair G Kergon
79446ffad7 raid: Infrastructure for raid takeover. 2016-06-28 02:42:30 +01:00
David Teigland
ff3c4ed1c0 lvmetad: two phase vg_remove
Apply the same idea as vg_update.
Before doing the VG remove on disk, invalidate
the VG in lvmetad.  After the VG is removed,
remove the VG in lvmetad.  If the command fails
after removing the VG on disk, but before removing
the VG metadata from lvmetad, then a subsequent
command will see the INVALID flag and not use the
stale metadata from lvmetad.
2016-06-28 02:30:36 +01:00
David Teigland
a7c45ddc59 lvmetad: two phase vg_update
Previously, a command sent lvmetad new VG metadata in vg_commit().
In vg_commit(), devices are suspended, so any memory allocation
done by the command while sending to lvmetad, or by lvmetad while
updating its cache could deadlock if memory reclaim was triggered.

Now lvmetad is updated in unlock_vg(), after devices are resumed.
The new method for updating VG metadata in lvmetad is in two phases:

1. In vg_write(), before devices are suspended, the command sends
   lvmetad a short message ("set_vg_info") telling it what the new
   VG seqno will be.  lvmetad sees that the seqno is newer than
   the seqno of its cached VG, so it sets the INVALID flag for the
   cached VG.  If sending the message to lvmetad fails, the command
   fails before the metadata is committed and the change is not made.
   If sending the message succeeds, vg_commit() is called.

2. In unlock_vg(), after devices are resumed, the command sends
   lvmetad the standard vg_update message with the new metadata.
   lvmetad sees that the seqno in the new metadata matches the
   seqno it saved from set_vg_info, and knows it has the latest
   copy, so it clears the INVALID flag for the cached VG.

If a command fails between 1 and 2 (after committing the VG on disk,
but before sending lvmetad the new metadata), the cached VG retains
the INVALID flag in lvmetad.  A subsequent command will read the
cached VG from lvmetad, see the INVALID flag, ignore the cached
copy, read the VG from disk instead, update the lvmetad copy
with the latest copy from disk, (this clears the INVALID flag
in lvmetad), and use the correct VG metadata for the command.

(This INVALID mechanism already existed for use by lvmlockd.)
2016-06-28 02:30:31 +01:00
David Teigland
cc3e7c7c31 lvmetad: remove unused code for other format types
lvmetad is no longer used at all with the lvm1 format,
so the text format is the only one that uses lvmetad.
2016-06-28 02:30:25 +01:00
David Teigland
5a327755b4 WHATS_NEW: add recent changes 2016-06-28 02:28:57 +01:00
David Teigland
17ad29ebba lvmlockd: fix coverity report 2016-06-28 02:28:49 +01:00
Peter Rajnoha
3985b12a2d libdm: report: fix field width calculation when using dm_report_column_headings
This fixes commit 0ba5f4b8e9 which moved
field recalculation (field width and sort position) from
dm_report_object to dm_report_output but it didn't handle the case when
dm_report_column_headings was used separately to report headings (before
dm_report_outpout call) and hence we ended up with intial widths for
fields in the headings.

If we're using dm_report_column_headings, we need to recalculate
fields if we haven't done so yet, the same way as we do in
dm_report_output.
2016-06-28 02:28:40 +01:00
Peter Rajnoha
1b11f09d2a reporter: simplify --configreport handling for -S|--select and fix an issue reported by coverity
Simplify code around _do_get_report_selection - remove "expected_idxs[]"
argument which is superfluous and add "allow_single" switch instead to
allow for recognition of "--configreport <report_name> -S" as well as
single "-S" if needed.

Null pointer dereferences  (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 961 in _do_report_get_selection()
Null pointer dereferences  (FORWARD_NULL) Dereferencing null pointer "single_args".
2016-06-28 02:27:19 +01:00
Peter Rajnoha
f0768f636e coverity: fix issues detected in recent code
Uninitialized variables  (UNINIT) /safe/guest2/covscan/LVM2.2.02.158/tools/toollib.c: 3520 in _process_pvs_in_vgs()
Uninitialized variables  (UNINIT) Using uninitialized value "do_report_ret_code".

Null pointer dereferences  (REVERSE_INULL) /safe/guest2/covscan/LVM2.2.02.158/libdm/libdm-report.c: 4745 in dm_report_output()
Null pointer dereferences  (REVERSE_INULL) Null-checking "rh" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

Incorrect expression  (MISSING_COMMA) /safe/guest2/covscan/LVM2.2.02.158/lib/log/log.c: 280 in _get_log_level_name()
Incorrect expression  (MISSING_COMMA) In the initialization of "log_level_names", a suspicious concatenated string ""noticeinfo"" is produced.

Null pointer dereferences  (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 816 in_get_report_options()
Null pointer dereferences  (FORWARD_NULL) Comparing "mem" to null implies that "mem" might be null.
2016-06-28 02:26:54 +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
15b932a70e doc: Resync kernel docs. 2016-06-25 19:59:49 +01:00
Peter Rajnoha
d914151591 man: lvs: move doc about --all so it's ordered alphabetically in the man page 2016-06-24 14:57:09 +02:00
Peter Rajnoha
a910052a2e man: document --configreport, --logonly, --reportformat 2016-06-24 14:51:20 +02:00
Peter Rajnoha
9a414245b9 commands: help: add missing --reportformat references 2016-06-24 14:49:13 +02:00
Peter Rajnoha
14da3cc793 commands: fix typo in arg assignment 2016-06-24 11:10:10 +02:00
Zdenek Kabelac
e88e9ee9ed cleanup: clean warns from older gcc
Don't report uninitialized use by older gcc.
2016-06-24 01:10:04 +02:00