]> sourceware.org Git - lvm2.git/log
lvm2.git
9 years agolvchange: deactivate is always possible in foreign vgs
David Teigland [Wed, 25 Feb 2015 17:33:11 +0000 (11:33 -0600)]
lvchange: deactivate is always possible in foreign vgs

The only realistic way for a host to have active LVs in a
foreign VG is if the host's system_id (or system_id_source)
is changed while LVs are active.

In this case, the active LVs produce an warning, and access
to the VG is implicitly allowed (without requiring --foreign.)
This allows the active LVs to be deactivated.

In this case, rescanning PVs for the VG offers no benefit.
It is not possible that rescanning would reveal an LV that
is active but wasn't previously in the VG metadata.

9 years agocmirror: Adjust region size to work around CPG msg limit to avoid hang.
Jonathan Brassow [Wed, 25 Feb 2015 20:42:15 +0000 (14:42 -0600)]
cmirror: Adjust region size to work around CPG msg limit to avoid hang.

cmirror uses the CPG library to pass messages around the cluster and maintain
its bitmaps.  When a cluster mirror starts-up, it must send the current state
to any joining members - a checkpoint.  When mirrors are large (or the region
size is small), the bitmap size can exceed the message limit of the CPG
library.  When this happens, the CPG library returns CPG_ERR_TRY_AGAIN.
(This is also a bug in CPG, since the message will never be successfully sent.)

There is an outstanding bug (bug 682771) that is meant to lift this message
length restriction in CPG, but for now we work around the issue by increasing
the mirror region size.  This limits the size of the bitmap and avoids any
issues we would otherwise have around checkpointing.

Since this issue only affects cluster mirrors, the region size adjustments
are only made on cluster mirrors.  This patch handles cluster mirror issues
involving pvmove, lvconvert (from linear to mirror), and lvcreate.  It also
ensures that when users convert a VG from single-machine to clustered, any
mirrors with too many regions (i.e. a bitmap that would be too large to
properly checkpoint) are trapped.

9 years agolvcreate.8: Mention --cachepolicy and --cachesettings.
Petr Rockai [Wed, 25 Feb 2015 17:34:01 +0000 (18:34 +0100)]
lvcreate.8: Mention --cachepolicy and --cachesettings.

9 years agolvmcache.7: add a section on --cachepolicy/--cachesettings
Petr Rockai [Wed, 25 Feb 2015 17:20:06 +0000 (18:20 +0100)]
lvmcache.7: add a section on --cachepolicy/--cachesettings

9 years agovgcfgbackup: enable foreign VG access
David Teigland [Wed, 25 Feb 2015 17:01:37 +0000 (11:01 -0600)]
vgcfgbackup: enable foreign VG access

Backup of a foreign VG is allowed.

9 years agosystemid: silently ignore foreign vgs unless named
David Teigland [Wed, 25 Feb 2015 16:44:42 +0000 (10:44 -0600)]
systemid: silently ignore foreign vgs unless named

A foreign VG should be silently ignored by a reporting/display
command like 'vgs'.  If the reporting/display command specifies
a foreign VG by name on the command line, it should produce an
error message.

Scanning commands pvscan/vgscan/lvscan are always allowed to
read and update caches from all PVs, including those that belong
to foreign VGs.

Other non-report/display/scan commands always ignore a foreign
VG, or report an error if they attempt to use a foreign VG.

vgimport should always invalidate the lvmetad cache because
lvmetad likely holds a pre-vgexported copy of the VG.
(This is unrelated to using foreign VGs; the pre-vgexported
VG may have had no system_id at all.)

9 years agotoolcontext: Fix lvmlocal.conf load fail path.
Alasdair G Kergon [Wed, 25 Feb 2015 16:36:47 +0000 (16:36 +0000)]
toolcontext: Fix lvmlocal.conf load fail path.

9 years agoexample.conf: Update systemid comments.
Alasdair G Kergon [Wed, 25 Feb 2015 14:22:24 +0000 (14:22 +0000)]
example.conf: Update systemid comments.

Avoid using 'cluster' (ambiguous).
Add holding ref for machine-id source.

9 years agosystemid: Improve concurrent warning.
Alasdair G Kergon [Wed, 25 Feb 2015 14:17:35 +0000 (14:17 +0000)]
systemid: Improve concurrent warning.

9 years agosystemid: Allow empty systemid with warnings.
Alasdair G Kergon [Wed, 25 Feb 2015 14:12:24 +0000 (14:12 +0000)]
systemid: Allow empty systemid with warnings.

Add warning messages when empty system ID is set.

9 years agocache: Fix a segfault when passing --cachepolicy without --cachesettings.
Petr Rockai [Tue, 24 Feb 2015 10:36:30 +0000 (11:36 +0100)]
cache: Fix a segfault when passing --cachepolicy without --cachesettings.

9 years agosystemid: Extend --foreign to reporting commands.
Alasdair G Kergon [Mon, 23 Feb 2015 23:41:38 +0000 (23:41 +0000)]
systemid: Extend --foreign to reporting commands.

