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

8673 Commits

Author SHA1 Message Date
Zdenek Kabelac
7a595d7388 makefiles: use BLKID/UDEV_CFLAGS properly
blkid.h needs BLKID_CFLAGS
Do not add UDEV_CFLAGS everywhere and use it only when needed.
2014-03-06 17:30:06 +01:00
Zdenek Kabelac
216c57eed7 readline: switch to new-style readline typedef
Based on patch:
https://www.redhat.com/archives/lvm-devel/2014-March/msg00015.html

The CPPFunction typedef (among others) have been deprecated in favour of
specific prototyped typedefs since readline 4.2 (circa 2001).
It's been working since because compatibility typedefs have been in
place until they where removed in the recent readline 6.3 release.
Switch to the new style to avoid build breakage.

But also add full backward compatibility with define.

Signed-off-by: Gustavo Zacarias <gustavo zacarias com ar>
2014-03-06 17:28:40 +01:00
Zdenek Kabelac
061acd177f configure: drop duplicated SUBST
These subst are already there from pkg_config
2014-03-06 16:16:11 +01:00
Peter Rajnoha
cfc9e178bf tests: fix name-mangling test and remove udev transaction in dmsetup wrapper 2014-03-06 14:46:50 +01:00
Peter Rajnoha
42eb9b4526 WHATS_NEW: config handling changes 2014-03-06 13:03:51 +01:00
Peter Rajnoha
9a1d31a3c6 cleanup: remove superfluous forward declaration 2014-03-06 12:43:21 +01:00
Peter Rajnoha
74a3fc4e85 config: add default for allocation/cache_pool_chunk_size
The same as for allocation/thin_pool_chunk_size - the default value
used is just a starting point. The calculation continues using the
properties of the devices actually used.
2014-03-06 11:34:02 +01:00
Peter Rajnoha
d27868e94f config: runtime default for allocation/thin_pool_chunk_size
The allocation/thin_pool_chunk_size is a bit more complex. It's default
value is evaluated in runtime based on selected thin_pool_chunk_size_policy.
But the value is just a starting point. The calculation then continues
with dependency on the properties of the devices used. Which means for
such a default value, we know only the starting value.
2014-03-06 11:26:02 +01:00
Peter Rajnoha
932e75e89f config: separate cfg_def_default_value_hint out of cfg_def_get_default_value
If the config setting is defined as having no default value, but it's
still not NULL, it means such a value acts as a *hint* only
(e.g. a starting value from which the default value is calculated).

The new "cfg_def_get_default_value_hint" will always return the value
as defined in config_settings.h.

The original "cfg_def_get_default_value" will always return 0/NULL if
the config setting is defined with CFG_DEFAULT_UNDEFINED flag (hence
ignoring the hint).

This is needed for proper distiction between a correct default value
and the value which is just a hint or a starting point in calculation,
but it's not the final value (yes, we do have such settings!).
2014-03-06 11:18:19 +01:00
Peter Rajnoha
eecf191d3e config: runtime default for activation/mirror_image_fault_policy
The activation/mirror_image_fault_policy default value copies the
value (or default one) used for activation/mirror_device_fault_policy.
2014-03-06 11:16:23 +01:00
Peter Rajnoha
11039589d3 config: runtime default for config/profile_dir
The config/profile_dir default value takes LVM_SYSTEM_DIR into consideraton.
2014-03-06 11:16:04 +01:00
Peter Rajnoha
0da1e5d9f8 config: runtime default for backup/backup_dir, backup/archive_dir
The backup/backup_dir and backup/archive_dir default value is evaluated
in runtime and takes LVM_SYSTEM_DIR into consideration...
2014-03-06 11:15:21 +01:00
Peter Rajnoha
f6adef9825 config: runtime default for devices/cache, devices/cache_dir
The devices/cache and devices/cache_dir are evaluated in runtime this way:

  - if devices/cache is set, use it

  - if devices_cache/dir or devices/cache_file_prefix is set, make up a
    path out of that for devices/cache in runtime, taking into account
    the LVM_SYSTEM_DIR environment variable if set

  - otherwise make up the path out of default which is:
    <LVM_SYSTEM_DIR>/<cache_dir>/<cache_file_prefix>.cache

With the runtime defaults, we can encode this easily now. Also, the lvm
dumpconfig can show proper and exact information about this setting then
(the variant that shows default values).
2014-03-06 11:07:54 +01:00
Peter Rajnoha
b53ec37286 config: add CFG_DEFAULT_RUN_TIME for config options with runtime defaults
Previously, we declared a default value as undefined ("NULL") for
settings which require runtime context to be set first (e.g. settings
for paths that rely on SYSTEM_DIR environment variable or they depend
on any other setting in some way).

If we want to output default values as they are really used in runtime,
we should make it possible to define a default value as function which
is evaluated, not just providing a firm constant value as it was before.

