]> sourceware.org Git - lvm2.git/log
lvm2.git
14 years agoImprove various log messages.
Alasdair Kergon [Wed, 30 Jun 2010 13:51:11 +0000 (13:51 +0000)]
Improve various log messages.

14 years agoUpdate nightly tests for vgextend --metadataignore.
Dave Wysochanski [Wed, 30 Jun 2010 13:11:12 +0000 (13:11 +0000)]
Update nightly tests for vgextend --metadataignore.

14 years agoUpdate nightly tests for vgextend --metadataignore.
Dave Wysochanski [Wed, 30 Jun 2010 13:04:59 +0000 (13:04 +0000)]
Update nightly tests for vgextend --metadataignore.

14 years agoAdd --metadataignore to vgextend and man pages.
Dave Wysochanski [Wed, 30 Jun 2010 13:03:48 +0000 (13:03 +0000)]
Add --metadataignore to vgextend and man pages.

14 years agoAdd pvmetadatacopies to lvm.conf and pvcreate man pages.
Dave Wysochanski [Wed, 30 Jun 2010 12:49:28 +0000 (12:49 +0000)]
Add pvmetadatacopies to lvm.conf and pvcreate man pages.

14 years agoUpdate pvcreate tests for --metadataignore.
Dave Wysochanski [Wed, 30 Jun 2010 12:17:55 +0000 (12:17 +0000)]
Update pvcreate tests for --metadataignore.

14 years agoAdd --metadataignore to pvcreate.
Dave Wysochanski [Wed, 30 Jun 2010 12:17:24 +0000 (12:17 +0000)]
Add --metadataignore to pvcreate.

Allow metadataignore flag to be passed in to pvcreate.
Ideally, more refactoring of the mda allocation / initialization
is warranted, but for now, we just add another parameter to 'add_mda'
to take an existing mda ignored flag.  We need to do this or pv_write
loses the state of the mda 'ignored' flag before copying and writing
to disk.

14 years agoImprove logging for setting --vgmetadatacopies.
Dave Wysochanski [Tue, 29 Jun 2010 22:41:28 +0000 (22:41 +0000)]
Improve logging for setting --vgmetadatacopies.

Example of logging:
metadata/metadata.c:1127     Setting mda_copies = 3 on vg vgtest
metadata/pv_manip.c:296         /dev/loop2 0:      0     25: NULL(0:0)
metadata/pv_manip.c:296         /dev/loop3 0:      0     25: NULL(0:0)
metadata/pv_manip.c:296         /dev/loop4 0:      0     25: NULL(0:0)
metadata/metadata.c:1072     Adjusting ignored mdas on vg vgtest, vg_mda_used_count=5, vg_mda_copies=3
metadata/metadata.c:1015     Setting ignore flag for 2 mdas on vg vgtest
metadata/metadata.c:4151     Setting mda ignored flag for metadata_locn /dev/loop2.
metadata/metadata.c:4151     Setting mda ignored flag for metadata_locn /dev/loop3.

14 years agoImprove logging for metadata ignore by printing device name.
Dave Wysochanski [Tue, 29 Jun 2010 22:37:32 +0000 (22:37 +0000)]
Improve logging for metadata ignore by printing device name.

Print device name when setting or clearing metadata ignore bit.
Example:
label/label.c:160       /dev/loop2: lvm2 label detected
cache/lvmcache.c:1136         lvmcache: /dev/loop2: now in VG #orphans_lvm2 (#orphans_lvm2)
metadata/metadata.c:4142     Setting mda ignored flag for metadata_locn /dev/loop2.
format_text/text_label.c:318     Skipping mda with ignored flag on device /dev/loop2 at offset 4096

14 years agoAdd some log_verbose debug statements related to metadataignore.
Dave Wysochanski [Tue, 29 Jun 2010 22:25:58 +0000 (22:25 +0000)]
Add some log_verbose debug statements related to metadataignore.

Logging isn't ideal, especially for mda_set_ignore.  Ideally we'd
like to display the device name and offset in this case but this
requires a bit more work and a per-format 'mda_description' function
pointer definition (we don't have access to mda_context in
metadata.c).

14 years agoMove code into pv_change_metadataignore library function.
Dave Wysochanski [Tue, 29 Jun 2010 21:32:44 +0000 (21:32 +0000)]
Move code into pv_change_metadataignore library function.

In preparation to call this from both pvcreate as well as pvchange,
move the guts of metadataignore into a library function.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd error message if backup_to_file fails because of empty in_use mdas list.
Dave Wysochanski [Tue, 29 Jun 2010 15:03:59 +0000 (15:03 +0000)]
Add error message if backup_to_file fails because of empty in_use mdas list.

14 years agoAdd more initializations of 'mda->flags' field.
Dave Wysochanski [Tue, 29 Jun 2010 14:52:56 +0000 (14:52 +0000)]
Add more initializations of 'mda->flags' field.

Mda allocation needs refactored into a single function but as an
interim step, ensure mda->flags is initialized properly.

14 years agoAttempt to fix intermittent failure with non-debug configured vgcfgbackup.
Dave Wysochanski [Tue, 29 Jun 2010 13:29:53 +0000 (13:29 +0000)]
Attempt to fix intermittent failure with non-debug configured vgcfgbackup.

There's an intermittent failure with vgcfgbackup that seems to have been
introduced with the metadataignore / vgmetadatacopies patchset.
Intermittent failures are often the result of uninitialized data,
so this patch calls zalloc in a few places it might matter.

14 years agoUpdate WHATS_NEW for --metadataignore and --vgmetadatacopies changes.
Dave Wysochanski [Tue, 29 Jun 2010 12:06:14 +0000 (12:06 +0000)]
Update WHATS_NEW for --metadataignore and --vgmetadatacopies changes.

14 years agoUpdate t-covercmd pvck to take proper device argument.
Dave Wysochanski [Mon, 28 Jun 2010 21:49:31 +0000 (21:49 +0000)]
Update t-covercmd pvck to take proper device argument.

14 years agoFix compile warning in vgchange.c regarding mda_copies initialization.
Dave Wysochanski [Mon, 28 Jun 2010 21:35:00 +0000 (21:35 +0000)]
Fix compile warning in vgchange.c regarding mda_copies initialization.

14 years agoUpdate tests to handle phase 2 (vg based) metadata balance.
Dave Wysochanski [Mon, 28 Jun 2010 20:40:27 +0000 (20:40 +0000)]
Update tests to handle phase 2 (vg based) metadata balance.

Test vgcreate/vgchange --vgmetadatacopies, vgextend, vgreduce,
vgsplit, vgmerge.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate example.conf.in to describe vgmetadatacopies.
Dave Wysochanski [Mon, 28 Jun 2010 20:40:15 +0000 (20:40 +0000)]
Update example.conf.in to describe vgmetadatacopies.

Update example.conf to describe vgmetadatacopies.  Provide an
explanation for the '0' ("unmanaged") value.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAllow 'all' and 'unmanaged' values for --vgmetadatacopies.
Dave Wysochanski [Mon, 28 Jun 2010 20:40:01 +0000 (20:40 +0000)]
Allow 'all' and 'unmanaged' values for --vgmetadatacopies.

Allowing an 'all' and 'unmanaged' value is more intuitive, and
provides a simple way for users to get back to original LVM behavior
of metadata written to all PVs in the volume group.

If the user requests "--vgmetadatacopies unmanaged", this instructs
LVM not to manage the ignore bits to achieve a specific number of
metadata copies in the volume group.  The user is free to use
"pvchange --metadataignore" to control the mdas on a per-PV basis.
If the user requests "--vgmetadatacopies all", this instructs LVM
to do 2 things: 1) clear all ignore bits, and 2) set the "unmanaged"
policy going forward.

Internally, we use the special MAX_UINT32 value to indicate 'all'.
This 'just' works since it's the largest value possible for the
field and so all 'ignore' bits on all mdas in the VG will get
cleared inside _vg_metadata_balance().  However, after we've
called the _vg_metadata_balance function, we check for the special
'all' value, and if set, we write the "unmanaged" value into the
metadata.  As such, the 'all' value is never written to disk.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoEnsure --metadatacopies parameter gets interpreted based on command.
Dave Wysochanski [Mon, 28 Jun 2010 20:39:39 +0000 (20:39 +0000)]
Ensure --metadatacopies parameter gets interpreted based on command.

Now that we have both --pvmetadatacopies and --vgmetadatacopies,
we need to make sure --metadatacopies gets interpreted correctly.

For pv commands, --metadatacopies should imply --pvmetadatacopies,
and for vg commands, --vgmetadatacopies.

Note: this will change the behavior of vgcreate with --metadatacopies
to be a synonym for --vgmetadatacopies.  Previously, --metadatacopies
would apply to any PVs given with vgcreate that needed an implicit
pvcreate.  As a result, one small change is needed to one of the nightly
tests - t-vgcreate-usage.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd --vgmetadatacopies to vgsplit man page and command.
Dave Wysochanski [Mon, 28 Jun 2010 20:39:24 +0000 (20:39 +0000)]
Add --vgmetadatacopies to vgsplit man page and command.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate _vgmerge_single() to move fid->metadata_areas_ignored.
Dave Wysochanski [Mon, 28 Jun 2010 20:39:08 +0000 (20:39 +0000)]
Update _vgmerge_single() to move fid->metadata_areas_ignored.

When vgmerge is called we move the mdas from the source to the
destination.  With metadata balancing we now have another mda
list, fid->metadata_areas_ignored, so move the mdas on this list
as well.

This patch should not matter as the code is written today.  However
we include it for completeness in the case that _vgmerge_single()
is refactored and/or moved into a library function.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate check in vg_split_mdas to account for ignored mdas list.
Dave Wysochanski [Mon, 28 Jun 2010 20:38:56 +0000 (20:38 +0000)]
Update check in vg_split_mdas to account for ignored mdas list.

The check in vg_split_mdas will trigger an error if the 'from' vg
list is empty.  However, this might be ok in some instances now
that we have ignored mdas.  Relax this check so an error is triggered
only in the case where there's truly no more mdas in the 'from'
vg.

One example of where this makes a difference is with vgreduce.
If we try to vgreduce a PV with un-ignored mdas, this should trigger
the balancing function to un-ignore mdas on another PV in the VG.
However, we don't get to vg_write() before we fail because this
list size check fails, and we see an error message indicating:
"Cannot remove final metadata area ..."

Another example is with vgsplit into a new VG, where the PVs
being moved contain all ignored mdas.  We must move the mdas on
fid->metadata_areas_ignored from 'vg_from' to 'vg_to'.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoEnsure fid mda lists are populated correctly during vgextend.
Dave Wysochanski [Mon, 28 Jun 2010 20:38:39 +0000 (20:38 +0000)]
Ensure fid mda lists are populated correctly during vgextend.

The vgextend path calls add_pv_to_vg().  Inside add_pv_to_vg(),
we must ensure we pass the correct mdas list into pv_setup(), as
copies of mdas are placed on the vg->fid list.  If we don't place
the mdas on the correct vg->fid list, the various counts may be
incorrect and the metadata balance algorithm will not work when
called from vg_write() path.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd --vgmetadatacopies to vgcreate man page, command, and lvm.conf.
Dave Wysochanski [Mon, 28 Jun 2010 20:38:23 +0000 (20:38 +0000)]
Add --vgmetadatacopies to vgcreate man page, command, and lvm.conf.

