[Ovirt-devel] [PATCH node] Checks for hardware support for virtualization.

Perry Myers pmyers at redhat.com
Thu Feb 26 19:28:36 UTC 2009


Darryl L. Pierce wrote:
> 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.

nitpicking :)

> 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

declare local since they're only used in this function?

> +    egrep -v "^No hardware virtualization" < $ISSUE > $BACKUP

egrep -v ".." $ISSUE should work, what is the < for?

> +    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

Also, we should do the same for /etc/issue.net too right?  I think that is 
used for ssh and /etc/issue is for serial/local console.  Or maybe 
issue.net is only for telnet...  I forget.  And we might want to make the 
error in /etc/issue* stand out more.

Hmm, we could also be nicer and detect:
1. hardware virt present on chip and enabled (virsh capabilities succeeds)
2. hardware virt present on chip but disabled in bios (virsh capabilities 
fails, but check for flag in /proc/cpuinfo succeeds)
3. hardware virt not present on chip (virsh capabilities and cpuinfo check 
failed)

That way the user could differentiate between:
1. I need new hardware
2. whoops, need to fix my Bios

Perry

-- 
|=-        Red Hat, Engineering, Emerging Technologies, Boston        -=|
|=-                     Email: pmyers at redhat.com                      -=|
|=-         Office: +1 412 474 3552   Mobile: +1 703 362 9622         -=|
|=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|




More information about the ovirt-devel mailing list