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

1108 Commits

Author SHA1 Message Date
Alasdair Kergon
7f355587f5 Make cmd->cmd_line const. 2009-07-13 19:49:48 +00:00
Dave Wysochanski
b85357cd0c Change lock ordering of vgcfgrestore to be consistent with other tools.
Orphan lock is now obtained second and released first, and all tools
are consistent in this regard.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-10 20:10:18 +00:00
Dave Wysochanski
7fa91ec044 Move orphan lock obtain/release inside vg_extend().
With this change we now have vgcreate/vgextend liblvm functions.
Note that this changes the lock order of the following functions as the
orphan lock is now obtained first.  With our policy of non-blocking
second locks, this should not be a problem.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-10 20:09:21 +00:00
Dave Wysochanski
03660b3045 Move orphan lock inside vg_remove_single.
Move the vg orphan lock inside vg_remove_single, now a complete liblvm
function.  Note that this changes the order of the locks - originally
VG_ORPHAN was obtained first, then the vgname lock.  With the current
policy of non-blocking second locks, this could mean we get a failure
obtaining the orphan lock.  In the case of a vg with lvs being removed,
this could result in the lvs being removed but not the vg.  Such a
scenario could have happened prior though with a different failure.
Other tools were examined for side-effects, and no major problems
were noted.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-10 20:08:37 +00:00
Dave Wysochanski
42ae96fa3d Remove force parameter from vg_remove_single, now the liblvm function.
Move check for active LVs outside of library function.  The vgremove
liblvm function function will fail if there are active LVs.  It will
be the application's responsibility to check this condition and remove
the LVs individually before calling vgremove.  Note also that we've
duplicated the EXPORTED_VG check in vgremove_single (tools) and
vg_remove_single (library).  Duplication seemed the only option here
since we don't want to do the automatic removal of LVs (in the tools)
if the vg is exported, and we still need to protect the library call
from removal if the vg is exported.

We still need to deal with the ORPHAN lock but vg_remove_single is now
very close to our liblvm function.

TODO: Refactor lvremove in a similar way.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-10 20:07:02 +00:00
Dave Wysochanski
a6ad9c6166 Remove unnecessary parameters from vg_remove_single().
Use vg_t instead of struct volume_group.
Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-10 20:05:29 +00:00
Dave Wysochanski
10a27bdfb6 Change vg_create() to take only minimal parameters and obtain a lock.
vg_t *vg_create(struct cmd_context *cmd, const char *vg_name);
This is the first step towards the API called to create a VG.
Call vg_lock_newname() inside this function.  Use _vg_make_handle()
where possible.
Now we have 2 ways to construct a volume group:
1) vg_read: Used when constructing an existing VG from disks
2) vg_create: Used when constructing a new VG
Both of these interfaces obtain a lock, and return a vg_t *.
The usage of _vg_make_handle() inside vg_create() doesn't fit
perfectly but it's ok for now.  Needs some cleanup though and I've
noted "FIXME" in the code.

Add the new vg_create() plus vg 'set' functions for non-default
VG parameters in the following tools:
- vgcreate: Fairly straightforward refactoring.  We just moved
vg_lock_newname inside vg_create so we check the return via
vg_read_error.
- vgsplit: The refactoring here is a bit more tricky.  Originally
we called vg_lock_newname and depending on the error code, we either
read the existing vg or created the new one.  Now vg_create()
calls vg_lock_newname, so we first try to create the VG.  If this
fails with FAILED_EXIST, we can then do the vg_read.  If the
create succeeds, we check the input parameters and set any new
values on the VG.