Allow parsing of --vgmetadatacopies for vgcreate.  Accept
--metadatacopies as a synonym for --vgmetadatacopies.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoSet vg_mda_copies when pvchange --metadataignore is given.
Dave Wysochanski [Mon, 28 Jun 2010 20:38:06 +0000 (20:38 +0000)]
Set vg_mda_copies when pvchange --metadataignore is given.

When a user explicitly sets a new mda ignore value for a PV, we
should update vg_mda_copies accordingly.  When the VG is written
out, the user would not want the new ignore state to get lost as
a result of the vg_mda_copies value and logic in the vg_write
path.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoImplement _vg_adjust_ignored_mdas and call from vg_write() path.
Dave Wysochanski [Mon, 28 Jun 2010 20:37:54 +0000 (20:37 +0000)]
Implement _vg_adjust_ignored_mdas and call from vg_write() path.

Compare the value of the newly added vg_mda_copies field
(--vgmetadatacopies parameter) with the current count of
in-use mdas and ignoring or unignoring mdas as necessary to
get to the target count.  Also, as a safety check before
returning, ensure we have at least one mda enabled.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate vgchange tool to accept --vgmetadatacopies.
Dave Wysochanski [Mon, 28 Jun 2010 20:37:37 +0000 (20:37 +0000)]
Update vgchange tool to accept --vgmetadatacopies.

Update logic in vgchange to handle --vgmetadatacopies, allow
--metadatacopies as a synonym to --vgmetadatacopies,
and add these parameters to args.h and commands.h
Forbit both --vgmetadatacopies and --metadatacopies as only
one allowed.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd vg_mda_copies display field to 'vgs' command.
Dave Wysochanski [Mon, 28 Jun 2010 20:37:23 +0000 (20:37 +0000)]
Add vg_mda_copies display field to 'vgs' command.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoMake vg->mda_copies persistent in on disk vg metadata.
Dave Wysochanski [Mon, 28 Jun 2010 20:37:10 +0000 (20:37 +0000)]
Make vg->mda_copies persistent in on disk vg metadata.

This patch adds the ability to read/write the vg->mda_copies values
from/to the vg metadata.

If we read the VG metadata and this field does not exist, we set
mda_copies to the default value of 0.  Later in the code, we use
this special '0' value to indicate a disable of metadata balancing.
This should preserve existing LVM behavior and ensure metadata balancing
can be turned off should the need arise.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd vg get/set methods for VG metadata copies.
Dave Wysochanski [Mon, 28 Jun 2010 20:36:56 +0000 (20:36 +0000)]
Add vg get/set methods for VG metadata copies.

This patch adds the get and partially implemented set function.
The 'set' function should probably ignore or un-ignore metadata areas
based on new values.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd mda_copies to VG structures and initialization.
Dave Wysochanski [Mon, 28 Jun 2010 20:36:37 +0000 (20:36 +0000)]
Add mda_copies to VG structures and initialization.

Add a field to struct volume_group to later implement metadata
balancing:
- mda_copies: target # of non-ignored mdas in the VG; default 0 (do
not control pv 'ignore mdas' bit.

This patch just adds the parameter to the structures with the default
values but does not modify any commands.  Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoDefine vgmetadatacopies in vgchange man page.
Dave Wysochanski [Mon, 28 Jun 2010 20:36:18 +0000 (20:36 +0000)]
Define vgmetadatacopies in vgchange man page.

This patch adds a vgmetadatacopies parameter for metadata balancing.
This parameter provides a simple way for users to create a policy for
placing metadata on PVs automatically by LVM.  The behavior is implemented
inside LVM by managing the 'ignore' mda bits.  We chose the name
'vgmetadatacopies' as this is a natural extension to the existing parameter
'pvmetadatacopies' / 'metadatacopies' in pvcreate.

This is a first step at VG parameter based metadata balancing.  Most users
will probably want to state that they want a certain number of PVs to contain
metadata, and they may be less concerned about a specific number of metadata
copies in the volume group.  However, for default values (pvmetadatacopies
is 1 by default), the number of metadatacopies in the volume group, and the
number of PVs with metadata are the same.  In the future we could add
vgmetadatacopiespvs to define more specifically the number of pvs in the
VG that contain metadata, but for now we start with this parameter.

Another possible future extension would be to define a specific pv tag
to mark the set of PVs that should be used for metadata balancing.  This
tag based approach could be used in conjunction with 'vgmetadatacopies'.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd tests for phase 1 of metadata balance - manage per-PV ignore bit.
Dave Wysochanski [Mon, 28 Jun 2010 20:36:06 +0000 (20:36 +0000)]
Add tests for phase 1 of metadata balance - manage per-PV ignore bit.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoBefore committing each mda, arrange mdas so ignored mdas get committed first.
Dave Wysochanski [Mon, 28 Jun 2010 20:35:49 +0000 (20:35 +0000)]
Before committing each mda, arrange mdas so ignored mdas get committed first.

Arrange mdas so mdas that are to be ignored come first.  This is an
optimization that ensures consistency on disk for the longest period of time.
This was noted by agk in review of the v4 patchset of pvchange-based mda
balance.

Note the following example for an explanation of the background:
Assume the initial state on disk is as follows:
PV0 (v1, non-ignored)
PV1 (v1, non-ignored)
PV2 (v1, non-ignored)
PV3 (v1, non-ignored)

If we did not sort the list, we would have a commit sequence something like
this:
PV0 (v2, non-ignored)
PV1 (v2, ignored)
PV2 (v2, ignored)
PV3 (v2, non-ignored)

After the commit of PV0's mdas, we'd have an on-disk state like this:
PV0 (v2, non-ignored)
PV1 (v1, non-ignored)
PV2 (v1, non-ignored)
PV3 (v1, non-ignored)

This is an inconsistent state of the disk. If the machine fails, the next
time it was brought back up, the auto-correct mechanism in vg_read would
update the metadata on PV1-PV3.  However, if possible we try to avoid
inconsistent on-disk states.  Clearly, because we did not sort, we have
a greater chance of on-disk inconsistency - from the time the commit of
PV0 is complete until the time PV3 is complete.

We could improve the amount of time the on-disk state is consistent by simply
sorting the commit order as follows:
PV1 (v2, ignored)
PV2 (v2, ignored)
PV0 (v2, non-ignored)
PV3 (v2, non-ignored)

Thus, after the first PV is committed (in this case PV1), on-disk we would
have:
PV0 (v1, non-ignored)
PV1 (v2, ignored)
PV2 (v1, non-ignored)
PV3 (v1, non-ignored)

This is clearly a consistent state.  PV1 will be read but the mda will be
ignored.  All other PVs contain v1 metadata, and no auto-correct will be
required.  In fact, if we commit all PVs with ignored mdas first, we'll
only have an inconsistent state when we start writing non-ignored PVs,
and thus the chances we'll get an inconsistent state on disk is much
less with the sorted method.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoRefactor vg_commit() to add _vg_commit_mdas().
Dave Wysochanski [Mon, 28 Jun 2010 20:35:33 +0000 (20:35 +0000)]
Refactor vg_commit() to add _vg_commit_mdas().

Factor out calling mda->ops->vg_commit() for each mda.
No functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate _vg_read and _text_create_text_instance to use fid_add_mda[s].
Dave Wysochanski [Mon, 28 Jun 2010 20:35:17 +0000 (20:35 +0000)]
Update _vg_read and _text_create_text_instance to use fid_add_mda[s].

When we are constructing the vg, we may need to adjust the list of
metadata_areas if there are ignored mdas.  At label read time, we
do not read the metadata of ignored mdas, and as a result, they do
not get placed on vg->fid->metadata_areas inside _text_create_text_instance
since lvmcache does not have these areas attached to vginfo->infos.
However, when we're checking the pvids inside _vg_read, after having
read another metadata area from another PV, we do have the opportunity
to update the metadata_area and metadata_areas_ignored lists based
on the read metadata_area.  We need accurate mda lists for the reporting
functions that count the ignored mdas, as well as general correctness
of mda balancing.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUse mdas_empty_or_ignored() in place of checks for empty mda list.
Dave Wysochanski [Mon, 28 Jun 2010 20:34:58 +0000 (20:34 +0000)]
Use mdas_empty_or_ignored() in place of checks for empty mda list.

With the addition of ignored mdas, we replace all checks for an empty
mda list with a new function to look for either an empty mda list or
ignored mdas.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd mdas_empty_or_ignored() helper function.
Dave Wysochanski [Mon, 28 Jun 2010 20:34:40 +0000 (20:34 +0000)]
Add mdas_empty_or_ignored() helper function.

Add a helper function to consolidate checking for an empty mdas list
or ignored mdas.  Ignored mdas should behave almost identically to
an empty mda list - the metadata areas should not be read or written
to.  This function will make it easier to implement metadata balancing
and easier to track pvs with an empty mda list or ignored mdas.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoImplement ignore of mda if bit set by skipping r/w of metadata.
Dave Wysochanski [Mon, 28 Jun 2010 20:34:24 +0000 (20:34 +0000)]
Implement ignore of mda if bit set by skipping r/w of metadata.

We implement ignore of an mda at label_read time by checking for
the ignore bit, and then skipping the reading of the vgname and
other information in the metadata.  This will have an effect similar
to a PV found with no mdas.  Thus, it will look like an orphan in the
cache until we scan the rest of the system and find a PV with
metadata, and the mda will not be on the vg->fid->metadata_areas
list so no read/writes will be done to the metadata area.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoUpdate pvchange, pvs and vgs man pages for metadata ignore.
Dave Wysochanski [Mon, 28 Jun 2010 20:34:12 +0000 (20:34 +0000)]
Update pvchange, pvs and vgs man pages for metadata ignore.

Explain --metadataignore argument to pvchange, add new fields to pvs / vgs.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd --metadataignore to pvchange, allowing for ignoring of metadata areas.
Dave Wysochanski [Mon, 28 Jun 2010 20:33:58 +0000 (20:33 +0000)]
Add --metadataignore to pvchange, allowing for ignoring of metadata areas.

This patch just modifies pvchange to call the underlying ignore
functions for mdas.  Ensure special cases do not reflect changes
in metadata (PVs with 0 mdas, setting ignored when already ignored,
clearing ignored when not ignored).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoDefine new functions and vgs/pvs fields related to mda ignore.
Dave Wysochanski [Mon, 28 Jun 2010 20:33:44 +0000 (20:33 +0000)]
Define new functions and vgs/pvs fields related to mda ignore.

Define a new pvs field, pv_mda_used_count, and a new vgs field,
vg_mda_used_count to match the existing pv_mda_count and vg_mda_count.
These new fields count the number of mdas that have the 'ignored' bit
clear (they are in use on the PV / VG).  Also define various supporting
functions to implement the counting as well as setting the ignored
flag and determining if an mda is ignored.  These high level functions
call into the lower level location independent mda ignore functions
defined by earlier patches.

Note that counting ignored mdas in a vg requires traversing both lists
and checking for the ignored bit on the mda.  The count of 'ignored'
mdas then is defined by having the bit set, not by which list the mda
is on.  The list does determine whether LVM actually does read/write to
the mda, though we must count the bits in order to return accurate numbers
for the various counts.  Also, pv_mda_set_ignored must search both vg
lists for ignored mda.  If the state changes and needs to be committed
to disk, the ignored mda will be on the non-ignored list.