Add --foreign to the remaining reporting and display commands plus
vgcfgbackup.
Add a NEEDS_FOREIGN_VGS flag for vgimport to always set --foreign.
If lvmetad is being used with --foreign, scan foreign VGs (currently
implemented as a full PV scan).
Handle these things centrally in lvmcmdline.c.
Also allow lvchange and vgchange -an/-aln to deactivate any foreign
LVs that happen to be active if something went wrong.
Remember to set the system ID when creating a new VG in vgsplit.

9 years agosystemid: Fix access restrictions.
Alasdair G Kergon [Mon, 23 Feb 2015 23:19:36 +0000 (23:19 +0000)]
systemid: Fix access restrictions.

When checking whether the system ID permits access to a VG, check for
each permitted situation first, and only then issue the appropriate
error message.  Always issue a message for now.  (We'll try to
suppress some of those later when the VG concerned wasn't explicitly
requested.)
Add more messages to try to ensure every return code is checked and
every error path (and only an error path) contains a log_error().
Add self-correction to vgchange -c to deal with situations where
the cluster state and system ID state are out-of-sync (e.g. if
old tools were used).

9 years agolvm1: Reenable sys ID.
Alasdair G Kergon [Mon, 23 Feb 2015 23:03:52 +0000 (23:03 +0000)]
lvm1: Reenable sys ID.

Move the lvm1 sys ID into vg->lvm1_system_id and reenable the #if 0
LVM1 code.  Still display the new-style system ID in the same
reporting field, though, as only one can be set.
Add a format feature flag FMT_SYSTEM_ON_PVS for LVM1 and disallow
access to LVM1 VGs if a new-style system ID has been set.
Treat the new vg->system_id as const.

9 years agoconfig: Rename allow_system_id to extra_system_ids.
Alasdair G Kergon [Mon, 23 Feb 2015 22:19:08 +0000 (22:19 +0000)]
config: Rename allow_system_id to extra_system_ids.

Add warnings to the config file templates and briefly document
each value.
Configure lvmlocal.conf and install in /etc/lvm.

9 years agoconfig: Adjust system_id defaults.
Alasdair G Kergon [Mon, 23 Feb 2015 21:20:51 +0000 (21:20 +0000)]
config: Adjust system_id defaults.

Allow cmd->unknown_system_id to be cleared during toolcontext
refresh.
Set a default value of "none" for global/system_id_source.
Allow local/system_id to be empty so it's not impossible for
a later config file to remove it.

9 years agosystemid: Define file content more precisely.
Alasdair G Kergon [Mon, 23 Feb 2015 20:49:15 +0000 (20:49 +0000)]
systemid: Define file content more precisely.

In a file containing a system ID:
  Any whitespace at the start of a line is ignored;
  Blank lines are ignored;
  Any characters after a # are ignored along with the #.
  The system ID is obtained by processing the first line with
non-ignored characters.
  If further lines with non-ignored characters follow, a warning is
issued.

9 years agosystemid: Add warnings if invalid.
Alasdair G Kergon [Mon, 23 Feb 2015 20:36:27 +0000 (20:36 +0000)]
systemid: Add warnings if invalid.

Add WARNING messages if there are problems setting the requested
system ID.
Ban "localhost" as a prefix regardless of the system_id_source.
Use cmd->hostname instead of calling uname again.
Make system_id_source values case-insensitive (as with new settings like
log_debug_classes) and also accept machine-id to match the filename.

9 years agotoolcontext: Include system_id in refresh.
Alasdair G Kergon [Mon, 23 Feb 2015 20:21:00 +0000 (20:21 +0000)]
toolcontext: Include system_id in refresh.

Move _init_system_id() into _process_config() so it's also called when
refreshing the toolcontext.  Add WARNING to log_warn messages.

9 years agotoolcontext: Move lvmlocal.conf loading.
Alasdair G Kergon [Mon, 23 Feb 2015 20:11:00 +0000 (20:11 +0000)]
toolcontext: Move lvmlocal.conf loading.

Load lvmlocal.conf after basic initialisation from lvm.conf.

9 years agosystemid: Require alphanumeric 1st character.
Alasdair G Kergon [Mon, 23 Feb 2015 19:47:03 +0000 (19:47 +0000)]
systemid: Require alphanumeric 1st character.

Require system ID to begin with an alphanumeric character.
Rename fn to make clear it's only validation for systemid
and always terminate result rather than imposing this on the caller.

9 years agoformat_text: Fix creation_host_system_id.
Alasdair G Kergon [Mon, 23 Feb 2015 19:19:48 +0000 (19:19 +0000)]
format_text: Fix creation_host_system_id.

Don't escape quotes - forbidden characters.

9 years agoformat_text: Store creation_host_system_id.
Alasdair G Kergon [Mon, 23 Feb 2015 17:54:47 +0000 (17:54 +0000)]
format_text: Store creation_host_system_id.

Record the current system ID at the time of writing out VG metadata
in the outer section of it alongside the hostname and time.

9 years agoconfig: Reinstate recursive tags setting.
Alasdair G Kergon [Mon, 23 Feb 2015 17:40:58 +0000 (17:40 +0000)]
config: Reinstate recursive tags setting.

