]> sourceware.org Git - lvm2.git/log
lvm2.git
8 years agotoollib: remove unsed pvcreate params function
David Teigland [Tue, 26 Jan 2016 18:04:37 +0000 (12:04 -0600)]
toollib: remove unsed pvcreate params function

which has been replaced by an equivalent pvcreate_each params
function.

8 years agoliblvm: replace pvcreate_single with pvcreate_vol
David Teigland [Tue, 26 Jan 2016 17:50:11 +0000 (11:50 -0600)]
liblvm: replace pvcreate_single with pvcreate_vol

And remove the pvcreate_single wrapper.

8 years agovgcreate: use the common toollib pv create
David Teigland [Tue, 26 Jan 2016 17:34:59 +0000 (11:34 -0600)]
vgcreate: use the common toollib pv create

Use the new pvcreate_each_device() function from
toollib, previously added for pvcreate, in place
of the old pvcreate_vol().

This also requires shifting the location where the
lock is acquired for the new VG name.  The lock for
the new VG is supposed to be acquired before pvcreate.
This means splitting the vg_lock_newname() out of
vg_create(), and calling vg_lock_newname() directly
before pvcreate, and then calling the remainder of
vg_create() after pvcreate.

The new function vg_lock_and_create() now does
vg_lock_newname() + vg_create(), like the previous
version of vg_create().

The lock on the new VG name is released before the
pvcreate and reacquired after the pvcreate because
pvcreate needs to reset lvmcache, which doesn't work
when locks are held.  An exception could likely be
made for the new VG name lock, which would allow
vgcreate to hold the new VG name lock across the
pvcreate step.

8 years agovgextend: use the common toollib pv create
David Teigland [Mon, 15 Feb 2016 20:28:09 +0000 (14:28 -0600)]
vgextend: use the common toollib pv create

8 years agopvcreate: use the common toollib pv create
David Teigland [Mon, 15 Feb 2016 20:09:42 +0000 (14:09 -0600)]
pvcreate: use the common toollib pv create

8 years agotoollib: add two phase pv processing code
David Teigland [Tue, 16 Feb 2016 20:15:24 +0000 (14:15 -0600)]
toollib: add two phase pv processing code

This is common code for handling PV create/remove
that can be shared by pvcreate/vgcreate/vgextend/pvremove.
This does not change any commands to use the new code.

- Pull out the hidden equivalent of process_each_pv
  into an actual top level process_each_pv.

- Pull the prompts to the top level, and do not
  run any prompts while locks are held.
  The orphan lock is reacquired after any prompts are
  done, and the devices being created are checked for
  any change made while the lock was not held.

Previously, pvcreate_vol() was the shared function for
creating a PV for pvcreate, vgcreate, vgextend.
Now, it will be toollib function pvcreate_each_device().

pvcreate_vol() was called effectively as a helper, from
within vgcreate and vgextend code paths.
pvcreate_each_device() will be called at the same level
as other process_each functions.

One of the main problems with pvcreate_vol() is that
it included a hidden equivalent of process_each_pv for
each device being created:

  pvcreate_vol() -> _pvcreate_check() ->

   find_pv_by_name() -> get_pvs() ->

     get_pvs_internal() -> _get_pvs() -> get_vgids() ->

       /* equivalent to process_each_pv */
       dm_list_iterate_items(vgids)
         vg = vg_read_internal()
         dm_list_iterate_items(&vg->pvs)

pvcreate_each_device() reorganizes the code so that
each-VG-each-PV loop is done once, and uses the standard
process_each_pv function at the top level of the function.

8 years agovgconvert: refactor to avoid pvcreate code
David Teigland [Tue, 16 Feb 2016 19:22:50 +0000 (13:22 -0600)]
vgconvert: refactor to avoid pvcreate code

This uses the vg->pv_write_list in place of the
vg->pvs_to_write list, and eliminates the use of
pvcreate_params.  The label remove and zeroing
steps are shifted out of vg_write() to the higher
level like pvcreate will do.

8 years agometadata: use pv_write_list for _check_old_pv_ext_for_vg
David Teigland [Tue, 16 Feb 2016 19:02:00 +0000 (13:02 -0600)]
metadata: use pv_write_list for _check_old_pv_ext_for_vg

The _check_old_pv_ext_for_vg() function only needs to
do pv_write(), so it can use the simpler pv_list structs
on the pv_write_list.

