Updated nova logic to correct issues with addon devices

The logic within the pre_tasks was too loose. The pre_tasks need
to have a bit more restrictive conditionals. Additionall the
`lxc-device add` command which is being used always exits 0
even when the device add fails. While the task does not have
issues with running we should be making sure that our changes
are being recoreded correctly.

Closes-Bug: 1434945
Change-Id: Icb1707db6bde6c0a26af6bca21a1f88dc3c315a8
This commit is contained in:
Kevin Carter 2015-03-22 00:37:49 -05:00 committed by Jesse Pretorius
parent 2d4f9c750f
commit a74b076ff0
2 changed files with 21 additions and 4 deletions

View File

@ -32,8 +32,14 @@
for i in /dev/nbd*;do
lxc-device -n {{ container_name }} add $i $i
done
failed_when: false
register: device_add
changed_when: >
'added' in device_add.stdout.lower()
delegate_to: "{{ physical_host }}"
when: is_metal == false or is_metal == "False"
when: >
inventory_hostname in groups['nova_compute'] and
(is_metal == false or is_metal == "False")
tags:
- nova-kvm
- nova-kvm-container-devices
@ -41,7 +47,9 @@
shell: |
lxc-device -n {{ container_name }} add /dev/net/tun /dev/net/tun
delegate_to: "{{ physical_host }}"
when: is_metal == false or is_metal == "False"
when: >
inventory_hostname in groups['nova_compute'] and
(is_metal == false or is_metal == "False")
tags:
- nova-kvm
- nova-kvm-container-devices
@ -49,7 +57,14 @@
shell: |
lxc-device -n {{ container_name }} add /dev/kvm /dev/kvm
delegate_to: "{{ physical_host }}"
when: is_metal == false or is_metal == "False"
register: device_add
failed_when: false
changed_when: >
'added' in device_add.stdout.lower()
when: >
inventory_hostname in groups['nova_compute'] and
(is_metal == false or is_metal == "False") and
nova_virt_type == 'kvm'
tags:
- nova-kvm
- nova-kvm-container-devices

View File

@ -14,7 +14,9 @@
# limitations under the License.
- include: nova_compute_kvm.yml
when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu'
when: >
nova_virt_type == 'kvm' or
nova_virt_type == 'qemu'
- include: nova_compute_key_create.yml