From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga luci/site/luci/Extensions/ricci_bridge.p ...
Date: 20 Nov 2006 23:10:59 -0000 [thread overview]
Message-ID: <20061120231059.6031.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-20 23:10:58
Modified files:
luci/site/luci/Extensions: ricci_bridge.py ricci_communicator.py
ricci/modules/cluster: ClusterModule.cpp Makefile
ricci/ricci : Ricci.cpp
Added files:
ricci/modules/cluster: Virt.cpp Virt.h
ricci/test_suite/cluster: is_virtual.xml
Log message:
dmidecode needs to read /dev/mem, so it can't run as the ricci user; move it into the cluster module
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Virt.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Virt.h.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Makefile.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/cluster/is_virtual.xml.diff?cvsroot=cluster&r1=NONE&r2=1.1
--- conga/luci/site/luci/Extensions/ricci_bridge.py 2006/11/16 20:20:49 1.44
+++ conga/luci/site/luci/Extensions/ricci_bridge.py 2006/11/20 23:10:57 1.45
@@ -503,6 +503,15 @@
ricci_xml = rc.batch_run(batch_str)
return batchAttemptResult(ricci_xml)
+def nodeIsVirtual(rc):
+ batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="virt_guest"/></request></module>'
+
+ ricci_xml = rc.batch_run(batch_str, async=False)
+ if not ricci_xml or not ricci_xml.firstChild:
+ luci_log.debug_verbose('no ricci_xml in nodeIsVirtual')
+ return None
+ return ricci_xml.firstChild
+
def getDaemonStates(rc, dlist):
batch_str = '<module name="service"><request API_version="1.0"><function_call name="query"><var mutable="false" name="search" type="list_xml">'
--- conga/luci/site/luci/Extensions/ricci_communicator.py 2006/11/20 22:11:21 1.20
+++ conga/luci/site/luci/Extensions/ricci_communicator.py 2006/11/20 23:10:57 1.21
@@ -62,7 +62,6 @@
self.__reported_hostname = hello.firstChild.getAttribute('hostname')
self.__os = hello.firstChild.getAttribute('os')
self.__dom0 = hello.firstChild.getAttribute('xen_host') == 'true'
- self.__domU = hello.firstChild.getAttribute('xen_guest') == 'true'
pass
@@ -91,11 +90,6 @@
luci_log.debug_verbose('RC:dom0: [auth %d] reported system_name = %s for %s' \
% (self.__authed, self.__dom0, self.__hostname))
return self.__dom0
- def domU(self):
- luci_log.debug_verbose('RC:domU: [auth %d] reported system_name = %s for %s' \
- % (self.__authed, self.__domU, self.__hostname))
- return self.__domU
-
def auth(self, password):
if self.authed():
@@ -364,8 +358,6 @@
return ricci.os()
def ricci_get_dom0(self, ricci):
return ricci.dom0()
-def ricci_get_domU(self, ricci):
- return ricci.domU()
def ricci_get_cluster_info(self, ricci):
return ricci.cluster_info()
def ricci_get_authenticated(self, ricci):
/cvs/cluster/conga/ricci/modules/cluster/Virt.cpp,v --> standard output
revision 1.1
--- conga/ricci/modules/cluster/Virt.cpp
+++ - 2006-11-20 23:10:59.031150000 +0000
@@ -0,0 +1,40 @@
+/*
+ Copyright Red Hat, Inc. 2006
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+ MA 02139, USA.
+*/
+
+#include "Virt.h"
+#include "utils.h"
+
+using namespace std;
+
+bool Virt::virt_guest(void) {
+ try {
+ String out, err;
+ int status;
+ vector<String> args;
+ if (utils::execute(DMIDECODE_PATH, args, out, err, status, false))
+ throw command_not_found_error_msg(DMIDECODE_PATH);
+ if (status != 0)
+ throw String("dmidecode failed");
+ if (out.find("Vendor: Xen") != out.npos)
+ return true;
+ if (out.find("Manufacturer: Xen") != out.npos)
+ return true;
+ } catch ( ... ) {}
+ return false;
+}
/cvs/cluster/conga/ricci/modules/cluster/Virt.h,v --> standard output
revision 1.1
--- conga/ricci/modules/cluster/Virt.h
+++ - 2006-11-20 23:10:59.110523000 +0000
@@ -0,0 +1,32 @@
+/*
+ Copyright Red Hat, Inc. 2006
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+ MA 02139, USA.
+*/
+
+#ifndef __RICCI_CLUSTER_VIRT_H
+#define __RICCI_CLUSTER_VIRT_H
+
+#include "String.h"
+
+#define DMIDECODE_PATH "/usr/sbin/dmidecode"
+
+class Virt {
+ public:
+ static bool virt_guest(void);
+};
+
+#endif
--- conga/ricci/modules/cluster/ClusterModule.cpp 2006/10/05 17:38:01 1.5
+++ conga/ricci/modules/cluster/ClusterModule.cpp 2006/11/20 23:10:58 1.6
@@ -26,6 +26,7 @@
#include "ClusterStatus.h"
#include "Clusvcadm.h"
#include "Fence.h"
+#include "Virt.h"
using namespace std;
@@ -40,6 +41,7 @@
static VarMap fence_node(const VarMap& args);
static VarMap start_node(const VarMap& args);
static VarMap stop_node(const VarMap& args);
+static VarMap virt_guest(const VarMap& args);
static ApiFcnMap build_fcn_map();
@@ -68,6 +70,7 @@
api_1_0["start_node"] = start_node;
api_1_0["stop_node"] = stop_node;
api_1_0["fence_node"] = fence_node;
+ api_1_0["virt_guest"] = virt_guest;
ApiFcnMap api_fcn_map;
@@ -183,6 +186,16 @@
return ret;
}
+VarMap
+virt_guest(const VarMap& args)
+{
+ Variable var("virt_guest", Virt::virt_guest());
+
+ VarMap ret;
+ ret.insert(pair<String, Variable>(var.name(), var));
+ return ret;
+}
+
VarMap
fence_node(const VarMap& args)
{
--- conga/ricci/modules/cluster/Makefile 2006/08/16 06:34:19 1.14
+++ conga/ricci/modules/cluster/Makefile 2006/11/20 23:10:58 1.15
@@ -21,7 +21,8 @@
ClusterConf.o \
ClusterStatus.o \
Clusvcadm.o \
- Fence.o
+ Fence.o \
+ Virt.o
INCLUDE +=
--- conga/ricci/ricci/Ricci.cpp 2006/11/20 22:11:21 1.20
+++ conga/ricci/ricci/Ricci.cpp 2006/11/20 23:10:58 1.21
@@ -45,7 +45,6 @@
static bool dom0();
-static bool domU();
static String hostname();
static pair<String, String> clusterinfo();
static String os_release();
@@ -89,9 +88,6 @@
header.set_attr("xen_host",
dom0() ? "true" : "false");
-
- header.set_attr("xen_guest",
- domU() ? "true" : "false");
}
}
@@ -503,26 +499,6 @@
}
}
-bool domU(void) {
- try {
- String out, err;
- int status;
- vector<String> args;
- if (utils::execute("/usr/sbin/dmidecode",
- args, out, err, status, false))
- {
- throw command_not_found_error_msg("/usr/sbin/dmidecode");
- }
- if (status != 0)
- return false;
- if (out.find("Vendor: Xen") != out.npos)
- return true;
- if (out.find("Manufacturer: Xen") != out.npos)
- return true;
- } catch ( ... ) {}
- return false;
-}
-
bool
dom0()
{
/cvs/cluster/conga/ricci/test_suite/cluster/is_virtual.xml,v --> standard output
revision 1.1
--- conga/ricci/test_suite/cluster/is_virtual.xml
+++ - 2006-11-20 23:10:59.476119000 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<ricci version="1.0" function="process_batch" async="false">
+<batch>
+
+<module name="cluster">
+<request sequence="1254" API_version="1.0">
+<function_call name="virt_guest" />
+</request>
+</module>
+
+</batch>
+</ricci>
+
reply other threads:[~2006-11-20 23:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20061120231059.6031.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/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.