Mailinglist Archive: yast-commit (396 mails)

< Previous Next >
[yast-commit] r65177 - /branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp
Author: charlesa
Date: Wed Aug 3 21:42:53 2011
New Revision: 65177

URL: http://svn.opensuse.org/viewcvs/yast?rev=65177&view=rev
Log:
Added an is_kvm() function. See fate#311371

Modified:
branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp

Modified: branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp?rev=65177&r1=65176&r2=65177&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/library/modules/Arch.ycp Wed Aug 3
21:42:53 2011
@@ -34,6 +34,9 @@
// Xen dom0
boolean _is_xen0 = nil;

+// KVM
+boolean _is_kvm = nil;
+
/* ************************************************************ */
/* system architecture */

@@ -447,6 +450,26 @@
}

/* ************************************************************ */
+/* KVM stuff */
+
+/**
+ * true if KVM is running
+ *
+ * @return true if we are running on KVM hypervisor
+ */
+global boolean is_kvm () {
+ if (_is_kvm == nil) {
+ // KVM hypervisor has /dev/kvm file
+ map stat = (map)SCR::Read(.target.stat, "/dev/kvm");
+ y2milestone("stat /dev/kvm: %1", stat);
+
+ _is_kvm = (size(stat) > 0);
+ }
+
+ return _is_kvm;
+}
+
+/* ************************************************************ */
/* SMP stuff */

/**

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages