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

53 Commits

Author SHA1 Message Date
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
1280a3c7ed tools: remove metadata.h from pvresize/vgck 2013-07-09 02:41:56 +01: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
Zdenek Kabelac
b90450b8a0 cleanup: introduce return_ECMD_FAILED macro
Use shortening macro for common code sequence
stack;
return ECMD_FAILED;
2013-07-01 23:10:33 +02:00
Petr Rockai
f65dd341a5 locking: Make it possible to pass down an LV to activation code.
Previously, we have relied on UUIDs alone, and on lvmcache to make getting a
"new copy" of VG metadata fast. If the code which triggers the activation has
the correct VG metadata at hand (the version which is currently on disk), it can
now hand it to the activation code directly.
2013-06-10 17:26:38 +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
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
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
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
Peter Rajnoha
da721ac1ef Add a hint for manual revert if there's an error in pv_write, vg_write, vg_commit for pvresize. 2011-02-28 17:08:09 +00:00
Peter Rajnoha
3b97e8d643 Allow non-orphan PVs with two metadata areas to be resized.
We allow writing non-orphan PVs only for resize now. The "orphan PV" assert
in pv_write fn uses the "allow_non_orphan" parameter to control this assert.
However, we should find a more elaborate solution so we can remove this
restriction altogether (pv_write together with vg_write is not atomic, we
need to find a safe mechanism so there's an easy revert possible in case of
an error).
2011-02-28 13:19:02 +00:00
Peter Rajnoha
cb2396730a Change pvresize code to work with new metadata handling interface and allow
resizing a PV with two metadata areas.
2011-02-21 12:27:26 +00:00
Peter Rajnoha
17ad2b1115 Change pv_write code to work with the changes in metadata handling interface
and changes in format_instance.
2011-02-21 12:26:27 +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
794e94fe16 Replace PV_MIN_SIZE with function pv_min_size()
Add configurable option to define minimal size of
of block device usable as a PV.

pv_min_size() is added to lvm-globals and it's being
initialized through _process_config.

Macro PV_MIN_SIZE is unused and removed.

New define DEFAULT_PV_MIN_SIZE_KB is added to lvm-global
and unlike PV_MIN_SIZE it uses KB units.

Should help users with various slow devices attached to the system,
which cannot be easily filtered out (like FDD on /dev/sdX):
https://bugzilla.redhat.com/show_bug.cgi?id=644578
2011-02-18 14:11:22 +00:00
Alasdair Kergon
2b82bd79f5 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Zdenek Kabelac
3cb3f15cf2 Print vg_name and do not to access vg->name
Reported by clang as: Logic error Dereference of null pointer
Replace pointer dereference with vg_name.
2010-10-25 12:01:38 +00:00
Alasdair Kergon
fa305e2ec6 Accept orphan VG names as parameters to lock_vol() and related functions. 2010-05-19 01:16:40 +00:00
Zdenek Kabelac
685be1dc7a Fix unlocking vg in some pvresize and toollib error paths. 2009-12-11 13:11:56 +00:00
Alasdair Kergon
651ff9b328 Add lots of missing stack debug messages to tools.
Make readonly locking available as locking type 4.
Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)
2009-09-14 22:47:49 +00:00
Petr Rockai
21a98eda88 Port process_each_pv to new vg_read. 2009-07-15 05:50:22 +00:00
Dave Wysochanski
4c611a220a Fix vg_read() error paths to properly release upon vg_read_error().
Fix vg_read() error paths to properly release upon vg_read_error().
Note that in the iterator paths (process_each_*()), we release
inside the iterator so no individual cleanup is needed.  However there
are a number of other places we missed the cleanup.  Proper cleanup
when vg_read_error() is true should be calling vg_release(vg), since
there should be no locks held if we get an error (except in certain
special cases, which IMO we should work to remove from the code).

Unfortunately the testsuite is unable to detect these types of memory
leaks.  Most of them can be easily seen if you try an operation
(e.g. lvcreate) with a volume group that does not exist.  Error
message looks like this:
  Volume group "vg2" not found
  You have a memory leak (not released memory pool):
   [0x1975eb8]
  You have a memory leak (not released memory pool):
   [0x1975eb8]


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-07 01:18:35 +00:00
Dave Wysochanski
b8b3508c59 Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).
Sun May  3 11:40:51 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).

