[virt-tools-list] virt-what patch, questions

otheus uibk otheus.uibk at gmail.com
Wed Mar 23 13:13:29 UTC 2016


I stupidly omitted the Subject from my last email.

1. Why is dmidecode not setuid?  If it were, running virt-what as non-root
would be a non-issue.

2. Why the possibility of outputting multiple lines. Programming laziness?
Or do programs now rely on this as a feature?  I propose replacing all
instances of "echo" with something like "report" where report is a function
call:

   report() { echo "$*" ; exit 0; }

3. Proposed patches to acknowledge RedHat Virtualization.

The relevant code is taken from facter v2.4.6,
files /usr/share/ruby/vendor_ruby/facter/virtual.rb:134 and
/usr/share/ruby/vendor_ruby/facter/virtual.rb:175 except that the latter
also matches for xen and must be improved here:

diff --git a/virt-what.in b/virt-what.in
index 776bfde..67bbc67 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -114,6 +114,13 @@ elif echo "$dmi" | grep -q 'Manufacturer: VMware'; then
     echo vmware
 fi

+# Check for RedHat Virtualization
+if grep -q 'RHEV Hypervisor'
"${root}/sys/devices/virtual/dmi/id/product_name"; then
+    echo rhev; exit;
+elif echo "$dmi" | grep -q '[[:space:]]Product Name: RHEV Hypervisor'; then
+    echo rhev; exit;
+fi 2>/dev/null
+
 # Check for Hyper-V.
 #
http://blogs.msdn.com/b/sqlosteam/archive/2010/10/30/is-this-real-the-metaphysics-of-hardware-virtuali
 if [ "$cpuid" = "Microsoft Hv" ]; then


I also wrote the test cases. That's in the next mail.


-- 
Otheus
otheus.uibk at gmail.com
otheus.shelling at uibk.ac.at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20160323/92601a84/attachment.htm>


More information about the virt-tools-list mailing list