Note also in pv_mda_set_ignored(), we must properly manage the mda lists.
If we change the ignored state of an mda, we must change any mdas on
vg->fid->metadata_areas that correspond to this pv.  Also, we may
need to allocate a copy of the mda, as is done when fid->metadata_areas
is populated from _vg_read(), if we are un-ignoring an ignored mda.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd metadata_areas_ignored list and functions to manage ignored mdas.
Dave Wysochanski [Mon, 28 Jun 2010 20:33:22 +0000 (20:33 +0000)]
Add metadata_areas_ignored list and functions to manage ignored mdas.

Add a second mda list, metadata_areas_ignored to fid, and a couple
functions, fid_add_mda() and fid_add_mdas() to help manage the lists.

These functions are needed to properly count the ignored mdas and
manage the lists attached to the 'fid' and ultimately the 'vg'.

Ensure metadata_areas_ignored is initialized in other formats, even
if the list is never used.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoRename fid->metadata_areas to fid->metadata_areas_in_use.
Dave Wysochanski [Mon, 28 Jun 2010 20:32:44 +0000 (20:32 +0000)]
Rename fid->metadata_areas to fid->metadata_areas_in_use.

Rename the metadata_areas list to an 'in_use' list to prepare for
future 'ignored' list.

14 years agoUse vg_mda_count() in vgdisplay.
Dave Wysochanski [Mon, 28 Jun 2010 20:32:21 +0000 (20:32 +0000)]
Use vg_mda_count() in vgdisplay.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd mda location specific mda_copy constructor.
Dave Wysochanski [Mon, 28 Jun 2010 20:31:59 +0000 (20:31 +0000)]
Add mda location specific mda_copy constructor.

Because of the way mdas are handled internally, where a PV in a VG
has mdas on both info->mdas and vg->fid->metadata_areas list, we
need a location independent copy constructor for struct
metadata_area.  Break up the existing format-text specific copy
constructor into a format independent piece and a format dependent
piece.

This function is necessary to properly implement pv_set_mda_ignored().

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
14 years agoAdd mda_locns_match() internal library function for mapping pv/device to VG mda.
Dave Wysochanski [Mon, 28 Jun 2010 20:31:38 +0000 (20:31 +0000)]
Add mda_locns_match() internal library function for mapping pv/device to VG mda.

A metadata_area is defined independent of the location.  One downside
is that there is no obvious mapping from a pv to an mda.  For a PV in
a VG, we need a way to start with a PV and end up with an MDA, if we
are to manage mdas starting with a device/pv.  This function provides
us a way to go down the list of PVs on a VG, and identify which ones
match a particular PV.

I'm not entirely happy with this approach, but it does fit into the
existing structures in a reasonable way.

An alternative solution might be to refactor the VG - PV interface such
that mdas are a list tied to a PV.  However, this seemed a bit tricky since
a PV does not come into existence until after the list of mdas is
constructed (see _vg_read() - we create a 'fid' and attach mdas to it,
then we go through them and attach pvs).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
14 years agoEnsure in-memory state matches on-disk state of mda ignore bit.
Dave Wysochanski [Mon, 28 Jun 2010 20:31:18 +0000 (20:31 +0000)]
Ensure in-memory state matches on-disk state of mda ignore bit.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAllow raw_read_mda_header to be called from text_label.c.
Dave Wysochanski [Mon, 28 Jun 2010 20:31:01 +0000 (20:31 +0000)]
Allow raw_read_mda_header to be called from text_label.c.

We'd like to pass in mda_header to vgname_from_mda().  In order to
do this, we need to call raw_read_mda_header() from text_label.c,
_text_read(), which gets called from the label_read() path, and
peers into the metadata and update vginfo cache.  We should check
the disable bit here, and if set, not peer into the vg metadata,
thus reducing the I/O to disk.

In the process, move vgname_from_mda() to layout.h, since the fn
only gets called from format_text code, and we need the mda_header
definition from the private layout.h.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoMove dev_open/dev_close outside vgname_from_mda().
Dave Wysochanski [Mon, 28 Jun 2010 20:30:46 +0000 (20:30 +0000)]
Move dev_open/dev_close outside vgname_from_mda().

Refactor vgname_from_mda() so caller must open/close the device.
Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoMove dev_open / dev_close outside _vg_read_raw_area().
Dave Wysochanski [Mon, 28 Jun 2010 20:30:30 +0000 (20:30 +0000)]
Move dev_open / dev_close outside _vg_read_raw_area().

This refactoring moves the device open/close up one level to the caller of
_vg_read_raw_area().  Should be no functional change and facilitate future
changes related to metadata balancing.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoAdd location independent flag and functions to ignore mdas.
Dave Wysochanski [Mon, 28 Jun 2010 20:30:14 +0000 (20:30 +0000)]
Add location independent flag and functions to ignore mdas.

First we add a 'flags' field to the location independent
metadata_area structure, and a MDA_IGNORE flag.  The
mda_is_ignored and mda_set_ignored functions are added to
manage the flag.  Adding the flag and functions gives a
library interface to ignore metadata areas independent of
the underlying location (disk, file, etc).  The location
specific read/write functions must then handle the specifics
of what this flag means to the location.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
14 years agoAdd text format specific 'rlocn' ignore flag and access functions.
Dave Wysochanski [Mon, 28 Jun 2010 20:29:57 +0000 (20:29 +0000)]
Add text format specific 'rlocn' ignore flag and access functions.

Adding a flag to the 'rlocn' structure in the mda header of the
text format allows us to flip a bit to ignore an area on disk that
stores the metadata via the text format specific mda_header.
This patch defines the flag and access functions to manage the flag.
Other patches will manage the ignore on a format-independent basis,
by using a flag in the metadata_area structure.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoChange 'filler' to 'flags' in on-disk 'raw_locn' structure.
Dave Wysochanski [Mon, 28 Jun 2010 20:29:42 +0000 (20:29 +0000)]
Change 'filler' to 'flags' in on-disk 'raw_locn' structure.

Future patches will make use of a specific flag in the on-disk 'raw_locn'
structure to enable/disable metadata areas, and facilitate metadata
balancing.

