1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
Commit Graph

4125 Commits

Author SHA1 Message Date
Peter Rajnoha
3c134e0165 Don't use LVM_UDEV_DISABLE_CHECKING environment variable anymore.
Set the state automatically based on udev and libdevmapper dev path comparison.
If these paths differ, disable udev checking.
2010-02-15 16:26:48 +00:00
Peter Rajnoha
f0e073fcdc Several changes in dmsetup and libdevmapper:
- add DM_UDEV_DISABLE_LIBRARY_FALLBACK udev flag to rely on udev only

 - export dm_udev_create_cookie function to create new cookies on demand

 - add --udevcookie, udevcreatecookie and udevreleasecookie for dmsetup
   (to support "udev transactions" where one cookie value can be used for
    several dmsetup calls)

 - don't use DM_UDEV_DISABLE_CHECKING env. var. anymore and set the state
   automatically (based on udev and libdevmapper dev path comparison)
2010-02-15 16:21:33 +00:00
Peter Rajnoha
acbb93a383 Rename "stat" to "status" in dmeventd_snapshot.c.
Otherwise "warning: declaration of ‘stat’ shadows a global declaration"
will appear because it shadows "stat" from stat.h.
2010-02-15 12:55:20 +00:00
Dave Wysochanski
5ffe56d800 Update simple lvm2app unit test for new size apis.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-02-14 03:23:07 +00:00
Dave Wysochanski
629efc6a89 Export lvm_pv_get_size(), lvm_pv_get_free(), lvm_pv_get_dev_size in lvm2app.
We add these exports to show the pv_size and pv_free and dev_size
fields.
Fixes rhbz561423.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-02-14 03:21:37 +00:00
Dave Wysochanski
ed3329eb45 Fix off by 512 sizes for lvm2app.
Internally we store sizes in sectors, but lvm2app exports sizes
in bytes.  We could get fancier and allow units configuration but
this fix should do for now.

Fixes rhbz561422.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-02-14 03:21:06 +00:00
Mike Snitzer
a5ce579672 Add 'fail_if_percent_unsupported' arg to _percent() and _percent_run(). 2010-02-10 15:56:20 +00:00
Mike Snitzer
15816a3b8c Add 'fail_if_percent_unsupported' arg to _percent() and _percent_run().
We unfortunately don't yet _know_, in dev_manager_snapshot_percent(), if
a snapshot-merge target is active (activation is deferred if dev is
open); so we can't short-circuit origin devices based purely on existing
LVM LV attributes.

Set 'fail_if_percent_unsupported' in dev_manager_snapshot_percent() for
a merging origin LV, otherwise passing unsupported LV types to _percent
will lead to a default successful return with percent_range as
PERCENT_100.

For a merging origin, PERCENT_100 will result in a polldaemon that runs
infinitely (because completion is PERCENT_0).
2010-02-10 14:38:24 +00:00
Mike Snitzer
d6bf26af8e Remove false "failed to find tree node for <lv>" error from _cached_info().
When activating a merging origin it is valid, and expected, to not have
a node in the deptree for both the origin and its merging snapshot.  The
_cached_info() caller is only concerned with whether a device is open.
If there isn't a node in the tree the associated device is definitely
not open.
2010-02-08 23:28:06 +00:00
Petr Rockai
57f5ec5d6c Make lvconvert --repair --use-policies exit with success when no action is needed. 2010-02-06 07:44:16 +00:00
Mike Snitzer
d57c51d963 Add multiple snapshot lv 'lvconvert --merge @tag' support via process_each_lv(). 2010-02-05 22:50:56 +00:00
Mike Snitzer
50ba52456e Switch lvconvert_single() over to using get_vg_lock_and_logical_volume()
This change was deferred to help ease the review of previous refactoring
related to using process_each_lv() for lvconvert's merge support.  Not
that doing so _really_ helped but...

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-02-05 22:47:22 +00:00
Mike Snitzer
234b12480e lvconvert --merge @tag support
Switch lvconvert's --merge code over to using process_each_lv().  Doing
so adds support for a single 'lvconvert --merge' to start merging
multiple LVs (which includes @tag expansion).

Add 'lvconvert --merge @tag' testing to test/t-snapshot-merge.sh

Adjust man/lvconvert.8.in to reflect these expanded capabilities.

The lvconvert.c implementation requires rereading the VG each iteration
of process_each_lv().  Otherwise a stale VG instance associated with
the LV passed to lvconvert_single_merge() would result in stale VG
metadata being written back out to disk.  This overwrote new metadata
that was written when a previous snapshot LV finished merging (via
lvconvert_poll).  This is only an issue when merging multiple LVs that
share the same VG (a single VG is typical for most LVM configurations on
system disks).

In the end this new support is very useful for performing a "system
rollback" that requires multiple snapshot LVs be merged to their
respective origin LV.