TODO in future patches:
1. The VG_ORPHAN lock needs some thought.  We may want to treat
this as any other VG, and require the application to obtain a handle
and pass it to other API calls (for example, vg_extend).  Or,
we may find that hiding the VG_ORPHAN lock inside other APIs is
the way to go.  I thought of placing the VG_ORPHAN lock inside
vg_create() and tying it to the vg handle, but was not certain
this was the right approach.
2. Cleanup error paths. Integrate vg_read_error() with vg_create and
vg_read* error codes and/or the new error APIs.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:09:33 +00:00
Dave Wysochanski
5d623bde94 Add vg_set_alloc_policy() liblvm function and move vgchange logic inside.
NOTE: vg_set_alloc_policy() returns success if you try to set a value that
is already stored.  The behavior of vgchange is the same though - it fails.
There is a fixme noted in the code about this inconsistency, which should
be resolved if possible.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:08:54 +00:00
Dave Wysochanski
dba458ae9a Add vg_set_max_pv() liblvm function and move vgchange logic inside.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:07:47 +00:00
Dave Wysochanski
a88bfbcb13 Add vg_set_max_lv() liblvm function and move vgchange logic inside.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:06:00 +00:00
Dave Wysochanski
3f6a21ead4 Rename vg_change_pesize to vg_set_extent_size and use vg_t.
In liblvm, we will reserve the word 'change' to mean an API that
both sets one or more values, and commits to disk.  This will be
consistent with the LVM commandline.  The existing vg_change_pesize()
function does not commit to disk, but just changes the extent_size
and ensures all internal structures are updated.  This logic should
be contained in a function that sets the value.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:04:52 +00:00
Dave Wysochanski
b1278ba1b8 Remove unused 'cmd' from vg_change_pesize().
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:03:37 +00:00
Dave Wysochanski
de5dfec56b Update vg_change_pesize() to contain all validity checks.
It would be nice to have one function that does all the validation
and setting of the VG's pesize.  However, currently some checks
are in the higher-level function _vgchange_pesize(), and some
checks are in the lower function vg_change_pesize().
This patch moves most of the higher-level checks inside
vg_change_pesize.  In one case a failure return code is
changed from ECMD_FAILED to EINVALID_CMD_LINE.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:02:15 +00:00
Dave Wysochanski
9af5a142d0 Add defines for default vgcreate parameters. 2009-07-09 10:00:36 +00:00
Dave Wysochanski
2c3093af7c Fix memory leak in vgsplit when re-reading the VG.
Call vg_release() before re-reading the vg.
Remove vgsplit whitespace and update copyright.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 05:40:59 +00:00
Dave Wysochanski
0f66b7086b Refactor a couple log_error() statements in prep for larger log_error() patch.
Part of twoerner's log_error() patches.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-08 18:15:51 +00:00
Dave Wysochanski
4c35d6dee6 Remove unneeded LOCK_NONBLOCKING from vg_read() API.
Remove unneeded LOCK_NONBLOCKING from vg_read() API and tools that
use it.  We no longer need this flag anywhere since we now automatically
set LCK_NONBLOCK inside lock_vol() if vgs_locked().
For further details, see:
commit d52b3fd3fe
Author: Dave Wysochanski <dwysocha@redhat.com>
Date:   Wed May 13 13:02:52 2009 +0000

    Remove NON_BLOCKING lock flag from tools and set a policy to auto-set.

    As a simplification to the tools and further liblvm, this patch pushes
    the setting of NON_BLOCKING lock flag inside the lock_vol() call.
    The policy we set is if any existing VGs are currently locked, we
    set the NON_BLOCKING flag.