Note that 'filler' is always set to '0' (see add_mda() - memset),
so use of this area as a non-zero flags field is a safe way to
provide future code features.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
14 years agoMinor shell style cleanup.
Petr Rockai [Mon, 28 Jun 2010 19:13:33 +0000 (19:13 +0000)]
Minor shell style cleanup.

14 years agoRefactor the handles_missing_pv logic in lvchange.
Petr Rockai [Mon, 28 Jun 2010 19:10:16 +0000 (19:10 +0000)]
Refactor the handles_missing_pv logic in lvchange.

14 years agoFix for bz608048 from Taka...
Jonathan Earl Brassow [Mon, 28 Jun 2010 14:19:41 +0000 (14:19 +0000)]
Fix for bz608048 from Taka...

The same region size is used for both mirror volume and mirrored
log volume, but when the physical extent size is bigger than region size,
the size of mirror leg for mirrored log is smaller than the region size
and lvcreate command fails.

This patch adjusts a region size of mirrored log to a smaller value of
region size or physical extent size.

[This patch ensures that the region_size of the mirrored log does not
exceed the size of the mirrored log itself, which would violate the
kernel constraint: (region_size <= ti->len).]

Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
14 years agogenerate liblvm2cmd exported symbols too
Alasdair Kergon [Fri, 25 Jun 2010 18:23:10 +0000 (18:23 +0000)]
generate liblvm2cmd exported symbols too

14 years agoGenerate liblvm2app and libdevmapper exported symbols from header files.
Alasdair Kergon [Fri, 25 Jun 2010 18:17:38 +0000 (18:17 +0000)]
Generate liblvm2app and libdevmapper exported symbols from header files.

Detection is simply by prefix - dm_ or lvm_ - and any additional symbols needed
but not detected this way are placed in .exported_symbols.

14 years agoactually, let's keep these in same order as in header
Alasdair Kergon [Fri, 25 Jun 2010 12:21:47 +0000 (12:21 +0000)]
actually, let's keep these in same order as in header

14 years agoUpdate liblvm2app exported symbols.
Alasdair Kergon [Fri, 25 Jun 2010 12:19:52 +0000 (12:19 +0000)]
Update liblvm2app exported symbols.
Add Makefile target to generate current list of lvm2app.h functions.

14 years agoFix typo reported in Debian bugzilla #586043
Zdenek Kabelac [Thu, 24 Jun 2010 08:36:57 +0000 (08:36 +0000)]
Fix typo reported in Debian bugzilla #586043

14 years agoPreload libc locale messages.
Zdenek Kabelac [Thu, 24 Jun 2010 08:29:30 +0000 (08:29 +0000)]
Preload libc locale messages.

Preload libc.mo file for localized lvm before taking memory lock - this way
we prevent disk access for some error paths in libdm, that prints localized
errno messages while they are still in memory locked state.

14 years agoAdd few missing information about what is this script doing.
Zdenek Kabelac [Thu, 24 Jun 2010 08:18:54 +0000 (08:18 +0000)]
Add few missing information about what is this script doing.
(based upon Debian bugzilla suggestion)

14 years agoAdd a test of wait_for_locks behaviour (adapted from an original by Dave).
Petr Rockai [Thu, 24 Jun 2010 07:57:54 +0000 (07:57 +0000)]
Add a test of wait_for_locks behaviour (adapted from an original by Dave).

14 years agoupdate WHATS_NEW file with entry for simultaneous mirror image and
Jonathan Earl Brassow [Wed, 23 Jun 2010 21:01:42 +0000 (21:01 +0000)]
update WHATS_NEW file with entry for simultaneous mirror image and
mirrored log image fault-handling fix.

14 years agoCommitting Taka's patch... He found a problem during
Jonathan Earl Brassow [Wed, 23 Jun 2010 20:32:29 +0000 (20:32 +0000)]
Committing Taka's patch...  He found a problem during
the failure of a device that contained both a image of
a mirror and an image of the mirrored log.  The order
of the handling of those faults was important (and
wrong), this patch corrects that.

Patch-From: Takahiro Yasui <tyasui@redhat.com>

14 years agopost-release
Alasdair Kergon [Wed, 23 Jun 2010 19:35:11 +0000 (19:35 +0000)]
post-release

14 years agopre-release
Alasdair Kergon [Wed, 23 Jun 2010 17:48:41 +0000 (17:48 +0000)]
pre-release

14 years agoIn some C++ standards, typeof is not reserved.
Alasdair Kergon [Wed, 23 Jun 2010 17:03:14 +0000 (17:03 +0000)]
In some C++ standards, typeof is not reserved.

14 years agoFix udev rules to handle spurious events properly.
Peter Rajnoha [Wed, 23 Jun 2010 17:00:32 +0000 (17:00 +0000)]
Fix udev rules to handle spurious events properly.

We can use DM_UDEV_PRIMARY_SOURCE_FLAG to identify the spurious events
and use it as an indication that the device has already been activated before
(and hence we can find this property in udev database).

WARNING: This change requires udev startup script to preserve udev database
from initrd. All the information stored there during activation of devices
is important for the initial "udevadm trigger --action=add" call that is
used in udev startup script. If not done this way, udev startup script needs
to define DM_UDEV_PRIMARY_SOURCE_FLAG=1 property for any ADD events it uses.

14 years agoFix clvmd init script status
Milan Broz [Wed, 23 Jun 2010 16:24:13 +0000 (16:24 +0000)]
Fix clvmd init script status

- s/Active clustred VG/clustered VG/ (only LV can be active)

- print only active LVs (not all) in status command
(In the lvdisplay form /dev/vg/lv.)

For now, still use awk (already used in clustered_vgs).

https://bugzilla.redhat.com/show_bug.cgi?id=598495

