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

1373 Commits

Author SHA1 Message Date
Zdenek Kabelac
f6ded62291 snapshot: fix merging
When the merging of snapshot is finished, we need to clean dm table
intries for snapshot and -cow device. So for merging snapshot
we have to activate_lv plain 'cow' LV and let the table
resolver to its work - shortly deactivation_lv() request
will follow - in cluster this needs LV lock to be held by clvmd.

Also update a test - add small wait - if lvremove is not 'fast enough'
and merging process has not been stopped and $lv1 removed in background.
Ortherwise the following lvcreate occasionally finds name $lv1 still in use.

(in release fix)
2013-07-22 16:26:00 +02:00
Zdenek Kabelac
ea68f08501 cleanup: remove unused headers 2013-07-22 12:41:21 +02:00
Petr Rockai
6d2604f026 metadata: Fix tracking of read_status flags in _vg_make_handle. 2013-07-22 12:04:47 +02:00
Petr Rockai
3ed7f78ff4 metadata: Do not ignore errors in _vg_update_vg_ondisk. 2013-07-22 12:00:48 +02:00
Petr Rockai
f897fcbd95 metadata: Do not try to maintain an ondisk copy of orphan VGs. 2013-07-22 11:51:35 +02:00
Zdenek Kabelac
3075784955 thin: add spare lvcreate support
Add --poolmetadataspare option and creates and handles
pool metadata spare lv when thin pool is created.
With default setting 'y' it tries to ensure, spare has
at least the size of created LV.
2013-07-18 18:22:44 +02:00
Zdenek Kabelac
a916bf7eeb thin: removal of spare disables recovery
Warn user when removing spare LV.
Remove spare automatically, when last pool from VG is removed.
2013-07-18 18:22:44 +02:00
Zdenek Kabelac
915cc5a2fa thin: report 'e' volume type pool metadata spare
Reuse m'e'tadata volume type for spar'e' volume as well.
Essentially they are related and there is no big reason
to introduce new flag.
2013-07-18 18:22:44 +02:00
Zdenek Kabelac
460d0254eb thin: add pool metadata spare lv support
Add support for pool's metadata spare volume.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
08df7ba844 thin: improve pool creation activation order
Pool creation involves clearing of metadata device
which triggers udev watch rule we cannot udev synchronize with
in current code.

This metadata devices needs to be activated localy,
so in cluster mode deactivation and reactivation
is always needed.

However for non-clustered mode we may reload table
via suspend/resume path which avoids collision with
udev watch rule which was occasionaly triggering
retry deactivation loop.

Code has been also split into 2 separate code paths
for thin pools and thin volumes which improved readability
of the code as well.

Deactivation has been moved out of extend_pool() and
decision is now in _lv_create_an_lv() which knows
the change mode.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
d72f34af41 thin: fix error paths for metadata creation
Since we vg_write&commit metadata LV inside  lv_extend() call,
proper restore is needed in case something fails.

So add bad: section which deactivates activated LV
and removes it from VG.

Also check early for metadata LV name lengh fail.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
7afa9cebcb thin: fix error path in creation path
Remove some calls to revert_new_lv when no LV has been created/commited so far.
When the pool update failed - then only revert is needed.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
1d3f7953bd lv_manip: move some validation code before archiving
Make as much test we can, before actualy modifying metadata.
Avoids also unnecessary archiving.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
7b4b97b731 snapshot: local activation for clear COW device
To clear snapshot cow device in cluster enforce local
activation here.
2013-07-18 18:22:43 +02:00
Zdenek Kabelac
b5dfe4bec2 metadata: add is_change_activating
Add simple inline function to check, whether the change is activating.
(better then macro since we get type checking).
2013-07-18 18:22:42 +02:00
Zdenek Kabelac
e8fc77bd6d cleanup: move detection of change mode before commit point
Following patch will need to know change state before commit point.
Also the test mode should properly report all ongoing operation.
2013-07-18 18:22:42 +02:00
Zdenek Kabelac
20187fc190 cleanup: use dm_list_empty
Check for empty list directly.
2013-07-18 18:22:42 +02:00
Zdenek Kabelac
8bd67f9e5a cleanup: exit earlier in lv_rename_update
List doesn't need to be created when the metadata are not updated.
2013-07-18 18:16:29 +02:00
Peter Rajnoha
73e7f6c45f profile: move profile assignment to common lv_create_empty fn 2013-07-17 11:31:54 +02:00
Zdenek Kabelac
925701d9f3 thin: write back when command successfully finished
Remove backup() call from update_pool_lv() as it's been there
duplicated and preperly order backup() call after lvresize,
so there is just one such call.
2013-07-15 15:48:32 +02:00
Zdenek Kabelac
42881c8877 thin: send messages to active pool
If the thin pool is known to be active, messages can be passed
to the pool even when the created thin volume is not going to be
activated.

