-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix SystemVMs running in Xen HVM mode are not configured (#2760) #2824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize this is old code moved but it does not seem reliable or future proof. How about a call to virsh (--version or so)?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. virsh is only the hypervisor host, not in the guest VM. |
||
| grep -q QEMU /var/log/messages && echo "kvm" && return 0 | ||
|
|
||
| vmware-checkvm &> /dev/null && echo "vmware" && return 0 | ||
|
|
||
| echo "unknown" && return 1 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From XenServer only point of view, this block of code is redundant. Because result of
dmesg | grep -q "Xen HVM"on HVM instance on XenServer, line 41, will work 100% of the time. The gotcha point of this function is to look for hvm on xen the first thing and if not a match let the rest of the function try to detect the type.A while back I had the same issue and did a non-conclusive investigation about how
virt-whatworks, and was actually getting all sorts of results/order on HVM and PV instance on Xen Server. Essentially the workaround I came up was the one I mentioned above.