14 years agoUse more standard naming for PVs and VG in vgimportclone example.
Mike Snitzer [Wed, 23 Jun 2010 16:12:30 +0000 (16:12 +0000)]
Use more standard naming for PVs and VG in vgimportclone example.

14 years agoCleanup sentences of the example provided in the vgimportclone man page
Mike Snitzer [Wed, 23 Jun 2010 14:15:55 +0000 (14:15 +0000)]
Cleanup sentences of the example provided in the vgimportclone man page
(motivated by a patch that Debian was carrying).

14 years agoThe function that runs to compress a stacked mirror after
Jonathan Earl Brassow [Wed, 23 Jun 2010 13:57:26 +0000 (13:57 +0000)]
The function that runs to compress a stacked mirror after
converting from 2-way to 3-way mirror (collapse_mirrored_lv)
was calling '_remove_mirror_images' with the 'remove_log'
parameter set.  When the code was put in to fix 599898 to
honor log parameters during conversion, this argument was
suddenly being honored.  Thus, when someone would convert from
a 2-way to 3-way mirror, the log would get removed.

'collapse_mirrored_lv' should not be calling '_remove_mirror_images'
with 'remove_log' set.

14 years agoFix typo: "INTERNAL ERROR" -> "INTERNAL_ERROR"
Zdenek Kabelac [Wed, 23 Jun 2010 12:54:46 +0000 (12:54 +0000)]
Fix typo: "INTERNAL ERROR" -> "INTERNAL_ERROR"

Author: Xinwei Hu
        xwhu at novell dot com

14 years agoAdd lv_path to reports to offer full /dev pathname.
Alasdair Kergon [Wed, 23 Jun 2010 12:32:08 +0000 (12:32 +0000)]
Add lv_path to reports to offer full /dev pathname.

14 years agoFix typo: premitted -> permitted
Zdenek Kabelac [Wed, 23 Jun 2010 10:22:59 +0000 (10:22 +0000)]
Fix typo: premitted ->  permitted

Signed-off-by: Takahiro Yasui<tyasui@redhat.com>
14 years agoBetter WHATS_NEW message - as we still have not fixed 'make exec_prefix' build
Zdenek Kabelac [Wed, 23 Jun 2010 10:21:00 +0000 (10:21 +0000)]
Better WHATS_NEW message - as we still have not fixed 'make exec_prefix' build

14 years agoFix "allocated" warning typo.
Milan Broz [Tue, 22 Jun 2010 21:10:53 +0000 (21:10 +0000)]
Fix "allocated" warning typo.

14 years agoAdd device name to output of error messages in raw_read_mda_header().
Dave Wysochanski [Tue, 22 Jun 2010 19:18:27 +0000 (19:18 +0000)]
Add device name to output of error messages in raw_read_mda_header().

It would be helpful if we had the device name when something like
a mda_header checksum error occurs.

Before:
./tools/lvm pvs -opv_name,vg_name,uuid,mda_count,pv_mda_count_ignored,vg_mda_count,vg_mda_count_ignored,vg_mda_copies
  Incorrect metadata area header checksum
  PV         VG      PV UUID                                #PMda #PMdaIgn #VMda #VMdaIgn #VMdaCps
  /dev/loop0 vgtest2 sVv26t-gjpb-Rcau-uBDO-Cx04-GbRR-6Ssq7e     2        0     4        0        4
  /dev/loop1 vgtest2 zXWStT-qE8F-mbkc-RfgH-aytv-mptF-Y5Ce09     2        0     4        0        4
  /dev/loop2         riCpK9-9G8r-LlIp-i2oh-mb3N-CUzk-u5YpuR     1        0     0        0        0
  /dev/loop3 vgtest  tQCUjm-rmyd-i92d-4eeE-UYBW-v1vQ-kRaA17     2        0     4        2        0
  /dev/loop4 vgtest  ZRvpeI-p8F1-ccVW-BBac-xhl1-aGXU-CbP0oo     2        2     4        2        0

After:
./tools/lvm pvs -opv_name,vg_name,uuid,mda_count,pv_mda_count_ignored,vg_mda_count,vg_mda_count_ignored,vg_mda_copies
  Incorrect metadata area header checksum on /dev/loop2 at offset 4096
  PV         VG      PV UUID                                #PMda #PMdaIgn #VMda #VMdaIgn #VMdaCps
  /dev/loop0 vgtest2 sVv26t-gjpb-Rcau-uBDO-Cx04-GbRR-6Ssq7e     2        0     4        0        4
  /dev/loop1 vgtest2 zXWStT-qE8F-mbkc-RfgH-aytv-mptF-Y5Ce09     2        0     4        0        4
  /dev/loop2         riCpK9-9G8r-LlIp-i2oh-mb3N-CUzk-u5YpuR     1        0     0        0        0
  /dev/loop3 vgtest  tQCUjm-rmyd-i92d-4eeE-UYBW-v1vQ-kRaA17     2        0     4        2        0
  /dev/loop4 vgtest  ZRvpeI-p8F1-ccVW-BBac-xhl1-aGXU-CbP0oo     2        2     4        2        0

14 years agoUse flexible data[] in cmirrord request to prevent abort in runtime size checks.
Milan Broz [Tue, 22 Jun 2010 13:11:29 +0000 (13:11 +0000)]
Use flexible data[] in cmirrord request to prevent abort in runtime size checks.

14 years agoAdding section number for lvm.conf manpages.
Zdenek Kabelac [Tue, 22 Jun 2010 07:34:34 +0000 (07:34 +0000)]
Adding section number for lvm.conf manpages.

14 years agoMirrors can be layered - as in the case of an converting 2-way
Jonathan Earl Brassow [Mon, 21 Jun 2010 16:12:33 +0000 (16:12 +0000)]
Mirrors can be layered - as in the case of an converting 2-way
to 3-way mirror.  When conversion operations are performed on
these types of mirrors, log options can be confused/ignored.

