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

264 Commits

Author SHA1 Message Date
Peter Rajnoha
6d8de3638c cleanup: use struct pvcreate_restorable_params throughout 2013-02-26 11:25:11 +01:00
Peter Rajnoha
6692b17777 cleanup: add struct pvcreate_restorable_params and move relevant items from pvcreate_params
Extract restorable PV creation parameters from struct pvcreate_params into
a separate struct pvcreate_restorable_params for clarity and also for better
maintainability when adding any new items later.
2013-02-26 11:24:38 +01:00
Zdenek Kabelac
7cd25062ac cleanup: avoid overflow warning
Even we do not expect to support chunks bigger then 2GB.
2013-02-05 14:27:25 +01:00
Zdenek Kabelac
8b8065a870 cleanup: drop unused header
This header does not resolve any symbols here.
2012-12-15 14:57:40 +01:00
Zdenek Kabelac
03be45ac0a cleanup: convert to 32bit
Chunk sizes fits into 4G range, so keep it in 32bit range.
2012-12-15 14:57:39 +01:00
Petr Rockai
b19f840af8 toollib: Avoid a global lock in process_each_pv if lvmetad is used.
The motivation to grab the global lock is to avoid a scan and metadata parsing
for each PV, but the cost of obtaining metadata is _mostly_ mitigated by having
lvmetad around. Not taking the global lock improves throughput when multiple pvs
or related commands are running in parallel, like in RHEV.
2012-12-12 14:44:03 +01:00
Zdenek Kabelac
ed65860861 thin: remove detection for thin discard support
Remove no longer needed warning for unsuppoted discards
for non-power-2 lvcreate commands.

(Missed from the patch for the same update in lvchange made
by commit dde5a6c52b)
2012-12-11 11:24:45 +01:00
Zdenek Kabelac
1ef9831018 thin: support configurable thin pool defaults
Configurable settings for thin pool create
if they are not specified on command line.

New supported lvm.conf options are:
  allocation/thin_pool_chunk_size
  allocation/thin_pool_discards
  allocation/thin_pool_zero
2012-11-26 12:16:47 +01:00
Zdenek Kabelac
b786096863 thin: add alloc_pool_metadata
Since our api call is not yet powerfull enough,
use this wrapper to preset options.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
f4137640f6 thin: add common pool functions
Move common functions for lvcreate and lvconvert.

get_pool_params() - read thin pool args.
update_pool_params() - updates/validates some thin args.

It is getting complicated and even few more things will be
implemented, so to avoid reimplementing things differently
in lvcreate and lvconvert  code has been splitted
into 2 common functions that allow some future extension.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
f260f99d57 cleanup: switch log_error to log_warn
Use log_warn to print non-fatal warning messages.

Use of log_error would confuse checker for testing
whether proper error has been reported for some real error.
2012-10-17 15:41:35 +02:00
Zdenek Kabelac
b89963a7c3 cleanup: swap return values
Use lvm standard return code for success/fail  1/0.
2012-10-17 15:37:26 +02:00
Zdenek Kabelac
9bb210192d cleanup: readable test to check for 32bit overflow
also swap return value 0 - fail, 1 - success.
2012-10-14 23:19:27 +02:00
Alasdair G Kergon
438e0050df config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.

When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]

Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 20:35:48 +01:00
Zdenek Kabelac
286cd2006b cleanup: drop unneeded included header files
This headers were not resolving anything used for compiled .c files.
Remove unused util.c file.
2012-08-23 14:37:20 +02:00
Alasdair G Kergon
1d0a2b919f toollib: fix ignored_mdas process_each_pv rescan
In process_each_pv() if we haven't yet scanned and the PV appears
to be an orphan, we must scan the other PVs looking for mdas that
reference it to find out what VG it is in.

1. If the PV has no mdas, we must scan.
2. If the PV has an mda that is not ignored we do not need to scan.
3. If the PV has an mda that is ignored, we do need to scan.

This patch fixes case 3.

> pvs -o +mda_count,vg_mda_count /dev/loop[0123]
  PV         VG   Fmt  Attr PSize  PFree  #PMda #VMda
  /dev/loop0 vg3  lvm2 a-   96.00m 96.00m     0     1
  /dev/loop1 vg3  lvm2 a-   96.00m 96.00m     1     1
  /dev/loop2 vg2  lvm2 a-   96.00m 96.00m     1     2
  /dev/loop3 vg2  lvm2 a-   28.00m 28.00m     1     2

Before:
> pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered
  PV         VG   Fmt  Attr PSize   PFree
  /dev/loop2      lvm2 a--  100.00m 100.00m
  /dev/loop3 vg2  lvm2 a--   28.00m  28.00m
  /dev/loop0      lvm2 a--  100.00m 100.00m
  /dev/loop1 vg3  lvm2 a--   96.00m  96.00m

After:
> pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered
  PV         VG   Fmt  Attr PSize  PFree
  /dev/loop2 vg2  lvm2 a--  96.00m 96.00m
  /dev/loop3 vg2  lvm2 a--  28.00m 28.00m
  /dev/loop0 vg3  lvm2 a--  96.00m 96.00m
  /dev/loop1 vg3  lvm2 a--  96.00m 96.00m
