public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/test/api test.c Date: Fri, 07 Aug 2009 21:22:00 -0000 [thread overview] Message-ID: <20090807212238.32206.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-07 21:22:37 Modified files: test/api : test.c Log message: Update test/api/test.c to call lvm_vg_create and lvm_vg_remove. Also fix a couple bugs. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/test/api/test.c 2009/07/29 14:06:31 1.24 +++ LVM2/test/api/test.c 2009/08/07 21:22:37 1.25 @@ -81,6 +81,10 @@ "Issue a lvm_vg_open() API call on VG 'vgname'\n"); printf("'vg_close vgname': " "Issue a lvm_vg_close() API call on VG 'vgname'\n"); + printf("'vg_create vgname: " + "Issue a lvm_vg_create() to create VG 'vgname'\n"); + printf("'vg_remove vgname: " + "Issue a lvm_vg_remove() to remove VG 'vgname'\n"); printf("'config_reload': " "Issue a lvm_config_reload() API to reload LVM config\n"); printf("'config_override' device: " @@ -351,24 +355,70 @@ return; } vg = _lookup_vg_by_name(argv, argc); - if (vg) - rc = lvm_vg_write(vg); + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_write(vg); _lvm_status_to_pass_fail(rc); printf("writing VG %s\n", lvm_vg_get_name(vg)); } +static void _vg_create(char **argv, int argc, lvm_t libh) +{ + vg_t *vg; + + if (argc < 2) { + printf ("Please enter vg_name\n"); + return; + } + vg = lvm_vg_create(libh, argv[1]); + if (!vg || !lvm_vg_get_name(vg)) { + printf("Error creating %s\n", argv[1]); + return; + } + + printf("Success creating vg %s\n", argv[1]); + dm_hash_insert(_vgname_hash, lvm_vg_get_name(vg), vg); + dm_hash_insert(_vgid_hash, lvm_vg_get_uuid(vg), vg); +} + +static void _vg_remove(char **argv, int argc) +{ + vg_t *vg; + int rc = 0; + + if (argc < 2) { + printf ("Please enter vg_name\n"); + return; + } + vg = _lookup_vg_by_name(argv, argc); + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_remove(vg); + _lvm_status_to_pass_fail(rc); + printf("removing VG\n"); +} + static void _vg_close(char **argv, int argc) { vg_t *vg; + int rc = 0; if (argc < 2) { printf ("Please enter vg_name\n"); return; } vg = _lookup_and_remove_vg(argv[1]); - if (vg) - lvm_vg_close(vg); - /* FIXME: remove LVs from lvname_hash */ + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_close(vg); + _lvm_status_to_pass_fail(rc); + printf("closing VG\n"); } static void _show_one_vg(vg_t *vg) @@ -593,6 +643,10 @@ _vg_open(argv, argc, libh); } else if (!strcmp(argv[0], "vg_close")) { _vg_close(argv, argc); + } else if (!strcmp(argv[0], "vg_create")) { + _vg_create(argv, argc, libh); + } else if (!strcmp(argv[0], "vg_remove")) { + _vg_remove(argv, argc); } else if (!strcmp(argv[0], "lv_activate")) { _lv_activate(argv, argc); } else if (!strcmp(argv[0], "lv_deactivate")) {
next reply other threads:[~2009-08-07 21:22 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-08-07 21:22 wysochanski [this message] -- strict thread matches above, loose matches on Subject: below -- 2011-03-01 23:29 zkabelac 2011-03-01 23:18 zkabelac 2010-11-25 14:35 mornfall 2010-11-17 20:13 mornfall 2010-11-17 19:17 mornfall 2010-10-25 14:09 wysochanski 2010-05-19 11:53 wysochanski 2010-02-24 18:16 wysochanski 2009-07-28 14:12 wysochanski 2009-07-28 13:49 wysochanski 2009-07-27 21:02 wysochanski 2009-07-27 17:45 wysochanski 2009-07-26 20:59 wysochanski 2009-07-26 20:58 wysochanski 2009-07-26 14:37 wysochanski 2009-07-26 13:08 wysochanski 2009-07-26 13:07 wysochanski 2009-07-26 2:35 wysochanski 2009-07-26 2:35 wysochanski 2009-07-24 12:51 wysochanski 2009-07-24 4:15 wysochanski 2009-07-23 23:40 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=20090807212238.32206.qmail@sourceware.org \ --to=wysochanski@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).