diff --git a/defaults/main.yml b/defaults/main.yml index 73aece39..acf0b21f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -52,6 +52,7 @@ nova_system_group_name: nova nova_system_shell: /bin/bash nova_system_comment: nova system user nova_system_home_folder: "/var/lib/{{ nova_system_user_name }}" +nova_libvirt_save_path: "{{ nova_system_home_folder }}/save" ## Manually specified nova UID/GID # Deployers can specify a UID for the nova user as well as the GID for the @@ -397,6 +398,8 @@ nova_pip_packages: - nova - python-cephlibs +nova_qemu_user: libvirt-qemu +nova_qemu_group: kvm ## Tunable overrides nova_nova_conf_overrides: {} diff --git a/releasenotes/notes/symlink_libvirt_save_dir_to_nova_dir-3b1b278cb7e5831f.yaml b/releasenotes/notes/symlink_libvirt_save_dir_to_nova_dir-3b1b278cb7e5831f.yaml new file mode 100644 index 00000000..0f23d70a --- /dev/null +++ b/releasenotes/notes/symlink_libvirt_save_dir_to_nova_dir-3b1b278cb7e5831f.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - The ``/var/lib/libvirt/qemu/save`` directory is now a + symlink to ``{{ nova_system_home_folder }}/save`` to + resolve an issue where the default location used by the + libvirt managed save command can result with the root + partitions on compute nodes becoming full when + ``nova image-create`` is run on large instances. diff --git a/tasks/nova_compute_kvm_install.yml b/tasks/nova_compute_kvm_install.yml index b751580b..2cda83e3 100644 --- a/tasks/nova_compute_kvm_install.yml +++ b/tasks/nova_compute_kvm_install.yml @@ -45,6 +45,30 @@ - nova-apt-packages - nova-compute-kvm-apt-packages +- name: Check if qemu save directory is a directory + stat: + path: "/var/lib/libvirt/qemu/save" + register: qemu_savedir_stat + +- name: Check if qemu save directory is empty + shell: + cmd: 'ls -1A /var/lib/libvirt/qemu/save' + register: qemu_savedir_empty + +# 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 + file: + path: "/var/lib/libvirt/qemu/save" + state: link + owner: "{{ nova_qemu_user }}" + 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 (venv) pip: name: "{{ item }}" diff --git a/tasks/nova_pre_install.yml b/tasks/nova_pre_install.yml index 31d028dd..f1eefa21 100644 --- a/tasks/nova_pre_install.yml +++ b/tasks/nova_pre_install.yml @@ -68,6 +68,7 @@ - { path: "{{ nova_system_home_folder }}/.ssh", mode: "0700" } - { path: "{{ nova_system_home_folder }}/cache/api" } - { path: "{{ nova_system_home_folder }}/instances" } + - { path: "{{ nova_libvirt_save_path }}", mode: "0750" } - { path: "/var/lock/nova" } - { path: "/var/run/nova" } tags: