From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/test/api vgtest.c
Date: 3 Sep 2009 17:13:46 -0000 [thread overview]
Message-ID: <20090903171346.26318.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2009-09-03 17:13:46
Modified files:
test/api : vgtest.c
Log message:
Update lvm2app vgtest to take vgname and devices as parameters.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/vgtest.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/test/api/vgtest.c 2009/08/13 12:16:45 1.10
+++ LVM2/test/api/vgtest.c 2009/09/03 17:13:46 1.11
@@ -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 @@
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 @@
goto bad; \
}
+int init_vgtest(int argc, char *argv[])
+{
+ int i;
+
+ if (argc < 4) {
+ fprintf(stderr, "Usage: %s <vgname> <pv1> <pv2> [... <pvN> ]",
+ argv[0]);
+ return -1;
+ }
+ vg_name = argv[1];
+ for(i=2; i<MAX_DEVICES && i < argc; i++) {
+ device[i-2] = argv[i];
+ }
+ return 0;
+}
+
int main(int argc, char *argv[])
{
int status;
- /* FIXME: input vgname, etc from cmdline */
+ if (init_vgtest(argc, argv) < 0)
+ goto bad;
+
/* FIXME: make the below messages verbose-only and print PASS/FAIL*/
printf("Opening LVM\n");
handle = lvm_init(NULL);
@@ -99,7 +117,7 @@
printf("Library version: %s\n", lvm_library_get_version());
vg_create(vg_name);
- vg_extend(vg, device);
+ vg_extend(vg, device[0]);
printf("Setting VG %s extent_size to %"PRIu64"\n", vg_name, size);
status = lvm_vg_set_extent_size(vg, size);
@@ -117,13 +135,13 @@
vg_close(vg);
vg_open(vg_name, "w");
- vg_extend(vg, device2);
- vg_reduce(vg, device);
+ vg_extend(vg, device[1]);
+ vg_reduce(vg, device[0]);
vg_commit(vg);
vg_close(vg);
vg_open(vg_name, "w");
- vg_extend(vg, device);
+ vg_extend(vg, device[0]);
vg_commit(vg);
vg_close(vg);
next reply other threads:[~2009-09-03 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 17:13 wysochanski [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-09-04 19:17 LVM2/test/api vgtest.c wysochanski
2009-07-27 17:44 wysochanski
2009-07-22 22:25 wysochanski
2009-07-22 16:49 wysochanski
2009-07-22 3:13 wysochanski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090903171346.26318.qmail@sourceware.org \
--to=wysochanski@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.