So we do not need to stack large list of message and validate
and catch creation errors earlier in this case.

Replace the test for valid activation combination with simpler list of
deactivation combinations.
2013-07-15 15:47:25 +02:00
Zdenek Kabelac
9ba7783350 cleanup: update comments
Add and indent.
2013-07-15 15:40:46 +02:00
Peter Rajnoha
8d1e511363 conf: add activation/auto_set_activation_skip
The activation/auto_set_activation_skip enables/disables automatic
adding of the ACTIVATION_SKIP LV flag. By default thin snapshots
are flagged to be skipped during activation.

And by default, the auto_set_activation_skip is enabled.
2013-07-12 20:54:17 +02:00
Peter Rajnoha
283c93a858 lvs: add 's(k)ip activatoin' lv_attr field
A new 10-th bit in lvs lv_attr field to indicate whether an LV
has the ACTIVATION_SKIP flag attached (stored in metadata).
2013-07-12 20:54:17 +02:00
Peter Rajnoha
7dc8c84b18 activation: add support for skipping activation of selected LVs
Also add -k/--setactivationskip y/n and -K/--ignoreactivationskip
options to lvcreate.

The --setactivationskip y sets the flag in metadata for an LV to
skip the LV during activation. Also, the newly created LV is not
activated.

Thin snapsots have this flag set automatically if not specified
directly by the --setactivationskip y/n option.

The --ignoreactivationskip overrides the activation skip flag set
in metadata for an LV (just for the run of the command - the flag
is not changed in metadata!)

A few examples for the lvcreate with the new options:

  (non-thin snap LV => skip flag not set in MDA + LV activated)
  raw/~ $ lvcreate -l1 vg
    Logical volume "lvol0" created
  raw/~ $ lvs -o lv_name,attr vg/lvol0
    LV    Attr
    lvol0 -wi-a----

  (non-thin snap LV + -ky => skip flag set in MDA + LV not activated)
  raw/~ $ lvcreate -l1 -ky vg
    Logical volume "lvol1" created
  raw/~ $ lvs -o lv_name,attr vg/lvol1
    LV    Attr
    lvol1 -wi------

  (non-thin snap LV + -ky + -K => skip flag set in MDA + LV activated)
  raw/~ $ lvcreate -l1 -ky -K vg
    Logical volume "lvol2" created
  raw/~ $ lvs -o lv_name,attr vg/lvol2
    LV    Attr
    lvol2 -wi-a----

  (thin snap LV => skip flag set in MDA (default behaviour) + LV not activated)
  raw/~ $ lvcreate -L100M -T vg/pool -V 1T -n thin_lv
    Logical volume "thin_lv" created
  raw/~ $ lvcreate -s vg/thin_lv -n thin_snap
    Logical volume "thin_snap" created
  raw/~ $ lvs -o name,attr vg
    LV        Attr
    pool      twi-a-tz-
    thin_lv   Vwi-a-tz-
    thin_snap Vwi---tz-

  (thin snap LV + -K => skip flag set in MDA (default behaviour) + LV activated)
  raw/~ $ lvcreate -s vg/thin_lv -n thin_snap -K
    Logical volume "thin_snap" created
  raw/~ $ lvs -o name,attr vg/thin_lv
    LV      Attr
    thin_lv Vwi-a-tz-

  (thins snap LV + -kn => no skip flag in MDA (default behaviour overridden) + LV activated)
  [0] raw/~ # lvcreate -s vg/thin_lv -n thin_snap -kn
    Logical volume "thin_snap" created
  [0] raw/~ # lvs -o name,attr vg/thin_snap
    LV        Attr
    thin_snap Vwi-a-tz-
