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

10714 Commits

Author SHA1 Message Date
Tony Asleson
e8c11c7df0 python: Check for NULL value before constructing string property
When retrieving a property value that is a string, if the character pointer in C
was NULL, we would segfault.  This change checks for non-null before creating a
python string representation.  In the case where the character pointer is NULL
we will return a python 'None' for the value.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2015-05-06 08:51:04 -05:00
Tony Asleson
c21f1ba07a python: Build correct python value for numerical property
With the lvm2app C API adding the ability to determine when a property is
signed we can then use this information to construct the correct representation
of the number for python which will maintain value and sign.  Previously, we
only represented the numbers in python as positive integers.

Python long type exceeds the range for unsigned and signed integers, we just
need to use the appropriate parsing code to build correctly.

Python part of the fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=838257

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2015-05-06 08:51:04 -05:00
Tony Asleson
91f737383c lvm2app: Add signed numerical property values
Currently lvm2app properties have the following structure:

typedef struct lvm_property_value {
        uint32_t is_settable:1;
        uint32_t is_string:1;
        uint32_t is_integer:1;
        uint32_t is_valid:1;
        uint32_t padding:28;
        union {
                const char *string;
                uint64_t integer;
        } value;
} lvm_property_value_t;

which assumes that numerical values were in the range of 0 to 2**64-1.  However,
some of the properties were 'signed', like LV major/minor numbers and some
reserved values for properties that represent percentages.  Thus when the
values were retrieved they were in two's complement notation.  So for a -1
major number the API user would get a value of 18446744073709551615.  The
API user could cast the returned value to an int64_t to handle this, but that
requires the API developer to look at the source code and determine when it
should be done.

This change modifies the return property structure to:

typedef struct lvm_property_value {
        uint32_t is_settable:1;
        uint32_t is_string:1;
        uint32_t is_integer:1;
        uint32_t is_valid:1;
        uint32_t is_signed:1;
        uint32_t padding:27;
        union {
                const char *string;
                uint64_t integer;
                int64_t signed_integer;
        } value;
} lvm_property_value_t;

With this addition the API user can interrogate that the value is numerical,
(is_integer = 1) and subsequently check if it's signed (is_signed = 1) too.
If signed, then the API developer should use the union's signed_integer to
avoid casting.

This change maintains backwards compatibility as the structure size remains
unchanged and integer value remains unchanged.  Only the additional bit
taken from the pad is utilized.

Bugzilla reference:
https://bugzilla.redhat.com/show_bug.cgi?id=838257

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2015-05-06 08:51:04 -05:00
Ondrej Kozina
5bbf083cd1 tests: do not restart lvmetad when not necessary
overlooked pvmove-restart test during cleanup
2015-05-06 15:20:11 +02:00
Ondrej Kozina
9fc6b654f5 WHATS_NEW: update for recent changes
commits:
- bda26acf70
- 76a0dffe6f
2015-05-05 20:52:49 +02:00
Ondrej Kozina
7fca7f196d polldaemon: make wait_for_single_lv public
referenced by new lvpoll command after lvmpolld
gets merged.
2015-05-05 20:52:24 +02:00
Ondrej Kozina
81c038934c polldaemon: introduce _nanosleep function
querying future lvmpolld with zero wait time is highly undesirable
and can cause serious performance drop of the future daemon. The new
wrapper function may avoid immediate return from syscal by
introducing minimal wait time on demand.
2015-05-05 20:52:17 +02:00
Ondrej Kozina
76a0dffe6f polldaemon: refactor polling interfaces
Routines responsible for polling of in-progress pvmove, snapshot merge
or mirror conversion each used custom lookup functions to find vg and
lv involved in polling.

Especially pvmove used pvname to lookup pvmove in-progress. The future
lvmpolld will poll each operation by vg/lv name (internally by lvid).
Also there're plans to make pvmove able to move non-overlaping ranges
of extents instead of single PVs as of now. This would also require
to identify the opertion in different manner.

The poll_operation_id structure together with daemon_parms structure they
identify unambiguously the polling task.
2015-05-05 20:52:07 +02:00
Ondrej Kozina
bda26acf70 polldaemon: optimise out waiting after polling
Waiting even after _check_lv_status returned success and
'finished' flag was set to true doesn't make much sense.

