1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00
lvm2/tools
Dave Wysochanski 10a27bdfb6 Change vg_create() to take only minimal parameters and obtain a lock.
vg_t *vg_create(struct cmd_context *cmd, const char *vg_name);
This is the first step towards the API called to create a VG.
Call vg_lock_newname() inside this function.  Use _vg_make_handle()
where possible.
Now we have 2 ways to construct a volume group:
1) vg_read: Used when constructing an existing VG from disks
2) vg_create: Used when constructing a new VG
Both of these interfaces obtain a lock, and return a vg_t *.
The usage of _vg_make_handle() inside vg_create() doesn't fit
perfectly but it's ok for now.  Needs some cleanup though and I've
noted "FIXME" in the code.

Add the new vg_create() plus vg 'set' functions for non-default
VG parameters in the following tools:
- vgcreate: Fairly straightforward refactoring.  We just moved
vg_lock_newname inside vg_create so we check the return via
vg_read_error.
- vgsplit: The refactoring here is a bit more tricky.  Originally
we called vg_lock_newname and depending on the error code, we either
read the existing vg or created the new one.  Now vg_create()
calls vg_lock_newname, so we first try to create the VG.  If this
fails with FAILED_EXIST, we can then do the vg_read.  If the
create succeeds, we check the input parameters and set any new
values on the VG.

TODO in future patches:
1. The VG_ORPHAN lock needs some thought.  We may want to treat
this as any other VG, and require the application to obtain a handle
and pass it to other API calls (for example, vg_extend).  Or,
we may find that hiding the VG_ORPHAN lock inside other APIs is
the way to go.  I thought of placing the VG_ORPHAN lock inside
vg_create() and tying it to the vg handle, but was not certain
this was the right approach.
2. Cleanup error paths. Integrate vg_read_error() with vg_create and
vg_read* error codes and/or the new error APIs.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-09 10:09:33 +00:00
..
.exported_symbols .export.sym generation 2004-03-26 14:51:23 +00:00
args.h Use lvconvert --repair instead of vgreduce in mirror dmeventd DSO (mornfall) 2009-06-04 12:01:15 +00:00
cmdnames.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
commands.h Allow commandline sizes to be specified in terms of bytes and sectors. 2009-07-06 19:13:26 +00:00
dmsetup.c Add splitname. 2009-06-03 20:44:42 +00:00
dumpconfig.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
formats.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvchange.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
lvconvert.c Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). 2009-07-01 16:59:37 +00:00
lvcreate.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
lvdisplay.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
lvextend.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvm2cmd-static.c Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
lvm2cmd.c Fix mirror log name construction during lvconvert. (2.02.30) 2008-01-31 12:19:36 +00:00
lvm2cmd.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
lvm2cmdline.h lvm2cmdline.h:31: warning: declaration of `is_static' shadows a global declaration 2008-12-19 18:51:02 +00:00
lvm-static.c Use tools.h in for lvm-static. 2009-01-20 20:37:41 +00:00
lvm.c Create global is_static() to eliminate from the library init function. 2008-12-18 05:27:17 +00:00
lvmchange.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvmcmdlib.c Move tools/version.h to lib/misc/lvm-version.h. 2009-02-22 22:11:58 +00:00
lvmcmdline.c Fix compile warning in lvmcmdline.c - use C99 PRIu64 for uint64_t. 2009-07-07 01:51:00 +00:00
lvmdiskscan.c Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
lvreduce.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvremove.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
lvrename.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
lvresize.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
lvscan.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
Makefile.in Reinstate version in liblvm2cmd.so soname. (2.02.44) 2009-05-21 11:11:29 +00:00
polldaemon.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
polldaemon.h Fix convert polling to ignore LV with different UUID. 2009-06-01 14:43:27 +00:00
pvchange.c Refactor a couple log_error() statements in prep for larger log_error() patch. 2009-07-08 18:15:51 +00:00
pvck.c Clean up numerous compiler warnings that crept in recently. 2007-08-22 14:38:18 +00:00
pvcreate.c Properly release VG memory pool in all CLI tools. 2009-04-10 10:01:38 +00:00
pvdisplay.c Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). 2009-07-01 16:59:37 +00:00
pvmove.c Refactor a couple log_error() statements in prep for larger log_error() patch. 2009-07-08 18:15:51 +00:00
pvremove.c Try to avoid full rescan if label scan is enough. 2009-02-25 23:29:06 +00:00
pvresize.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
pvscan.c Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
reporter.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
segtypes.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
stub.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
toollib.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
toollib.h Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
tools.h Fix convert polling to ignore LV with different UUID. 2009-06-01 14:43:27 +00:00
vgcfgbackup.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgcfgrestore.c Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. 2009-05-13 13:02:52 +00:00
vgchange.c Add vg_set_alloc_policy() liblvm function and move vgchange logic inside. 2009-07-09 10:08:54 +00:00
vgck.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgconvert.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgcreate.c Change vg_create() to take only minimal parameters and obtain a lock. 2009-07-09 10:09:33 +00:00
vgdisplay.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgexport.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgextend.c Remove unneeded LOCK_NONBLOCKING from vg_read() API. 2009-07-08 14:33:17 +00:00
vgimport.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgmerge.c Remove unneeded LOCK_NONBLOCKING from vg_read() API. 2009-07-08 14:33:17 +00:00
vgmknodes.c Add "--refresh" functionality to vgchange and vgmknodes. 2008-12-22 09:00:51 +00:00
vgreduce.c Remove unneeded LOCK_NONBLOCKING from vg_read() API. 2009-07-08 14:33:17 +00:00
vgremove.c Remove unneeded LOCK_NONBLOCKING from vg_read() API. 2009-07-08 14:33:17 +00:00
vgrename.c Fix vg_read() error paths to properly release upon vg_read_error(). 2009-07-07 01:18:35 +00:00
vgscan.c Rework the toollib interface (process_each_*) on top of new vg_read. 2009-07-01 17:00:50 +00:00
vgsplit.c Change vg_create() to take only minimal parameters and obtain a lock. 2009-07-09 10:09:33 +00:00