At some point it may make sense to add this flag back if we get an
RFE from a liblvm user, but for now let's keep it as simple as
possible.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-08 14:33:17 +00:00
Dave Wysochanski
6b6f59da79 Remove LOCK_KEEP and READ_CHECK_EXISTENCE from vgsplit.
Remove LOCK_KEEP and READ_CHECK_EXISTENCE from vgsplit.
These flags are no longer necessary.  We now check for existence
in a differnet function, and it is not necessary to keep the lock.
Removing these flags simplifies the new vg_read() interface.
After this patch, we can fully remove LOCK_KEEP.
READ_CHECK_EXISTENCE needs a bit more work before full removal.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-08 14:27:37 +00:00
Dave Wysochanski
6cf4278659 Fix compile warning in lvmcmdline.c - use C99 PRIu64 for uint64_t.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-07 01:51:00 +00:00
Dave Wysochanski
4c611a220a Fix vg_read() error paths to properly release upon vg_read_error().
Fix vg_read() error paths to properly release upon vg_read_error().
Note that in the iterator paths (process_each_*()), we release
inside the iterator so no individual cleanup is needed.  However there
are a number of other places we missed the cleanup.  Proper cleanup
when vg_read_error() is true should be calling vg_release(vg), since
there should be no locks held if we get an error (except in certain
special cases, which IMO we should work to remove from the code).

Unfortunately the testsuite is unable to detect these types of memory
leaks.  Most of them can be easily seen if you try an operation
(e.g. lvcreate) with a volume group that does not exist.  Error
message looks like this:
  Volume group "vg2" not found
  You have a memory leak (not released memory pool):
   [0x1975eb8]
  You have a memory leak (not released memory pool):
   [0x1975eb8]


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-07 01:18:35 +00:00
Mike Snitzer
c1060e13a7 Allow commandline sizes to be specified in terms of bytes and sectors.
Update the man pages to document size units uniformly.
2009-07-06 19:13:26 +00:00
Dave Wysochanski
542d034441 Add lvmcache_init() to polldaemon initialization.
Signed-off-by: Petr Rockai <me@mornfall.net>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-01 17:05:12 +00:00
Dave Wysochanski
819f14eaf4 Convert vgsplit to use vg_read_for_update.
Sun May  3 13:12:28 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert vgsplit to use vg_read_for_update.


Author: Petr Rockai <prockai@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>
2009-07-01 17:04:21 +00:00
Dave Wysochanski
a2214e5509 Convert vgrename to vg_read_for_update.
Sun May  3 12:54:28 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert vgrename to vg_read_for_update.

Rebased 6/26/2009 - Dave W.

Author: Petr Rockai <prockai@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>
2009-07-01 17:02:18 +00:00
Dave Wysochanski
542ef24d9f Convert vgreduce to use vg_read_for_update.
Sun May  3 12:50:58 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert vgreduce to use vg_read_for_update.

Rebased 6/26/2009 - Dave W.
2009-07-01 17:01:46 +00:00
Dave Wysochanski
13e8c7e434 Rework the toollib interface (process_each_*) on top of new vg_read.
Sun May  3 12:32:30 CEST 2009  Petr Rockai <me@mornfall.net>
  * Rework the toollib interface (process_each_*) on top of new vg_read.

Rebased 6/26/09 by Dave W.
- Add skipping message to process_each_lv
- Remove inconsistent_t.
2009-07-01 17:00:50 +00:00
Dave Wysochanski
b8b3508c59 Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).
Sun May  3 11:40:51 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).

Rebased 6/26/09 by Dave W.
2009-07-01 16:59:37 +00:00
Alasdair Kergon
476d463348 pre-release tidy up 2009-06-30 18:39:31 +00:00
Dave Wysochanski
c6b235efc8 Fix incomplete revert for lvconvert. 2009-06-26 11:29:06 +00:00
Alasdair Kergon
f7c76e3878 revert last patch - let's do a release first 2009-06-26 10:55:57 +00:00
Dave Wysochanski
96d0004d12 Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).
Sun May  3 11:40:51 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).


Author: Petr Rockai <prockai@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>
2009-06-26 09:47:36 +00:00
Alasdair Kergon
2f5a1df42c Abort if automatic metadata correction fails when reading VG to update it. 2009-06-26 09:19:13 +00:00
Alasdair Kergon
024e2cd0e6 Abort operation if automatic metadata correction in lvconvert fails. 2009-06-26 09:03:59 +00:00
Petr Rockai
1f164ad9d0 - Ignore suspended devices during repair (Milan).
- Call vgreduce --removemissing (without --force) automatically to clean up bad
  PVs (Milan).
