[packages/ruby-ohai] reorder vserver virtualization, so that vbox takes preference

glen glen at pld-linux.org
Sun May 26 00:18:13 CEST 2013


commit 410d4b640b12a31777bba84c76161b637f2656f7
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun May 26 01:17:03 2013 +0300

    reorder vserver virtualization, so that vbox takes preference
    
    in pld, all kernels have vserver host support, and such kernel in vbox
    should have vbox guest as virtualization, not "vserver host"

 ruby-ohai.spec               |  4 +++-
 virtualization-vserver.patch | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
---
diff --git a/ruby-ohai.spec b/ruby-ohai.spec
index d882d4d..ee86c1f 100644
--- a/ruby-ohai.spec
+++ b/ruby-ohai.spec
@@ -6,11 +6,12 @@
 Summary:	Profiles your system and emits JSON
 Name:		ruby-%{gemname}
 Version:	6.16.0
-Release:	1
+Release:	2
 License:	Apache v2.0
 Group:		Development/Languages
 Source0:	https://github.com/opscode/ohai/archive/%{version}.tar.gz
 # Source0-md5:	5c00b0ba4c313bedfec62cd5e1525551
+Patch0:		virtualization-vserver.patch
 URL:		http://docs.opscode.com/ohai.html
 BuildRequires:	rpm-rubyprov
 BuildRequires:	rpmbuild(macros) >= 1.656
@@ -50,6 +51,7 @@ This package contains documentation for %{name}.
 
 %prep
 %setup -q -n ohai-%{version}
+%patch0 -p1
 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/*
 
 # no plist and not darwin so don't care
diff --git a/virtualization-vserver.patch b/virtualization-vserver.patch
new file mode 100644
index 0000000..54b9080
--- /dev/null
+++ b/virtualization-vserver.patch
@@ -0,0 +1,41 @@
+--- ohai-6.16.0/lib/ohai/plugins/linux/virtualization.rb~	2013-01-17 21:03:16.000000000 +0200
++++ ohai-6.16.0/lib/ohai/plugins/linux/virtualization.rb	2013-05-25 20:52:31.871480338 +0300
+@@ -23,6 +23,20 @@
+ # if it is possible to detect paravirt vs hardware virt, it should be put in
+ # virtualization[:mechanism]
+ 
++# Detect Linux-VServer
++if File.exists?("/proc/self/status")
++  proc_self_status = File.read("/proc/self/status")
++  vxid = proc_self_status.match(/^(s_context|VxID): (\d+)$/)
++  if vxid and vxid[2]
++    virtualization[:system] = "linux-vserver"
++    if vxid[2] == "0"
++      virtualization[:role] = "host"
++    else
++      virtualization[:role] = "guest"
++     end
++  end
++end
++
+ ## Xen
+ # /proc/xen is an empty dir for EL6 + Linode Guests
+ if File.exists?("/proc/xen")
+@@ -109,17 +123,3 @@
+ 
+   end
+ end
+-
+-# Detect Linux-VServer
+-if File.exists?("/proc/self/status")
+-  proc_self_status = File.read("/proc/self/status")
+-  vxid = proc_self_status.match(/^(s_context|VxID): (\d+)$/)
+-  if vxid and vxid[2]
+-    virtualization[:system] = "linux-vserver"
+-    if vxid[2] == "0"
+-      virtualization[:role] = "host"
+-    else
+-      virtualization[:role] = "guest"
+-     end
+-  end
+-end
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ruby-ohai.git/commitdiff/410d4b640b12a31777bba84c76161b637f2656f7



More information about the pld-cvs-commit mailing list