From 815ac51249f1c6f62ef65842476da8f87d62650a Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 6 Sep 2017 13:04:37 -0400 Subject: [PATCH] Wait for guest capabilities to appear Deploying the multi-node-aio from master on a machine running Ubuntu 14.04 fails frequently as libvirt doesn't think it has the hvm OS type. I was able to manually run "virsh capabilities" shortly after libvirt was installed and sure enough it didn't list any guest capabilities. Subsequent runs of "virsh capabilities" then returned the XML element w/ hvm defined. This commit simply adds a task that checks "virsh capabilities", retrying up to 6 times if the element is not present. From my limit testing this seems sufficient to ensure that the domains are defined and created successfully. Lastly, we add a task to create /etc/libvirt/storage which is expected to exist, but doesn't on a 14.04 deployment. Change-Id: I158987270b71d3781e91d819fdcb02da736f3c1d --- multi-node-aio/playbooks/deploy-vms.yml | 10 ++++++++++ multi-node-aio/playbooks/setup-host.yml | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/multi-node-aio/playbooks/deploy-vms.yml b/multi-node-aio/playbooks/deploy-vms.yml index e95fcfbe..291115ab 100644 --- a/multi-node-aio/playbooks/deploy-vms.yml +++ b/multi-node-aio/playbooks/deploy-vms.yml @@ -49,6 +49,16 @@ - hostvars[item]['server_vm'] | default(false) | bool with_items: "{{ groups['pxe_servers'] }}" + - name: Wait for guest capabilities to appear + command: "virsh capabilities" + register: virsh_caps + until: "'' in virsh_caps.stdout" + retries: 6 + delay: 10 + when: + - hostvars[item]['server_vm'] | default(false) | bool + with_items: "{{ groups['pxe_servers'] }}" + - name: Define the VM command: "virsh define /etc/libvirt/qemu/{{ hostvars[item]['server_hostname'] }}.xml" failed_when: false diff --git a/multi-node-aio/playbooks/setup-host.yml b/multi-node-aio/playbooks/setup-host.yml index a5e0abc3..45635ab4 100644 --- a/multi-node-aio/playbooks/setup-host.yml +++ b/multi-node-aio/playbooks/setup-host.yml @@ -198,6 +198,11 @@ failed_when: false register: virsh_data_volume + - name: Create /etc/libvirt/storage directory + file: + path: "/etc/libvirt/storage/" + state: "directory" + - name: Create virsh data volume shell: | virsh pool-create-as vg01 logical