* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-09 22:48 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-09 22:48 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-03-09 22:48:20
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: ClusterModule.cpp Clusvcadm.cpp
Clusvcadm.h
Log message:
- Fix virt service disable and relocate.
- Add a "migrate" ricci call to allow for the bifurcation of relocation and live migration for virt services.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- conga/ricci/docs/cluster_api.html 2007/02/05 20:08:28 1.5
+++ conga/ricci/docs/cluster_api.html 2007/03/09 22:48:20 1.6
@@ -75,15 +75,27 @@
<P>Start service ???servicename???. If ???nodename??? is specified,
service is started on that node, otherwise it will be started on a
node chosen by service manager. <BR>If service was not running, it
- is started. If it was running, it is migrated to ???nodename???.
+ is started. If it was running, it is relocated to ???nodename???.
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
service to manipulate<BR>- ???nodename??? (string) ??? optional
- name of node for service to start on/ migrate to</P>
+ name of node for service to start on / relocate to</P>
<P>No output variables.</P>
<P>On failure:<BR>- 1 ??? service manager is not running on this
managed system<BR>- generic ones</P>
</UL>
+ <LI><P>migrate_service</P>
+ <UL>
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ </P>
+ <P>Input variables:<BR>- ???servicename??? (string) ??? name of
+ the virtual service to migrate.<BR>- ???nodename??? (string) ???
+ name of node to which the virtual service is to be migrated.</P>
+ <P>No output variables.</P>
+ <P>On failure:<BR>- 1 ??? service manager is not running on this
+ managed system<BR>- generic ones</P>
+ </UL>
+
<LI><P>stop_service</P>
<UL>
<P>Stop service ???servicename???. It is not an error to stop
--- conga/ricci/modules/cluster/ClusterModule.cpp 2006/11/20 23:10:58 1.6
+++ conga/ricci/modules/cluster/ClusterModule.cpp 2007/03/09 22:48:20 1.7
@@ -36,6 +36,7 @@
static VarMap set_cluster_conf(const VarMap& args);
static VarMap cluster_status(const VarMap& args);
static VarMap service_start(const VarMap& args);
+static VarMap service_migrate(const VarMap& args);
static VarMap service_stop(const VarMap& args);
static VarMap service_restart(const VarMap& args);
static VarMap fence_node(const VarMap& args);
@@ -66,6 +67,7 @@
api_1_0["start_service"] = service_start;
api_1_0["stop_service"] = service_stop;
api_1_0["restart_service"] = service_restart;
+ api_1_0["migrate_service"] = service_migrate;
api_1_0["start_node"] = start_node;
api_1_0["stop_node"] = stop_node;
@@ -168,6 +170,29 @@
}
VarMap
+service_migrate(const VarMap& args)
+{
+ String service_name, node_name;
+ try {
+ VarMap::const_iterator iter = args.find("servicename");
+ if (iter == args.end())
+ throw APIerror("missing servicename variable");
+ service_name = iter->second.get_string();
+
+ iter = args.find("nodename");
+ if (iter != args.end())
+ node_name = iter->second.get_string();
+ } catch ( String e ) {
+ throw APIerror(e);
+ }
+
+ Clusvcadm::migrate(service_name, node_name);
+
+ VarMap ret;
+ return ret;
+}
+
+VarMap
service_restart(const VarMap& args)
{
String name;
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/08 06:04:12 1.9
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:48:20 1.10
@@ -72,7 +72,6 @@
-
void
Clusvcadm::start(const String& servicename,
const String& nodename)
@@ -80,7 +79,6 @@
pair<list<String>, list<ServiceStatus> > info = service_states();
list<String> nodes = info.first;
list<ServiceStatus> services = info.second;
- String svcname = servicename;
// check if node can run services
bool node_found = false;
@@ -106,19 +104,18 @@
flag = "-e";
else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
iter->status == ServiceStatus::RG_STATE_STARTING) {
- if (iter->vm) {
- flag = "-M";
- svcname = "vm:" + servicename;
} else
flag = "-r";
- }
if (flag.size()) {
String out, err;
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(svcname);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (nodename.size()) {
args.push_back("-m");
args.push_back(nodename);
@@ -135,6 +132,64 @@
}
void
+Clusvcadm::migrate(const String& servicename, const String& nodename)
+{
+ pair<list<String>, list<ServiceStatus> > info = service_states();
+ list<String> nodes = info.first;
+ list<ServiceStatus> services = info.second;
+
+ // check if node can run services
+ bool node_found = false;
+ for (list<String>::const_iterator iter = nodes.begin();
+ iter != nodes.end();
+ iter++)
+ if (*iter == nodename)
+ node_found = true;
+ if (!node_found && nodename.size())
+ throw String("node unable to run services");
+
+ // start
+ for (list<ServiceStatus>::const_iterator iter = services.begin();
+ iter != services.end();
+ iter++) {
+ if (!iter->vm)
+ continue;
+ if (iter->name == servicename) {
+ String flag;
+ if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
+ iter->status == ServiceStatus::RG_STATE_STOPPING ||
+ iter->status == ServiceStatus::RG_STATE_FAILED ||
+ iter->status == ServiceStatus::RG_STATE_ERROR ||
+ iter->status == ServiceStatus::RG_STATE_DISABLED)
+ flag = "-e";
+ else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
+ iter->status == ServiceStatus::RG_STATE_STARTING) {
+ flag = "-M";
+ }
+
+ if (flag.size()) {
+ String out, err;
+ int status;
+ vector<String> args;
+ args.push_back(flag);
+ args.push_back("vm:" + servicename);
+ if (nodename.size()) {
+ args.push_back("-m");
+ args.push_back(nodename);
+ }
+ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
+ throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
+ if (status != 0)
+ throw String("clusvcadm failed");
+ }
+ return;
+ }
+ }
+
+ throw String("no such virtual service");
+}
+
+void
Clusvcadm::stop(const String& servicename)
{
pair<list<String>, list<ServiceStatus> > info = service_states();
@@ -151,7 +206,10 @@
int status;
vector<String> args;
args.push_back("-d");
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
@@ -189,7 +247,10 @@
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
--- conga/ricci/modules/cluster/Clusvcadm.h 2006/08/10 22:53:08 1.2
+++ conga/ricci/modules/cluster/Clusvcadm.h 2007/03/09 22:48:20 1.3
@@ -30,11 +30,10 @@
class Clusvcadm
{
public:
- static void start(const String& servicename,
- const String& nodename);
- static void stop(const String& servicename);
+ static void start(const String& servicename, const String& nodename);
+ static void migrate(const String& servicename, const String& nodename);
static void restart(const String& servicename);
-
+ static void stop(const String& servicename);
};
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-09 22:49 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-09 22:49 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-03-09 22:49:37
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: ClusterModule.cpp Clusvcadm.cpp
Clusvcadm.h
Log message:
- Fix virt service disable and relocate.
- Add a "migrate" ricci call to allow for the bifurcation of relocation and live migration for virt services.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.2&r2=1.7.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
--- conga/ricci/docs/cluster_api.html 2007/03/01 00:31:19 1.4.2.1
+++ conga/ricci/docs/cluster_api.html 2007/03/09 22:49:36 1.4.2.2
@@ -75,15 +75,27 @@
<P>Start service ???servicename???. If ???nodename??? is specified,
service is started on that node, otherwise it will be started on a
node chosen by service manager. <BR>If service was not running, it
- is started. If it was running, it is migrated to ???nodename???.
+ is started. If it was running, it is relocated to ???nodename???.
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
service to manipulate<BR>- ???nodename??? (string) ??? optional
- name of node for service to start on/ migrate to</P>
+ name of node for service to start on / relocate to</P>
<P>No output variables.</P>
<P>On failure:<BR>- 1 ??? service manager is not running on this
managed system<BR>- generic ones</P>
</UL>
+ <LI><P>migrate_service</P>
+ <UL>
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ </P>
+ <P>Input variables:<BR>- ???servicename??? (string) ??? name of
+ the virtual service to migrate.<BR>- ???nodename??? (string) ???
+ name of node to which the virtual service is to be migrated.</P>
+ <P>No output variables.</P>
+ <P>On failure:<BR>- 1 ??? service manager is not running on this
+ managed system<BR>- generic ones</P>
+ </UL>
+
<LI><P>stop_service</P>
<UL>
<P>Stop service ???servicename???. It is not an error to stop
--- conga/ricci/modules/cluster/ClusterModule.cpp 2006/11/20 23:15:03 1.5.2.1
+++ conga/ricci/modules/cluster/ClusterModule.cpp 2007/03/09 22:49:37 1.5.2.2
@@ -36,6 +36,7 @@
static VarMap set_cluster_conf(const VarMap& args);
static VarMap cluster_status(const VarMap& args);
static VarMap service_start(const VarMap& args);
+static VarMap service_migrate(const VarMap& args);
static VarMap service_stop(const VarMap& args);
static VarMap service_restart(const VarMap& args);
static VarMap fence_node(const VarMap& args);
@@ -66,6 +67,7 @@
api_1_0["start_service"] = service_start;
api_1_0["stop_service"] = service_stop;
api_1_0["restart_service"] = service_restart;
+ api_1_0["migrate_service"] = service_migrate;
api_1_0["start_node"] = start_node;
api_1_0["stop_node"] = stop_node;
@@ -168,6 +170,29 @@
}
VarMap
+service_migrate(const VarMap& args)
+{
+ String service_name, node_name;
+ try {
+ VarMap::const_iterator iter = args.find("servicename");
+ if (iter == args.end())
+ throw APIerror("missing servicename variable");
+ service_name = iter->second.get_string();
+
+ iter = args.find("nodename");
+ if (iter != args.end())
+ node_name = iter->second.get_string();
+ } catch ( String e ) {
+ throw APIerror(e);
+ }
+
+ Clusvcadm::migrate(service_name, node_name);
+
+ VarMap ret;
+ return ret;
+}
+
+VarMap
service_restart(const VarMap& args)
{
String name;
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/08 06:05:08 1.7.2.2
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:49:37 1.7.2.3
@@ -72,7 +72,6 @@
-
void
Clusvcadm::start(const String& servicename,
const String& nodename)
@@ -80,7 +79,6 @@
pair<list<String>, list<ServiceStatus> > info = service_states();
list<String> nodes = info.first;
list<ServiceStatus> services = info.second;
- String svcname = servicename;
// check if node can run services
bool node_found = false;
@@ -106,19 +104,18 @@
flag = "-e";
else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
iter->status == ServiceStatus::RG_STATE_STARTING) {
- if (iter->vm) {
- flag = "-M";
- svcname = "vm:" + servicename;
} else
flag = "-r";
- }
if (flag.size()) {
String out, err;
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(svcname);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (nodename.size()) {
args.push_back("-m");
args.push_back(nodename);
@@ -135,6 +132,64 @@
}
void
+Clusvcadm::migrate(const String& servicename, const String& nodename)
+{
+ pair<list<String>, list<ServiceStatus> > info = service_states();
+ list<String> nodes = info.first;
+ list<ServiceStatus> services = info.second;
+
+ // check if node can run services
+ bool node_found = false;
+ for (list<String>::const_iterator iter = nodes.begin();
+ iter != nodes.end();
+ iter++)
+ if (*iter == nodename)
+ node_found = true;
+ if (!node_found && nodename.size())
+ throw String("node unable to run services");
+
+ // start
+ for (list<ServiceStatus>::const_iterator iter = services.begin();
+ iter != services.end();
+ iter++) {
+ if (!iter->vm)
+ continue;
+ if (iter->name == servicename) {
+ String flag;
+ if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
+ iter->status == ServiceStatus::RG_STATE_STOPPING ||
+ iter->status == ServiceStatus::RG_STATE_FAILED ||
+ iter->status == ServiceStatus::RG_STATE_ERROR ||
+ iter->status == ServiceStatus::RG_STATE_DISABLED)
+ flag = "-e";
+ else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
+ iter->status == ServiceStatus::RG_STATE_STARTING) {
+ flag = "-M";
+ }
+
+ if (flag.size()) {
+ String out, err;
+ int status;
+ vector<String> args;
+ args.push_back(flag);
+ args.push_back("vm:" + servicename);
+ if (nodename.size()) {
+ args.push_back("-m");
+ args.push_back(nodename);
+ }
+ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
+ throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
+ if (status != 0)
+ throw String("clusvcadm failed");
+ }
+ return;
+ }
+ }
+
+ throw String("no such virtual service");
+}
+
+void
Clusvcadm::stop(const String& servicename)
{
pair<list<String>, list<ServiceStatus> > info = service_states();
@@ -151,7 +206,10 @@
int status;
vector<String> args;
args.push_back("-d");
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
@@ -189,7 +247,10 @@
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
--- conga/ricci/modules/cluster/Clusvcadm.h 2006/08/10 22:53:08 1.2
+++ conga/ricci/modules/cluster/Clusvcadm.h 2007/03/09 22:49:37 1.2.2.1
@@ -30,11 +30,10 @@
class Clusvcadm
{
public:
- static void start(const String& servicename,
- const String& nodename);
- static void stop(const String& servicename);
+ static void start(const String& servicename, const String& nodename);
+ static void migrate(const String& servicename, const String& nodename);
static void restart(const String& servicename);
-
+ static void stop(const String& servicename);
};
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-09 22:50 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-09 22:50 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-03-09 22:50:08
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: ClusterModule.cpp Clusvcadm.cpp
Clusvcadm.h
Log message:
- Fix virt service disable and relocate.
- Add a "migrate" ricci call to allow for the bifurcation of relocation and live migration for virt services.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.4.1&r2=1.4.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2&r2=1.2.4.1
--- conga/ricci/docs/cluster_api.html 2007/02/05 21:27:22 1.4.4.1
+++ conga/ricci/docs/cluster_api.html 2007/03/09 22:50:08 1.4.4.2
@@ -75,15 +75,27 @@
<P>Start service ???servicename???. If ???nodename??? is specified,
service is started on that node, otherwise it will be started on a
node chosen by service manager. <BR>If service was not running, it
- is started. If it was running, it is migrated to ???nodename???.
+ is started. If it was running, it is relocated to ???nodename???.
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
service to manipulate<BR>- ???nodename??? (string) ??? optional
- name of node for service to start on/ migrate to</P>
+ name of node for service to start on / relocate to</P>
<P>No output variables.</P>
<P>On failure:<BR>- 1 ??? service manager is not running on this
managed system<BR>- generic ones</P>
</UL>
+ <LI><P>migrate_service</P>
+ <UL>
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ </P>
+ <P>Input variables:<BR>- ???servicename??? (string) ??? name of
+ the virtual service to migrate.<BR>- ???nodename??? (string) ???
+ name of node to which the virtual service is to be migrated.</P>
+ <P>No output variables.</P>
+ <P>On failure:<BR>- 1 ??? service manager is not running on this
+ managed system<BR>- generic ones</P>
+ </UL>
+
<LI><P>stop_service</P>
<UL>
<P>Stop service ???servicename???. It is not an error to stop
--- conga/ricci/modules/cluster/ClusterModule.cpp 2006/11/20 23:10:58 1.6
+++ conga/ricci/modules/cluster/ClusterModule.cpp 2007/03/09 22:50:08 1.6.2.1
@@ -36,6 +36,7 @@
static VarMap set_cluster_conf(const VarMap& args);
static VarMap cluster_status(const VarMap& args);
static VarMap service_start(const VarMap& args);
+static VarMap service_migrate(const VarMap& args);
static VarMap service_stop(const VarMap& args);
static VarMap service_restart(const VarMap& args);
static VarMap fence_node(const VarMap& args);
@@ -66,6 +67,7 @@
api_1_0["start_service"] = service_start;
api_1_0["stop_service"] = service_stop;
api_1_0["restart_service"] = service_restart;
+ api_1_0["migrate_service"] = service_migrate;
api_1_0["start_node"] = start_node;
api_1_0["stop_node"] = stop_node;
@@ -168,6 +170,29 @@
}
VarMap
+service_migrate(const VarMap& args)
+{
+ String service_name, node_name;
+ try {
+ VarMap::const_iterator iter = args.find("servicename");
+ if (iter == args.end())
+ throw APIerror("missing servicename variable");
+ service_name = iter->second.get_string();
+
+ iter = args.find("nodename");
+ if (iter != args.end())
+ node_name = iter->second.get_string();
+ } catch ( String e ) {
+ throw APIerror(e);
+ }
+
+ Clusvcadm::migrate(service_name, node_name);
+
+ VarMap ret;
+ return ret;
+}
+
+VarMap
service_restart(const VarMap& args)
{
String name;
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/08 06:04:39 1.8.2.1
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:50:08 1.8.2.2
@@ -72,7 +72,6 @@
-
void
Clusvcadm::start(const String& servicename,
const String& nodename)
@@ -80,7 +79,6 @@
pair<list<String>, list<ServiceStatus> > info = service_states();
list<String> nodes = info.first;
list<ServiceStatus> services = info.second;
- String svcname = servicename;
// check if node can run services
bool node_found = false;
@@ -106,19 +104,18 @@
flag = "-e";
else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
iter->status == ServiceStatus::RG_STATE_STARTING) {
- if (iter->vm) {
- flag = "-M";
- svcname = "vm:" + servicename;
} else
flag = "-r";
- }
if (flag.size()) {
String out, err;
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(svcname);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (nodename.size()) {
args.push_back("-m");
args.push_back(nodename);
@@ -135,6 +132,64 @@
}
void
+Clusvcadm::migrate(const String& servicename, const String& nodename)
+{
+ pair<list<String>, list<ServiceStatus> > info = service_states();
+ list<String> nodes = info.first;
+ list<ServiceStatus> services = info.second;
+
+ // check if node can run services
+ bool node_found = false;
+ for (list<String>::const_iterator iter = nodes.begin();
+ iter != nodes.end();
+ iter++)
+ if (*iter == nodename)
+ node_found = true;
+ if (!node_found && nodename.size())
+ throw String("node unable to run services");
+
+ // start
+ for (list<ServiceStatus>::const_iterator iter = services.begin();
+ iter != services.end();
+ iter++) {
+ if (!iter->vm)
+ continue;
+ if (iter->name == servicename) {
+ String flag;
+ if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
+ iter->status == ServiceStatus::RG_STATE_STOPPING ||
+ iter->status == ServiceStatus::RG_STATE_FAILED ||
+ iter->status == ServiceStatus::RG_STATE_ERROR ||
+ iter->status == ServiceStatus::RG_STATE_DISABLED)
+ flag = "-e";
+ else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
+ iter->status == ServiceStatus::RG_STATE_STARTING) {
+ flag = "-M";
+ }
+
+ if (flag.size()) {
+ String out, err;
+ int status;
+ vector<String> args;
+ args.push_back(flag);
+ args.push_back("vm:" + servicename);
+ if (nodename.size()) {
+ args.push_back("-m");
+ args.push_back(nodename);
+ }
+ if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
+ throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
+ if (status != 0)
+ throw String("clusvcadm failed");
+ }
+ return;
+ }
+ }
+
+ throw String("no such virtual service");
+}
+
+void
Clusvcadm::stop(const String& servicename)
{
pair<list<String>, list<ServiceStatus> > info = service_states();
@@ -151,7 +206,10 @@
int status;
vector<String> args;
args.push_back("-d");
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
@@ -189,7 +247,10 @@
int status;
vector<String> args;
args.push_back(flag);
- args.push_back(servicename);
+ if (iter->vm)
+ args.push_back("vm:" + servicename);
+ else
+ args.push_back(servicename);
if (utils::execute(CLUSVCADM_TOOL_PATH, args, out, err, status, false))
throw command_not_found_error_msg(CLUSVCADM_TOOL_PATH);
if (status != 0)
--- conga/ricci/modules/cluster/Clusvcadm.h 2006/08/10 22:53:08 1.2
+++ conga/ricci/modules/cluster/Clusvcadm.h 2007/03/09 22:50:08 1.2.4.1
@@ -30,11 +30,10 @@
class Clusvcadm
{
public:
- static void start(const String& servicename,
- const String& nodename);
- static void stop(const String& servicename);
+ static void start(const String& servicename, const String& nodename);
+ static void migrate(const String& servicename, const String& nodename);
static void restart(const String& servicename);
-
+ static void stop(const String& servicename);
};
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-10 4:57 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-10 4:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-03-10 04:57:47
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: Clusvcadm.cpp
Log message:
- Add recognition of the RG_STATE_MIGRATE service state
- Do not allow a service to be migrated, started, or restarted if it is currently in the process of being migrated
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- conga/ricci/docs/cluster_api.html 2007/03/09 22:48:20 1.6
+++ conga/ricci/docs/cluster_api.html 2007/03/10 04:57:47 1.7
@@ -86,7 +86,7 @@
</UL>
<LI><P>migrate_service</P>
<UL>
- <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? To migrate the virtual service, it must be started, and xend must be running and configured to allow live migration on both its current node and on ???nodename.??? If the service is not started, it will be started on ???nodename.???
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
the virtual service to migrate.<BR>- ???nodename??? (string) ???
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:48:20 1.10
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/10 04:57:47 1.11
@@ -47,7 +47,8 @@
RG_STATE_CHECK = 116, // Checking status
RG_STATE_ERROR = 117, // Recoverable error
RG_STATE_RECOVER = 118, // Pending recovery
- RG_STATE_DISABLED = 119}; // Resource not allowd to run
+ RG_STATE_DISABLED = 119, // Resource not allowd to run
+ RG_STATE_MIGRATE = 120}; // Resource migrating
ServiceStatus(const String& name,
const String& node,
@@ -96,6 +97,10 @@
iter++)
if (iter->name == servicename) {
String flag;
+
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -156,6 +161,8 @@
continue;
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is already in the process of being migrated");
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -233,6 +240,9 @@
iter++)
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-10 5:00 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-10 5:00 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-03-10 05:00:35
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: Clusvcadm.cpp
Log message:
- Add recognition of the RG_STATE_MIGRATE service state
- Do not allow a service to be migrated, started, or restarted if it is currently in the process of being migrated
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.2&r2=1.4.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.3&r2=1.7.2.4
--- conga/ricci/docs/cluster_api.html 2007/03/09 22:49:36 1.4.2.2
+++ conga/ricci/docs/cluster_api.html 2007/03/10 05:00:34 1.4.2.3
@@ -86,7 +86,7 @@
</UL>
<LI><P>migrate_service</P>
<UL>
- <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? To migrate the virtual service, it must be started, and xend must be running and configured to allow live migration on both its current node and on ???nodename.??? If the service is not started, it will be started on ???nodename.???
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
the virtual service to migrate.<BR>- ???nodename??? (string) ???
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:49:37 1.7.2.3
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/10 05:00:34 1.7.2.4
@@ -47,7 +47,8 @@
RG_STATE_CHECK = 116, // Checking status
RG_STATE_ERROR = 117, // Recoverable error
RG_STATE_RECOVER = 118, // Pending recovery
- RG_STATE_DISABLED = 119}; // Resource not allowd to run
+ RG_STATE_DISABLED = 119, // Resource not allowd to run
+ RG_STATE_MIGRATE = 120}; // Resource migrating
ServiceStatus(const String& name,
const String& node,
@@ -96,6 +97,10 @@
iter++)
if (iter->name == servicename) {
String flag;
+
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -156,6 +161,8 @@
continue;
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is already in the process of being migrated");
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -233,6 +240,9 @@
iter++)
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus ...
@ 2007-03-10 5:01 rmccabe
0 siblings, 0 replies; 6+ messages in thread
From: rmccabe @ 2007-03-10 5:01 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-03-10 05:01:19
Modified files:
ricci/docs : cluster_api.html
ricci/modules/cluster: Clusvcadm.cpp
Log message:
- Add recognition of the RG_STATE_MIGRATE service state
- Do not allow a service to be migrated, started, or restarted if it is currently in the process of being migrated
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.4.2&r2=1.4.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.2&r2=1.8.2.3
--- conga/ricci/docs/cluster_api.html 2007/03/09 22:50:08 1.4.4.2
+++ conga/ricci/docs/cluster_api.html 2007/03/10 05:01:19 1.4.4.3
@@ -86,7 +86,7 @@
</UL>
<LI><P>migrate_service</P>
<UL>
- <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? The virtual service ???servicename??? must be running, and xend must be running and configured to allow live migration on both nodes.
+ <P>Migrate the virtual service ???servicename??? to cluster node ???nodename.??? To migrate the virtual service, it must be started, and xend must be running and configured to allow live migration on both its current node and on ???nodename.??? If the service is not started, it will be started on ???nodename.???
</P>
<P>Input variables:<BR>- ???servicename??? (string) ??? name of
the virtual service to migrate.<BR>- ???nodename??? (string) ???
--- conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/09 22:50:08 1.8.2.2
+++ conga/ricci/modules/cluster/Clusvcadm.cpp 2007/03/10 05:01:19 1.8.2.3
@@ -47,7 +47,8 @@
RG_STATE_CHECK = 116, // Checking status
RG_STATE_ERROR = 117, // Recoverable error
RG_STATE_RECOVER = 118, // Pending recovery
- RG_STATE_DISABLED = 119}; // Resource not allowd to run
+ RG_STATE_DISABLED = 119, // Resource not allowd to run
+ RG_STATE_MIGRATE = 120}; // Resource migrating
ServiceStatus(const String& name,
const String& node,
@@ -96,6 +97,10 @@
iter++)
if (iter->name == servicename) {
String flag;
+
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -156,6 +161,8 @@
continue;
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is already in the process of being migrated");
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
@@ -233,6 +240,9 @@
iter++)
if (iter->name == servicename) {
String flag;
+ if (iter->status == ServiceStatus::RG_STATE_MIGRATE)
+ throw String(servicename + " is in the process of being migrated");
+
if (iter->status == ServiceStatus::RG_STATE_STOPPED ||
iter->status == ServiceStatus::RG_STATE_STOPPING ||
iter->status == ServiceStatus::RG_STATE_FAILED ||
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-10 5:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 22:48 [Cluster-devel] conga/ricci docs/cluster_api.html modules/clus rmccabe
-- strict thread matches above, loose matches on Subject: below --
2007-03-09 22:49 rmccabe
2007-03-09 22:50 rmccabe
2007-03-10 4:57 rmccabe
2007-03-10 5:00 rmccabe
2007-03-10 5:01 rmccabe
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 NNTP newsgroup(s).