[Ovirt-devel] [PATCH node] Causes ovirt-post to wait for libvirt to finish initializing.

Darryl L. Pierce mcpierce at gmail.com
Thu Mar 26 10:13:42 UTC 2009


NOTE: Forgot to change the original check for hw virt. This patch supercedes the
      one sent last night.

It will give libvirt up to 10 seconds to complete initializing before
giving up. This overcomes a bug where ovirt-post fails to detect
hardware virtualization due to libvirt having not finished initializing.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-post |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index 2f0483b..d211aa1 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -11,13 +11,23 @@
 . /etc/init.d/ovirt-functions
 
 start() {
+    # wait for libvirt to finish initializing
+    local count=0
+    while true; do
+	if [ -r /dev/kvm -o "$count" == "100"]; then
+	    break
+	else
+	    log "Waiting for hardware virtualization to initializing..."
+	    count=$(xpr $count + 1)
+	    sleep 1
+	fi
+    done
     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
+    if [ -x /usr/bin/qemu-kvm -a -r /dev/kvm ]; then
 	log "Hardware virtualization detected"
     else
 	log "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-- 
1.6.0.6




More information about the ovirt-devel mailing list