2009-06-15 14:47:39 +00:00
Milan Broz
1bf740434a Suggest use lvchange --resync when up converting not yet synced mirror. 2009-06-15 13:43:15 +00:00
Milan Broz
9242380c2f Fix lvconvert to not poll mirror if no conversion in progress. 2009-06-15 12:08:59 +00:00
Petr Rockai
41c97745a6 Complain when lvconvert --repair is used on non-mirror LV. 2009-06-10 15:27:57 +00:00
Milan Broz
37093b1d17 Fix compiler warning. 2009-06-10 11:21:10 +00:00
Milan Broz
d39e1be45c Unlock VG in recover_vg if metadata read failed. 2009-06-10 11:15:29 +00:00
Milan Broz
6c1e32c0e0 Unlock vg when requested automatic update failed.
(fixes previous commit)
2009-06-10 10:15:28 +00:00
Dave Wysochanski
9567c70939 Update vgsplit to use new vg_reserve_newname() function. 2009-06-09 14:31:20 +00:00
Dave Wysochanski
285375e6c3 Update vgcreate to use new vg_lock_newname(). 2009-06-09 14:30:44 +00:00
Dave Wysochanski
f3a56d49e3 Update vgrename to use vg_lock_newname. 2009-06-09 14:30:16 +00:00
Milan Broz
b4a2de670a Fix the same readahead rounding in lvcreate.
(fixes previous commit)
2009-06-06 22:06:54 +00:00
Milan Broz
12b1f31cbb Round readahead more inteligently and print warning.
Round readahead at least to one page up.
Print warning instead of verbose message.
2009-06-06 22:00:20 +00:00
Milan Broz
66086ce962 Fix double releasing of vg when repairing of vg is requested.
Several commands calls process_each_vg() and in provided
callback it explicitly recovers VG if inconsistent.
(vgchange, vgconvert, vgscan)

It means that old VG is released and reread  but the function
above (process_one_vg) tries to unlock and release old VG.

Patch moves the repair logic into _process_one_vg() function.

It always tries to read vg (even inconsistent) and then decides
what to do according new defined parameter.

Also patch unifies inconsistent error messages.

The only slight change if for vgremove command, where
it now tries to repair VG before it removes if force arg is given.
(It works similar way before, just the order of operation changed).
2009-06-05 20:00:52 +00:00
Milan Broz
c26488d348 Use lvconvert --repair instead of vgreduce in mirror dmeventd DSO (mornfall)
Introduce lvconvert --use_policies (mornfall)
2009-06-04 12:01:15 +00:00
Alasdair Kergon
896fc66e32 Add splitname. 2009-06-03 20:44:42 +00:00
Alasdair Kergon
9767eb448d Add subsystem, vg_name, lv_name, lv_layer fields to dmsetup reports. 2009-06-03 18:35:39 +00:00
Milan Broz
31f55a07db Fix convert polling to ignore LV with different UUID.
When mirror convert polling is started (mainly as backgound process,
in lvchange -a y or in lvconvert itself) it tries to read VG
and LV identified by its name.

Unfortunatelly, the VG can have already different LV under the same name,
and various more or less funny things can happen (note that
_finish_lvconvert_mirror suspends the volume for example).

(the typical example is our testing script which continuously recreates
LVs under the same name in the same VG.)

This patch adds optional uuid parameter which helps to properly
select the monitoring object. For lvconvert polling it is set to LV UUID
and both _get_lvconvert_vg and _get_lvconvert_lv uses it to read proper VG/LV.

