MOS fix

Change-Id: I8958e4fc53a6040baa4bb0b5b4f5ca2fddd3ca01
diff --git a/nova/compute.sls b/nova/compute.sls
index 505587e..ef0c60a 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -201,4 +201,18 @@
 
 {%- endif %}
 
+{# temporary hack to fix broken init script in MOS 9.0 libvirt package #}
+
+{%- if compute.get('manage_init', False) and grains.init == 'upstart' %}
+
+/etc/init/libvirtd.conf:
+  file.managed:
+  - template: jinja
+  - source: salt://nova/files/libvirtd.conf
+  - mode: 755
+
+{%- endif %}
+
+{# end temporary hack #}
+
 {%- endif %}
diff --git a/nova/files/libvirtd.conf b/nova/files/libvirtd.conf
new file mode 100644
index 0000000..bc1e398
--- /dev/null
+++ b/nova/files/libvirtd.conf
@@ -0,0 +1,19 @@
+
+post-start script
+    LIBVIRTD_SYSCONFIG=/etc/default/libvirtd
+    if [ -f $LIBVIRTD_SYSCONFIG ]; then
+        . $LIBVIRTD_SYSCONFIG
+    fi
+    sockfile="${SOCKFILE:-/var/run/libvirt/libvirt-sock}"
+    sockfile_check_retries=5
+    initsleep=2
+    while [ ! -S $sockfile ] ; do
+        sleep ${initsleep}
+        initsleep=$((${initsleep}*2))
+        if ! sockfile_check_retries=`expr $sockfile_check_retries - 1`; then
+            echo "Giving up waiting for $sockfile."
+            stop; exit 1
+        fi
+    done
+    echo "$sockfile ready."
+end script