Merge "If /var/lib/libvirt/qemu/save exists, move it to nova_libvirt_save_path"
This commit is contained in:
commit
fbf0eceee2
@ -13,28 +13,34 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Check if qemu save directory is a directory
|
- name: Check the state of the default qemu save directory
|
||||||
stat:
|
stat:
|
||||||
path: "/var/lib/libvirt/qemu/save"
|
path: "/var/lib/libvirt/qemu/save"
|
||||||
register: qemu_savedir_stat
|
register: _qemu_save_dir
|
||||||
|
|
||||||
- name: Check if qemu save directory is empty
|
- name: Check if the qemu save directory is empty
|
||||||
shell: 'ls -1A /var/lib/libvirt/qemu/save'
|
shell: 'ls -1A /var/lib/libvirt/qemu/save'
|
||||||
register: qemu_savedir_empty
|
register: _qemu_save_dir_contents
|
||||||
|
|
||||||
|
- name: Move the existing save directory to nova_libvirt_save_path
|
||||||
|
command: "mv /var/lib/libvirt/qemu/save {{ nova_libvirt_save_path }}"
|
||||||
|
when:
|
||||||
|
- _qemu_save_dir.stat.isdir is defined
|
||||||
|
- _qemu_save_dir.stat.isdir | bool
|
||||||
|
- _qemu_save_dir_contents.stdout_lines | length == 0
|
||||||
|
|
||||||
|
- name: Create the new save directory
|
||||||
|
file:
|
||||||
|
path: "{{ nova_libvirt_save_path }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
# We force the link creation if our tests passed, this removes the directory as
|
|
||||||
# well
|
|
||||||
- name: Symlink qemu save dir to nova_libvirt_save_path
|
- name: Symlink qemu save dir to nova_libvirt_save_path
|
||||||
file:
|
file:
|
||||||
path: "/var/lib/libvirt/qemu/save"
|
src: "{{ nova_libvirt_save_path }}"
|
||||||
|
dest: "/var/lib/libvirt/qemu/save"
|
||||||
state: link
|
state: link
|
||||||
owner: "{{ nova_qemu_user }}"
|
owner: "{{ nova_qemu_user }}"
|
||||||
group: "{{ nova_qemu_group }}"
|
group: "{{ nova_qemu_group }}"
|
||||||
src: "{{ nova_libvirt_save_path }}"
|
|
||||||
force: True
|
|
||||||
when:
|
|
||||||
- qemu_savedir_stat.stat.isdir
|
|
||||||
- qemu_savedir_empty.stdout_lines | length == 0
|
|
||||||
|
|
||||||
- name: Install pip packages
|
- name: Install pip packages
|
||||||
pip:
|
pip:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user