From e077f1bdc2723234ee4381b7aaa7e60f18ce0fbe Mon Sep 17 00:00:00 2001 From: Jerry Cai Date: Thu, 30 Jun 2016 16:51:23 +0800 Subject: [PATCH] Filter libvirt in nova.conf. Add nova_powervm module in nova.virt Filter libvirt in nova.conf. Create nova_powervm symbolic link to nova.virt.nova_powervm module. Change-Id: I479ff18d15097738eb6671d3cdbe66e6ef66cd31 --- tasks/nova_compute_powervm_install.yml | 38 ++++++++++++++++++++++++++ templates/nova.conf.j2 | 5 +++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/tasks/nova_compute_powervm_install.yml b/tasks/nova_compute_powervm_install.yml index 3d7a8bec..7f32da53 100644 --- a/tasks/nova_compute_powervm_install.yml +++ b/tasks/nova_compute_powervm_install.yml @@ -122,3 +122,41 @@ tags: - nova-install - nova-pip-packages + +- name: Register nova module path (no venv) + command: python -c 'import nova; print nova.__file__' + register: nova_module_path + when: + - not nova_venv_enabled | bool + tags: + - nova-powervm-libs + +- name: Register nova_powervm module path (no venv) + command: python -c 'import nova_powervm; print nova_powervm.__file__' + register: nova_powervm_module_path + when: + - not nova_venv_enabled | bool + tags: + - nova-powervm-libs + +- name: Link nova_powervm module into the nova virt (no venv) + file: + src: "{{ nova_powervm_module_path.stdout | dirname }}/virt/powervm" + dest: "{{ nova_module_path.stdout | dirname }}/virt/powervm" + state: link + force: "yes" + when: + - not nova_venv_enabled | bool + tags: + - nova-powervm-libs + +- name: Link nova_powervm module into the nova virt (venv) + file: + src: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/nova_powervm/virt/powervm" + dest: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/nova/virt/powervm" + state: link + force: "yes" + when: + - nova_venv_enabled | bool + tags: + - nova-powervm-libs diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index dcbd1310..cb3d805c 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -103,7 +103,9 @@ auth_strategy = keystone ## Vif linuxnet_interface_driver = {{ nova_linuxnet_interface_driver }} +{% if nova_virt_type in ['kvm', 'qemu', 'xen'] %} libvirt_vif_type = ethernet +{% endif %} vif_plugging_timeout = 10 vif_plugging_is_fatal = False @@ -251,7 +253,7 @@ admin_url = {{ keystone_service_adminuri }}/v2.0 api_endpoint = {{ ironic_service_adminurl }} {% endif %} - +{% if nova_virt_type in ['kvm', 'qemu', 'xen'] %} [libvirt] inject_partition = {{ nova_libvirt_inject_partition }} inject_password = {{ nova_libvirt_inject_password }} @@ -275,3 +277,4 @@ images_rbd_ceph_conf = /etc/ceph/ceph.conf live_migration_flag = "{{ nova_libvirt_live_migration_flag }}" hw_disk_discard = {{ nova_libvirt_hw_disk_discard }} disk_cachemodes = {{ nova_libvirt_disk_cachemodes }} +{% endif %}