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

9785 Commits

Author SHA1 Message Date
Zdenek Kabelac
11ea72cfd8 mirror: extra parsing for mirrorlog arg
Put validation of mirrorlog arg into a separate function.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
29c14a1194 man: lvconvert/create updates
More description for cache support.
Introduce --pooldatasize option.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
fd00d2c6ec cache: separate func for pool/origin validation
Split validate_lv_cache_create() into 2 function
once is called for pool validation other for origin.

It's less misleading the accepting NULLs.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
298de1f5c3 segments: mark more of them unzeroable
Use segment flags to avoid zeroing of cache, cache pool
snapshot and thin pool segments.

We never want to zero these segment types.

Note:
Snapshot COW and Cache origin are created as stripes
thus are then properly zeroed.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
784c216d2b lvcreate: check for conflicting -Zy -Wy
Let the finaly state of zero & wipe_signature to be
resolved later together with all the types.

Don't play with zero assigment and segtype flag
(i.e. thin-pool -Z  has different meaning).

Check if the passed options do allow requested zeroing/wiping.

lvcreate without -Z or -W will fallback to warning if the device
cannot be zeroed, however if user requested them explicitely
it will give user error.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
c7484a139a toollib: persistent major minor
Deduce -M from presence of --minor, --major option if
not specified on command line.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
d13239b054 lvcreate: new validation code
Refactor lvcreate code.

Prefer to use arg_outside_list_is_set() so we get automatic 'white-list'
validation of supported options with different segment types.

Drop used lp->cache, lp->cache and use seg_is_cache(), seg_is_thin()

Draw clear border where is the last moment we could change create
segment type.

When segment type is given with --type - do not allow it to be changed
later.

Put together tests related to individual segment types.

Finish cache conversion at proper part of lv_manip code after
the vg_metadata are written - so we could correcly clean-up created
stripe LV for cache volume.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
51a29e6056 pools: error path removes metadata
When pool volume is create - it has already managed to update metadata
once within lv_extend - so revert new created LV here.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
dfcf03a9ce lvcreate: handle linear segment
Put in code to accept 'linear' segment type
(when specified stripes cannot be used)

Also report 'error' when unknown type is specified.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
7359a9df88 pool: better error path handling
Move test for size of new LV names in front before
any creation of LV.

Properly check striped  segtype kernel presence,
since passed 'segtype' is already tested.

Keep deactivation error path local to wiping part of the function.

Create metadata with temporary flag (it's activated, zeroed
and deactivated).
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
1632064281 cleanup: code move
Update comment and move code to new place.
Gets updated with next commit.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
b23e125982 cleanup: function embeded
It's used just in one place now.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
21798418fc cleanup: better stack tracing
Show proper backtrace on error path.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
a330640063 options: introduce pooldatasize option
Introduce new option to specify pool data size.
This will be user to create i.e.  cache & cachepool at once.
And possible for thin external origin snapshot.

This is only very basic patch to enable options, the
real working code will come later.
2014-10-24 16:39:32 +02:00
Zdenek Kabelac
9a6758e953 cleanup: use matching flags for permissions
Since our status bits are 64b - use uint64_t for permissions.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
37bd12e7ba cleanup: lv_manip drops duplicated internal error
No reason to check the same condition twice with internal error.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
958cae8fd8 cleanup: use arg_is_set 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
f2ea890423 cleanup: don't backup twice 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
a4788b4994 cleanup: move code for checking vg features
Move code that checks for needed VG features into separate
smaller function.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
b726003b85 cleanup: simplier lv name construction
Using NAME_LEN max lv name size.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
9e85dbbfd0 cleanup: sort args alphabetically
Give it some order for easier human lookup for options we do support.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
cf674142a2 cleanup: move code 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
4f8ed25a99 cleanup: indent
Various indents and tiny error message improvements.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
c6456bd639 cleanup: commands.h update descriptions 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
df933c2ac9 cleanup: commands.h shorted string
Replace  " "\n"  with simplier  \n"
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
f1cb267274 lv_manip: preserve read-only status in layered volume 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
be3f666ef3 lv_manip: improve should_wipe reporting
We want to print smarter warning message only when
the zeroing was not provided on the first zeroable segment
of newly created LV.

Put warning within _should_wipe_lv function to avoid reevaluation
of same conditions twice.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
2fc403b0fc toollib: new arg list functions
Check for negative arg list:
arg_from_list_is_negative()

Check for zero arg in list:
arg_from_list_is_zero()
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
fd1aa7fd5a segments: disable init of free segment
Since it is not needed and would require separate
code for validation disable its initialization.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
128131dbc5 lvconvert: external detects more conflicts
Check for more prohibited types for external origin conversion.
TODO: Move this function to separate validation code.
(Continuing in release fixes.)
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
8a2f553b7d lvcreate: move tests that requires activation
Tests that needs active kernel driver put in single place.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
f7cfea251c lvcreate: better logging for temporary device
Hide creation of temporary LVs and print them only in verbose mode.

