All of lore.kernel.org
 help / color / mirror / Atom feed
From: mornfall@sourceware.org <mornfall@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/test/api test.c
Date: 17 Nov 2010 19:17:08 -0000	[thread overview]
Message-ID: <20101117191708.26936.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall at sourceware.org	2010-11-17 19:17:07

Modified files:
	test/api       : test.c 

Log message:
	Add vg_set_property to the interactive lvm2app test program.
	
	Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
	Reviewed-by: Petr Rockai <prockai@redhat.com>

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

--- LVM2/test/api/test.c	2010/10/25 14:09:19	1.31
+++ LVM2/test/api/test.c	2010/11/17 19:17:07	1.32
@@ -97,6 +97,8 @@
 	       "Display the value of VG property\n");
 	printf("'pv_get_property pvname property_name': "
 	       "Display the value of PV property\n");
+	printf("'vg_set_property vgname property_name': "
+	       "Set the value of VG property\n");
 	printf("'lv_get_tags vgname lvname': "
 	       "List the tags of a LV\n");
 	printf("'vg_{add|remove}_tag vgname tag': "
@@ -652,6 +654,36 @@
 	_print_property_value(v);
 }
 
+static void _vg_set_property(char **argv, int argc)
+{
+	vg_t vg;
+	struct lvm_property_value value;
+	int rc;
+
+	if (argc < 4) {
+		printf("Please enter vgname, field_id, value\n");
+		return;
+	}
+	if (!(vg = _lookup_vg_by_name(argv, argc)))
+		return;
+	value = lvm_vg_get_property(vg, argv[2]);
+	if (!value.is_valid) {
+		printf("Error obtaining property value\n");
+		return;
+	}
+	if (value.is_string)
+		value.value.string = argv[3];
+	else
+		value.value.integer = atoi(argv[3]);
+	rc = lvm_vg_set_property(vg, argv[2], &value);
+	if (rc)
+		printf("Error ");
+	else
+		printf("Success ");
+	printf("setting value of property %s in VG %s\n",
+	       argv[2], argv[1]);
+}
+
 static void _lv_get_tags(char **argv, int argc)
 {
 	lv_t lv;
@@ -908,6 +940,8 @@
 			_vg_get_property(argv, argc);
 		} else if (!strcmp(argv[0], "pv_get_property")) {
 			_pv_get_property(argv, argc);
+		} else if (!strcmp(argv[0], "vg_set_property")) {
+			_vg_set_property(argv, argc);
 		} else if (!strcmp(argv[0], "lv_add_tag")) {
 			_lv_tag(argv, argc, 1);
 		} else if (!strcmp(argv[0], "lv_remove_tag")) {



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

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 19:17 mornfall [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01 23:29 LVM2/test/api test.c zkabelac
2011-03-01 23:18 zkabelac
2010-11-25 14:35 mornfall
2010-11-17 20:13 mornfall
2010-10-25 14:09 wysochanski
2010-05-19 11:53 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=20101117191708.26936.qmail@sourceware.org \
    --to=mornfall@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.