From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Mishin Date: Fri, 10 Dec 2010 12:00:13 +0300 Subject: [Cluster-devel] [PATCH 8/8] Added ability to reference domains from services In-Reply-To: <1291971613-13076-1-git-send-email-dim@parallels.com> References: <1291971613-13076-1-git-send-email-dim@parallels.com> Message-ID: <1291971613-13076-9-git-send-email-dim@parallels.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Signed-off-by: Dmitry Mishin --- 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