2012-06-29 21:22:09 +01:00
Peter Rajnoha
2729720fd3 args: add --activate synonym for --available arg
We're refererring to 'activation' all over the code and we're talking
about 'LVs being activated' all the time so let's use 'activation/activate'
everywhere for clarity and consistency (still providing the old
'available' keyword as a synonym for backward compatibility with
existing environments).
2012-06-28 09:42:44 -04:00
Zdenek Kabelac
6f3cd63551 cleanup: replace memset with struct initilization
Simplifies the code, properly detects too long socket paths,
drops unused parameter.
2012-06-22 13:23:03 +02:00
Zdenek Kabelac
98c92abf4e Add FIXMEs
Processing loop needs some thinking
2012-03-04 15:58:31 +00:00
Zdenek Kabelac
f3c177312f Correct enum type
Using debug_t and some forgetten alloc_policy_t, force_t from past commit.
2012-03-01 21:14:43 +00:00
Alasdair Kergon
dc9ef7a028 Check return values after calling new lvmetad fns
(Haven't checked error path handling though)
2012-02-28 18:08:08 +00:00
Zdenek Kabelac
fbf6b89a84 Using enum types for enums
alloc_policy_t, dm_string_mangling_t, percent_range_t, sign_t
2012-02-28 14:24:57 +00:00
Petr Rockai
dae0822698 The lvmetad client-side integration. Only active when use_lvmetad = 1 is set in
lvm.conf *and* lvmetad is running.
2012-02-23 13:11:07 +00:00
Zdenek Kabelac
d81498a824 Initialize dmeventd monitoring for every command
Read lvm.conf setting for monitoring for each command. So we should not
activate monitoring if the default compilation is set to monitor during
lvconvert commnads.

Patch also removes check for  clustered VG and allows to disable monitoring
for clustered VG with the assumption, the problem with monitoring and dmeventd
flag passing for INGNORE is already fixed.
2012-02-15 15:18:43 +00:00
Petr Rockai
8e5f7cf3dc Move lvmcache data structures behind an API (making the structures private to
lvmcache.c). No functional change.
2012-02-10 01:28:27 +00:00
Zdenek Kabelac
462835faa0 Switch to return void
List delete cannot fail, so there is no reason to test for error.
2012-02-08 12:52:58 +00:00
Zdenek Kabelac
1ef10bd81a Limit alignment to 32bit values
to get the same behavior on 32/64 machines.
2012-01-25 21:52:53 +00:00
Zdenek Kabelac
4fbde0143a Support rounding of percentage upward
We want to keep this logic -
when LV is extend - extend the LV by at least given amount,
when LV is reduced - reduce the LV by at most given amount.

So for this the rounding needs to be used.
Current logic which seems to satisfy give rule is to round up all
extent values for LV resize upward except for values with '-' sign
that are round downward.

This patch also fixes the problem when  lvextend --use-polices tried
to extend LV the by i.e. 20% - but the resulting 20% were smaller
the extent size thus before this patch no extension happened.
2012-01-05 15:38:18 +00:00
Zdenek Kabelac
e858ac1546 Skip non-virtual snapshots for availability
Change the behavior of availability change.
With this patch the lvgchange returns success
when VG is properly changed.

It skips non-virtual origins from being changes when
only 'vg' is specified as lvchange -a parameter.

Before this change we had this:

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

$> lvchange -an mvg ; echo $?
  Can't change snapshot logical volume "lvol2".
  Can't change snapshot logical volume "lvol3".
5

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi---s- 128.00k
  lvol1 mvg  owi---s- 128.00k
  lvol2 mvg  swi---s-   1.25m      lvol0
  lvol3 mvg  swi---s-   1.25m      lvol1

$> lvchange -ay mvg ; echo $?
  Can't change snapshot logical volume "lvol2".
  Can't change snapshot logical volume "lvol3".
5

$> lvs
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

After commit:

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1

$> lvchange -an mvg ; echo $?
0

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi---s- 128.00k
  lvol1 mvg  owi---s- 128.00k
  lvol2 mvg  swi---s-   1.25m      lvol0
  lvol3 mvg  swi---s-   1.25m      lvol1

$> lvchange -ay mvg ; echo $?
0

$> lvs -a
  LV    VG   Attr     LSize   Pool Origin
  lvol0 mvg  owi-a-s- 128.00k
  lvol1 mvg  owi-a-s- 128.00k
  lvol2 mvg  swi-a-s-   1.25m      lvol0
  lvol3 mvg  swi-a-s-   1.25m      lvol1
2011-11-18 19:19:22 +00:00
Zdenek Kabelac
6744c143a5 Thin remove unused define
Remove DM_THIN_ERROR_DEVICE_ID from API.
Remove API warning.
Drop code that was using DM_THIN_ERROR_DEVICE_ID (already commented)
Remove debug message which slipped in through some previous commit.
2011-11-12 22:44:10 +00:00
Zdenek Kabelac
6e89eb9a52 Small comment and indent updates 2011-11-10 12:43:05 +00:00
Zdenek Kabelac
267a575768 Thin removing limitation on activation of pool device.
Since activation of pool is now independent on thin activation,
user may do whatever he needs - thought preferable thin should stay alive,
but it it will be found inactivate, update_pool will bring the pool up.
2011-11-03 14:59:20 +00:00
Zdenek Kabelac
a1d5aaf725 Thin pool activation change
To ensure we properly handle LV cluster locking - explicitely do
not allow to change the availability of the thin pool that is in use
for some thin LV.

As soon as the thin volume is created the only way to activate pool
is via implicit dependency.

Ignore thinpool open count for lv/vgchange operations.
2011-10-28 20:28:00 +00:00
Milan Broz
b18e1fd50e Fix possible overflow of size if %FREE or %VG is used.
https://bugzilla.redhat.com/show_bug.cgi?id=737087
2011-09-15 15:26:40 +00:00
Zdenek Kabelac
4144938350 Support break for vgchange and vgrefresh operation
Allow to break some lengthy vgchange and vgrefresh operation.
2011-09-07 08:41:47 +00:00
Petr Rockai
e59e2f7c3c Move the core of the lib/config/config.c functionality into libdevmapper,
leaving behind the LVM-specific parts of the code (convenience wrappers that
handle `struct device` and `struct cmd_context`, basically). A number of
functions have been renamed (in addition to getting a dm_ prefix) -- namely,
all of the config interface now has a dm_config_ prefix.
2011-08-30 14:55:15 +00:00
Zdenek Kabelac
077a6755ff Replace free_vg with release_vg
Move the free_vg() to  vg.c  and replace free_vg  with release_vg
and make the _free_vg internal.

Patch is needed for sharing VG in vginfo cache so the release_vg function name
is a better fit here.
2011-08-10 20:25:29 +00:00
Alasdair Kergon
3cac20f850 Defer writing PV labels to vg_write.
Store label_sector only in struct physical_volume.
2011-06-01 19:29:31 +00:00
Zdenek Kabelac
5ec549ca5a Do not log a superfluous stack message when the lv is properly processed 2011-05-19 13:59:22 +00:00
Peter Rajnoha
84f48499a3 Add new free_pv_fid fn and use it throughout to free all attached fids.
Since format instances will use own memory pool, it's necessary to properly
deallocate it. For now, only fid is deallocated. The PV structure itself
still uses cmd mempool mostly, but anytime we'd like to add a mempool
in the struct physical_volume, we can just rename this fn to free_pv and
add the code (like we have free_vg fn for VGs).
2011-03-11 14:56:56 +00:00
Milan Broz
be3510b204 PE size overflows, on most architectures it is catch by "PE cannot be 0"
but s390x unfortunately return something usable.

Always use unit64 in inital parameter check.
2011-03-02 20:00:09 +00:00
Milan Broz
301c2b8822 Use 64bit unsigned value for maximum stripe size test.
While STRIPE_SIZE_LIMIT * 2 is basically UINT_MAX, 32bit integer
value can already overflow durin arg size parsing.

(This really happens in test where --stripesize 4294967291 is used,
in s390x uint overflow and this test is ineffective.)
2011-03-02 16:56:06 +00:00
Peter Rajnoha
305816232d Remove useless mdas parameter for pv_read (from now on, we store mdas in a
format instance)
2011-02-21 12:15:59 +00:00
Zdenek Kabelac
0a62e0145a Add some backtraces for error paths in process_each_lv 2011-02-18 15:02:25 +00:00
Zdenek Kabelac
aec2115410 Const fixing
Fixing some const warnings - with API change in:

int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,

Change is needed - as lvm2api expects const behaviour here.
So vg_extend() is doing local strdup for unescaping.

skip_dev_dir return const char* from const char* vg_name.

Rest of the patch is cleanup of related warnings.

Also using dm_report_filed_string() API change to simplify
casting in _string_disp and _lvname_disp.
2011-02-18 14:47:28 +00:00
Alasdair Kergon
b51cd542be Add change_tag to toollib.
Allow multiple pvchange command line options to be specified together.
2011-01-24 13:38:31 +00:00
Zdenek Kabelac
bb86f0a22a Remove unused variable dev_dir_provided 2010-12-20 14:05:31 +00:00
Alasdair Kergon
2b82bd79f5 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Zdenek Kabelac
5bd1cb414b Test lv_name is not NULL
Patch adds extra check for lv_name not being NULL.
Test avoids unneeded strlen call for this case.
Otherwise there is no functional change as test would fail on
size_t comparation even for NULL lv_name (thus there is no risk
of NULL dereference when taking 'true' if branch.
2010-12-01 12:22:49 +00:00
Zdenek Kabelac
1d2f212a3d Optimize second call to strchr with same parameters
Small optimalization - reusing already known strchr result.
2010-12-01 10:36:25 +00:00