Suppress warning message on Amazon EC2:

"grep: /proc/xen/capabilities: No such file or directory"
This commit is contained in:
Richard W.M. Jones 2013-10-28 11:13:58 +00:00
parent 66aa533ad2
commit ef2238cb2f
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 8709c0e87dc3124b1a64d85654d6d4904702d767 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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

View File

@ -1,6 +1,6 @@
Name: virt-what
Version: 1.13
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Detect if we are running in a virtual machine
License: GPLv2+
@ -9,6 +9,7 @@ Source0: http://people.redhat.com/~rjones/virt-what/files/%{name}-%{versi
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.
@ -60,6 +61,7 @@ Current types of virtualization detected:
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
@ -83,6 +85,10 @@ make check
%changelog
* Mon Sep 28 2013 Richard W.M. Jones <rjones@redhat.com> - 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 <rjones@redhat.com> - 1.13-2
- Include two upstream patches for detecting Xen and Linux VServer better
(RHBZ#973663).