You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/09/07 10:41:31 UTC

[cloudstack] branch 4.11 updated: systemvmtemplate: Fixes: #2760 Fix SystemVMs running in Xen HVM mode are not configured (#2824)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 4b4555b  systemvmtemplate: Fixes: #2760 Fix SystemVMs running in Xen HVM mode are not configured (#2824)
4b4555b is described below

commit 4b4555bff78882221f5d7d2808cc41d7d6ac1670
Author: David Passante <da...@orange.com>
AuthorDate: Fri Sep 7 12:41:23 2018 +0200

    systemvmtemplate: Fixes: #2760 Fix SystemVMs running in Xen HVM mode are not configured (#2824)
    
    Set hypervisor to xen-hvm when virt-what detects both HyperV cpuid and xen-domU.
---
 .../debian/opt/cloud/bin/setup/cloud-early-config   | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
index 9baed01..99acb86 100755
--- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
+++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
@@ -35,14 +35,8 @@ log_it() {
 }
 
 hypervisor() {
-  local try=$([ -x /usr/sbin/virt-what ] && virt-what | tail -1)
-  [ "$try" != "" ] && echo $try && return 0
-
-  grep -q QEMU /proc/cpuinfo  && echo "kvm" && return 0
-  grep -q QEMU /var/log/messages && echo "kvm" && return 0
-
-  [ -d /proc/xen ] && mount -t xenfs none /proc/xen
   if [ -d /proc/xen ]; then
+    mount -t xenfs none /proc/xen
     $(dmesg | grep -q "Xen HVM")
     if [ $? -eq 0 ]; then  # 1=PV,0=HVM
       echo "xen-hvm" && return 0
@@ -51,6 +45,19 @@ hypervisor() {
     fi
   fi
 
+  [ -x /usr/sbin/virt-what ] && local facts=( $(virt-what) )
+  if [ "$facts" != "" ]; then
+    # Xen HVM is recognized as Hyperv when Viridian extensions are enabled
+    if [ "${facts[-1]}" == "xen-domU" ] && [ "${facts[0]}" == "hyperv" ]; then
+      echo "xen-hvm" && return 0
+    else
+      echo ${facts[-1]} && return 0
+    fi
+  fi
+
+  grep -q QEMU /proc/cpuinfo  && echo "kvm" && return 0
+  grep -q QEMU /var/log/messages && echo "kvm" && return 0
+
   vmware-checkvm &> /dev/null && echo "vmware" && return 0
 
   echo "unknown" && return 1