(In the pvmove case it is NULL, here we poll for physical volume name).
2009-06-01 14:43:27 +00:00
Alasdair Kergon
99113cc588 Suppress 'removed' messages displayed when internal LVs are removed.
Fix lvchange -a and -p for sparse LVs.
Fix lvcreate --virtualsize to activate the new device immediately.
2009-05-27 18:19:21 +00:00
Alasdair Kergon
154753db8b Make --snapshot optional with lvcreate --virtualsize.
Generalise --virtualoriginsize to --virtualsize.
2009-05-27 16:30:29 +00:00
Alasdair Kergon
36a1d9e9b4 Skip virtual origins in process_each_lv_in_vg(). (mbroz) 2009-05-27 13:23:41 +00:00
Alasdair Kergon
fcc2a694eb 0->NULL (mbroz) 2009-05-27 13:07:37 +00:00
Alasdair Kergon
4b896598c7 Reinstate version in liblvm2cmd.so soname. (2.02.44) 2009-05-21 11:11:29 +00:00
Alasdair Kergon
25a2e7b80e Pre-release cleanups. 2009-05-21 03:04:52 +00:00
Milan Broz
a01e55b6ec Use lock query instead of activate_lv_excl
- switch lvremove to not force activate volume when removing
 - ditto for force resync

 - fix some wrong return codes in lvchange_resync()
2009-05-20 09:55:33 +00:00
Milan Broz
eb91c4eee3 Use suspend with flush when device size was changed during table preload.
This allows online mirror resize, also removes condition to preventing
code to do this.
2009-05-20 09:52:37 +00:00
Milan Broz
8dd0ae923b Fix lvconvert check for multiple-segment mirrors (mornfall) 2009-05-19 10:27:47 +00:00
Milan Broz
94994d7e74 Fix compilation warning. 2009-05-19 10:12:41 +00:00
Milan Broz
65edd11bfb If pvmove fails activating mirror volume, try restore to previous state.
pvmove now keep suspended devices if temporary mirror creation fails.

We can try to restore previous state if it is first attempt to activate
pvmove (code basically run the same code as --abort automatically).
2009-05-19 09:51:02 +00:00
Milan Broz
970f241c52 Check max_lv on only place and force the check only for new volume.
We can temporarily violate max_lv during mirror conversion etc.

(If the operation fails, orphan mirror images are visible to administrator
for manual remove for example. Not that this should ever happen:-)

Force limit only for lvcreate (and vg merge) command.

Patch also adds simple max_lv tests into testsuite
2009-05-13 21:29:10 +00:00
Milan Broz
82cf926094 Remove unneeded import parameter from lv_create_empty. 2009-05-13 21:28:31 +00:00
Milan Broz
afd9ba98c1 Merge lv_is_displayable and lv_is_visible.
Displayable and visible is the same thing.

volumes_count(vg) is now vg_visible_lvs() and always
returns number of LVs from user perspective.
2009-05-13 21:27:43 +00:00
Milan Broz
d60f341d96 Remove vg->lv_count and use counter function.
This should not cause problems but simplifies code a lot.

(the volumes_count is merged and renamed with lvs_visible
function by following patch.)
2009-05-13 21:22:57 +00:00
Milan Broz
4b13d5a823 Fix snapshot segment import to not use duplicate segments & replace.
The snapshot segment (snapshotX) is created twice
during the text metadata segment processing.

This can cause temporary violation of max_lv count.

Simplify the code, snapshot segment is properly initialized
in init_snapshot_seg function now and do not need to be replaced
by vg_add_snapshot call.

The vg_add_snapshot() is now usefull only for adding new
snapshot and it shares the same initialization function.

The snapshot name is always generated, name paramater can be
removed from function call.
2009-05-13 21:21:58 +00:00
Dave Wysochanski
5a820745ce Remove NON_BLOCKING lock flag from tools and set a policy to auto-set.
As a simplification to the tools and further liblvm, this patch pushes
the setting of NON_BLOCKING lock flag inside the lock_vol() call.
The policy we set is if any existing VGs are currently locked, we
set the NON_BLOCKING flag.