8 years agometadata: refactor part of add_pv_to_vg
David Teigland [Tue, 16 Feb 2016 18:49:57 +0000 (12:49 -0600)]
metadata: refactor part of add_pv_to_vg

This shifts the use of the 'pv_to_write' struct
and the 'pvcreate_params' struct to the one
caller of add_pv_to_vg, which is made static.

8 years agovg_write: add list of pvs to write
David Teigland [Tue, 16 Feb 2016 18:43:24 +0000 (12:43 -0600)]
vg_write: add list of pvs to write

The vg->pv_write_list contains pv_list structs for which
vg_write() should call pv_write().

The new list will replace vg->pvs_to_write that contains
vg_to_create structs which are used to perform higher-level
pvcreate-related operations. The higher level pvcreate
operations will be moved out of vg_write() to higher levels.

8 years agoconfigure
Alasdair G Kergon [Thu, 25 Feb 2016 13:58:48 +0000 (13:58 +0000)]
configure

8 years agoconfigure: require sanlock 3.3.0
David Teigland [Wed, 24 Feb 2016 19:22:23 +0000 (13:22 -0600)]
configure: require sanlock 3.3.0

For a sanlock flag added in that version.

8 years agolvmlockd: use new sanlock flag to avoid blocking
David Teigland [Wed, 24 Feb 2016 16:10:59 +0000 (10:10 -0600)]
lvmlockd: use new sanlock flag to avoid blocking

This flag allows sanlock requests to avoid all blocking.

8 years agotests: include lvmlockd in default make check
David Teigland [Tue, 23 Feb 2016 22:34:46 +0000 (16:34 -0600)]
tests: include lvmlockd in default make check

8 years agolvmlockd: fix sparse snapshot case
David Teigland [Tue, 23 Feb 2016 21:44:14 +0000 (15:44 -0600)]
lvmlockd: fix sparse snapshot case

A snapshot can be created without a real origin LV
in this case, so there's no lock to use.

8 years agocleanup: use sizeof instead of macro.
Zdenek Kabelac [Tue, 23 Feb 2016 19:19:50 +0000 (20:19 +0100)]
cleanup: use sizeof instead of macro.

Keep the buffer size defined at a single place and then use
its sizeof.

8 years agocleanup: use braces around macro params
Zdenek Kabelac [Tue, 23 Feb 2016 18:51:45 +0000 (19:51 +0100)]
cleanup: use braces around macro params

8 years agocoverity: ensure thin_pool_seg is not NULL
Zdenek Kabelac [Tue, 23 Feb 2016 20:36:51 +0000 (21:36 +0100)]
coverity: ensure thin_pool_seg is not NULL

thin_pool_seg being NULL would be an internal error.

8 years agocoverity: use same arithmetic for both major and minor
Zdenek Kabelac [Tue, 23 Feb 2016 20:16:08 +0000 (21:16 +0100)]
coverity: use same arithmetic for both major and minor

Run all arithmetic in the same 'dev_t' type.

8 years agocoverity: check for dm_snprintf
Zdenek Kabelac [Tue, 23 Feb 2016 20:03:50 +0000 (21:03 +0100)]
coverity: check for dm_snprintf

Check return state like everywhere else.

8 years agocoverity: check cmd pointer exists
Zdenek Kabelac [Tue, 23 Feb 2016 20:02:36 +0000 (21:02 +0100)]
coverity: check cmd pointer exists

Since in _report_init() we check few times for cmd != NULL
keep it consistent and Coverity happier.

8 years agocoverity: ensure non-null pointers are used
Zdenek Kabelac [Tue, 23 Feb 2016 19:16:06 +0000 (20:16 +0100)]
coverity: ensure non-null pointers are used

Here is too complex for Coverity to guess
those pointers cannot be NULL, but it's
very easy to add little checks here.

8 years agocoverity: drop unused assignments
Zdenek Kabelac [Tue, 23 Feb 2016 18:57:56 +0000 (19:57 +0100)]
coverity: drop unused assignments

8 years agocoverity: check for zero length buffer
Zdenek Kabelac [Tue, 23 Feb 2016 18:54:19 +0000 (19:54 +0100)]
coverity: check for zero length buffer

When get_shared_library_path() would got zero length buffer,
it could have underflow in size calc later.
So just put extra small check for this case.

