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 luci/site/luci/Extensions/ricci_communic ...
Date: 20 Nov 2006 22:12:06 -0000	[thread overview]
Message-ID: <20061120221206.4677.qmail@sourceware.org> (raw)

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()
 {



             reply	other threads:[~2006-11-20 22:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-20 22:12 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-20 22:11 [Cluster-devel] conga luci/site/luci/Extensions/ricci_communic rmccabe
2006-08-24 20:15 kupcevic

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