Note that while we skip the wait() we also skip the
init_full_scan_done(0) inside the routine. This should
have no impact as long as the code after _wait_for_single_lv
doesn't presume anything about the state of the cache.
2015-05-05 20:51:45 +02:00
Ondrej Kozina
22ae43a11e polldaemon: get get_copy_vg ready for refactoring
with refactored code we take some VG locks as read-only.
Make the poll_get_copy_vg ready for the change.
2015-05-05 20:51:34 +02:00
Ondrej Kozina
991d646354 lvconvert: code cleanup and preps for refactoring
just a code cleanup and preparations for adding
new code required for polldaemon refactoring.
This commit should not have any functional impact.
2015-05-05 20:51:27 +02:00
Ondrej Kozina
32527861d0 polldaemon: respect lv_attr parm in poll_get_copy_lv
as a part of bigger effort to unify polling intefaces
poll_get_copy_lv should be able to look up LVs based
on theirs lv->status field.

Effective after pvmove starts using poll_get_copy_lv
fn as well.
2015-05-04 16:56:52 +02:00
Ondrej Kozina
26f4b1da88 polldaemon: move lvconvert_get_copy_lv code
Moving lvconvert_get_copy_lv to polldaemon (poll_get_copy_lv).
Clear move and rename.
2015-05-04 16:56:39 +02:00
Ondrej Kozina
079895b8be polldaemon: move lvconvert_get_copy_vg code
Moving lvconvert_get_copy_vg to polldaemon (poll_get_copy_vg).
Clear move and rename.
2015-05-04 16:56:28 +02:00
Zdenek Kabelac
7a5a4f952e tests: play better with mdadm
Manage mdadm devices on older distros is a challange.
2015-05-04 13:11:41 +02:00
Zdenek Kabelac
88421c883e raid: reread status when 0 is reported
When kernel target reports sync status as 0%  it might as well mean
it's 100% in sync, just the target is in some race inconsistent
state - so reread once again and take a more optimistic value ;)

Patch tries to work around:
https://bugzilla.redhat.com/show_bug.cgi?id=1210637
2015-05-04 13:09:05 +02:00
Zdenek Kabelac
2d10a6f6ae tests: check for open_count
Instead of checking /proc/mounts check for open_count of snap device.
Parallel umount has race, so check for open_count.
2015-05-04 10:18:44 +02:00
Zdenek Kabelac
7a588bce7b tests: drop extra scsi init
Use first test also for checking the support is there -
avoid one extra unnecessary scsi_debug reload.
2015-05-04 10:17:48 +02:00
Zdenek Kabelac
c90ee0414d tests: check for clvmd process entry
Instead of checking just for pid file - rather check
for process  - since there could be slight race, the
pid file is gone, but process still exists.
2015-05-04 10:16:33 +02:00
Zdenek Kabelac
3f05e662bb tests: validate passed LVM_TEST_DEVDIR
Quit test early if passed LVM_TEST_DEVDIR dir does not exists.
2015-05-04 10:15:56 +02:00
Zdenek Kabelac
b09ac72624 tests: wait for scsi device to appear
Continue with test as soon as device appear (avoid 2s delay)
2015-05-04 10:14:52 +02:00
Zdenek Kabelac
75aa3e951f tests: dd needs to fail in this case 2015-05-03 01:06:20 +02:00
Zdenek Kabelac
224e30a4b1 tests: more waits on restart
Check for socket presence (hardcoded for now)
2015-05-03 00:43:15 +02:00
Zdenek Kabelac
31f1375d23 tests: use 800ms write delay
Since this value magically worked for  pvmove-abort*
use it here as well.

Also prepate_lvmetad has better kill&reload mechanism.
2015-05-03 00:43:15 +02:00
Zdenek Kabelac
4f6660db7d tests: use odirect
Fill snaphot with odirect so we know data hits disk
before we test how full the snapshot is.
2015-05-03 00:43:15 +02:00
Zdenek Kabelac
74a81a4577 lvm2app: call fin_locking in lvm_quit
lvm_quit() function should also close locking.
Fixes unclosed socket connecting clvmd.
2015-05-03 00:43:13 +02:00
Zdenek Kabelac
bc52f07a8f configure: detect /run dir
Access /run directly when system supports it.
2015-05-03 00:42:07 +02:00
Zdenek Kabelac
636bcb020a clvmd: missed newline in help text
Print \n after listing included lock managers.
2015-05-03 00:41:20 +02:00
Alasdair G Kergon
9fb93fcd90 post-release 2015-05-02 01:52:05 +01:00
Alasdair G Kergon
bee2df3903 pre-release 2015-05-02 01:41:17 +01:00
Alasdair G Kergon
796dc9c91c config: Remove newly-exposed default settings.
Reinstate config settings matching the last release until every
case where the generator produces different output has been reviewed
and fresh decisions made about which defaults to expose as protection
against changes in newer releases. We should be trying to reduce, not
increase, this number.
2015-05-02 00:07:12 +01:00
Zdenek Kabelac
3542fce0fb tests: more advance cleanup of running pvmove
More take down more targets and use time-limited code.
2015-05-01 22:49:38 +02:00
Zdenek Kabelac
abdfb1e75b tests: configure use_lvmetad when needed 2015-05-01 22:49:38 +02:00
David Teigland
6a171bbdf5 man: expanded explanation of lvmetad 2015-05-01 15:23:43 -05:00
David Teigland
9273b1a964 man: expanded explanation of pvscan
Related to it's role with lvmetad and auto-activation.
2015-05-01 15:23:32 -05:00
Zdenek Kabelac
9c7063ef89 tests: free -h is quite new option
Stay with -g and and ignore failure.
2015-05-01 15:40:04 +02:00
Zdenek Kabelac
79844b9066 tests: minor simplifications
minor updates
2015-05-01 15:07:59 +02:00
Zdenek Kabelac
fee09f0964 tests: disable usage of fuser
Seems we captured problems with debug.log overwrite,
so avoid quite expensive usage of fuser tool with each lvm command.
2015-05-01 15:07:59 +02:00
Zdenek Kabelac
4ce5b5fdf3 tests: run api tests from startup dir 2015-05-01 15:07:59 +02:00
Zdenek Kabelac
a3473e60db tests: no lvmetad reload for debugless output
Introduce LVM_TEST_LVMETAD_DEBUG_OPTS to allow to override
default debug opts for lvmetad.

