1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/lib
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
..
activate Fix backward compatibility for major:minor query. 2009-06-17 20:55:24 +00:00
cache Fix pool leak in lvmcache_read_vg error path. 2009-04-24 12:03:55 +00:00
commands Make destroy_toolcontext() better able to handle NULL pointers. 2009-07-08 18:12:08 +00:00
config Add defines for default vgcreate parameters. 2009-07-09 10:00:36 +00:00
datastruct more missing bits 2008-11-04 14:57:06 +00:00
device Use the MD device's stripe-width, instead of chunk_size, to align the 2009-07-06 19:04:24 +00:00
display Continue to make --units and --size consistent (in code and man pages): 2009-07-07 19:28:57 +00:00
error Fix last check-ins: seg can be NULL. 2009-02-28 20:04:24 +00:00
filters Fix segfault in persistent_filter_dump() if lvm init fails. 2009-07-08 18:13:32 +00:00
format1 Merge lv_is_displayable and lv_is_visible. 2009-05-13 21:27:43 +00:00
format_pool Introduce link_lv_to_vg and unlink_lv_from_vg functions. 2009-05-13 21:25:01 +00:00
format_text Make exit paths more robust when some init function fails. 2009-07-08 22:18:32 +00:00
freeseg Fix reporting of LV fields alongside unallocated PV segments. 2008-06-25 16:52:27 +00:00
label Make exit paths more robust when some init function fails. 2009-07-08 22:18:32 +00:00
locking Re-instate partial activation support in clustered mode. (mornfall) 2009-06-12 08:30:19 +00:00
log more tweaking to get things to compile - dmlib.h for log fns, list.h 2008-11-03 18:59:59 +00:00
metadata Change vg_create() to take only minimal parameters and obtain a lock. 2009-07-09 10:09:33 +00:00
mirror Fix last check-ins: seg can be NULL. 2009-02-28 20:04:24 +00:00
misc Attempt cleanup in child before execing new binary in exec_cmd() 2009-02-28 00:54:06 +00:00
mm fix setpriority int error 2008-05-28 23:12:45 +00:00
report Pre-release cleanups. 2009-05-21 03:04:52 +00:00
snapshot Fix snapshot segment import to not use duplicate segments & replace. 2009-05-13 21:21:58 +00:00
striped Fix last check-ins: seg can be NULL. 2009-02-28 20:04:24 +00:00
uuid Add generic function to read /dev/urandom, used in uuid calculation. 2008-12-07 04:23:37 +00:00
zero Attempt to load dm-zero module if zero target needed but not present. (mbroz) 2009-05-27 13:05:53 +00:00
Makefile.in Build shared parts with 'make' command (mpatocka) 2009-06-03 11:31:06 +00:00