From 45b90bbad7110eb1c6296a980ccc29fdc9317bac Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Oct 28 2013 11:21:31 +0000 Subject: import virt-what-1.13-3.el7.src.rpm --- diff --git a/.virt-what.metadata b/.virt-what.metadata new file mode 100644 index 0000000..2bd960a --- /dev/null +++ b/.virt-what.metadata @@ -0,0 +1 @@ +aa723938fa2cb8ebd639694812b76909499b350b SOURCES/virt-what-1.13.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-Differentiate-between-vserver-host-and-guest.patch b/SOURCES/0001-Differentiate-between-vserver-host-and-guest.patch new file mode 100644 index 0000000..38c34ef --- /dev/null +++ b/SOURCES/0001-Differentiate-between-vserver-host-and-guest.patch @@ -0,0 +1,72 @@ +From d409914d13b88541402fe871d70e3dff9d738455 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= +Date: Mon, 2 Sep 2013 15:24:11 +0100 +Subject: [PATCH 1/2] Differentiate between vserver host and guest. + +RWMJ: Update documentation and tests. +--- + tests/test-linux-vserver.sh | 3 ++- + virt-what.in | 5 +++++ + virt-what.pod | 12 ++++++++++++ + 3 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/tests/test-linux-vserver.sh b/tests/test-linux-vserver.sh +index 40d75a5..7988f81 100755 +--- a/tests/test-linux-vserver.sh ++++ b/tests/test-linux-vserver.sh +@@ -19,7 +19,8 @@ + root=tests/linux-vserver + + output="$(./virt-what --test-root=$root 2>&1)" +-expected="linux_vserver" ++expected="linux_vserver ++linux_vserver-guest" + + if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" +diff --git a/virt-what.in b/virt-what.in +index f12c95b..422f6d0 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -147,6 +147,11 @@ fi + # Check for Linux-VServer + if cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then + echo linux_vserver ++ if grep -q "VxID: 0$" "${root}/proc/self/status"; then ++ echo linux_vserver-host ++ else ++ echo linux_vserver-guest ++ fi + fi + + # Check for UML. +diff --git a/virt-what.pod b/virt-what.pod +index 98cd4af..bff2998 100644 +--- a/virt-what.pod ++++ b/virt-what.pod +@@ -62,10 +62,22 @@ Status: confirmed by RWMJ using a Fedora guest running in z/VM + + =item B + ++This is printed for backwards compatibility with older virt-what which ++could not distinguish between a Linux VServer container guest and ++host. ++ ++=item B ++ + This process is running in a Linux VServer container. + + Status: contributed by Barış Metin + ++=item B ++ ++This process is running as the Linux VServer host (VxID 0). ++ ++Status: contributed by Barış Metin and Elan Ruusamäe ++ + =item B + + This process is running in a Linux LXC container. +-- +1.8.3.1 + diff --git a/SOURCES/0001-xen-Don-t-emit-warning-message-if-proc-xen-capabilit.patch b/SOURCES/0001-xen-Don-t-emit-warning-message-if-proc-xen-capabilit.patch new file mode 100644 index 0000000..456c96b --- /dev/null +++ b/SOURCES/0001-xen-Don-t-emit-warning-message-if-proc-xen-capabilit.patch @@ -0,0 +1,35 @@ +From 8709c0e87dc3124b1a64d85654d6d4904702d767 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 28 Oct 2013 11:09:24 +0000 +Subject: [PATCH] xen: Don't emit warning message if /proc/xen/capabilities + file does not exist. + +On Amazon EC2: + +xen +grep: /proc/xen/capabilities: No such file or directory +xen-domU + +The warning is harmless but should not be printed. + +Thanks: Can Zhang for testing. +--- + virt-what.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/virt-what.in b/virt-what.in +index bf663aa..4b6d3b8 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -199,7 +199,7 @@ if [ "$cpuid" = "XenVMMXenVMM" ]; then + skip_qemu_kvm=true + elif [ -d "${root}/proc/xen" ]; then + echo xen +- if grep -q "control_d" "${root}/proc/xen/capabilities"; then ++ if grep -q "control_d" "${root}/proc/xen/capabilities" 2>/dev/null; then + echo xen-dom0 + else + echo xen-domU +-- +1.8.3.1 + diff --git a/SOURCES/0002-Detect-new-Xen-VMs-RHBZ-973663.patch b/SOURCES/0002-Detect-new-Xen-VMs-RHBZ-973663.patch new file mode 100644 index 0000000..a161b63 --- /dev/null +++ b/SOURCES/0002-Detect-new-Xen-VMs-RHBZ-973663.patch @@ -0,0 +1,25 @@ +From acd6bec92a99550ad98011d44f6381fdf7fa5992 Mon Sep 17 00:00:00 2001 +From: nodata +Date: Mon, 2 Sep 2013 16:59:32 +0100 +Subject: [PATCH 2/2] Detect new Xen VMs (RHBZ#973663). + +--- + virt-what.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/virt-what.in b/virt-what.in +index 422f6d0..bf663aa 100644 +--- a/virt-what.in ++++ b/virt-what.in +@@ -197,7 +197,7 @@ fi + if [ "$cpuid" = "XenVMMXenVMM" ]; then + echo xen; echo xen-hvm + skip_qemu_kvm=true +-elif [ -f "${root}/proc/xen/capabilities" ]; then ++elif [ -d "${root}/proc/xen" ]; then + echo xen + if grep -q "control_d" "${root}/proc/xen/capabilities"; then + echo xen-dom0 +-- +1.8.3.1 + diff --git a/SPECS/virt-what.spec b/SPECS/virt-what.spec new file mode 100644 index 0000000..283e9d6 --- /dev/null +++ b/SPECS/virt-what.spec @@ -0,0 +1,156 @@ +Name: virt-what +Version: 1.13 +Release: 3%{?dist} +Summary: Detect if we are running in a virtual machine +License: GPLv2+ + +URL: http://people.redhat.com/~rjones/virt-what/ +Source0: http://people.redhat.com/~rjones/virt-what/files/%{name}-%{version}.tar.gz + +Patch1: 0001-Differentiate-between-vserver-host-and-guest.patch +Patch2: 0002-Detect-new-Xen-VMs-RHBZ-973663.patch +Patch3: 0001-xen-Don-t-emit-warning-message-if-proc-xen-capabilit.patch + +# This is provided by the build root, but we make it explicit +# anyway in case this was dropped from the build root in future. +BuildRequires: /usr/bin/pod2man + +# Required at build time in order to do 'make check' (for getopt). +BuildRequires: util-linux + +# virt-what script uses dmidecode and getopt (from util-linux). +# RPM cannot detect this so make the dependencies explicit here. +%ifarch %{ix86} x86_64 +Requires: dmidecode +%endif +Requires: util-linux + + +%description +virt-what is a shell script which can be used to detect if the program +is running in a virtual machine. + +The program prints out a list of "facts" about the virtual machine, +derived from heuristics. One fact is printed per line. + +If nothing is printed and the script exits with code 0 (no error), +then it can mean either that the program is running on bare-metal or +the program is running inside a type of virtual machine which we don't +know about or can't detect. + +Current types of virtualization detected: + + - hyperv Microsoft Hyper-V + - kvm Linux Kernel Virtual Machine (KVM) + - openvz OpenVZ or Virtuozzo + - powervm_lx86 IBM PowerVM Lx86 Linux/x86 emulator + - qemu QEMU (unaccelerated) + - uml User-Mode Linux (UML) + - virtage Hitachi Virtualization Manager (HVM) Virtage LPAR + - virtualbox VirtualBox + - virtualpc Microsoft VirtualPC + - vmware VMware + - xen Xen + - xen-dom0 Xen dom0 (privileged domain) + - xen-domU Xen domU (paravirtualized guest domain) + - xen-hvm Xen guest fully virtualized (HVM) + + +%prep +%setup -q + +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + + +%build +%configure +make + + +%install +make install DESTDIR=$RPM_BUILD_ROOT + + +%check +make check + + +%files +%doc README COPYING +%{_sbindir}/virt-what +%{_libexecdir}/virt-what-cpuid-helper +%{_mandir}/man1/*.1* + + +%changelog +* Mon Oct 28 2013 Richard W.M. Jones - 1.13-3 +- Suppress warning message on Amazon EC2: + "grep: /proc/xen/capabilities: No such file or directory" + +* Wed Sep 11 2013 Richard W.M. Jones - 1.13-2 +- Include two upstream patches for detecting Xen and Linux VServer better + (RHBZ#973663). +- Modernize the spec file. + +* Mon Jul 29 2013 Richard W.M. Jones - 1.13-1 +- New upstream version 1.13. + +* Fri Feb 15 2013 Fedora Release Engineering - 1.12-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 1.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Mar 17 2012 Richard W.M. Jones - 1.12-1 +- New upstream version 1.12. + +* Wed Feb 29 2012 Richard W.M. Jones - 1.11-3 +- Remove ExclusiveArch, but don't require dmidecode except on + i?86 and x86-64 (RHBZ#791370). + +* Sat Jan 14 2012 Fedora Release Engineering - 1.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri May 27 2011 Richard W.M. Jones - 1.11-1 +- New upstream version 1.11. + +* Wed May 25 2011 Richard W.M. Jones - 1.10-1 +- New upstream version 1.10. + +* Tue Mar 8 2011 Richard W.M. Jones - 1.9-1 +- New upstream version 1.9. + +* Mon Feb 07 2011 Fedora Release Engineering - 1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 31 2011 Richard W.M. Jones - 1.8-1 +- New upstream version 1.8. + +* Thu Jan 20 2011 Richard W.M. Jones - 1.7-1 +- New upstream version 1.7. + +* Wed Jan 19 2011 Richard W.M. Jones - 1.6-2 +- New upstream version 1.6. +- BuildRequires 'getopt' from util-linux-ng. + +* Tue Jan 18 2011 Richard W.M. Jones - 1.5-1 +- New upstream version 1.5. +- Add 'make check' section. + +* Tue Jan 18 2011 Richard W.M. Jones - 1.4-1 +- New upstream version 1.4. +- More hypervisor types detected. + +* Thu Oct 28 2010 Richard W.M. Jones - 1.3-4 +- Move configure into build (not prep). + +* Thu Oct 28 2010 Richard W.M. Jones - 1.3-3 +- Initial import into Fedora. + +* Tue Oct 19 2010 Richard W.M. Jones - 1.3-2 +- Make changes suggested by reviewer (RHBZ#644259). + +* Tue Oct 19 2010 Richard W.M. Jones - 1.3-1 +- Initial release.