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: Wed, 19 May 2010 11:53:00 -0000	[thread overview]
Message-ID: <20100519115331.25591.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-05-19 11:53:30

Modified files:
	test/api       : test.c 

Log message:
	Test lvm_vgname_from_{pvid|device}.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30

--- LVM2/test/api/test.c	2010/02/24 18:16:35	1.29
+++ LVM2/test/api/test.c	2010/05/19 11:53:30	1.30
@@ -97,6 +97,10 @@
 	       "Add/remove a tag from a VG\n");
 	printf("'lv_{add|remove}_tag vgname lvname tag': "
 	       "Add/remove a tag from a LV\n");
+	printf("'vgname_from_devname device': "
+	       "Lookup a vgname from a device name\n");
+	printf("'vgname_from_pvid pvid': "
+	       "Lookup a vgname from a pvid\n");
 	printf("'quit': exit the program\n");
 }
 
@@ -576,6 +580,38 @@
 	printf("%s tag %s to LV %s\n",
 	       add ? "adding":"removing", argv[3], argv[2]);
 }
+static void _vgname_from_pvid(char **argv, int argc, lvm_t libh)
+{
+	const char *vgname;
+
+	if (argc < 1) {
+		printf("Please enter pvid\n");
+		return;
+	}
+	if (!(vgname = lvm_vgname_from_pvid(libh, argv[1]))) {
+		printf("Error ");
+	} else {
+		printf("Success ");
+	}
+	printf("looking up vgname=%s from PVID=%s\n",
+	       vgname, argv[1]);
+}
+static void _vgname_from_devname(char **argv, int argc, lvm_t libh)
+{
+	const char *vgname;
+
+	if (argc < 1) {
+		printf("Please enter device\n");
+		return;
+	}
+	if (!(vgname = lvm_vgname_from_device(libh, argv[1]))) {
+		printf("Error ");
+	} else {
+		printf("Success ");
+	}
+	printf("looking up vgname=%s from device name=%s\n",
+	       vgname, argv[1]);
+}
 static void _lvs_in_vg(char **argv, int argc)
 {
 	struct dm_list *lvs;
@@ -766,6 +802,10 @@
 			_lv_tag(argv, argc, 0);
 		} else if (!strcmp(argv[0], "lv_get_tags")) {
 			_lv_get_tags(argv, argc);
+		} else if (!strcmp(argv[0], "vgname_from_devname")) {
+			_vgname_from_devname(argv, argc, libh);
+		} else if (!strcmp(argv[0], "vgname_from_pvid")) {
+			_vgname_from_pvid(argv, argc, libh);
 		} else {
 			printf ("Unrecognized command %s\n", argv[0]);
 		}


             reply	other threads:[~2010-05-19 11:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 11:53 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-02-24 18:16 wysochanski
2009-08-07 21:22 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=20100519115331.25591.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: link
Be 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).