2013-07-12 20:39:07 +02:00
Alasdair G Kergon
aaa9a68b2f metadata: cleanup comments and formatting 2013-07-09 12:34:48 +01:00
Alasdair G Kergon
f56a1819e9 tools: remove metadata-exported.h
metadata-exported.h is included by tools.h
2013-07-09 03:07:55 +01:00
Alasdair G Kergon
9d5bdc91ca tools: remove metadata.h 2013-07-09 02:51:24 +01:00
Alasdair G Kergon
8adddbf101 pvcreate: remove metadata.h header
Files in tools/ should only use metadata-exported.h not metadata.h.
Rename pvcreate_locked to pvcreate_single.
2013-07-09 02:37:56 +01:00
Alasdair G Kergon
7c6526aae2 lvresize: separate validation from action
Start separating the validation from the action in the basic lvresize
code moved to the library.
Remove incorrect use of command line error codes from lvresize library
functions.  Move errors.h to tools directory to reinforce this,
exporting public versions of the error codes in lvm2cmd.h for dmeventd
plugins to use.
2013-07-06 03:28:21 +01:00
Zdenek Kabelac
a64239f225 cleanup: use plain unsigned types 2013-07-05 17:20:57 +02:00
Zdenek Kabelac
7319bc0420 cleanup: move declaration to front 2013-07-05 17:20:57 +02:00
Zdenek Kabelac
f88f5a1ca3 thin: move alloc_pool_metadata
Move function from /tool to /lib to thin_manip.c
Since lvm2api will need to move many things into /lib anyway.
2013-07-04 13:33:41 +02:00
Zdenek Kabelac
6f335ffa35 sigint: improve logic on for sigint reaction
Fix and improve handling on sigint.

Always check for signal presence *before* calling of command,
so it will not call the command when break was hit.

If the command has been finished succesfully there is
no problem to mark the command ok and not report interrupt at all.

Fix cuple related stack; reports and assignments.
2013-07-03 14:46:42 +02:00
Mike Snitzer
f9e0adcce5 snapshot: Rename snapshot segment returning methods from find_*_cow to find_*_snapshot
find_cow -> find_snapshot, find_merging_cow -> find_merging_snapshot.
Will thin snapshot code to reuse these methods without confusion.
2013-07-02 16:26:03 -04:00
Tony Asleson
50db109e20 liblvm: Moved additional pv resize code
The pv resize code required that a lvm_vg_write be done
to commit the change.  When the method to add the ability
to list all PVs, including ones that are not assocated with
a VG we had no way for the user to make the change persistent.
Thus additional resize code was move and now liblvm calls into
a resize function that does indeed write the changes out, thus
not requiring the user to explicitly write out he changes.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
6d6ccded35 lib2app: Added PV create. V2
V2: Correct call to lock_vol

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
8ddb1b4abf _get_pvs: Remove unused variable
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
e33ac7b1ed lvm2app: Implement lvm_pv_remove V2
Code move and changes to support calling code from
command line and from library interface.

V2 Change lock_vol call

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
ef3ab801e8 lvm2app: Add function to retrieve list of PVs V3
As locks are held, you need to call the included function
to release the memory and locks when done transversing the
list of physical volumes.

V2: Rebase fix
V3: Prevent VGs from getting cached and then write protected.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:33 -05:00
Tony Asleson
49d7596581 lvm2app: Implement lv resize (v3)
Simplified version of lv resize.

v3: Rebase changes to make work.  Needed to set sizeargs = 1
to indicate to resize that we are asking for a size based
resize.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:33 -05:00
Tony Asleson
c43ce46ba7 lvm2app: Move core lv re-size code (v6)
Moved to allow use from command line and for library use.

v3,v4,v5,v6: rebase changes

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:33 -05:00
Peter Rajnoha
9f6cfc9de4 report: add vg_profile and lv_profile to report the profile attached to VG/LV
vgs -o vg_profile ...
lvs -o lv_profile ...
2013-07-02 15:22:12 +02:00
Peter Rajnoha
24a84549a8 thin: make selected thinp settings profilable
These settins are customizable by profiles:

	allocation/thin_pool_zero
	allocation/thin_pool_discards
	allocation/thin_pool_chunk_size
	activation/thin_pool_autoextend_threshold
	activation/thin_pool_autoextend_percent
2013-07-02 15:22:11 +02:00
Peter Rajnoha
6f0427cc56 lv: add lv_config_profile fn
Returns LV's profile if it exists, VG's profile otherwise
(LV inherits VG's profile).
2013-07-02 15:22:11 +02:00
Peter Rajnoha
e21e38cf74 metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
If "vgcreate/lvcreate --profile <profile_name>" is used, the profile
name is automatically stored in metadata for making it possible to
load it automatically next time the VG/LV is used.
2013-07-02 15:19:09 +02:00
Peter Rajnoha
d6a91da4be config: add profile arg to find_config_tree_bool 2013-07-02 15:19:09 +02:00
Peter Rajnoha
50bf2c0db1 config: add profile arg to find_config_tree_int 2013-07-02 15:19:09 +02:00
Peter Rajnoha
eeb7b0f7fa config: add profile arg to find_config_tree_node 2013-07-02 15:19:09 +02:00
Peter Rajnoha
c5e6bc393e metadata: read VG/LV profile name from metadata if it exists and load it
This is per VG/LV profile loading on demand. The profile itself is saved
in struct volume_group/logical_volume as "profile" field so we can
reference it whenever needed.
2013-07-02 15:19:09 +02:00