8 years agocoverity: check for info pointer existance
Zdenek Kabelac [Tue, 23 Feb 2016 18:48:01 +0000 (19:48 +0100)]
coverity: check for info pointer existance

Since we already check in few other places  'info' is not NULL,
do the same for others - however when info would be NULL
it more or less looks like internal error.

8 years agocoverity: drop unneeded header
Zdenek Kabelac [Tue, 23 Feb 2016 18:47:35 +0000 (19:47 +0100)]
coverity: drop unneeded header

8 years agolibdm: fix string boundary
Zdenek Kabelac [Tue, 23 Feb 2016 19:17:41 +0000 (20:17 +0100)]
libdm: fix string boundary

The test for string 'end' needs to account for ending \0,
which also needs to fit <SIZE.

8 years agolvmlockd: set default result value
David Teigland [Tue, 23 Feb 2016 20:35:40 +0000 (14:35 -0600)]
lvmlockd: set default result value

The default error value should be set indicating
an error.

8 years agotests: updates for check_lvmlockd
David Teigland [Tue, 23 Feb 2016 19:58:22 +0000 (13:58 -0600)]
tests: updates for check_lvmlockd

Move the lvmlockd-related setup functions into aux.

For check_lvmlockd_test, start a new instance of
lvmlockd --test for each shell test.

8 years agomake: Add check_lvmlockd_* targets to top-level
Marian Csontos [Tue, 23 Feb 2016 17:34:46 +0000 (18:34 +0100)]
make: Add check_lvmlockd_* targets to top-level

8 years agotests: add SKIP_WITH_LVMLOCKD
David Teigland [Mon, 22 Feb 2016 22:13:42 +0000 (16:13 -0600)]
tests: add SKIP_WITH_LVMLOCKD

to all tests that don't already used vgcreate $SHARED

8 years agotests: check warn about belong is printed
Zdenek Kabelac [Tue, 23 Feb 2016 13:38:26 +0000 (14:38 +0100)]
tests: check warn about belong is printed

8 years agogcc: logical-op warning go away
Zdenek Kabelac [Tue, 23 Feb 2016 12:16:55 +0000 (13:16 +0100)]
gcc: logical-op warning go away

Don't be too much inventive and shutdown gcc6 warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

8 years agogcc: cleanup Wunused-const-variable
Zdenek Kabelac [Tue, 23 Feb 2016 11:59:46 +0000 (12:59 +0100)]
gcc: cleanup  Wunused-const-variable

Use #define instead, since we do not require actually buffer needs
to exists to eliminated new gcc6 warning:

clvm.h:53:19: warning: â€˜CLVMD_SOCKNAME’ defined but not used
[-Wunused-const-variable]

8 years agopvremove: add warn when removing PV in use
Zdenek Kabelac [Tue, 23 Feb 2016 13:10:45 +0000 (14:10 +0100)]
pvremove: add warn when removing PV in use

Reshuffle messages during pvremove.

Always print WARNING: when PV is in use so using options
--force --force doesn't make this important user
notification go away.

Simplify variable 'used' usage (so older gcc doesn't warn
about the use of unitilizied variable).

Add some '.' into messages.

8 years agocleanup: drop double ;
Zdenek Kabelac [Tue, 23 Feb 2016 11:12:29 +0000 (12:12 +0100)]
cleanup: drop double ;

8 years agogcc: cleanup some sign warnings
Zdenek Kabelac [Tue, 23 Feb 2016 11:18:48 +0000 (12:18 +0100)]
gcc: cleanup some sign warnings

When comparing unsigned with int, the comparision is made
as 'unsigned' type, so make it rather explicit which type
is being compared.

8 years agocache: enforce header check
Zdenek Kabelac [Tue, 23 Feb 2016 11:15:42 +0000 (12:15 +0100)]
cache: enforce header check

Currently it's been checked for 'zero' header for thin-pool,
but lets use it always for cache as well - since it's relatively 'cheap'
detection of read 'error' problems as thin/cache tools
currently do not work fast enough in this case.

8 years agothin: fix read size compare
Zdenek Kabelac [Tue, 23 Feb 2016 11:11:15 +0000 (12:11 +0100)]
thin: fix read size compare

Fix the compare with 'unsigned' sizeof() and error read -1 result.
So the read error is correctly recognized.

