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

2350 Commits

Author SHA1 Message Date
Zdenek Kabelac
969ab6bbf0 cache: convert thin-pool
Support caching of thin-pool.

lvresize needs to be resolved - so far, user
has to manually drop cache-pool before resizing.
2014-11-03 14:19:33 +01:00
Zdenek Kabelac
127cf4895a thin: allow to convert chunksize of empty pool
When pool is not used, allow to change its chunksize.
2014-11-03 14:19:33 +01:00
Zdenek Kabelac
897b091579 pool: validate sizes
0 size are not supported as well as negative.
2014-11-03 14:19:32 +01:00
Zdenek Kabelac
c1ee6d4ffc lvcreate: tollerate defaults
lvcreate -m0 and -Mn goes with anything.
Read ahead works either with pools or thin/cache, but not with both.
2014-11-03 14:19:32 +01:00
Zdenek Kabelac
464f3b8abd lvmcmdline: support size_mb_arg_with_percent
New size_mb_arg_with_percent is able to read  size_mb_arg
but also it's able to read % values.

Percent parsing is share with int_arg_with_sign_and_percent.
2014-10-30 23:58:49 +01:00
Zdenek Kabelac
519fbe71e4 lvmcmdline: extra support for decimal point
If root has locales with different decimal point then '.'
(i.e. Czech with ',') lets be tolerant and retry with
"C" locales in the case '.' is found during parse of number.

Locales are then restored back.
2014-10-30 23:58:49 +01:00
Zdenek Kabelac
97cccfbf1c segtype: drop cmdcontex pointer
Users of context provide their cmd pointer,
so don't keep it inside segtype.
2014-10-30 23:58:49 +01:00
Zdenek Kabelac
87fc3b710c lvcreate: improving recent lvcreate updates
We need to be able to parse:

lvcreate --type snapshot -s
lvcreate --type thin -s
lvcreate --type cache-pool -H
2014-10-30 23:58:48 +01:00
Zdenek Kabelac
e0164f2188 sparse: configurable type for sparse volumes
Support compile type configurable defaults for creation
of sparse volumes.

By default now create 'thin-pools' for sparse volumes.
Use the global/sparse_segtype_default to switch back to old
snapshots if needed.

Apply the same compile logic for newly introduces mirror/raid1 options.
2014-10-30 23:58:48 +01:00
Zdenek Kabelac
c9fbbf48ba cache: support more args
Unlike with thin-pool - with cache we support all args also
directly when create cache volume.

So the result of 'separate' cache-pool creation and setting its
options should give same result as specifying those args
during cache creation.

Cache-pool values are used as defaults if the params are
not specified with cache creation.
2014-10-26 18:37:13 +01:00
Zdenek Kabelac
ff2e8b0de6 thin: simplify thin volume creation
Move code for creation of thin volume into a single place
out of lv_extend().  This allows to drop extra pool arg
for alloc_lv_segment() && lv_extend() and makes code
more easier to read and follow.
2014-10-26 18:37:13 +01:00
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
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
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
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
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
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
958cae8fd8 cleanup: use arg_is_set 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
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
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
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
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
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
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
Alasdair G Kergon
5e6e2d6b1b vgcreate: Permit non-power-of-2 extent sizes.
Relax validation to permit extent sizes > 128KB that are not powers of 2
with lvm2 format.  Existing code was already capable of handling this.
2014-10-14 18:12:15 +01:00
Petr Rockai
22a6b0e40b lvchange: Allow appropriate actions on cache (in addition to thin) pools. 2014-10-13 16:21:41 +02:00
Zdenek Kabelac
b59335fb39 toollib: validate_restricted_lvname_param
Lets make a separate new function to validate names that has
to follow up restriction rules.
2014-10-08 11:35:50 +02:00
Alasdair G Kergon
f3bb1c018f vgremove: Use process_each_lv_in_vg. 2014-10-07 16:45:45 +01:00
Zdenek Kabelac
0cbb381e15 lvcreate: regression fix on lv name limits
When we are given an existing LV name - it needs to be allowed
to pass in even restricted name as the LV could have existed
long before we introduced some new restriction on prefix/suffix.i

Fix the regression on name limits and drop restriction to be applied
on any existing LVs - only the new created LV names have to be
complient with current name restrictions.

FIXME: we are currently using restricted names incorrectly in few
other places - device_is_usable() skips restricted names,
and udev flags are also incorrectly set for restricted names
so these LVs are not getting links properly.
2014-10-07 15:52:31 +02:00
Zdenek Kabelac
27ff61d012 cleanup: rename _name, _lv and _size
Use some standard names for lv char * names, logical_volume * lv
and sizes internally.
2014-10-07 15:51:53 +02:00
Petr Rockai
b66f16fd63 lvconvert: Allow --repair and --splitmirrors on reserved-name LVs. 2014-10-07 08:58:24 +02:00
David Teigland
8dc5f42254 metadata: Use flags to control warnings.
The warnings arg was used to enable logging of warnings
when reading a PV.  This arg is turned into a set of flags
with the WARN_PV_READ flag matching the existing behavior.

A new flag WARN_INCONSISTENT is added that will cause
vg_read_internal() to log the "VG is not consistent"
warning so the various callers do not need to log
this warning themselves.

A new vg_read flag READ_WARN_INCONSISTENT is used from
reporting to enable the WARN_INCONSISTENT flag in
vg_read_internal.

[Committed by agk with cosmetic changes and tweaks.]
2014-10-07 01:15:43 +01:00
David Teigland
e458fc9a6a vgreduce: Use process_each_pv.
Adapt process_each_pv for use by vgreduce in the non-repair case.

[Committed by agk with cosmetic changes and tweaks.]
2014-10-07 01:15:43 +01:00
David Teigland
f1a000a477 toollib: Rewrite process_each_pv.
Process PVs by iterating through VGs, then iterating through
devices if the command needs to process non-PV devices.
The process_single function can always use the VG and PV args.

[Committed by agk with cosmetic changes and tweaks.]
2014-10-07 01:15:43 +01:00
Alasdair G Kergon
97b16ec26f toollib: Shuffle PV functions. 2014-10-06 22:02:00 +01:00
Alasdair G Kergon
1115a9ea51 toollib: Remove unused functions from header file. 2014-10-06 15:22:01 +01:00
Zdenek Kabelac
b7a78d81bc cleanup: indent 2014-10-06 15:23:08 +02:00
Zdenek Kabelac
73c74d582c cleanup: lvconvert use standard function exit
Use 1|0 inside _lvconvert_splitsnapshot to match rest of code.
2014-10-06 15:23:07 +02:00