Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e39bb6348295c8d3f69b2d1fd30691a67c40445c
Parent: 612d65819bc6e840483bb3b4f1ac9f10a7e5d0fb
Author: Dmitry Mishin <dim(a)parallels.com>
AuthorDate: Fri Dec 10 16:42:37 2010 +0300
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Wed Dec 15 09:04:11 2010 +0100
Added ability to reference domains from services
Signed-off-by: Dmitry Mishin <dim(a)parallels.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.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 516b338..a443831 100644
--- a/config/tools/ccs_tool/editconf.c
+++ b/config/tools/ccs_tool/editconf.c
@@ -44,6 +44,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;
@@ -696,6 +697,7 @@ static void add_clusterservice(xmlNode *root_element, struct
option_info *ninfo,
{
xmlNode *rm;
xmlNode *rs;
+ xmlNode *fdomains;
xmlNode *newnode;
xmlNode *newfs = NULL;
@@ -712,6 +714,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);
@@ -721,11 +724,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);
@@ -1137,6 +1145,7 @@ struct option create_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'},
@@ -1530,7 +1539,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)
{
@@ -1539,6 +1548,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;