All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci modules/cluster/ClusterModule.cpp  ...
Date: 20 Nov 2006 23:15:05 -0000	[thread overview]
Message-ID: <20061120231505.8203.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2006-11-20 23:15:04

Modified files:
	ricci/modules/cluster: ClusterModule.cpp Makefile 
	ricci/ricci    : Ricci.cpp 
Added files:
	ricci/modules/cluster: Virt.cpp Virt.h 

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/ricci/modules/cluster/Virt.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Virt.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.14&r2=1.14.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.2&r2=1.18.2.3

/cvs/cluster/conga/ricci/modules/cluster/Virt.cpp,v  -->  standard output
revision 1.1.2.1
--- conga/ricci/modules/cluster/Virt.cpp
+++ -	2006-11-20 23:15:04.985132000 +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.2.1
--- conga/ricci/modules/cluster/Virt.h
+++ -	2006-11-20 23:15:05.274878000 +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:15:03	1.5.2.1
@@ -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:15:03	1.14.2.1
@@ -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:12:06	1.18.2.2
+++ conga/ricci/ricci/Ricci.cpp	2006/11/20 23:15:04	1.18.2.3
@@ -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()
 {



             reply	other threads:[~2006-11-20 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-20 23:15 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-23 18:47 [Cluster-devel] conga/ricci modules/cluster/ClusterModule.cpp rmccabe

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=20061120231505.8203.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.