From 2c641baaffd6ec7f1a0222089252686f239bf150 Mon Sep 17 00:00:00 2001 From: Logan V Date: Thu, 11 Aug 2016 09:14:20 -0500 Subject: [PATCH] Fix race condition when configuring the qemu save directory The /var/lib/libvirt/qemu/save directory is not actually created by the installation of libvirt-bin, it is created by libvirt upon startup. So if libvirt is slow to initialize and this task runs before the directory is created, then the next task: "Check if the qemu save directory is empty" will fail with: stderr: ls: cannot access /var/lib/libvirt/qemu/save: No such file or directory Change-Id: I0d035fa6b4eaedebb733fef2126fe9c4f63c2917 --- tasks/nova_compute_kvm_install.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/nova_compute_kvm_install.yml b/tasks/nova_compute_kvm_install.yml index 3a798fd7..6697ce01 100644 --- a/tasks/nova_compute_kvm_install.yml +++ b/tasks/nova_compute_kvm_install.yml @@ -16,6 +16,9 @@ - name: Check the state of the default qemu save directory stat: path: "/var/lib/libvirt/qemu/save" + until: _qemu_save_dir.stat.exists | bool + retries: 5 + delay: 10 register: _qemu_save_dir - name: Check if the qemu save directory is empty