All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Mishin <dim@parallels.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 8/8] Added ability to reference domains from services
Date: Fri, 10 Dec 2010 12:00:13 +0300	[thread overview]
Message-ID: <1291971613-13076-9-git-send-email-dim@parallels.com> (raw)
In-Reply-To: <1291971613-13076-1-git-send-email-dim@parallels.com>

Signed-off-by: Dmitry Mishin <dim@parallels.com>
---
 config/tools/ccs_tool/editconf.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/config/tools/ccs_tool/editconf.c b/config/tools/ccs_tool/editconf.c
index aae1095..baa6fd3 100644
--- a/config/tools/ccs_tool/editconf.c
+++ b/config/tools/ccs_tool/editconf.c
@@ -46,6 +46,7 @@ struct option_info
 	const char *exclusive;
 	const char *recovery;
 	const char *fs;
+	const char *domain;
 	const char *script;
 	const char *mountpoint;
 	const char *type;
@@ -695,6 +696,7 @@ static void add_clusterservice(xmlNode *root_element, struct option_info *ninfo,
 {
 	xmlNode *rm;
 	xmlNode *rs;
+	xmlNode *fdomains;
 	xmlNode *newnode;
 
 	xmlNode *newfs = NULL;
@@ -711,6 +713,7 @@ static void add_clusterservice(xmlNode *root_element, struct option_info *ninfo,
 				ninfo->configfile);
 
 	rs = findnode(rm, "resources");
+	fdomains = findnode(rm, "failoverdomains");
 	if (ninfo->fs && (!rs || !find_fs_resource(rs, ninfo->fs)))
 		die("fs resource %s doesn't exist in %s\n", ninfo->fs,
 				ninfo->configfile);
@@ -720,11 +723,16 @@ static void add_clusterservice(xmlNode *root_element, struct option_info *ninfo,
 	if (ninfo->ip_addr && (!rs || !find_ip_resource(rs, ninfo->ip_addr)))
 		die("ip resource %s doesn't exist in %s\n", ninfo->ip_addr,
 				ninfo->configfile);
+	if (ninfo->domain && (!fdomains || !find_fdomain_resource(fdomains, ninfo->domain)))
+		die("failover domain %s doesn't exist in %s\n", ninfo->domain,
+				ninfo->configfile);
 
 	/* Add the new service */
 	newnode = xmlNewNode(NULL, BAD_CAST "service");
 	xmlSetProp(newnode, BAD_CAST "name", BAD_CAST ninfo->name);
 	xmlSetProp(newnode, BAD_CAST "autostart", BAD_CAST ninfo->autostart);
+	if (ninfo->domain)
+		xmlSetProp(newnode, BAD_CAST "domain", BAD_CAST ninfo->domain);
 	if (ninfo->exclusive)
 		xmlSetProp(newnode, BAD_CAST "exclusive",
 				BAD_CAST ninfo->exclusive);
@@ -1135,6 +1143,7 @@ struct option list_options[] =
 struct option addservice_options[] =
 {
       { "autostart", required_argument, NULL, 'a'},
+      { "domain", required_argument, NULL, 'd'},
       { "exclusive", required_argument, NULL, 'x'},
       { "recovery", required_argument, NULL, 'r'},
       { "fs", required_argument, NULL, 'f'},
@@ -1553,7 +1562,7 @@ void add_service(int argc, char **argv)
 	ninfo.autostart = "1";
 	ninfo.recovery = "relocate";
 
-	while ( (opt = getopt_long(argc, argv, "a:x:r:f:o:c:s:i:CFh?", addservice_options, NULL)) != EOF)
+	while ( (opt = getopt_long(argc, argv, "a:d:x:r:f:o:c:s:i:CFh?", addservice_options, NULL)) != EOF)
 	{
 		switch(opt)
 		{
@@ -1562,6 +1571,10 @@ void add_service(int argc, char **argv)
 			ninfo.autostart = optarg;
 			break;
 
+		case 'd':
+			ninfo.domain = strdup(optarg);
+			break;
+
 		case 'x':
 			validate_int_arg(opt, optarg);
 			ninfo.exclusive = optarg;
-- 
1.7.1



  parent reply	other threads:[~2010-12-10  9:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10  9:00 [Cluster-devel] [PATCH 0/8] ccs_tool enhancement Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 1/8] Add "service" object manipulations Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 2/8] Unify 'del' functions Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 3/8] Add "script" object manipulations Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 4/8] Unify parsing of options Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 5/8] Added "ip" object manipulations Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 6/8] Added 'fs' " Dmitry Mishin
2010-12-10  9:00 ` [Cluster-devel] [PATCH 7/8] Added 'failoverdomain' " Dmitry Mishin
2010-12-10  9:00 ` Dmitry Mishin [this message]
2010-12-10  9:12 ` [Cluster-devel] [PATCH 0/8] ccs_tool enhancement Fabio M. Di Nitto
2010-12-10  9:37   ` Dmitry Mishin
2010-12-10  9:36     ` Fabio M. Di Nitto
  -- strict thread matches above, loose matches on Subject: below --
2010-12-10 13:42 [Cluster-devel] [PATCH 0/8] [STABLE31] sccs_tool enhancement Dmitry Mishin
2010-12-10 13:42 ` [Cluster-devel] [PATCH 8/8] Added ability to reference domains from services Dmitry Mishin

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=1291971613-13076-9-git-send-email-dim@parallels.com \
    --to=dim@parallels.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.