Darryl L. Pierce
2009-Feb-26 19:06 UTC
[Ovirt-devel] [PATCH node] Checks for hardware support for virtualization.
If hardware support is not found then an error is logged calling out that hardware virt is not supported. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- scripts/ovirt-post | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-post b/scripts/ovirt-post index 068c709..3c8cb13 100755 --- a/scripts/ovirt-post +++ b/scripts/ovirt-post @@ -11,6 +11,15 @@ . /etc/init.d/ovirt-functions start() { + hwvirt=$(virsh capabilities) + if [[ $hwvirt =~ kvm ]]; then + log "Hardware virtualization detected" + else + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + log "!!! No hardware virtualization detected. !!!" + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + fi + if is_standalone; then return 0 fi -- 1.6.0.6
Darryl L. Pierce
2009-Feb-26 19:21 UTC
[Ovirt-devel] [PATCH node] Checks for hardware support for virtualization.
NOTE: this patch adds text to the /etc/issue file so that the user sees the lack of hardware virt on login. If hardware support is not found then an error is logged calling out that hardware virt is not supported. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- scripts/ovirt-post | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-post b/scripts/ovirt-post index 068c709..8409e5d 100755 --- a/scripts/ovirt-post +++ b/scripts/ovirt-post @@ -11,6 +11,21 @@ . /etc/init.d/ovirt-functions start() { + BACKUP=$(mktemp) + ISSUE=/etc/issue + egrep -v "^No hardware virtualization" < $ISSUE > $BACKUP + cp -f $BACKUP $ISSUE + hwvirt=$(virsh capabilities) + if [[ $hwvirt =~ kvm ]]; then + log "Hardware virtualization detected" + else + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + log "!!! No hardware virtualization detected. !!!" + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + + echo "No hardware virtualization was detected." >> $ISSUE + fi + if is_standalone; then return 0 fi -- 1.6.0.6
Darryl L. Pierce
2009-Feb-26 20:13 UTC
[Ovirt-devel] [PATCH node] Checks for hardware support for virtualization.
NOTE: This patch incorporates changes suggested by pmyers. If hardware virtualization is not available, the system updates /etc/issue* with a message. It then appends to that whether hardware virtual- ization is possible with the current hardware. If hardware support is not found then an error is logged calling out that hardware virt is not supported. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- scripts/ovirt-post | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-post b/scripts/ovirt-post index 068c709..2f0483b 100755 --- a/scripts/ovirt-post +++ b/scripts/ovirt-post @@ -11,6 +11,30 @@ . /etc/init.d/ovirt-functions start() { + BACKUP=$(mktemp) + ISSUE=/etc/issue + ISSUE_NET=/etc/issue.net + egrep -v "[Vv]irtualization hardware" $ISSUE > $BACKUP + cp -f $BACKUP $ISSUE + hwvirt=$(virsh capabilities) + if [[ $hwvirt =~ kvm ]]; then + log "Hardware virtualization detected" + else + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + log "!!! Hardware Virtualization Is Unavailable !!!" + log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + + echo "Virtualization hardware is unavailable." >> $ISSUE + + flags=$(cat /proc/cpuinfo | grep "^flags") + if [[ $flags =~ vmx ]] || [[ $flags =~ svm ]]; then + echo "(Virtualization hardware was detected but is disabled)" >> $ISSUE + else + echo "(No virtualization hardware was detected on this system)" >> $ISSUE + fi + fi + cp -f $ISSUE $ISSUE_NET + if is_standalone; then return 0 fi -- 1.6.0.6