diff --git a/test/api/vgtest.c b/test/api/vgtest.c index 8b82f3960..7d2ac7703 100644 --- a/test/api/vgtest.c +++ b/test/api/vgtest.c @@ -25,9 +25,9 @@ lvm_t handle; vg_t vg; -const char *vg_name = "my_vg"; -const char *device = "/dev/loop3"; -const char *device2 = "/dev/loop4"; +const char *vg_name; +#define MAX_DEVICES 16 +const char *device[MAX_DEVICES]; uint64_t size = 1024; #define vg_create(vg_name) \ @@ -51,7 +51,7 @@ uint64_t size = 1024; if (status) { \ fprintf(stderr, "Creation of volume group '%s' on " \ "device '%s' failed\n", \ - lvm_vg_get_name(vg), device); \ + lvm_vg_get_name(vg), device[0]); \ goto bad; \ } #define vg_open(vg_name, mode) \ @@ -84,11 +84,29 @@ uint64_t size = 1024; goto bad; \ } +int init_vgtest(int argc, char *argv[]) +{ + int i; + + if (argc < 4) { + fprintf(stderr, "Usage: %s [... ]", + argv[0]); + return -1; + } + vg_name = argv[1]; + for(i=2; i