Should be no functional change.
2009-05-13 13:02:52 +00:00
Milan Broz
2f9a9d1a7f Remove snapshot_count from VG and use function instead. 2009-05-12 19:12:09 +00:00
Milan Broz
0b502933c5 Introduce lvm2_install target.
Buildsystem support device-mapper only install,
but generic install tagret includes both dm+lvm2.

For distribution which uses separate install_device-mapper,
there is no way how to install lvm2 only
(so after installing lvm2 for packaging purposes
built system must remove installed device-mapper files).

Fix it by allowing lvm2_install target, similarily like
install_cluster for clvmd.

(install = install_device-mapper + install_lvm2)
2009-05-11 10:28:45 +00:00
Milan Broz
19363a13b1 Fix device-mapper static build targets.
dmsetup.static is not built and cleaned properly
if running only device-mapper install/build.
2009-05-11 10:13:28 +00:00
Dave Wysochanski
c5185d4c03 Fixup whitespace. 2009-04-29 20:14:21 +00:00
Dave Wysochanski
1fa92933b5 Fixup whitespace. 2009-04-29 20:11:46 +00:00
Peter Rajnoha
7833b01291 Fix wrong arg in lv_is_virtual_origin call while creating snapshots. 2009-04-26 08:12:12 +00:00
Alasdair Kergon
87f42fda5e Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin).
Add lvs origin_size field.
Fix linux configure --enable-debug to exclude -O2.

Still a few rough edges, but hopefully usable now:
  lvcreate -s vg1 -L 100M --virtualoriginsize 1T
2009-04-25 01:17:59 +00:00
Peter Rajnoha
2dce31a16a Fix segfault when using -U, -G and -M options in dmsetup. 2009-04-24 11:30:49 +00:00
Petr Rockai
eb23252b61 Implement, test and document (first iteration of) lvconvert --repair. 2009-04-23 16:56:21 +00:00
Petr Rockai
54120cb254 Refuse adding missing PVs in create_pv_list in toollib when allocatable_only is
requested.
2009-04-23 16:45:30 +00:00
Milan Broz
cd978f74da Fix vgreduce --removemissing failure exit code. 2009-04-22 17:00:28 +00:00
Dave Wysochanski
efa62ff443 Remove some trailing whitespace so git won't complain. 2009-04-22 12:46:25 +00:00
Milan Broz
8f3fd69ffa Move metadata backup call after vg_commit.
The backup() call store metadata from memory.

But in cluster backup() call performs
remote nodes metadata backup and it reads data from disk.

For metadata backup consistency,
patch moves all backup() calls after vg_commit.

(Moreover, some tools already do that this way.)
2009-04-21 14:31:57 +00:00
Milan Broz
d66abfb82a Fix pvseg report for orphan PVs and other devices.
If user requests report attribute from PVSEG type
and PV is orphan (or all devices is set), the report
is empty.

Try for example (when only orphan PV are present)
 #pvs
 #pvs -o +devices
# pvs /dev/sdb1
  PV         VG   Fmt  Attr PSize  PFree
    /dev/sdb1       lvm2 --   46.58G 46.58G
# pvs -o +devices /dev/sdb1
(no output)

The problem is caused by empty pv->segments list.