The yum-utils 'fs-snapshot' plugin tags all snapshot LVs that it creates
with a common 'snapshot_tag' that is unique to the yum transaction.
Rolling back a yum transaction, that created LVM snapshots with the tag
'yum_20100129133223', is as simple as:
  lvconvert --merge @yum_20100129133223

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-02-05 22:44:37 +00:00
Mike Snitzer
0ade9a8b37 Prepare for _get_lvconvert_vg() reuse as part of a larger lvconvert.c
refactoring.

Document the need to cleanup the "name" args passed around polldaemon,
lvconvert and pvmove.  It is quite a mess.

Annotate the unused nature of the existing poll_fns->get_copy_vg
methods' 'uuid' arg.
2010-02-05 22:40:49 +00:00
Jonathan Earl Brassow
abdd429f35 Adding a new mimage (leg/copy) to a mirror behaves differently
depending on if the mirror has a 'core' or 'disk' log.  When there
is a disk log, the new leg is added by stacking a new mirror on
top of the old (one leg is the old mirror and the other leg is the newly
added device).  When the log is a 'core' log, the new leg is simply added
to the existing mirror and all the devices are re-synced.

The logic that handles collapsing the stacked 'disk' log mirror was
having the effect of causing 'core' logged mirrors to begin resync'ing
for a second time.  I have used the 'CONVERTING' flag to indicate that
a mirror is converting by way of stacking.  This is no longer set for
up-converting core logs.  The final 'collapse' logic can safely be skipped
for 'core' log mirrors - getting rid of the second resync.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-02-05 21:49:16 +00:00
Peter Rajnoha
04fa77c3be This is related to liblvm and its lvm_list_vg_names() and lvm_list_vg_uuids() functions
where we should not expose internal VG names/uuids (the ones with "#" prefix )through the
interface. Otherwise, we could end up with library users opening internal VGs which will
initiate locking mechanism that won't be cleaned up properly.

"#orphans_{lvm1, lvm2, pool}" names are treated in a special way, they are truncated first
to "orphans" and this is used as a part of the lock name then (e.g. while calling lvm_vg_open()).
When library user calls lvm_vg_close(), the original name "orphans_{lvm1, lvm2, pool}"
is used directly and therefore no unlock occurs.

We should exclude internal VG names and uuids in the lists provided by lvmcache:
lvmcache_get_vgids() and lvmcache_get_vgnames().
2010-02-03 14:08:39 +00:00
Mike Snitzer
5bc2af2688 Add %ORIGIN support to lv{create,extend,reduce,resize} --extents option
Allow the number of logical extents to be expressed (for a snapshot) as
a percentage of the total space in the Origin Logical Volume with the
suffix %ORIGIN.

Update the relevant man pages accordingly.  Eliminate inconsistencies
between the man pages and tools/commands.h

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-02-03 03:58:08 +00:00
Mike Snitzer
ddd6c357ba move WHATS_NEW entries whose changes were made after 2.02.60 to 2.02.61 2010-02-02 17:48:30 +00:00
Dave Wysochanski
8caf272a93 Add copy constructor for struct metadata_area.
Clean up cut&paste code with proper copy constructor.
2010-02-02 16:26:34 +00:00
Alasdair Kergon
46cabd8a2e Remove pointless versioned symlinks to dmeventd plugin libraries. 2010-02-02 14:09:17 +00:00
Alasdair Kergon
30265f6ad2 Fix dmeventd snapshot plugin build dependency. 2010-02-02 14:03:50 +00:00
Christine Caulfield
9dc28ab802 Make clvmd -V return zero status rather than 1. 2010-02-02 08:54:29 +00:00
Dave Wysochanski
b34f3ea13f Remove unnecessary "dmsetup resume" after "dmsetup create".
It is not necessary to resume after a create since the create will
create the table and make it active.
2010-02-01 19:43:22 +00:00
Jonathan Earl Brassow
f972c51364 Was using dm_list_iterate_items when I should have been using
*_safe.  This had the effect of segfaulting the log daemon when
converting a mirror from one log type to another.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-27 22:28:05 +00:00
Milan Broz
a1b40be081 Fix pvmove abort when temporary mirror fails to be cluster-aware.
When activation of pvmove mirror fails on cluster, some nodes
still possibly succeeded in activation.

 - Explicitly deactivate that mirror to be sure
 - properly pair suspend/resume calls to not cause memory lock problems in clvmd

Code cannot simply call _finish_pvmove on cluster in this situation, because
changed LVs are suspended twice (causing memory inbalance) and also temporary
mirror is activated when it is not expected (and we know that it failed already).

Patch prepares special function which remove temporary mirror references from
metadata and then resumes changed LVs.
2010-01-27 13:29:11 +00:00
Milan Broz
4b373907f6 Always query device by using uuid only and not name in clvmd.
Otherwise confusion with the device of the same name
(but different UUID, e.g. non-lvm device) can happen.
2010-01-27 13:23:57 +00:00
Milan Broz
e01bdd2fab Add some missing vg_revrts calls when pvmove aborts. 2010-01-26 08:01:18 +00:00
Milan Broz
9b5fd08d26 Unlock shared lock if activation calls failed.
Clvmd should unlock new lock if activation in device-mapper fails.
2010-01-26 08:00:02 +00:00
Milan Broz
b1ef9cd0ad Fix return code of info callbacks.
In dev_manager_info 0 means error and 1 info is returned,
not that device exists (that value is part of info struct).

Fix query by uuid only (no name) which returns 0 when device
does not exist.
2010-01-26 07:58:23 +00:00
Alasdair Kergon
635983c449 pre-release 2010-01-23 02:14:30 +00:00
Mike Snitzer
43d99aab6c Default to checking LV's progress before waiting in _wait_for_single_lv.
Support "wait before testing" using '+' in pvmove and lvconvert
interval.  Doing so overrides the new default of sleeping after checking
the LV's progress.

Sleeping before checking progress can lead to extraneous polldaemons
being left running.  These polldaemons would have otherwise exited had
they checked before sleeping.  Checking progress before sleeping helps
workaround the subtly unreliable nature of "finished" state checking
in _percent_run.

Update test/t-mirror-names.sh to use '+' when providing its lvconvert
interval.
2010-01-22 21:59:42 +00:00
Jonathan Earl Brassow
794b3b1605 a little more information for the cmirrord man page 2010-01-22 21:48:17 +00:00
Milan Broz
9a2cde9519 Fix syntax error in cmirror init script
- break cannot be used here
 - remove CLVMDOPTS
 - add echo to stop call
2010-01-22 16:19:38 +00:00
Mike Snitzer
537f7456e2 Eliminate extra ioctls just to check open_count in _add_new_lv_to_dtree.
DM >= 4.7.0 always returns open_count so just use the associated nodes'
existing info.

Introduce _cached_info() to get an LV's cached info.
2010-01-22 15:40:31 +00:00
Milan Broz
ff26b68abc Document undocumented commits which fixed some bugs.
Go WHATS_NEW!
2010-01-22 14:33:33 +00:00
Mike Snitzer
5cb0d45d18 Removed inactive_table check from _lv_has_target_type. This check
doesn't offer any benefit (that I can recall) and testing validates
that.
2010-01-22 13:28:54 +00:00
Milan Broz
81d19574f7 Switch memory debugging off for now if compiled with dmeventd,
functions are not thread-safe in debug mode.
2010-01-22 13:20:32 +00:00
Milan Broz
676b511245 Fix syslog prefix in the first message (dmeventd->lvm). 2010-01-22 12:48:58 +00:00
Milan Broz
257bb03948 Fix exported symbols for lvm2 dmeventd wrapper. 2010-01-22 12:38:16 +00:00
Milan Broz
98d85f25be Move error message to locking constructor and print
more descriptive message if locking fails instead of
"Locking type -1 initialisation failed."

Use read-only locking instead of misleading ignorelocking option
in message.
2010-01-22 09:45:29 +00:00
Alasdair Kergon
59dd86581a post-release 2010-01-22 01:09:09 +00:00
Alasdair Kergon
86dce60ffe missing header 2010-01-22 00:43:28 +00:00
Alasdair Kergon
fff0de4865 fix lib include 2010-01-22 00:18:37 +00:00
Alasdair Kergon
1014cf876a pre-release 2010-01-21 23:55:17 +00:00
Alasdair Kergon
d3d98fdc1e Add libdevmapper-event-lvm2.so to serialise dmeventd plugin liblvm2cmd use. 2010-01-21 22:15:45 +00:00
Dave Wysochanski
a7ca101517 Call _alloc_pv() inside _pv_read() and clean up error paths.
We should be consistent with pv constructors so call _alloc_pv()
here as we do from pv_create().
2010-01-21 21:09:23 +00:00
Dave Wysochanski
1d749d01fb Remove useless memory allocation for pv->vg_name in _alloc_pv().
All this seems to do is provide a memory leak so remove it.
The only caller of _alloc_pv() later explicitly sets
pv->vg_name = fmt->orphan_vg_name so clearly this allocation
should be removed.  I also saw no where in the code where
strncpy was used to assign pv->vg_name - only direct assignments
and strdup's.
2010-01-21 21:04:44 +00:00
Dave Wysochanski
2b1446c7d6 Correct 'void *' usage in pvcreate_single.
Remove needless cast.
2010-01-21 21:04:20 +00:00
Zdenek Kabelac
488298a5af Log entry for the last lvmcmdline.c commit 2010-01-21 17:14:18 +00:00
Zdenek Kabelac
d40821aabc Reset released pointer and counters.
DSO is currently not dl_close-ing pluing during it is unregister handling,
so clear structure and related counter, so there are no memory problems.
Futher fixes are needed.
2010-01-21 13:41:39 +00:00