1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-25 10:04:17 +03:00
lvm2/tools/vgcreate.c

47 lines
1.0 KiB
C
Raw Normal View History

2001-10-03 20:38:07 +00:00
/*
2001-10-12 14:25:53 +00:00
* Copyright (C) 2001 Sistina Software (UK) Limited.
2001-10-03 20:38:07 +00:00
*
2001-10-12 14:25:53 +00:00
* This file is released under the GPL.
2001-10-03 20:38:07 +00:00
*/
#include "tools.h"
2001-10-12 14:25:53 +00:00
#define DEFAULT_PV 128
#define DEFAULT_LV 128
#define DEFAULT_EXTENT 8192
2001-10-12 12:21:43 +00:00
2001-10-03 20:38:07 +00:00
int vgcreate(int argc, char **argv)
{
2001-10-12 14:25:53 +00:00
int max_lv, max_pv, extent_size;
2001-10-03 20:38:07 +00:00
struct volume_group *vg;
2001-10-12 12:21:43 +00:00
if (!argc) {
log_error("Please provide volume group name and "
"physical volumes");
return EINVALID_CMD_LINE;
2001-10-03 20:38:07 +00:00
}
if (argc == 1) {
2001-10-12 12:21:43 +00:00
log_error("Please enter physical volume name(s)");
return EINVALID_CMD_LINE;
2001-10-03 20:38:07 +00:00
}
2001-10-12 14:25:53 +00:00
max_lv = arg_int_value(maxlogicalvolumes_ARG, DEFAULT_LV);
max_pv = arg_int_value(maxphysicalvolumes_ARG, DEFAULT_PV);
extent_size = arg_int_value(physicalextentsize_ARG, DEFAULT_EXTENT);
2001-10-12 12:21:43 +00:00
2001-10-12 14:25:53 +00:00
/* create the new vg */
if (!vg_create(ios, argv[0], extent_size, max_pv, max_lv,
argc - 1, argv + 1))
return ECMD_FAILED;
2001-10-03 20:38:07 +00:00
/* store vg on disk(s) */
2001-10-12 14:25:53 +00:00
if (ios->vg_write(ios, vg))
return ECMD_FAILED;
2001-10-03 20:38:07 +00:00
log_print("Volume group %s successfully created and activated",
2001-10-12 14:25:53 +00:00
argv[0]);
2001-10-03 20:38:07 +00:00
return 0;
}