Author: lidongyang Date: Tue Jun 7 10:55:37 2011 New Revision: 64243 URL: http://svn.opensuse.org/viewcvs/yast?rev=64243&view=rev Log: Add a helper to tell if we have KVM hypervisor running Modified: trunk/yast2/library/modules/Arch.ycp Modified: trunk/yast2/library/modules/Arch.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/modules/Arch.ycp?rev=64243&r1=64242&r2=64243&view=diff ============================================================================== --- trunk/yast2/library/modules/Arch.ycp (original) +++ trunk/yast2/library/modules/Arch.ycp Tue Jun 7 10:55:37 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@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org