Rebased 6/26/09 by Dave W.
2009-07-01 16:59:37 +00:00
Alasdair Kergon
f7c76e3878 revert last patch - let's do a release first 2009-06-26 10:55:57 +00:00
Dave Wysochanski
96d0004d12 Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).
Sun May  3 11:40:51 CEST 2009  Petr Rockai <me@mornfall.net>
  * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).


Author: Petr Rockai <prockai@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>
2009-06-26 09:47:36 +00:00
Milan Broz
043b13625b Properly release VG memory pool in all CLI tools. 2009-04-10 10:01:38 +00:00
Milan Broz
7b1c853bd9 Try to avoid full rescan if label scan is enough. 2009-02-25 23:29:06 +00:00
Milan Broz
ea0cdd28c1 Separate PV label attributes which do not need parse metadata when reporting.
When reporting explicitly label attributes (pv_uuid for example), we do not
need to read metadata.

This patch separate the label fileds and removes scan_vgs_for_pvs
in process_each_pv() if not needed.

(There should be no user visible change in output.)
2009-02-09 09:45:49 +00:00
Alasdair Kergon
8544a8a254 Rename vg_read() to vg_read_internal(). (mornfall) 2009-01-26 19:01:32 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Milan Broz
df9c7546a2 Fix pvresize to not allow resize if PV has two metadata areas.
If the PV has two metadata areas, second one is located at the end of the device.

Do not allow resize of PV or second metadata area can be overwritten.
(The check was active only for orphan PVs.)
2008-09-12 15:26:45 +00:00
Alasdair Kergon
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
Alasdair Kergon
c51b9fff19 Use stack return macros throughout. 2008-01-30 13:19:47 +00:00
Alasdair Kergon
3e50ea9eef Decode cluster locking state in log message. (untested)
Change file locking state messages from debug to very verbose.
2007-11-16 21:16:20 +00:00
Alasdair Kergon
a68d8ec833 move pvresize_single back under tools 2007-11-15 22:11:18 +00:00
Alasdair Kergon
223c62e7b7 Avoid nested vg_reads when processing PVs in VGs and fix associated locking. 2007-11-14 18:41:05 +00:00
Alasdair Kergon
204a12e594 Accept sizes with --readahead argument.
Store size arguments as sectors internally.
2007-11-14 00:08:25 +00:00
Dave Wysochanski
c6ea067fed move guts of pvresize into library 2007-08-30 20:30:41 +00:00
Dave Wysochanski
4463d20448 prepare to move guts of pvresize into library 2007-08-30 20:16:01 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Petr Rockai
e7ddf4168d Make warnings go to stderr. Change log_warn to that effect, log_print
continues to send messages to stdout.
2007-06-28 17:33:44 +00:00
Dave Wysochanski
ff77bb1ab6 Remove get_ prefix from get_pv_* functions 2007-06-15 22:16:55 +00:00
Dave Wysochanski
b5c344937b Convert pv->vg_name to get_pv_vg_name 2007-06-14 15:25:36 +00:00
Dave Wysochanski
7f5f9b02e2 Convert pv->vg_name to get_pv_vg_name 2007-06-13 23:53:38 +00:00
Dave Wysochanski
b7dd5ac374 Convert pv->dev to get_pv_dev 2007-06-13 23:29:33 +00:00
Dave Wysochanski
9dcbe73897 Convert pv->size to get_pv_size 2007-06-13 23:02:51 +00:00
Dave Wysochanski
70121705ba Convert pv->pe_size to get_pv_pe_size 2007-06-13 22:30:26 +00:00
Dave Wysochanski
1f72bbcaa7 Convert pv->pe_start to get_pv_pe_start 2007-06-13 22:16:27 +00:00
Dave Wysochanski
c221b0bc21 Add vg_check_status to consolidate vg status flags checks and error messages. 2007-06-06 19:40:28 +00:00