cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] conga luci/site/luci/Extensions/ricci_communic ...
@ 2006-08-24 20:15 kupcevic
  0 siblings, 0 replies; 3+ messages in thread
From: kupcevic @ 2006-08-24 20:15 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2006-08-24 20:15:30

Modified files:
	luci/site/luci/Extensions: ricci_communicator.py 
	ricci/ricci    : Ricci.cpp 

Log message:
	xen: domain-0 detection

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&r1=1.16&r2=1.17

--- conga/luci/site/luci/Extensions/ricci_communicator.py	2006/06/21 23:07:06	1.3
+++ conga/luci/site/luci/Extensions/ricci_communicator.py	2006/08/24 20:15:23	1.4
@@ -33,6 +33,7 @@
         self.__clualias = hello.firstChild.getAttribute('clusteralias')
         self.__reported_hostname = hello.firstChild.getAttribute('hostname')
         self.__os = hello.firstChild.getAttribute('os')
+        self.__dom0 = hello.firstChild.getAttribute('xen_host') == 'true'
         
         pass
     
@@ -49,6 +50,8 @@
         return (self.__cluname, self.__clualias)
     def os(self):
         return self.__os
+    def dom0(self):
+        return self.__dom0
     
     
     def auth(self, password):
@@ -211,6 +214,8 @@
     return ricci.system_name()
 def ricci_get_os(self, ricci):
     return ricci.os()
+def ricci_get_dom0(self, ricci):
+    return ricci.dom0()
 def ricci_get_cluster_info(self, ricci):
     return ricci.cluster_info()
 def ricci_get_authenticated(self, ricci):
--- conga/ricci/ricci/Ricci.cpp	2006/08/14 23:53:21	1.16
+++ conga/ricci/ricci/Ricci.cpp	2006/08/24 20:15:29	1.17
@@ -43,6 +43,7 @@
 using namespace std;
 
 
+static bool dom0();
 static String hostname();
 static pair<String, String> clusterinfo();
 static String os_release();
@@ -83,6 +84,9 @@
       String os = os_release();
       if (os.size())
 	header.set_attr("os", os);
+      
+      header.set_attr("xen_host", 
+		      dom0() ? "true" : "false");
     }
   }
   
@@ -529,3 +533,25 @@
     return "";
   }
 }
+
+bool 
+dom0()
+{
+  try {
+    String out, err;
+    int status;
+    vector<String> args;
+    args.push_back("nodeinfo");
+    if (utils::execute("/usr/bin/virsh",
+		       args,
+		       out,
+		       err,
+		       status,
+		       false))
+      throw String("execution of virsh failed");
+    if (status == 0)
+      return true;
+  } catch ( ... ) {}
+  
+  return false;
+}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] conga luci/site/luci/Extensions/ricci_communic ...
@ 2006-11-20 22:11 rmccabe
  0 siblings, 0 replies; 3+ messages in thread
From: rmccabe @ 2006-11-20 22:11 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-11-20 22:11:22

Modified files:
	luci/site/luci/Extensions: ricci_communicator.py 
	ricci/ricci    : Ricci.cpp 

Log message:
	add support for determining whether we're a virtual machine to ricci

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&r1=1.19&r2=1.20

--- conga/luci/site/luci/Extensions/ricci_communicator.py	2006/11/12 02:10:53	1.19
+++ conga/luci/site/luci/Extensions/ricci_communicator.py	2006/11/20 22:11:21	1.20
@@ -62,6 +62,7 @@
         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
     
@@ -90,6 +91,10 @@
         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):
@@ -359,6 +364,8 @@
     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):
--- conga/ricci/ricci/Ricci.cpp	2006/10/23 18:43:36	1.19
+++ conga/ricci/ricci/Ricci.cpp	2006/11/20 22:11:21	1.20
@@ -45,6 +45,7 @@
 
 
 static bool dom0();
+static bool domU();
 static String hostname();
 static pair<String, String> clusterinfo();
 static String os_release();
@@ -88,6 +89,9 @@
       
       header.set_attr("xen_host", 
 		      dom0() ? "true" : "false");
+
+      header.set_attr("xen_guest", 
+		      domU() ? "true" : "false");
     }
   }
   
@@ -499,6 +503,26 @@
   }
 }
 
+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()
 {



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cluster-devel] conga luci/site/luci/Extensions/ricci_communic ...
@ 2006-11-20 22:12 rmccabe
  0 siblings, 0 replies; 3+ messages in thread
From: rmccabe @ 2006-11-20 22:12 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2006-11-20 22:12:06

Modified files:
	luci/site/luci/Extensions: ricci_communicator.py 
	ricci/ricci    : Ricci.cpp 

Log message:
	add support for determining whether we're a virtual machine to ricci

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.4&r2=1.9.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.1&r2=1.18.2.2

--- conga/luci/site/luci/Extensions/ricci_communicator.py	2006/11/16 19:34:53	1.9.2.4
+++ conga/luci/site/luci/Extensions/ricci_communicator.py	2006/11/20 22:12:06	1.9.2.5
@@ -62,6 +62,7 @@
         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
     
@@ -90,6 +91,10 @@
         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):
@@ -359,6 +364,8 @@
     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):
--- conga/ricci/ricci/Ricci.cpp	2006/10/23 21:13:22	1.18.2.1
+++ conga/ricci/ricci/Ricci.cpp	2006/11/20 22:12:06	1.18.2.2
@@ -45,6 +45,7 @@
 
 
 static bool dom0();
+static bool domU();
 static String hostname();
 static pair<String, String> clusterinfo();
 static String os_release();
@@ -88,6 +89,9 @@
       
       header.set_attr("xen_host", 
 		      dom0() ? "true" : "false");
+
+      header.set_attr("xen_guest", 
+		      domU() ? "true" : "false");
     }
   }
   
@@ -499,6 +503,26 @@
   }
 }
 
+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()
 {



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-20 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-24 20:15 [Cluster-devel] conga luci/site/luci/Extensions/ricci_communic kupcevic
  -- strict thread matches above, loose matches on Subject: below --
2006-11-20 22:11 rmccabe
2006-11-20 22:12 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).