e.g. hides confusing message about creation of _pmspare
device during creation of pool.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
2c057f33f3 segtypes: macro segtype_is_unknown 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
237c54802c tools: read yes_no_arg via int_value
yes_no_arg is already parsed so read parsed value as int.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
5bdf48b489 tools: refactor reporter code
Use new libdm macro DM_LIST_HEAD_INIT().
Embeded 'free' segment type (so it's not needed in the list)
Drop assignments of 0,NULL since they are defaults.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
482e572e5d libdm: add DM_LIST_HEAD_INIT macro
Support to initialize dm_list struct members.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
a98ea95c4d pool: better error message 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
a2244c3776 pool: fix testmode support with pools
Allow the --test mode to proceed further.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
1c7aae40a1 raid: query lock holder
Ask for lock the proper LV.
Use the top-most LV to query for locally exclusive lock.

The rest of operations are then using 'lv_info()'

TODO:
  Check all devices are reloaded from proper level.
  In general any query on lv_is_active is supposed to be running
  ona lv_lock_holder() volume.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
e901a87a69 cache: better error message 2014-10-24 16:39:31 +02:00
Zdenek Kabelac
6e57dbfcaa cache: validate for locked
Add extra safety.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
d4dab0aa34 cleanup: drop default implementation
Now we reference segment name via  lvseg_name() and
we can drop default implementation and leave its
function pointer to be NULL.

Default give us 'return seg->segtype->name'.
2014-10-24 16:39:31 +02:00
Zdenek Kabelac
9411c19b31 segments: introduce lvseg_name
Instead of segtype->ops->name()  introduce lvseg_name().

This also allows us to leave name() function 'empty' for default
return of segtype->name.

TODO: add functions for rest of ops->
2014-10-24 16:39:30 +02:00
Zdenek Kabelac
ab94045693 file-locking: skip locking of VG_SYNC_NAMES
VG_SYNC_NAMES is internal name with different meaning,
there is no point to search it in cache.
2014-10-24 16:39:30 +02:00
Peter Rajnoha
9351dca863 report: fix selection on {vg,lv}_permissions fields to properly match selection criteria
There was a bug in value and their synonym definition for these two fields
causing selections on these fields to not work correctly - nothing matched
against vg/lv_permissions fields even if selection criteria should have
matched.

Scenario:
$ lvs -o name,lv_permissions vg
  LV    LPerms
  lvol0 read-only
  lvol1 writeable

Before this patch:

$ lvs -o name,lv_permissions vg -S 'permissions=read-only'
(blank)
$ lvs -o name,lv_permissions vg -S 'permissions=writeable
(blank)

With this patch applied:

$ lvs -o name,lv_permissions vg -S 'permissions=read-only'
  LV    LPerms
  lvol0 read-only
$ lvs -o name,lv_permissions vg -S 'permissions=writeable'
  LV    LPerms
  lvol1 writeable

Also synonyms match correctly now:
$ lvs -o name,lv_permissions vg -S 'permissions=rw'
  LV    LPerms
  lvol1 writeable
2014-10-23 15:03:04 +02:00
Peter Rajnoha
4b611bb816 report: lv_permissions: display read-only/read-only-override instead of blank when LV is not writeable
Before this patch:
$ lvs -o name,lv_attr,lv_permissions
  LV    Attr       LPerms
  root  -wi-ao---- writeable
  swap  -wi-ao---- writeable
  lvol0 -Ri-a-----
  lvol1 -ri-a-----
  lvol2 -wi-a----- writeable
  lvol3 -ri-------

With this patch applied:
$ lvs -o name,lv_attr,lv_permissions
  LV    Attr       LPerms
  root  -wi-ao---- writeable
  swap  -wi-ao---- writeable
  lvol0 -Ri-a----- read-only-override
  lvol1 -ri-a----- read-only
  lvol2 -wi-a----- writeable
  lvol3 -ri------- read-only

("read-only-override" is displayed if the "writeable" permission
is overriden based on "activation/read_only_volume_list" lvm.conf
setting)
2014-10-23 10:18:29 +02:00
Petr Rockai
2c8e7821c3 NIX: Fix 32b builds (2G of RAM is 1M too much for 32b QEMU). 2014-10-22 09:03:26 +02:00
Peter Rajnoha
4988d799a2 liblvm2cmd: recognize quotes properly when splitting cmd line string into argv array fields
Fix lvm_split that is called when cmd line string is separated into
argv fields to recognize quote chars ('\'" and '"') properly and
when these quotes are used, consider the text within quotes as one
argument, do not separate it based on space characters inside.

The lvm_split is used during processing lvm shell command line or
when calling lvm commands through cmdlib (e.g. dmeventd plugins).

For example, the lvm shell scenario:

Before this patch:
$lvm
lvm> lvs --config 'global{ suffix=0 }'
  Parse error at byte 9 (line 1): unexpected token
  Failed to set overridden configuration entries.

With this patch applied:
$lvm
lvm> lvs --config 'global{ suffix=0 }'
  LV    VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log  Cpy%Sync Convert
  root  fedora -wi-ao----   9.00g
  swap  fedora -wi-ao---- 512.00m

(Exactly the same problem is hit when calling LVM commands with
quoted arguments via lvm2cmd lib in dmeventd plugins.)
2014-10-17 14:03:43 +02:00
David Teigland
a6c294c5d0 toollib: remove unsed variable in process_each_segment_in_pv
Was left unused from the last change to this function.
2014-10-16 15:16:52 -05:00
David Teigland
23a38d242b toollib: remove dead code
Because of the recent change to process_each_pv(), the vg is always
provided when the pv is in a vg.  is_pv(pv) means the pv is in a vg,
which means that the vg arg will not be NULL, which means the removed
block of code is not needed.
2014-10-15 15:47:45 -05:00