This patch defines simple prototypes for such functions. Also, there's
new helper macros "cfg_runtime" and "cfg_array_runtime" - they provide
exactly the same functionality as the original "cfg" and "cfg_array"
macros when defining the configuration settings in config_settings.h,
but they don't set the constant default value. Instead, they automatically
link the configuration setting definition with one of these functions:

  typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile);
  typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile);
  typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile);
  typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile);
  typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile);

(The new macros actually set the CFG_DEFAULT_RUNTIME flag properly and
set the default value link to the function accordingly).

Then such configuration setting requires a function of selected type to
be defined. This function has a predefined name:

  get_default_<id>

...where the <id> is the id of the setting as defined in
config_settings.h. For example "backup_archive_dir_CFG" if defined
as a setting with default value evaluated in runtime with "cfg_runtime"
will automatically have "get_default_backup_archive_dir_CFG" function
linked to this setting to get the default value.
2014-03-06 10:54:17 +01:00
Peter Rajnoha
e2870c94cf config: use mempool for config paths used in find_config_tree_* functions
Using mempool is much safer than using the global static variable.
The global variable would be rewritten on each find_config_tree_* call
and we need to be very careful not to get into this problem (we don't
do now, but we can with the patches for "runtime defaults" that will follow).
2014-03-06 10:50:47 +01:00
Peter Rajnoha
c5a4e60c11 config: fixup default values for selected config settings
These settings don't have any default value predefined:
  log/file
  log/activate_file
  global/library_dir

This settings has default value but not yet declared in config_settings.h:
  global/locking_library (default is DEFAULT_LOCKING_LIB)
2014-03-06 09:49:57 +01:00
Jonathan Brassow
52aa3dbcab cmirrord: Clean-up stray warning message
cmirrord polls for messages on the kernel and cluster interfaces.
Sometimes it is possible for messages to be received on the cluster
interface and be waiting for processing while the node is in the
process of leaving the cluster group.  When this happens, the
messages received on the cluster interface are attempted to be
dispatched, but an error is returned because the connection is no
longer valid.  It is a harmless situation.  So, if we get the
specific error (CS_ERR_BAD_HANDLE) and we know that we have left
the group, then simply don't print the message.
2014-03-05 10:44:20 -06:00
Peter Rajnoha
2c42f60890 udev: run pvscan --cache via systemd-run in udev if the PV label is detected lost
If the PV label is lost (e.g. by doing a dd on the device), call
"systemd-run pvscan --cache <major>:<minor>" in 69-dm-lvm-metad.rules
to inform lvmetad about this state.

The reason for this is that ENV{SYSTEMD_WANTS}="lvm2-pvscan@<major>:<minor>"
logic will not cause the pvscan to be fired in this case since this works
only on proper device addition/removal cycle - the lvm2-pvscan service's
ExecStop is called only on proper REMOVE event - the service is bound to
device existence. Hence we need pvscan call via systemd-run (that
instantiates a quick transient service just to call the command).

See also https://bugzilla.redhat.com/show_bug.cgi?id=1063813.
2014-03-05 14:30:58 +01:00
Petr Rockai
3c9887467f test: Use correct path to /dev in lvchange-raid.sh. 2014-03-05 10:22:39 +01:00
Zdenek Kabelac
08aedff1fc tests: testing usable of /dev/kmsg
It's not so easy to recongnize unusable /dev/kmsg
Reorder the code in a way if the first regular read of /dev/kmsg
fail, fallback to klogctl interface.

Call drain_dmesg also for the case there is no user log output.
2014-03-04 17:54:33 +01:00
Zdenek Kabelac
9a99cb8c79 tests: hide error message
Make the logging looks normal for this case
2014-03-04 16:41:07 +01:00
Zdenek Kabelac
a01e2ff81c tests: print kernel version 2014-03-04 16:27:00 +01:00
Zdenek Kabelac
b47bdb4dca tests: check readability of /dev/kmsg
Looks like there are systems with /dev/kmsg device,
which is however not readable

Fix check for result value of klogctl and use only positive value.
2014-03-04 16:27:00 +01:00
Zdenek Kabelac
30810de1b0 tests: reinstantiate support for klogctl
Add a bit more complexity here - Switch to use /dev/kmsg
which has been introduced in 3.5 kernels and could run without
lossing lines from /proc/kmsg.

On older systems user may set env var LVM_TEST_CAN_CLOBBER_DMESG=1
to get kernel messages via klogctl() call (which deletes dmesg buffer)
otherwise no logging of kernel messages is provided.
2014-03-04 15:18:19 +01:00
Petr Rockai
cb77bdc253 test: Make teardown (more) resistant to funny DM device names. 2014-03-04 11:16:00 +01:00
Zdenek Kabelac
d739e16d85 tests: restore .txt suffix 2014-03-03 19:30:48 +01:00
Zdenek Kabelac
719261a33a tests: speedup kmsg processing
Since there could be multiple readers of kmsg (test & journald) it needs
to be fast, to capture things like sysrq trace.