Fix it by providing fake segment here (similar to fake structures
in _pvsegs_sub_single() calls.
2009-04-21 12:59:18 +00:00
Milan Broz
81c7482974 Fix pvs -a for segmented output
# pvs -a -o devices
   Volume group name (null) has invalid characters
   Skipping volume group (null)

...
_pvsegs_sub_single creates fake vg, we need to check
that pv is real here.
2009-04-21 12:57:31 +00:00
Milan Broz
19061a1a15 Fix dmsetup.static build. 2009-04-15 14:42:27 +00:00
Milan Broz
043b13625b Properly release VG memory pool in all CLI tools. 2009-04-10 10:01:38 +00:00
Milan Broz
1b25b6e009 Always return exit error status when locking of volume group fails. 2009-04-10 09:54:36 +00:00
Zdenek Kabelac
9bcd5c2ffc Avoid referencing files from DESTDIR during build process 2009-04-08 14:08:05 +00:00
Milan Broz
772cac09e3 Enable use of cached metadata for pvs & pvdisplay.
Currently PV commands, which performs full device scan, repeatly
re-reads PVs and scans for all devices.

This behaviour can lead to OOM for large VG.

This patch allows using internal metadata cache for pvs & pvdisplay,
so the commands scan the PVs only once.
(We have to use VG_GLOBAL otherwise cache is invalidated on every
VG unlock in process_single PV call.)
2009-04-08 12:53:20 +00:00
Milan Broz
0377a6de21 Use pv from newly read_vg to avoid possible use of not initialized memory.
If the vg in process_each_segment_in_pv is NULL, the pv struct
can be incomplete (for example lv_segs are not copied in get_pvs()
call).

We need use the new pv from just read-in volume group.

(The same code is in pvdisplay already.)
2009-04-07 10:22:14 +00:00
Milan Broz
212a510f04 Do not use pointer from released memory pool (cmd->cmd_line). 2009-04-02 14:59:48 +00:00
Takahiro Yasui
36881b0133 Remove old metadata backup file after renaming vg.
Author: Takahiro Yasui <tyasui@redhat.com>
2009-03-23 22:29:06 +00:00
Petr Rockai
a9d72f0e9d Some extra (paranoid) checks on dev_is_{md,swap} result. 2009-03-17 14:00:58 +00:00
Petr Rockai
3402ccd488 Detect and wipe swap signatures in pvcreate. 2009-03-17 13:59:56 +00:00
Dave Wysochanski
d917c98cd8 Fix some clean rules, fix previous distclean checkin.
In libdm/Makefile.in, we need to cleanup the symlink properly.
Adding to CLEAN_TARGETS seemed like the simplest way to do this
in the current build framework.  We could redo dependencies for
VERSIONED_SHLIB, but for now just add to CLEAN_TARGETS.

For scripts/Makefile.in, we should be adding to DISTCLEAN_TARGETS.
The generic rule in make.tmpl.in takes care of the cleanup.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Author: Takahiro Yasui <tyasui@redhat.com>
2009-03-16 20:00:10 +00:00
Milan Broz
d726767f14 Fix warning in previous commit. 2009-03-16 15:19:29 +00:00
Milan Broz
7f436a0f39 Fix lv_count when manipulating with snapshots and max_lv is set.
Patch fixes these problems:
 - during the snapshot creation process, it needs create 2 LVs,
   one is cow, second becomes snapshot.
   If the code fails in vg_add_snapshot, code lvcreate will not remove
   LV cow volume.

 - if max_lv is set and VG contains snapshot, it can happen that
   during the activation lv_count is temporarily increased over the limit
   and VG metadata are not properly processed
   see https://bugzilla.redhat.com/show_bug.cgi?id=490298

 - vgcfgrestore alows restore with max_lv set to lower valuer that actual
   LV count. This later leads to situation that max_lv is completely ignored.

 - vgck doesn't call vg_validate(). It should at least try:-)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2009-03-16 14:34:57 +00:00
Dave Wysochanski
0bf8455b64 Rename liblvm to liblvm-internal.
Make preparation for using liblvm for new application library.
2009-03-06 16:17:28 +00:00
Alasdair Kergon
81680dce3c Fix last check-ins: seg can be NULL. 2009-02-28 20:04:24 +00:00
Alasdair Kergon
2b23864219 . 2009-02-28 19:43:42 +00:00
Alasdair Kergon
ed82bfd2ba Attempt cleanup in child before execing new binary in exec_cmd() 2009-02-28 00:54:06 +00:00
Alasdair Kergon
8a4e6cac0a . 2009-02-27 23:55:15 +00:00