In the case of a converting 3-way mirror, we have a top-level
2-way corelog mirror whose legs are 1) a 2-way disk-log mirror
and 2) a linear device.  If we wish to convert this 3-way mirror
to a 2-way mirror, the linear device is removed and the extra
top layer is eliminated.  If we also wished to convert the disk
log to a core log in the same step, ambiguity creeps in.  It is
somewhat obvious what the user wants - a 2-way mirror with a
corelog.  However, looking at the top level mirror before
compression, it seems that the mirror already has a core log.
This is why the operation seemed to fail.

This patch simply re-evaluates what mirrored_seg points to after
a compression and then considers the log argument.

This is a fix for bug 599898.

14 years agoAdd error checking for calls to sprintf - it can fail for more
Jonathan Earl Brassow [Mon, 21 Jun 2010 16:07:06 +0000 (16:07 +0000)]
Add error checking for calls to sprintf - it can fail for more
reasons than just 'out-of-space'.

14 years agoVarious cleanups following recent commits.
Alasdair Kergon [Mon, 21 Jun 2010 15:56:57 +0000 (15:56 +0000)]
Various cleanups following recent commits.

14 years agoLet running clvmd process time to reexec.
Milan Broz [Mon, 21 Jun 2010 10:45:15 +0000 (10:45 +0000)]
Let running clvmd process time to reexec.

Because execve stops the command loop,
we never receive response (only socket close) for clvmd -S,
so waiting for response here makes no sense.

But if the calling process (clvmd -S)  exits too early, connection
is closed from client side, clvmd takes this as an error and
never run restart code.

Ugly hack(TM).

14 years agoUse early udev synchronisation and update of dev nodes for clustered mirrors.
Peter Rajnoha [Mon, 21 Jun 2010 08:54:32 +0000 (08:54 +0000)]
Use early udev synchronisation and update of dev nodes for clustered mirrors.

When using clustered mirrors, we need device nodes to be created during
processing of device tree, not at its end like we normally do (we need to
access the nodes in cmirror prematurely). Therefore we use a new flag called
"immediate_dev_node" stored in deptree's load_properties struct to instruct the
device tree processing code to immediately synchronize with udev and flush all
stacked node operations so the nodes are prepared for use.

For now, the immediate_dev_node is used for clustered mirrors during
processing the dm_tree_preload_children code only. We can add more later if
needed.

14 years agodaemons/cmirrord/functions.c (part of cmirrord) was referencing
Jonathan Earl Brassow [Fri, 18 Jun 2010 20:58:04 +0000 (20:58 +0000)]
daemons/cmirrord/functions.c (part of cmirrord) was referencing
linux/kdev_t.h even though it wasn't needed.  Strangely, it seems
to be causing problems on various architectures (i686) in the
function daemons/cmirrord/functions.c:disk_status_info()->sprintf.

I'm not sure why this is a problem since none of the macros in
kdev_t.h are used in that code, but it certainly doesn't hurt to
pull an unnecessary header and it seems to fix the problem.

14 years agoAdd man pages for lvmconf and unsupported lvmsadc and lvmsar tools.
Zdenek Kabelac [Fri, 18 Jun 2010 10:19:29 +0000 (10:19 +0000)]
Add man pages for lvmconf and unsupported lvmsadc and lvmsar tools.

14 years agoFix exit code when requesting help using documented -o help option.
Milan Broz [Thu, 17 Jun 2010 13:15:51 +0000 (13:15 +0000)]
Fix exit code when requesting help using documented -o help option.

IOW fix lvs -o help
...
  Command failed with status code 5.

14 years agoClean up cluster lock mode and flags definition.
Milan Broz [Thu, 17 Jun 2010 12:48:54 +0000 (12:48 +0000)]
Clean up cluster lock mode and flags definition.

Code is mixing up internal DLM and LVM definitions of lock
modes and flags.

OpenAIS and singlenode locking do not depend on DLM but
code currently cannot be compiled without libdlm.h!

LCK_* flags is LVM abstraction, used through all the code.
Only low-level backend (clvmd-cman etc) should use DLM definitions,
also this code should do all needed conversions.

Because there are two DLM flags used in generic code
(NOQUEUE, CONVERT) we define it similar way like lock modes.
(So all needed binary-compatible flags are on one place in locking.h)

(Further code cleaning still needed, though:-)

14 years agoAdd man page for dmeventd
Zdenek Kabelac [Thu, 17 Jun 2010 12:14:43 +0000 (12:14 +0000)]
Add man page for dmeventd
(inspired by patch from Danny Rawlins, monster.romster at gmail dot com)

14 years agoUpdate lvresize/extend/reduce manpages with --nofsck, --resizefs options
Zdenek Kabelac [Thu, 17 Jun 2010 11:25:43 +0000 (11:25 +0000)]
Update lvresize/extend/reduce manpages with --nofsck, --resizefs options

14 years agoFix lvm2cmd example in documentation.
Milan Broz [Wed, 16 Jun 2010 13:03:48 +0000 (13:03 +0000)]
Fix lvm2cmd example in documentation.

14 years agoRemove C++ private keyword from headers.
Milan Broz [Wed, 16 Jun 2010 13:01:25 +0000 (13:01 +0000)]
Remove C++ private keyword from headers.
Add extern C definition for libdevmapper, lvm2app and lvm2cmd.

14 years agoUse "" instead of <> for configure.h and libdevmapper.h
Zdenek Kabelac [Tue, 15 Jun 2010 11:00:44 +0000 (11:00 +0000)]
Use "" instead of <> for  configure.h and libdevmapper.h
Move configure.h as the first header for clvmd source files.

14 years agoUpdate WHATS_NEW for last commit
Zdenek Kabelac [Mon, 7 Jun 2010 14:39:18 +0000 (14:39 +0000)]
Update WHATS_NEW  for last commit

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