But to capture whole output it would need to prioritize reading of kmsg,
thus we would first log kernel messages and followed by command output.

As a trade-off always log command output first and use large drain
buffer so is captures most of messages, but occasionaly miss some
lines.
2014-03-03 19:30:47 +01:00
Zdenek Kabelac
52007a9191 tests: split raid test
Use separate files for raid1, raid456, raid10.
They need different target versions to work, so support
more precise test selection.

Optimize duplicate tests of target avalability and skip
unsupported test cases sooner.
2014-03-03 11:23:57 +01:00
Zdenek Kabelac
a92fae079b lvmetad: fix minor gcc warning
Cast to pass in non-const pointer
2014-03-03 11:23:32 +01:00
Marian Csontos
445c0a5585 test: Remove incorrect evaluation 2014-03-03 08:31:33 +01:00
Zdenek Kabelac
6df716332c tests: detect nc or socat
Since shell is not in -o pipefail mode here,
we need to generate separate failure ahead of tee.
2014-03-02 21:48:28 +01:00
Zdenek Kabelac
6c377f5b3c tests: restore usage of reading kmsg
Basically reverts commit af8580d756.
"test: Use klogctl in the harness instead of reading /var/log/messages."

Problem is - this interface clears dmesg buffer
(just like call of dmesg -c)
Thus after running lvm2 test suitedmesg is empty - while all the
messages are usually logged in the journal/message, it's still not nice to
clear dmesg buffer.

It's not a pure revert, but switch to use /proc/kmsg directly instead of
reading /var/log/messages.
2014-03-02 21:30:26 +01:00
Zdenek Kabelac
33d69162e4 tests: split raid test
Use separate test file for raid456
Change test for broken kernel which has broken raid456 support.
2014-03-02 21:27:26 +01:00
Zdenek Kabelac
3ff10f5e61 tests: disable test which leaks node
This test is not detected as fault but leak device node
on a real /dev.
Added FIXME.
2014-03-02 21:27:26 +01:00
Zdenek Kabelac
75b5855ca1 tests: report selinux mode 2014-03-02 21:27:26 +01:00
Zdenek Kabelac
a2af5855c5 tests: use longer sleep
Eplore why 30sec is not enough for hydra and try higher value.
2014-03-02 21:27:25 +01:00
Petr Rockai
fade191aed test: Test that we cope with stray device nodes. 2014-03-02 20:53:43 +01:00
Petr Rockai
3b958984f1 test: Properly synchronize direct dmsetup calls. 2014-03-02 20:53:43 +01:00
Zdenek Kabelac
72ecf8e591 tests: detect reiserfs support
Since reiserfs is not commonly available detect its presence in kernel.
Stop reporting skipped test as WARNING.
2014-03-01 14:08:59 +01:00
Zdenek Kabelac
090e81281f lvmetad: more reuse precommit buffer
This patch moves more allocation to vg_write
(as started in 8c878438f5)
TODO: relocate also communication.
(in-release update)
2014-03-01 14:08:58 +01:00
Zdenek Kabelac
bda98c4b8d lvmetad: move memalloc/free out of lock
Small code move to lower locking time and make memory
allocation and free outside of lock.

Drop duplicate test of NULL pointer before calling dm_free.
2014-03-01 14:08:58 +01:00
Zdenek Kabelac
d8513da9be lvmetad: fix memleak when pv changes it device
Test vgimportclone invokes mem leak of pvid which
would be otherwise lost when device_old_pvid
is removed from hash table.
2014-03-01 14:00:15 +01:00
Petr Rockai
c8e868f6e0 lvmetad: Fix an invalid memory read that could cause a deadlock. 2014-03-01 00:42:09 +01:00
Petr Rockai
301ac8a07c NIX: Cope with existence of multiple primary.xml files.
This can happen temporarily while a mirror is syncing (parsing repomd.xml
would be a better fix, but slightly tricky since it's xml).
2014-02-28 23:56:04 +01:00
Petr Rockai
daa897fe90 test: Fix stat calls in lvmetad-pvscan-filter. 2014-02-28 23:33:30 +01:00
Petr Rockai
1bb29bb402 test: Downgrade lvmetad-lvm1 failure to a warning. 2014-02-28 23:33:17 +01:00
Petr Rockai
6733ac86d7 test: Fix the failing branch in aux lvmetad_talk. 2014-02-28 23:30:17 +01:00
Petr Rockai
fb003cdfd5 format-text: Fix a warning. 2014-02-28 16:23:16 +01:00
Petr Rockai
3e5bec37e9 format-text: Fix _raw_read_mda_header (missing close, open r/o). 2014-02-28 16:21:09 +01:00
Petr Rockai
c69d37d126 spec: udev rules don't live under %{_prefix} on fc16/rhel6 2014-02-28 14:18:15 +01:00