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

11136 Commits

Author SHA1 Message Date
Alasdair G Kergon
88551add97 libdm: Whitespace. 2015-08-05 05:11:42 +01:00
Alasdair G Kergon
23e8e849e4 libdm: Sort new exported symbols. 2015-08-05 05:07:45 +01:00
Alasdair G Kergon
362a1a5a82 dmsetup: Tidy whitespace. 2015-08-05 05:03:33 +01:00
Peter Rajnoha
ce1528359a man: document --nameprefixes 2015-08-04 14:03:50 +02:00
Peter Rajnoha
f02cdcff00 coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
lib/format1/import-export.c:167: var_deref_model: Passing null pointer "vg->lvm1_system_id" to "strncmp", which dereferences it.
2015-08-04 10:35:31 +02:00
Peter Rajnoha
1f3d04cddf coverity: variable init must be done before its use
tools/polldaemon.c:465: uninit_use_in_call: Using uninitialized value "id.vg_name" when calling "print_log".
tools/polldaemon.c:465: uninit_use_in_call: Using uninitialized value "id.lv_name" when calling "print_log".
2015-08-04 09:51:16 +02:00
Peter Rajnoha
c78033233a coverity: return value check in lvmlockd-dlm
daemons/lvmlockd/lvmlockd-dlm.c:647: check_return: Calling "closedir" without checking return value (as is done elsewhere 13 out of 14 times).
2015-08-04 09:49:29 +02:00
Peter Rajnoha
83541123c8 coverity: fix cppcheck warnings
/lib/log/log.c:88: warning[invalidScanfArgType_int]: %llu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'long long *'.
daemons/lvmlockd/lvmlockd-core.c:791: error[uninitstring]: Dangerous usage of 'version' (strncpy doesn't always null-terminate it).
2015-08-04 09:33:55 +02:00
Peter Rajnoha
46e6b2b86e coverity: fix possible resource leak in lvmpolld-core
/daemons/lvmpolld/lvmpolld-core.c:573: leaked_storage: Variable "cmdargv" going out of scope leaks the storage it points to.
2015-08-04 09:25:47 +02:00
Peter Rajnoha
6ac5689ce4 report: also recognize variants without underscores for <prefix>_all fields
For example: "pvs -o pv_all" and pvs -o pvall" are same.
2015-08-04 09:03:31 +02:00
David Teigland
d11f8d4228 lvmlockd: automatically remove the dlm global lockspace
The dlm global lockspace is automatically added when the
first dlm VG lockspace is added.  Reverse this by removing
the dlm global lockspace after the last dlm VG lockspace
is removed.  (Remove old non-working code that did this
based on an old command that could explicitly add/remove
the dlm global lockspace.)
2015-08-03 10:23:01 -05:00
Peter Rajnoha
71dbe47619 report: update comment for _is_same_field fn 2015-08-03 16:47:02 +02:00
Peter Rajnoha
a5b476a7d3 report: recognize report field name variants without any underscores too
Whenver reporting field name is registered with libdevmapper and if
the field name contains any number of underscores ('_'), libdm
can now automatically recognize any of its variant without any
underscores used.

For example:

..for underscores in prefixes:
  pvs -o pv_name
  pvs -o name
  pvs -o pvname (newly recognized besides pvname)

..for underscores in the name:
  lvs -o cache_mode
  lvs -o cachemode

..or even multiple underscores:
  pvs -o pv___na___me

It's all variant of the same field name.
2015-08-03 16:29:50 +02:00
Peter Rajnoha
b3997469b5 toolcontext: do not set cmd->initialized_connections = 0 on destroy_toolcontext
The whole cmd context is freed completely in destroy_toolcontext, so do
not write to any of dead cmd variables.
2015-08-03 16:17:17 +02:00
Bryn M. Reeves
519c309952 dmsetup: Use argcp and argvp. 2015-07-31 22:53:38 +01:00
Bryn M. Reeves
a161e29c59 dmsetup: Add --count and --interval to reports.
For example, to monitor active devices every second you can now run
dmsetup info -c --count 0.
2015-07-31 21:59:34 +01:00
David Teigland
72f754e2bc lockd: remove ignorelockingfailure checks
These code paths were effectively unused.  The checks
had been added long ago without any real thought behind
what they should do or be used for.
2015-07-31 15:51:50 -05:00
David Teigland
439a579aa2 vgchange/lvchange: allow deactivation without locking
If locking with lvmlockd has failed, allow LVs to be deactivated.
2015-07-31 14:11:24 -05:00
Alasdair G Kergon
649c9d4719 dmsetup: Allow commands to have subcommands.
No commands set has_subcommands yet.

Move multiple device loop to separate function because we'll
soon want to call it repeatedly.

(Based on patch from bmr.)
2015-07-31 19:09:31 +01:00
Alasdair G Kergon
51f89f2fbd dmsetup: Add subcommand parameter.
Not yet used.
Allows for dmsetup stats <subcommand> dev1 dev2...
2015-07-31 17:47:03 +01:00
Alasdair G Kergon
e06d188f0d dmsetup: _find_command returns const 2015-07-31 16:58:14 +01:00
Alasdair G Kergon
fef3cb3f21 dmsetup: Add _dmsetup to help and usage fns.
Prepare for dmstats.
Adjust some text to avoid 80-char wrap.
2015-07-31 16:26:38 +01:00
Alasdair G Kergon
027fe112ec dmsetup: Rename _commands to _dmsetup_commands.
We'll need to accommodate sub-commands for dmstats.
2015-07-31 16:13:45 +01:00
Peter Rajnoha
f54198eed6 toolcontext: use refresh_filters in refresh_toolcontext
Use refresh_filters instead of destroy_filters and init_filters
in refresh_toolcontext fn which deals with cmd->initialized.filters
correctly on refresh.
2015-07-31 10:25:36 +02:00
Marian Csontos
0dae377fbf test: Update Makefiles
- Add missing check_lvmpolld to toplevel Makefile
- Document check_system
2015-07-30 20:39:38 +02:00
Marian Csontos
8bc90a25c2 spec: lockd_dlm requires dlm-lib instead of dlm 2015-07-30 20:39:38 +02:00
David Teigland
b40ccdd57c lvmlockd: create sanlock lv large enough for existing lvs
When changing an existing VG to lock_type sanlock,
make the sanlock lv large enough to hold all the
locks needed for existing LVs.
2015-07-30 12:04:31 -05:00
David Teigland
78135c24b4 lvmlockd: small fixes and cleanup for lvmlockctl
. clean up the info output for readability
. remove some internal debug output
. fix the daemon quit option
2015-07-30 10:50:22 -05:00
Peter Rajnoha
d9c67a9b21 cleanup: toolcontext: move report_list_item_separator into its group 2015-07-30 16:14:10 +02:00
Peter Rajnoha
e6834b3237 cleanup: toolcontext: make cmd_context more readable
Just shuffle the items and put them into logical groups so it's
visible at first sight what each group contains - it makes it a bit
easier to make heads and tails of the whole cmd_context monster.
2015-07-30 16:01:02 +02:00
Peter Rajnoha
c0629c13fe commands: add new NO_METADATA_PROCESSING flag to selected commands
When a command is flagged with NO_METADATA_PROCESSING flag, it means
such command does not process any metadata and hence it doens't require
lvmetad, lvmpolld and it can get away with no locking too. These are
mostly simple commands (like lvmconfig/dumpconfig, version, types,
segtypes and other builtin commands that do not process metadata
in any way).

At first, when lvm command is executed, create toolcontext without
initializing connections (lvmetad,lvmpolld) and without initializing
filters (which depend on connections init). Instead, delay this
initialization until we know we need this. That is, until the
lvm_run_command fn is called in which we know what the actual
command to run is and hence we can avoid any connection, filter
or locking initiliazation for commands that would not make use
of it anyway.

For all the other create_toolcontext calls, we keep the original
behaviour - the filters and connections are initialized together
with the toolcontext.
2015-07-30 13:56:13 +02:00
Peter Rajnoha
f6473baffc toolcontext: add switches to create_toolcontext for connections and filters init
Make it possible to decide whether we want to initialize connections and
filters together with toolcontext creation.

Add "filters" and "connections" fields to struct
cmd_context_initialized_parts and set these in cmd_context.initialized
instance accordingly.

(For now, all create_toolcontext calls do initialize connections and
filters, we'll change that in subsequent patch appropriately.)
2015-07-30 13:54:09 +02:00
Peter Rajnoha
3e343ba5ef refactor: toolcontext: move lvmetad and lvmpolld init into separate function
Move original lvmetad and lvmpolld initialization code from
_process_config fn to their own functions _init_lvmetad and
_init_lvmpolld (both covered with single _init_connections fn).
2015-07-30 13:54:09 +02:00
Peter Rajnoha
6b0c464a34 refactor: toolcontext: add struct cmd_context_initialized_parts
Add struct cmd_context_initialized_parts to wrap up information
about which cmd context pieces are initialized and add variable
of this struct type into struct cmd_context.

Also, move existing "config_initialized" variable that was directly
part of cmd_context into the new cmd_context.initialized wrapper.

We'll be adding more items into the struct cmd_context_initialized_parts
with subsequent patches...
2015-07-30 13:54:05 +02:00
David Teigland
9aabf441bd vgremove: warn when removing sanlock global lock
When the sanlock VG holding the global lock is removed,
print a warning indicating that the global needs to be
enabled in another sanlock VG.
2015-07-29 14:27:32 -05:00
David Teigland
772b54a08b vgcreate: improve checks for existing global lock
This tries harder to avoid creating duplicate global locks in
sanlock VGs by refusing to create a new sanlock VG with a
global lock if other sanlock VGs exist that may have a gl.
2015-07-29 14:27:32 -05:00
David Teigland
e593213b87 lvmcache: add lock_type to VG summary and info structs
vgsummary information contains provisional VG information
that is obtained without holding the VG lock.  This info
can be used to lock the VG, and then read it with vg_read().
After the VG is read properly, the vgsummary info should
be verified.

Add the VG lock_type to the vgsummary.  It needs to be
known before the VG can be locked and read.
2015-07-29 14:27:32 -05:00
Alasdair G Kergon
3cd644aeb5 libdm: Require librt for new dm_timestamp. 2015-07-29 19:30:22 +01:00
Alasdair G Kergon
a28fb37b9e libdm: Add dm_timestamp functions. 2015-07-29 19:21:07 +01:00
Alasdair G Kergon
a5491d3698 dmsetup: Accept vg/lv name format.
If there is exactly one / which is not the first character, check
for /dev/vg/lv (as dm_dir()/../$name i.e. /dev/mapper/../vg/lv.)
2015-07-29 12:24:36 +01:00
Peter Rajnoha
ca0d9a70d1 dmsetup: remove dead code that covered "info -c -o help" case once
The "-o help" is now handled as implicit field and it gets processed
just like any other field - all handled by libdevmapper now.
2015-07-29 13:16:09 +02:00
Peter Rajnoha
cf700151eb cache: fix regression causing some PVs to bypass filters
This is a regression introduced by commit
6c0e44d5a2 which changed
the way dev_cache_get fn works - before this patch, when a
device was not found, it fired a full rescan to correct the
cache. However, the change coming with that commit missed
this full_rescan call, causing the lvmcache to still contain
info about PVs which should be filtered now.

Such situation may have happened by coincidence of using
old persistent cache (/etc/lvm/cache/.cache) which does not
reflect the actual state anymore, a device name/symlink which
now points to a device which should be filtered and a fact we
keep info about usable DM devices in .cache no matter what
the filter setting is.

This bug could be hidden though by changes introduced in
commit f1a000a477 as it
calls full_rescan earlier before this problem is hit.
But we need to fix this anyway for the dev_cache_get
to be correct if we happen to use the same code path
again somewhere sometime.

For example, simple reproducer was (before commit
1a000a477558e157532d5f2cd2f9c9139d4f87c):

- /dev/sda contains a PV header with UUID y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M

- lvm.conf: filter = [ "r|.*|" ]

- rm -f .cache (to start with clean state)

- dmsetup create test --table "0 8388608 linear /dev/sda 0" (8388608 is
  just the size of the /dev/sda device I use in the reproducer)

- pvs (this will create .cache file which contains
  "/dev/disk/by-id/lvm-pv-uuid-y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M"
  as well as "/dev/mapper/test" and the target node "/dev/dm-1" - all the
  usable DM mappings (and their symlinks) get into the .cache file even
  though the filter "is set to "ignore all" - we do this - so far it's OK)

- dmsetup remove test (so we end up with /dev/disk/by-id/lvm-pv-uuid-...
  pointing to the /dev/sda now since it's the underlying device
  containing the actual PV header)

- now calling "pvs" with such .cache file and we get:
$ pvs
  PV                                                                 VG  Fmt  Attr PSize PFree
  /dev/disk/by-id/lvm-pv-uuid-y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M vg  lvm2 a--  4.00g    0

Even though we have set filter = [ "r|.*|" ] in the lvm.conf file!
2015-07-29 10:19:12 +02:00
Alasdair G Kergon
af1c7bf0c7 libdm: Add dm_size_to_string to libdevmapper.
Moved out from lib/display and a little documentation added.
It's tuned to LVM's requirements historically and its behaviour
might not always be what you would expect.
2015-07-27 21:30:20 +01:00
Alasdair G Kergon
fa11ddd7df lvmlockd: Drop -lrt now handled by configure. 2015-07-27 14:53:08 +01:00
Alasdair G Kergon
3e333e9b5c configure: Enable realtime by default, if present. 2015-07-27 14:44:58 +01:00
Alasdair G Kergon
1568ed4d20 configure: Add missing checks. 2015-07-27 14:26:56 +01:00
Alasdair G Kergon
3934ade5a2 gitignore: Update for in-place build. 2015-07-27 13:18:35 +01:00
Alasdair G Kergon
f4fa3e1a6b post-release 2015-07-24 23:39:54 +01:00
Alasdair G Kergon
ce6a0f4469 post-release 2015-07-24 23:21:51 +01:00
Alasdair G Kergon
33eb7d7dfb pre-release 2015-07-24 23:20:42 +01:00