8 years agolvmdbusd: Initial unit test driver script
Tony Asleson [Mon, 22 Feb 2016 22:05:43 +0000 (16:05 -0600)]
lvmdbusd: Initial unit test driver script

It's disabled until we can fix it up.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agolvmdbusd: Remove unlimited retries
Tony Asleson [Mon, 22 Feb 2016 21:53:31 +0000 (15:53 -0600)]
lvmdbusd: Remove unlimited retries

Change while to for loop to prevent the daemon from getting stuck
when lvm is messed up.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agolvmdbusd: Add env variable to use session bus
Tony Asleson [Mon, 22 Feb 2016 20:28:11 +0000 (14:28 -0600)]
lvmdbusd: Add env variable to use session bus

export LVMDBUSD_SESSION=True to run on the session bus instead
of the system bus so that we can run the unit test without
installing the dbus conf file.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agolvmdbus: Make unit tests work in test env
Tony Asleson [Mon, 22 Feb 2016 20:03:31 +0000 (14:03 -0600)]
lvmdbus: Make unit tests work in test env

Reduced the size of LVs created and use actual PE numbers instead of hard
coding them to allow us to work with the loop back devices.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agolvmdbusd: background.py, fix stdout parse error
Tony Asleson [Mon, 22 Feb 2016 20:00:30 +0000 (14:00 -0600)]
lvmdbusd: background.py, fix stdout parse error

It appears that the output of lvconvert --merge can vary some.  The code
was blowing up as it was trying to parse a line of stdout to retrieve the
% complete, but the line did not have the needed format and an execption
was thrown.  The uncaught exception caused the background thread to exit
without updating the job object, which caused the client to hang forever
waiting.  Added a default exception handler to prevent unhandled execptions
causing hangs and removed the parameter skip_first_line as it's no longer
needed.  The code checks to see if the line can be parsed before doing so.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agolvmdbustest.py: Make executable
Tony Asleson [Fri, 19 Feb 2016 23:02:45 +0000 (17:02 -0600)]
lvmdbustest.py: Make executable

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agotests: fix clean up after lvmlockd tests
David Teigland [Mon, 22 Feb 2016 20:13:30 +0000 (14:13 -0600)]
tests: fix clean up after lvmlockd tests

8 years agolvmdbusd: Fix make install for python >= 3.5
Marian Csontos [Mon, 22 Feb 2016 17:14:23 +0000 (18:14 +0100)]
lvmdbusd: Fix make install for python >= 3.5

python 3.5 renamed .pyo files to .opt-1.pyc.

8 years agospec: Fix 04ab1fa572bb: Remove left-overs
Marian Csontos [Mon, 22 Feb 2016 16:40:12 +0000 (17:40 +0100)]
spec: Fix 04ab1fa572bb: Remove left-overs

8 years agolvmlockd: invalidate name in lockspace struct after remove
David Teigland [Mon, 22 Feb 2016 15:32:39 +0000 (09:32 -0600)]
lvmlockd: invalidate name in lockspace struct after remove

After the lockspace has been successfully removed,
invalidate the name field in the lockspace struct.
The struct remains on the list of lockspaces until
the struct can be freed later.  Until the struct is
freed, its name will prevent another new lockspace
from being created with the same name.

8 years agotest: add make check_lvmlockd_test
David Teigland [Thu, 14 Jan 2016 22:12:46 +0000 (16:12 -0600)]
test: add make check_lvmlockd_test

Which runs lvmlockd in --test mode, without
any lock manager.

Also make some adjustments to the check_lvmlockd
variations using the lock managds.

8 years agotests: skip thin-flags test on 32bit el6 kernel
Zdenek Kabelac [Mon, 22 Feb 2016 13:52:01 +0000 (14:52 +0100)]
tests: skip thin-flags test on 32bit el6 kernel

Until kernel is fixed, stop running test always hitting OOPS there.

8 years agocleanup: use char arrays.
Zdenek Kabelac [Mon, 22 Feb 2016 13:11:02 +0000 (14:11 +0100)]
cleanup: use char arrays.

8 years agocleanup: indent changes
Zdenek Kabelac [Mon, 22 Feb 2016 09:44:46 +0000 (10:44 +0100)]
cleanup: indent changes

Some code indention.
Use dm_strncpy() for simplier code.

TODO: we could possibly use   %32s  for printing pvid...
so maybe adding extra  FMT_PVID....

