From 67ca5da58fce97bb8988779537db902b85c05203 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 28 Feb 2013 14:27:56 +0100 Subject: [PATCH] dom0: include qubes-hcl-report for collecting HCL entries Thanks to Zrubecz Laszlo --- dom0/qvm-tools/qubes-hcl-report | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 dom0/qvm-tools/qubes-hcl-report diff --git a/dom0/qvm-tools/qubes-hcl-report b/dom0/qvm-tools/qubes-hcl-report new file mode 100755 index 00000000..06c3db7b --- /dev/null +++ b/dom0/qvm-tools/qubes-hcl-report @@ -0,0 +1,75 @@ +#!/bin/bash + +if [[ -z $1 ]] + then + echo "ERROR: Required parameter missing: 'AppVM name'" + exit 1 +fi + +DATE=`date +%Y%m%d` + +BRAND=`sudo dmidecode |grep -A9 "System Information" |grep "Manufacturer:" |cut -d ' ' -f2- |tr -s [:blank:] _` +PRODUCT=`sudo dmidecode |grep -A9 "System Information" |grep "Product Name:" |cut -d ' ' -f3- |tr -s [:blank:] _` + +CPU=`sudo cat /proc/cpuinfo |grep "model name" |sort -u |cut -d ' ' -f3-` +CHIPSET=`sudo lspci -nn |grep "00:00.0.*Host bridge"` +VGA=`sudo lspci -nn |grep "VGA"` +BIOS=`sudo dmidecode |grep -A9 "BIOS Information" |grep Version |cut -d ' ' -f2-` +XLINFO=`xl info |grep virt_caps` + +FILENAME="Qubes-HCL-$BRAND-$PRODUCT-$DATE" + +if [[ "$XLINFO" =~ "hvm_directio" ]] + then + VTX="Active" + VTD="Active" + + elif [[ "$XLINFO" =~ "hvm" ]] + then + VTX="Active" + VTD="Not Active" + + else + VTX="Not Active" + VTD="Not Active" +fi + +cat /etc/qubes-release |tee ~/$FILENAME.txt +echo +echo -e "Model Name:\t$BRAND $PRODUCT\n" |tee -a ~/$FILENAME.txt +echo -e "Chipset:\t$CHIPSET" |tee -a ~/$FILENAME.txt +echo -e "VGA:\t\t$VGA" |tee -a ~/$FILENAME.txt +echo -e "CPU:\t\t$CPU" |tee -a ~/$FILENAME.txt +echo -e "BIOS:\t\t$BIOS" |tee -a ~/$FILENAME.txt +echo -e "VT-x:\t\t$VTX" |tee -a ~/$FILENAME.txt +echo -e "VT-d:\t\t$VTD" |tee -a ~/$FILENAME.txt +echo + +TEMP_DIR=`mktemp -d` +sudo cat /etc/qubes-release > $TEMP_DIR/qubes-release +sudo cat /proc/cpuinfo > $TEMP_DIR/cpuinfo +sudo lspci -nnvk > $TEMP_DIR/lspci +sudo dmidecode > $TEMP_DIR/dmidecode +sudo xl info > $TEMP_DIR/xl + + +# cpio +cd $TEMP_DIR +find -print0 |cpio --quiet -o -H crc --null |gzip >~/$FILENAME.cpio.gz +cd + +# Copy to VM +qvm-start -q $1 2>/dev/null +cat ~/$FILENAME.cpio.gz | qvm-run -a -q --pass-io $1 "cat >/home/user/$FILENAME.cpio.gz" +cat ~/$FILENAME.txt | qvm-run -a -q --pass-io $1 "cat >/home/user/$FILENAME.txt" + +echo -e "Qubes HCL Support files are copied to AppVM: $1" +echo -e "\t$FILENAME.txt\t\t- HCL Info" +echo -e "\t$FILENAME.cpio.gz\t- HCL Support Files" + +# cleanup +if [[ -d $TEMP_DIR ]] + then + rm -rf $TEMP_DIR +fi +