In 2.02.99, _init_tags() inadvertently began to ignore the
dm_config_tree struct passed to it.  "tags" sections are not
merged together, so the "tags" section in the main config file was
being processed repeatedly and other "tags" sections were ignored.

9 years agosystemid: Add built-in systemid command.
Alasdair G Kergon [Mon, 23 Feb 2015 17:26:50 +0000 (17:26 +0000)]
systemid: Add built-in systemid command.

Make it easy to find the system ID when testing.
Also show in general debug output.

9 years agolvm-string: Fix HYPEN typo.
Alasdair G Kergon [Mon, 23 Feb 2015 17:09:35 +0000 (17:09 +0000)]
lvm-string: Fix HYPEN typo.

9 years agolvmetad: Add fn to scan only foreign VGs.
Alasdair G Kergon [Mon, 23 Feb 2015 17:03:03 +0000 (17:03 +0000)]
lvmetad: Add fn to scan only foreign VGs.

Not implemented yet - just a wrapper.

9 years agoman lvmsystemid: update changing the system_id
David Teigland [Fri, 20 Feb 2015 22:55:27 +0000 (16:55 -0600)]
man lvmsystemid: update changing the system_id

9 years agoman lvm: document --foreign option
David Teigland [Fri, 20 Feb 2015 22:26:04 +0000 (16:26 -0600)]
man lvm: document --foreign option

9 years agovgchange, vgcreate: add systemid option to command help
David Teigland [Fri, 20 Feb 2015 21:31:17 +0000 (15:31 -0600)]
vgchange, vgcreate: add systemid option to command help

9 years agoman: systemid option for vgcreate and vgchange
David Teigland [Fri, 20 Feb 2015 20:58:01 +0000 (14:58 -0600)]
man: systemid option for vgcreate and vgchange

9 years agotests: skip system_id machineid case when not available
David Teigland [Fri, 20 Feb 2015 19:12:38 +0000 (13:12 -0600)]
tests: skip system_id machineid case when not available

instead of creating a fake /etc/machine-id file on the
system to test with.

9 years agoman lvmsystemid: expanded limitations and warnings
David Teigland [Fri, 20 Feb 2015 18:21:23 +0000 (12:21 -0600)]
man lvmsystemid: expanded limitations and warnings

9 years agoreport: fix foreign reporting without lvmetad
David Teigland [Thu, 19 Feb 2015 21:24:31 +0000 (15:24 -0600)]
report: fix foreign reporting without lvmetad

9 years agotests: add system_id test
David Teigland [Thu, 19 Feb 2015 20:08:51 +0000 (14:08 -0600)]
tests: add system_id test

9 years agodoc: explanation of caching foreign VGs
David Teigland [Thu, 19 Feb 2015 17:33:23 +0000 (11:33 -0600)]
doc: explanation of caching foreign VGs

9 years agoman: update lvmthin about repair and recovery
David Teigland [Fri, 6 Feb 2015 10:24:30 +0000 (04:24 -0600)]
man: update lvmthin about repair and recovery

Explain the thin metadata repair might not work.
Clarify that a full thin pool won't require fsck for journaled fs.

9 years agoconfigure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
Peter Rajnoha [Thu, 19 Feb 2015 15:17:19 +0000 (16:17 +0100)]
configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized

AC_ARG_WITH(default-raid10r-segtype --> AC_ARG_WITH(default-raid10-segtype

(...raid10r... --> ...raid10... - extra "r")

9 years agocleanup: drop unused header file
Zdenek Kabelac [Thu, 19 Feb 2015 13:42:27 +0000 (14:42 +0100)]
cleanup: drop unused header file

9 years agocleanup: simplify error path code
Zdenek Kabelac [Thu, 19 Feb 2015 13:06:17 +0000 (14:06 +0100)]
cleanup: simplify error path code

Mempool needs to free only with first alllocated element,
everything allocated afterwards is released as well.

9 years agocleanup: drop unused value assign
Zdenek Kabelac [Thu, 19 Feb 2015 13:03:45 +0000 (14:03 +0100)]
cleanup: drop unused value assign

Dop unused value assignments.

Unknown is detected via other combination
(!linear && !striped).

Also change the log_error() message into a warning,
since the function is not really returning error,
but still keep the INTERNAL_ERROR.

Ret value is always set later.

9 years agopvcreate: switch to "none" dev-ext source during pvcreate
Peter Rajnoha [Thu, 19 Feb 2015 13:30:20 +0000 (14:30 +0100)]
pvcreate: switch to "none" dev-ext source during pvcreate

The dev ext source must be reset for the dev_cache_get call
(which evaluates filters), not lvmcache_label_scan - so fix
original commit 727c7ff85d448743f751bc5218e73c41314ed5f1.

Also, add comments in _pvcreate_check fn explaining why
refresh filter and rescan is needed and exactly in which
situations.

9 years agowiping: blkid: do not count skipped signatures in final number of wipes
Peter Rajnoha [Thu, 19 Feb 2015 12:20:01 +0000 (13:20 +0100)]
wiping: blkid: do not count skipped signatures in final number of wipes

We exclude some signatures from being wiped when using blkid wiping.
These are signatures which we simply overwrite. For example, the
LVM2_member signature which denotes a PV - if we call pvcreate on
existing PV, we just overwrite the PV header, no need to wipe it.

Previously, we counted such signatures as if they were wiped
and they were counted in the final number of wiped signatures
that _wipe_known_signatures_with_blkid fn returned in the "wiped"
output arg. Then the code checking this output arg could be
mislead that wiping happened while no wiping took place in real
and we could fire some code uselessly based on this information
(e.g. refreshing filters/rescanning - see also
commit 6b4066585f73df7328ea16f6cb3713cd49cf2d2d).

9 years agoclvmd: Fix BZ 1140095 by updating lastfd upon EINTR.
Petr Rockai [Wed, 18 Feb 2015 11:45:43 +0000 (12:45 +0100)]
clvmd: Fix BZ 1140095 by updating lastfd upon EINTR.

9 years agotest: Avoid a race in pvmove-restart.sh.
Petr Rockai [Wed, 18 Feb 2015 11:27:47 +0000 (12:27 +0100)]
test: Avoid a race in pvmove-restart.sh.

9 years agotest: Make pvmove0 device removal more robust, in pvmove-restart.sh.
Petr Rockai [Wed, 18 Feb 2015 09:17:43 +0000 (10:17 +0100)]
test: Make pvmove0 device removal more robust, in pvmove-restart.sh.

9 years agotests: hide uninteresting output
Zdenek Kabelac [Tue, 17 Feb 2015 14:53:24 +0000 (15:53 +0100)]
tests: hide uninteresting output

We don't care about diff output.

9 years agoNIX: Fix a typo that broke evaluation of fc19+.
Petr Rockai [Tue, 17 Feb 2015 13:41:51 +0000 (14:41 +0100)]
NIX: Fix a typo that broke evaluation of fc19+.

9 years agocleanup: fix compate of return value
Zdenek Kabelac [Tue, 17 Feb 2015 12:40:35 +0000 (13:40 +0100)]
cleanup: fix compate of return value

Drop '!' for 'ret' compare.
Since the effect of false compare was only stack trace printing,
it present no real code flow change.

9 years agocleanup: drop !! from code
Zdenek Kabelac [Tue, 17 Feb 2015 12:39:47 +0000 (13:39 +0100)]
cleanup: drop !! from code

It's unused piece of code - but gcc5 noticed problem with
usage of !! on the leftside.

9 years agocleanup: drop unused val
Zdenek Kabelac [Tue, 17 Feb 2015 12:39:26 +0000 (13:39 +0100)]
cleanup: drop unused val

9 years agotests: syncaction update
Zdenek Kabelac [Tue, 17 Feb 2015 10:03:20 +0000 (11:03 +0100)]
tests: syncaction update

Improve syncaction testing with some minor
workaround for current upstream kernel

9 years agotests: ensure lv1 goes away first
Zdenek Kabelac [Mon, 16 Feb 2015 09:53:22 +0000 (10:53 +0100)]
tests: ensure lv1 goes away first

$lv1 may appear in the table after -pvmove0 which could make -pvmove0
unremovable.

9 years agofilters: no need to refresh filters/rescan if no signature is wiped during pvcreate...
Peter Rajnoha [Tue, 17 Feb 2015 08:46:34 +0000 (09:46 +0100)]
filters: no need to refresh filters/rescan if no signature is wiped during pvcreate at all

Before, we refreshed filters and we did full rescan of devices if
we passed through wiping (wipe_known_signatures fn call). However,
this fn returns success even if no signatures were found and so
nothing was wiped. In this case, it's not necessary to do the
filter refresh/rescan of devices as nothing changed clearly.

This patch exports number of wiped signatures from all the
wiping functions below. The caller (_pvcreate_check) then checks
whether any wiping was done at all and if not, no refresh/rescan
is done, saving some time and resources.

9 years agospec: Include lvmsystemid.7 in RPMs.
Petr Rockai [Mon, 16 Feb 2015 16:14:23 +0000 (17:14 +0100)]
spec: Include lvmsystemid.7 in RPMs.

9 years agoNIX: Fix CentOS builds.
Petr Rockai [Mon, 16 Feb 2015 14:29:29 +0000 (15:29 +0100)]
NIX: Fix CentOS builds.

9 years agoNIX: Resolve issues with fedora-release and kernel-modules-extra.
Petr Rockai [Wed, 11 Feb 2015 13:22:05 +0000 (14:22 +0100)]
NIX: Resolve issues with fedora-release and kernel-modules-extra.

9 years agopvcreate: switch to "none" dev-ext source during pvcreate
Peter Rajnoha [Mon, 16 Feb 2015 13:43:03 +0000 (14:43 +0100)]
pvcreate: switch to "none" dev-ext source during pvcreate

pvcreate code path executes signature wiping if there are any signatures
found on device to prepare the device for PV. When the signature is wiped,
the WATCH udev rule triggers the event which then updates udev database
with fresh info, clearing the old record about previous signature.

However, when we're using udev db as dev-ext source, we'd need to wait
for this WATCH-triggered event. But we can't synchronize against such
events (at least not at this moment). Without this sync, if the code
continues, the device could still be marked as containing the old
signature if reading udev db. This may end up even with the device
to be still filtered, though the signature is already wiped.

This problem is then exposed as (an example with md components):

$  mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb --run
$  mdadm -S /dev/md0
$  pvcreate -y /dev/sda
Wiping linux_raid_member signature on /dev/sda.
/dev/sda: Couldn't find device.  Check your filters?
$ echo $?
5

So we need to temporarily switch off "udev" dev-ext source here
in this part of pvcreate code until we find a way how to sync
with WATCH events.

(This problem does not occur with signature wiping which we do
on newly created LVs since we already handle this properly with
our udev flags - the LV_NOSCAN/LV_TEMPORARY flag. But we can't use
this technique for non-dm devices to keep WATCH rule under control.)

9 years agoconf: Set default global/etc from --with-confdir.
Alasdair G Kergon [Fri, 13 Feb 2015 19:10:10 +0000 (19:10 +0000)]
conf: Set default global/etc from --with-confdir.

9 years agosystem_id: warn if the system_id_file cannot be opened
David Teigland [Fri, 13 Feb 2015 17:37:11 +0000 (11:37 -0600)]
system_id: warn if the system_id_file cannot be opened

9 years agosystem_id: omit leading hyphens from system_id
David Teigland [Fri, 13 Feb 2015 17:14:46 +0000 (11:14 -0600)]
system_id: omit leading hyphens from system_id

9 years agotoollib: add underscore to static ignore_vg function
David Teigland [Fri, 13 Feb 2015 17:01:55 +0000 (11:01 -0600)]
toollib: add underscore to static ignore_vg function

9 years agoWHATS_NEW for system_id
David Teigland [Fri, 13 Feb 2015 16:27:17 +0000 (10:27 -0600)]
WHATS_NEW for system_id

9 years agosystem_id: use for VG ownership
David Teigland [Fri, 24 Oct 2014 17:29:04 +0000 (12:29 -0500)]
system_id: use for VG ownership

See included lvmsystemid(7) for full description.

9 years agovgextend: Use process_each_vg.
David Teigland [Fri, 13 Feb 2015 14:58:51 +0000 (14:58 +0000)]
vgextend: Use process_each_vg.

Tags and --select are not yet supported because new code is needed
to ensure exactly one VG matches before the VG starts to be processed.

9 years agotests: fix pvcreate-operation-md test to properly clean up devs before their reuse
Peter Rajnoha [Fri, 13 Feb 2015 13:53:26 +0000 (14:53 +0100)]
tests: fix pvcreate-operation-md test to properly clean up devs before their reuse

pvcreate filters out devices with existing partitions defined on them,
we need to properly clean up the devs before we reuse them.

9 years agotests: comment in select-tools.sh
Peter Rajnoha [Fri, 13 Feb 2015 10:45:13 +0000 (11:45 +0100)]
tests: comment in select-tools.sh

9 years agotolllib: process_each_pv: always use full_filter unconditionally when getting all...
Peter Rajnoha [Fri, 13 Feb 2015 09:59:19 +0000 (10:59 +0100)]
tolllib: process_each_pv: always use full_filter unconditionally when getting all devices

(This reverts patch #d95c6154)

Filter complete device list through full_filter unconditionally when
we're getting the list of *all* devices even in case we're interested
only in fraction of those devices - the PVs, not the other devices
which are not PVs yet (e.g. pvs vs. pvs -a).

We need to do this full filtering whenever we're handling *complete*
list of devices, we need to be safe here, mainly if there are any
future changes and we'd forgot to change to use proper filtering then.
Also properly preventing duplicates if there are any block subsystem
components used (mpath, MD ...).

Thing here is that (under use_lvmetad=1), cmd->filter can be used
only if we're sure that the list of devices we're filtering contains
only PVs. We have to use cmd->full_filter otherwise (like it is in
case of _get_all_devices fn which acquires complete list of devices,
no matter if it is a PV or not).

Of course, cmd->full_filter is more extensive than cmd->filter
which is only a subset of full_filter.

We could optimize this in a way that if we're interested in PVs only
during process_each_pv processing (e.g. using pvs in contrast to pvs -a),
we'd get the list of PV devices directly from lvmetad from the
lvmcache_seed_infos_from_lvmetad fn call which currently updates
lvmcache only. We'd add an additional output arg for this fn to get
the list of PV devices directly in addition, without a need to iterate
over all devices which include non-PVs which we're not interested in
anyway, hence we could use only cmd->filter, not the cmd->full_filter.

So the code would look something like this:

static int _get_all_devices(....)
{
struct device_id_list *dil;

if (interested_in_pvs_only)
lvmcache_seed_infos_from_lvmetad(cmd, &dil); /* new "dil" arg */
/* the "dil" list would be filtered through cmd->filter inside lvmcache_seed_infos_from_lvmetad */
else {
lvmcache_seed_infos_from_lvmetad(cmd, NULL);
dev_iter_create(cmd->full_filter)
while (dev = dev_iter_get ...) {
dm_list_add(all_devices, &dil->list);
}
}
}

9 years agotests: select-tools.sh: pvchange now uses process_each_pv
Peter Rajnoha [Fri, 13 Feb 2015 09:52:36 +0000 (10:52 +0100)]
tests: select-tools.sh: pvchange now uses process_each_pv

pvchange now uses process_each_pv so uncomment parts of the test
which check proper functionality of intersection between selection
result and PVs or PV tags directly provided on command line. This
didn't work properly before when pvchange was not using process_each_pv.

For example:

  pvchange -u -S 'pv_name=/dev/sda' /dev/sdb

..changes nothing since clearly the intersection of /dev/sda and
/dev/sdb is empty set. The same applies for tags:

  pvchange -u -S 'pv_name=/dev/sda' @some_tag

..changes nothing if /dev/sda is not tagged with some_tag.

9 years agocleanup: remove deallocate_handle_root arg from destroy_procesing_handle fnw
Peter Rajnoha [Fri, 13 Feb 2015 09:42:21 +0000 (10:42 +0100)]
cleanup: remove deallocate_handle_root arg from destroy_procesing_handle fnw

9 years agocleanup: replace static struct processing_handle initializer with common init_process...
Peter Rajnoha [Fri, 13 Feb 2015 09:36:06 +0000 (10:36 +0100)]
cleanup: replace static struct processing_handle initializer with common init_processing_handle

It's cleaner this way - do not mix static and dynamic
(init_processing_handle) initializers. Use the dynamic one everywhere.
This makes it easier to manage the code - there are no "exceptions"
then and we don't need to take care about two ways of initializing the
same thing - just use one common initializer throughout and it's clear.

Also, add more comments, mainly in the report_for_selection fn explaining
what is being done and why with respect to the processing_handle and
selection_handle.

9 years agopvchange: no need to initialize selection handle directly, process_each_pv will do...
Peter Rajnoha [Fri, 13 Feb 2015 08:28:24 +0000 (09:28 +0100)]
pvchange: no need to initialize selection handle directly, process_each_pv will do that automatically

9 years agolvchange: change msg about required params (LV or selection) to be consistent with...
Peter Rajnoha [Fri, 13 Feb 2015 08:04:21 +0000 (09:04 +0100)]
lvchange: change msg about required params (LV or selection) to be consistent with msgs used in other tools

9 years agopvchange: Use process_each_pv.
Alasdair G Kergon [Thu, 12 Feb 2015 16:37:47 +0000 (16:37 +0000)]
pvchange: Use process_each_pv.

Invalid devices no longer included in the counters printed at the end.
May now need to use --ignoreskippedcluster if relying upon exit status.
If more than one change is requested per-PV, attempt to perform them
all.  Note that different arguments still handle exit status
differently.

9 years agoautoreconf: recent changes
Peter Rajnoha [Thu, 12 Feb 2015 14:48:12 +0000 (15:48 +0100)]
autoreconf: recent changes

autoconf-2.69-14.fc20.noarch
automake-1.13.4-6.fc20.noarch

9 years agovalgrind: when executed within valrind skip close
Zdenek Kabelac [Thu, 12 Feb 2015 14:32:30 +0000 (15:32 +0100)]
valgrind: when executed within valrind skip close

Since valgrind uses internal file descriptors for communication,
don't try to close them in this case.

9 years agomemory: disable check with valgrind pool build
Zdenek Kabelac [Thu, 12 Feb 2015 14:30:43 +0000 (15:30 +0100)]
memory: disable check with valgrind pool build

When lvm2 is build with valgrind pool detection - always disable
memcheck, since pool memory allocation are unconditionaly passed
into valgrind library.

9 years agoconfigure.in: AC_SUBST needs to be always executed
Zdenek Kabelac [Thu, 12 Feb 2015 14:29:58 +0000 (15:29 +0100)]
configure.in: AC_SUBST needs to be always executed

9 years agotests: BACKING_DEV
Zdenek Kabelac [Thu, 12 Feb 2015 12:30:39 +0000 (13:30 +0100)]
tests: BACKING_DEV

Reset BACKING_DEV when it's same as LOOP.
Reset only 64K - so just eats a bit less space from underlaying loop
devices...

9 years agotests: ensure array is synchronized
Zdenek Kabelac [Thu, 12 Feb 2015 09:40:57 +0000 (10:40 +0100)]
tests: ensure array is synchronized

Before continue of repair test, ensure mirror is in sync

9 years agotests: don't crash if checked string is shorter
Zdenek Kabelac [Thu, 12 Feb 2015 09:39:37 +0000 (10:39 +0100)]
tests: don't crash if checked string is shorter

Not really sure what is this testing - just avoid coredump if
the test cannot happen since the index would too high.

9 years agomakefiles: more _CFLAGS for -MM
Zdenek Kabelac [Thu, 12 Feb 2015 09:38:01 +0000 (10:38 +0100)]
makefiles: more _CFLAGS for -MM

Move of valgrind flags to _CFLAGS make the -MM generation
not compilable (d571eab3b2bbb9be80e75e633bf2e30834975552)

Add these _CFLAGS right into .c->.d rules
(as well as  UDEV)

9 years agotests: respect LVM_TEST_DIR
Zdenek Kabelac [Thu, 12 Feb 2015 09:33:48 +0000 (10:33 +0100)]
tests: respect LVM_TEST_DIR

Check for empty LVM_TEST_DIR
(regression from 48275c78361578672f5f3f5c29737404cf159f6d)

9 years agotoollib: process_each_pv: fix commit d38d047e which worked for processing "all device...
Peter Rajnoha [Thu, 12 Feb 2015 13:14:45 +0000 (14:14 +0100)]
toollib: process_each_pv: fix commit d38d047e which worked for processing "all devices", but didn't work for "all PVs"

We still need to get the list as the calls underneath process_each_pv
rely on this list. But still keep the change related to the filters -
if we're processing all devices, we need to use cmd->full_filter.
If we're processing only PVs, we can use cmd->filter only to save
some time which would be spent in filtering code.

9 years agotoollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting...
Peter Rajnoha [Thu, 12 Feb 2015 12:36:05 +0000 (13:36 +0100)]
toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs)

When lvmetad is used and at the same time we're getting list of all
PV-capable devices, we can't use cmd->filter (which is used to filter
out lvmetad responses - so we're sure that the devices are PVs already).

To get the list of PV-capable devices, we're bypassing lvmetad (since
lvmetad only caches PVs, not all the other devices which are not PVs).
For this reason, we have to use the "full_filter" filter chain (just
like we do when we're running without lvmetad).

Example scenario:
- sdo and sdp components of MD device md0
- sdq, sdr and sds components of mpatha multipath device
- mpatha multipath device partitioned
- vda device partitioned

=> sdo,sdp,sdr,sds, mpatha and vda should be filtered!

$ lsblk -o NAME,TYPE
NAME            TYPE
sdn             disk
sdo             disk
`-md0           raid0
sdp             disk
`-md0           raid0
sdq             disk
`-mpatha        mpath
  `-mpatha1     part
sdr             disk
`-mpatha        mpath
  `-mpatha1     part
sds             disk
`-mpatha        mpath
  `-mpatha1     part
vda             disk
|-vda1          part
`-vda2          part
  |-fedora-swap lvm
  `-fedora-root lvm

Before this patch:
==================
use_lvmetad=0 (correct behaviour!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

use_lvmetad=1 (incorrect behaviour - sdo,sdp,sdq,sdr,sds and mpatha not filtered!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha              ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/sdo                        ---     0     0
  /dev/sdp                        ---     0     0
  /dev/sdq                        ---     0     0
  /dev/sdr                        ---     0     0
  /dev/sds                        ---     0     0
  /dev/vda                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

With this patch applied:
========================
use_lvmetad=1
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

9 years agotoollib: process_each_pv: do not acquire list of all devices if not necessary
Peter Rajnoha [Thu, 12 Feb 2015 12:28:00 +0000 (13:28 +0100)]
toollib: process_each_pv: do not acquire list of all devices if not necessary

List of all devices is only needed if we want to process devices
which are not PVs (e.g. pvs -a). But if this is not the case, it's
useless to get the list of all devices and then discard it without
any use, which is exactly what happened in process_each_pv where
the code was never reached and the list was unused if we were
processing just PVs, not all PV-capable devices:

int process_each_pv(...)
{
...
process_all_devices = process_all_pvs &&
      (cmd->command->flags & ENABLE_ALL_DEVS) &&
      arg_count(cmd, all_ARG);
...
/*
 * If the caller wants to process all devices (not just PVs), then all PVs
 * from all VGs are processed first, removing them from all_devices.  Then
 * any devs remaining in all_devices are processed.
*/
_get_all_devices(cmd, &all_devices);
...
ret = _process_pvs_in_vgs(...);
...
if (!process_all_devices)
goto out;

        ret = _process_device_list(cmd, &all_devices, handle, process_single_pv);
...
}

This patch adds missing check for "process_all_devices" and it gets the
list of all (including non-PV) devices only if needed:

9 years agotest: Fix missing return in new test harness.
Marian Csontos [Thu, 12 Feb 2015 12:26:38 +0000 (13:26 +0100)]
test: Fix missing return in new test harness.

9 years agoconfig: fix version of introduction for devices/external_device_info_source (v115...
Peter Rajnoha [Thu, 12 Feb 2015 08:30:40 +0000 (09:30 +0100)]
config: fix version of introduction for devices/external_device_info_source (v115->v116)

9 years agotests: add select-tools.sh to test selection support in toollib
Peter Rajnoha [Wed, 11 Feb 2015 15:16:50 +0000 (16:16 +0100)]
tests: add select-tools.sh to test selection support in toollib

Tests for selection within non-reporting tools while using process_each_* fns.

9 years agotests: rename report-select.sh to select-report.sh
Peter Rajnoha [Wed, 11 Feb 2015 15:15:11 +0000 (16:15 +0100)]
tests: rename report-select.sh to select-report.sh

Let's name all selection-related tests with the "select-" prefix for
better sorting.

9 years agoreport: define ba_start, vg_free and seg_start fields as DM_REPORT_FIELD_TYPE_SIZE...
Peter Rajnoha [Wed, 11 Feb 2015 12:57:18 +0000 (13:57 +0100)]
report: define ba_start, vg_free and seg_start fields as DM_REPORT_FIELD_TYPE_SIZE instead of DM_REPORT_FIELD_TYPE_NUM

This makes a difference when using selection criteria based on
these fields - if those fields are defined as DM_REPORT_FIELD_TYPE_SIZE
(in contrast to DM_REPORT_FIELD_TYPE_NUMBER), units are also
recognize in selection clause.

For example:
$ lvs -o+seg_start vg1/lv2
  LV   VG   Attr       LSize  Start
  lv2  vg1  -wi-a----- 12.00m    0
  lv2  vg1  -wi-a----- 12.00m 8.00m

Before this patch:
$ lvs -o+seg_start --select 'seg_start=8m'
  Found size unit specifier but numeric value expected for selection field seg_start.
  Selection syntax error at 'seg_start=8m'.
  Use 'help' for selection to get more help.

With this patch applied:
$lvs -o+seg_start --select 'seg_start=8m'
  LV   VG   Attr       LSize  Start
  lv2  vg1  -wi-a----- 12.00m 8.00m

(the same applies for ba_start and vg_free fields)

9 years agoconf: update profile templates for recent changes
Peter Rajnoha [Wed, 11 Feb 2015 12:22:31 +0000 (13:22 +0100)]
conf: update profile templates for recent changes

9 years agoman: reference -S/--select in {vg,lv,pv}change, {vg,lv}remove, {vg,lv,pv}display...
Peter Rajnoha [Wed, 11 Feb 2015 09:03:37 +0000 (10:03 +0100)]
man: reference -S/--select in {vg,lv,pv}change, {vg,lv}remove, {vg,lv,pv}display and vg{import,export} man pages

9 years agotoollib: select: issue an error message for failed VG/LV/PV selection
Peter Rajnoha [Wed, 11 Feb 2015 08:36:09 +0000 (09:36 +0100)]
toollib: select: issue an error message for failed VG/LV/PV selection

9 years agoman: dumpconfig: mention LVM_COMMAND_PROFILE env var and add more references to ...
Peter Rajnoha [Wed, 11 Feb 2015 08:21:08 +0000 (09:21 +0100)]
man: dumpconfig: mention LVM_COMMAND_PROFILE env var and add more references to --mergedconfig option

The LVM_COMMAND_PROFILE env var is new - mention it in dumpconfig's
man page.

Also, dumpconfig always displays the top of the config cascade.
To display all the config found in the cascade merged (just like
it's used during LVM command processing), --mergedconfig option
must be used - this one's already described in that man page,
just make sure it's clear and add reference for this option also
in --profile/--commandprofile/--metadataprofile description.

9 years agoNIX: Drop Fedora 16 builds.
Petr Rockai [Tue, 10 Feb 2015 16:26:32 +0000 (17:26 +0100)]
NIX: Drop Fedora 16 builds.

9 years agoNIX: Adjust lists of extra RPMs to install.
Petr Rockai [Tue, 10 Feb 2015 16:26:02 +0000 (17:26 +0100)]
NIX: Adjust lists of extra RPMs to install.

9 years agotest: Fix harness not building on RHEL5 dev-mcsontos-rhel5-CLOEXEC
Marian Csontos [Tue, 10 Feb 2015 13:51:45 +0000 (14:51 +0100)]
test: Fix harness not building on RHEL5

9 years agoselect: initialize selection handle for process_each_* fns with initial report type
Peter Rajnoha [Tue, 10 Feb 2015 12:46:37 +0000 (13:46 +0100)]
select: initialize selection handle for process_each_* fns with initial report type

This is a followup patch for previous patchset that enables selection in
process_each_* fns to fix an issue where field prefixes are not
automatically used for fields in selection criteria.

Use initial report type that matches the intention of each process_each_* functions:
- _process_pvs_in_vg - PVS
- process_each_vg - VGS
- process_each_lv and process_each_lv_in_vg - LVS

This is not normally needed for the selection handle init, BUT we would
miss the field prefix matching, e.g.

lvchange -ay -S 'name=lvol0'

The "name" above would not work if we didn't initialize reporting with
the LVS type at its start. If we pass proper init type, reporting code
can deduce the prefix automatically ("lv_name" in this case).

This report type is then changed further based on what selection criteria we
have. When doing pure selection, not report output, the final report type
is purely based on combination of this initial report type and report types
of the fields used in selection criteria.

9 years agotools: allow -S|--select for vgexport and vgimport
Peter Rajnoha [Fri, 12 Dec 2014 11:03:34 +0000 (12:03 +0100)]
tools: allow -S|--select for vgexport and vgimport

This page took 0.07496 seconds and 5 git commands to generate.