However could be still overloaded on command line:

make check_lvmetad LVM_TEST_LVMETAD_DEBUG_OPTS="-l all"...
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
dd4e6b4e7e tests: lower version of dm-delay
Let's see what will break with lower version 1.1.

Also avoid repeated check of target version.
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
16e8006eb0 tests: rename kill_tagged_processes
Better name for aux function.
First use normal -TERM, and only after a while use -KILL
(leaving some time to correctly finish)
Print INFO about killed processes.
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
c18e969e30 tests: move conf preparing
If the test in the middle is restarting lvmetad
avoid conf regenerating.
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
0eea780bce tests: hide error message
Hide error about missing declare -A  support.
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
0480b4743a tests: wait between remount
Let's see if this help with some races...
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
4daede06e5 tests: move kernel_at_least to aux
Hide func processing and reuse existing
version_at_least().
2015-05-01 15:07:58 +02:00
Zdenek Kabelac
f48a4c391c tests: watch out for RAM size
Reduce mem-requirements on low memory boxes,
activate less volumes if machine is below 0.5G.

Also print mem size at test header.
2015-05-01 15:07:58 +02:00
Peter Rajnoha
11e0dc40dc config: add CFG_DEFAULT_COMMENTED to comment out default value on output 2015-04-30 18:26:56 +02:00
Peter Rajnoha
8f25606d3a man: lvmconfig: also mention '--type list' in synopsis 2015-04-30 18:00:39 +02:00
Peter Rajnoha
fc65269d68 lvmconfig: add supporting code for handling deprecated settings
This patch adds supporting code for handling deprecated settings.

Deprecated settings are not displayed by default in lvmconfig output
(except for --type current and --type diff). There's a new
"--showdeprecated" lvmconfig option to display them if needed.

Also, when using lvmconfig --withcomments, the comments with info
about deprecation are displayed for deprecated settings and with
lvmconfig --withversions, the version in which the setting was
deprecated is displayed in addition to the version of introduction.

If using --atversion with a version that is lower than the one
in which the setting was deprecated, the setting is then considered
as not deprecated (simply because at that version it was not
deprecated).

For example:

$ lvmconfig --type default activation
activation {
        ...
	raid_region_size=512
        ...
}

$ lvmconfig --type default activation --showdeprecated
activation {
        ...
	mirror_region_size=512
	raid_region_size=512
        ...
}

$ lvmconfig --type default activation --showdeprecated --withversions
activation {
        ...
	# Available since version 1.0.0.
	# Deprecated since version 2.2.99.
	mirror_region_size=512
	# Available since version 2.2.99.
	raid_region_size=512
        ...
}

$ lvmconfig --type default activation --showdeprecated --withcomments
activation {
        ...
	# Configuration option activation/mirror_region_size.
	# This has been replaced by the activation/raid_region_size
	# setting.
	# Size (in KB) of each copy operation when mirroring.
	# This configuration option is deprecated.
	mirror_region_size=512

	# Configuration option activation/raid_region_size.
	# Size in KiB of each raid or mirror synchronization region.
	# For raid or mirror segment types, this is the amount of
	# data that is copied at once when initializing, or moved
	# at once by pvmove.
	raid_region_size=512
        ...
}

$ lvmconfig --type default activation --withcomments --atversion 2.2.98
activation {
       ...
       # Configuration option activation/mirror_region_size.
       # Size (in KB) of each copy operation when mirroring.
       mirror_region_size=512
       ...
}
2015-04-30 17:55:04 +02:00