8 years agocleanup: libdm clang warnings
Zdenek Kabelac [Mon, 22 Feb 2016 09:49:45 +0000 (10:49 +0100)]
cleanup: libdm clang warnings

Add some extra clang pointer validation so we do not try deref NULL.

8 years agolibdm: grow with initialized struct content
Zdenek Kabelac [Mon, 22 Feb 2016 10:14:30 +0000 (11:14 +0100)]
libdm: grow with initialized struct content

Coverity noticed struct hist has been copied uninitalized into mempool.

8 years agolvmetad: fix error path
Zdenek Kabelac [Mon, 22 Feb 2016 09:45:01 +0000 (10:45 +0100)]
lvmetad: fix error path

Coverity noticed the internal error path would  be using uninit struct.
So always make sure reply is initilized.

8 years agopost-release
Alasdair G Kergon [Sun, 21 Feb 2016 23:37:48 +0000 (23:37 +0000)]
post-release

8 years agopre-release v2_02_143
Alasdair G Kergon [Sun, 21 Feb 2016 23:17:24 +0000 (23:17 +0000)]
pre-release

8 years agolvmdbustest.py: resync latest changes
Tony Asleson [Fri, 19 Feb 2016 21:16:05 +0000 (15:16 -0600)]
lvmdbustest.py: resync latest changes

This file update was missed, copied latest file from:
https://github.com/tasleson/lvm-dubstep/blob/master/test/lvmdbustest.py

Signed-off-by: Tony Asleson <tasleson@redhat.com>
8 years agothin: fix update_pool_lv error path
Zdenek Kabelac [Fri, 19 Feb 2016 10:18:41 +0000 (11:18 +0100)]
thin: fix update_pool_lv error path

When update fails in suspend() (sending of messages
fails because metadata space is full) call resume(),
so the locking sequence works properly for clustering.

Also failing deactivation should unlock memory.

8 years agospec: Update python bindings and dbus-service
Marian Csontos [Thu, 18 Feb 2016 13:34:17 +0000 (14:34 +0100)]
spec: Update python bindings and dbus-service

The workaround for python3 is no longer needed.

8 years agotests: needs_check needs version 16
Zdenek Kabelac [Thu, 18 Feb 2016 17:10:31 +0000 (18:10 +0100)]
tests: needs_check needs version 16

Skip part of test when driver is too old.

8 years agothin: fix test for nonexisting status
Zdenek Kabelac [Thu, 18 Feb 2016 17:09:49 +0000 (18:09 +0100)]
thin: fix test for nonexisting status

Check status has right type.

8 years agotests: checking thin flags
Zdenek Kabelac [Thu, 18 Feb 2016 15:44:42 +0000 (16:44 +0100)]
tests: checking thin flags

Test various  (D/M/F) attrs for thin-pool/thin

8 years agoman: lvs updates
Zdenek Kabelac [Thu, 18 Feb 2016 13:13:40 +0000 (14:13 +0100)]
man: lvs updates

8 years agothin: report needs_check and fail state
Zdenek Kabelac [Thu, 18 Feb 2016 12:19:25 +0000 (13:19 +0100)]
thin: report needs_check and fail state

Fix reporting of Fail thin-pool target status
as attr[8] letter 'F'.

Report  'needs_check' status from thin-pool target via
attr field [4] (letter 'c'/'C'), and also via CheckNeeded field.

TODO: think about better name here?
TODO: lots of prop_not_implemented_set

8 years agothin: report PERCENT_INVALID for failed pool
Zdenek Kabelac [Thu, 18 Feb 2016 12:18:18 +0000 (13:18 +0100)]
thin: report PERCENT_INVALID for failed pool

When thin-pool is in failed/error state, we can't
read percentage so report invalid value.

8 years agolibdm: thin status update
Zdenek Kabelac [Mon, 15 Feb 2016 15:33:38 +0000 (16:33 +0100)]
libdm: thin status update

Fix parsing of 'Fail' status (using capital letter) for thin-pool.
Add also parsing of 'Error' state for thin-pool.
Add needs_check test for thin-pool.

Detect Fail state for thin.

8 years agometadata: ask for confirmation before really initializing/removing PV that is marked...
Peter Rajnoha [Thu, 18 Feb 2016 13:30:14 +0000 (14:30 +0100)]
metadata: ask for confirmation before really initializing/removing PV that is marked as belonging to a VG

Ask for confirmation when using pvcreate/pvremove on a PV which is
marked as belonging to a VG, just like we do in case of a PV which
belongs to known VG:

$ pvcreate -ff /dev/sda
Really INITIALIZE physical volume "/dev/sda" that is marked as belonging to a VG [y/n]? n
  /dev/sda: physical volume not initialized

$ pvremove -ff /dev/sda
Really WIPE LABELS from physical volume "/dev/sda" that is marked as belonging to a VG [y/n]? n
  /dev/sda: physical volume label not removed

8 years agolbmdbusd: Support in-tree testing.
Alasdair G Kergon [Thu, 18 Feb 2016 13:26:08 +0000 (13:26 +0000)]
lbmdbusd: Support in-tree testing.

8 years agoFix rpm builds
Marian Csontos [Thu, 18 Feb 2016 11:36:43 +0000 (12:36 +0100)]
Fix rpm builds

8 years agoreport: report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary
Peter Rajnoha [Thu, 18 Feb 2016 11:10:00 +0000 (12:10 +0100)]
report: report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary

State:
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0
  LV    ActLocal       SnapInvalid     MergeFailed
  lvol0 active locally         unknown         unknown

Now with using --binary switch.

Before this patch (lv_snapshot_invalid and lv_merge_failed not switched into numeric value
where -1 represents 'unknown' value)
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0 --binary
  LV    ActLocal   SnapInvalid     MergeFailed
  lvol0          1         unknown         unknown

With this patch applied:
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0 --binary
  LV    ActLocal   SnapInvalid     MergeFailed
  lvol0          1              -1              -1

8 years agoconfigure: Use python-config if python2-config not found.
Alasdair G Kergon [Thu, 18 Feb 2016 02:10:35 +0000 (02:10 +0000)]
configure: Use python-config if python2-config not found.

Assume that's good enough for older systems.

8 years ago.
Alasdair G Kergon [Thu, 18 Feb 2016 01:50:36 +0000 (01:50 +0000)]
.

8 years agolvmdbusd: Rename module to lvmdbusd
Alasdair G Kergon [Thu, 18 Feb 2016 01:14:56 +0000 (01:14 +0000)]
lvmdbusd: Rename module to lvmdbusd

8 years agoautoconf: Fix py-compile permissions
Alasdair G Kergon [Thu, 18 Feb 2016 01:05:05 +0000 (01:05 +0000)]
autoconf: Fix py-compile permissions

8 years agolvmdbus: resync latest changes with original repo
Alasdair G Kergon [Thu, 18 Feb 2016 00:27:57 +0000 (00:27 +0000)]
lvmdbus: resync latest changes with original repo

8 years agoWHATS_NEW
Alasdair G Kergon [Thu, 18 Feb 2016 00:01:02 +0000 (00:01 +0000)]
WHATS_NEW

8 years agolvmdbus: Add new daemon.
Alasdair G Kergon [Wed, 17 Feb 2016 23:53:35 +0000 (23:53 +0000)]
lvmdbus: Add new daemon.

8 years agoman: fix list of restricted LV name suffixes
Peter Rajnoha [Wed, 17 Feb 2016 14:38:27 +0000 (15:38 +0100)]
man: fix list of restricted LV name suffixes

8 years agometadata: add missing _repair_inconsinstent_vg call during PV ext repair
Peter Rajnoha [Tue, 16 Feb 2016 14:50:32 +0000 (15:50 +0100)]
metadata: add missing _repair_inconsinstent_vg call during PV ext repair

8 years agometadata: do not repair missing PV_EXT_USED flag for PVs belonging to foreign VG
Peter Rajnoha [Tue, 16 Feb 2016 12:55:31 +0000 (13:55 +0100)]
metadata: do not repair missing PV_EXT_USED flag for PVs belonging to foreign VG

The host that owns foreign VGs is responsible for fixing up PV_EXT_USED
flag - the same already applies to repairing any inconsistent VG.

This patch also moves the iteration over vg->pvs inside
_check_or_repair_pv_ext fn - it's cleaner this way.

8 years agorefactor: add common _is_foreign_vg fn
Peter Rajnoha [Tue, 16 Feb 2016 12:44:48 +0000 (13:44 +0100)]
refactor: add common _is_foreign_vg fn

8 years agopv: use pv->fmt to check for fake PVs, not pv->vg
Peter Rajnoha [Mon, 15 Feb 2016 14:50:11 +0000 (15:50 +0100)]
pv: use pv->fmt to check for fake PVs, not pv->vg

pv->vg is not set yet during pvcreate processing. Use pv->fmt instead to
check for these fake PVs (all normal PVs have format defined, devices
which are not PVs don't have this set).

This fixes commit 0000db7f98a07aa31c5b1cf13938b612e7f2821b.

8 years agocleanup: make the message about marked PVs consistent with the others
Peter Rajnoha [Mon, 15 Feb 2016 14:20:23 +0000 (15:20 +0100)]
cleanup: make the message about marked PVs consistent with the others

8 years agotoollib: skip PV if system ID is used and PV marked as used but metadata missing
Peter Rajnoha [Mon, 15 Feb 2016 14:11:54 +0000 (15:11 +0100)]
toollib: skip PV if system ID is used and PV marked as used but metadata missing

If we know that a PV belongs to some VG and we're missing metadata
(because we have only those PV(s) from VG present in the system that
don't have metadata areas), we should skip such PV when processing
under system ID.

This is because we know that the PV belongs to some VG, but we
really can't decide whether it matches system ID unless the VG
metadata is present again.

8 years ago pv: mark fake PVs as not used
Peter Rajnoha [Mon, 15 Feb 2016 13:46:31 +0000 (14:46 +0100)]
 pv: mark fake PVs as not used

Some of the PVs are not even orphan PVs - they're fake PVs - this can
happen if we're listing all devices with "pvs -a". Such PV must not
be marked as used.

8 years agocleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free...
Peter Rajnoha [Mon, 15 Feb 2016 12:30:37 +0000 (13:30 +0100)]
cleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free field

8 years agoWHATS_NEW: PV_EXT_USED flag and related
Peter Rajnoha [Mon, 15 Feb 2016 12:07:35 +0000 (13:07 +0100)]
WHATS_NEW: PV_EXT_USED flag and related

8 years agotests: fix tests checking pv_attr - there's a new bit now
Peter Rajnoha [Fri, 12 Feb 2016 11:05:59 +0000 (12:05 +0100)]
tests: fix tests checking pv_attr - there's a new bit now

8 years agotests: add pv-ext-flags.sh test
Peter Rajnoha [Tue, 7 Apr 2015 11:50:54 +0000 (13:50 +0200)]
tests: add pv-ext-flags.sh test

Testing PV extension flags. Currently, there's only one PV extension
flag present - the PV_EXT_USED flag (marking PV as used in a VG).

8 years agovg: automatically update to newest PV ext version during vg_write
Peter Rajnoha [Fri, 12 Feb 2016 13:22:02 +0000 (14:22 +0100)]
vg: automatically update to newest PV ext version during vg_write

8 years agoformat: format_text: add pv_needs_rewrite to format_handler and implemention for...
Peter Rajnoha [Fri, 12 Feb 2016 12:53:06 +0000 (13:53 +0100)]
format: format_text: add pv_needs_rewrite to format_handler and implemention for format_text

8 years agoreport: identify used PVs in pv_attr field with 'u' char
Peter Rajnoha [Thu, 11 Feb 2016 14:34:05 +0000 (15:34 +0100)]
report: identify used PVs in pv_attr field with 'u' char

8 years agoreport: always display 0 for pv_free field if we don't have any mda and PV is marked...
Peter Rajnoha [Thu, 11 Feb 2016 14:00:43 +0000 (15:00 +0100)]
report: always display 0 for pv_free field if we don't have any mda and PV is marked as used at the same time

8 years agobackup: backup_restore_vg: register PVs that need writing via vg->pvs_to_write list
Peter Rajnoha [Thu, 26 Mar 2015 13:20:46 +0000 (14:20 +0100)]
backup: backup_restore_vg: register PVs that need writing via vg->pvs_to_write list

The backup_restore_vg is used directly for restoring the VG from backup.
It's also used to do the VG conversions from one metadata format to
another which means vgconvert calls backup_restore_vg too.

When restoring VG from backup, we need to rewrite/write PV headers as
PVs may have been orphans before and now they're becoming part of some
VG - we need to write the PV_EXT_USED flag at least.

When using the backup_restore_vg for vgconvert, we need to write
completely new PV header in different format.

Avoid the special "pv_write" call and handling that was used before
this patch in vgconvert (vgconvert_single function to be more precise)
and reuse existing internal interface to register PV header for writing
(or rewriting) via vg->pvs_to_write list instead like we do it elsewhere
in the code.

This patch also resolves a problem in which PV headers with target
format were written in the vgconvert_single fn as orphans and VG
metadata were added later on - this was a tiny hack actually.
We can't do this now - we need to write the PV as belonging
to a VG because otherwise the PV_EXT_USED flag won't be written
properly (if the PV header is written as orphan, the PV_EXT_USED
is set to 0, of course, even though metadata are attached later).
So this patch removes this tiny inconsistency which was passing
just fine before because we didn't have any relation to the VG
in PV header before. Now we have the PV_EXT_USED flag which says
the "PV is used in some VG".

8 years agometadata: _vg_read: check if PV_EXT_USED flag is set correctly for non-orphan PVs...
Peter Rajnoha [Thu, 19 Mar 2015 06:53:22 +0000 (07:53 +0100)]
metadata: _vg_read: check if PV_EXT_USED flag is set correctly for non-orphan PVs and do a repair if needed

The same check as we already do for orphan PVs, just the other way
round now: if the PV is surely part of some VG and any PV the VG
contains does not have the PV_EXT_USED flag set, repair it.

For example - /dev/sda here is in VG vg and it's incorrectly not
marked as used by PV_EXT_USED flag:

pvs --binary -o pv_ext_vsn,pv_in_use
  WARNING: Volume Group vg is not consistent.
  WARNING: Repairing Physical Volume /dev/sda that is in Volume Group vg but not marked as used.
  PV         VG     Fmt  Attr PSize   PFree   ExtVsn PInUse
  /dev/sda   vg     lvm2 a--  124.00m 124.00m      2      1

8 years agoreport: add pv_ext_vsn field to display PV header extension version used
Peter Rajnoha [Tue, 17 Mar 2015 08:49:08 +0000 (09:49 +0100)]
report: add pv_ext_vsn field  to display PV header extension version used

For example:

$ pvs -o pv_name,vg_name,pv_ext_vsn,pv_in_use
  PV         VG     ExtVsn InUse
  /dev/sda               2
  /dev/sdb   vg          2    used
  /dev/vda2  fedora      1    used

8 years agometadata: check for PV extension version before doing any checks on PV extension...
Peter Rajnoha [Mon, 16 Mar 2015 17:23:43 +0000 (18:23 +0100)]
metadata: check for PV extension version before doing any checks on PV extension flags

PV header extension versions:
  0 - the original PV without any extensions
  1 - bootloader area support added
  2 - PV_EXT_USED flag support added

So do the associated checks related to PV_EXT_USED flag only if
PV header extension found is of version 2 and higher.

8 years agometadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and...
Peter Rajnoha [Wed, 11 Mar 2015 15:18:42 +0000 (16:18 +0100)]
metadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and do a repair if needed

If we know that the PV is orphan, meaning there's at least one MDA on
that PV which does not reference any VG and at the same time there's
PV_EXT_USED flag set, we're certainly in an inconsistent state and we
need to fix this.

For example, such situation can happen during vgremove/vgreduce if we
removed/reduced the VG, but we haven't written PV headers yet because
vgremove stopped abruptly for whatever reason just before writing new
PV headers with updated state, including PV extension flags (and so the
PV_EXT_USED flag).

However, in case the PV has no MDAs at all, we can't double-check
whether the PV_EXT_USED is correct or not - if that PV is marked
as used, it's either:
  - really used (but other disks with MDAs are missing)
  - or the error state as described above is hit

User needs to overwrite the PV header directly if it's really clear
the PV having no MDAs does not belong to any VG and at the same time
it's still marked as being in use (pvcreate -ff <dev_name> will fix this).

For example - /dev/sda here has 1 MDA, orphan and is incorrectly marked
with PV_EXT_USED flag:

$ pvs --binary -o+pv_in_use
  WARNING: Found inconsistent standalone Physical Volumes.
  WARNING: Repairing flag incorrectly marking Physical Volume /dev/sda as used.
  PV         VG     Fmt  Attr PSize   PFree   InUse
  /dev/sda          lvm2 ---  128.00m 128.00m     0

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