diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 19e768371b..34a85d98f2 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -48,8 +48,3 @@ - include: bootstrap_service.yml when: database.changed or use_preconfigured_databases | bool - -- include: bootstrap_xenapi.yml - when: - - inventory_hostname in groups['compute'] - - nova_compute_virt_type == "xenapi" diff --git a/ansible/roles/nova/tasks/config.yml b/ansible/roles/nova/tasks/config.yml index ad5b4f8ef8..d33846ea38 100644 --- a/ansible/roles/nova/tasks/config.yml +++ b/ansible/roles/nova/tasks/config.yml @@ -55,6 +55,13 @@ notify: - "Restart {{ item.key }} container" +- name: Set XenAPI facts + set_fact: + xenapi_facts: "{{ lookup('file', xenapi_facts_root + '/' + inventory_hostname + '/' + xenapi_facts_file) | from_json }}" + when: + - nova_compute_virt_type == 'xenapi' + - inventory_hostname in groups['compute'] + - name: Copying over nova.conf become: true vars: diff --git a/ansible/roles/nova/tasks/deploy.yml b/ansible/roles/nova/tasks/deploy.yml index 0e4015136b..b5e1f3e848 100644 --- a/ansible/roles/nova/tasks/deploy.yml +++ b/ansible/roles/nova/tasks/deploy.yml @@ -18,6 +18,11 @@ - include: register.yml when: inventory_hostname in groups['nova-api'] +- include: bootstrap_xenapi.yml + when: + - inventory_hostname in groups['compute'] + - nova_compute_virt_type == "xenapi" + - include: config.yml - include: config-nova-fake.yml diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index fa8564a189..d94c8ace37 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -35,6 +35,9 @@ compute_driver = fake.FakeDriver compute_driver = vmwareapi.VMwareVCDriver {% elif nova_compute_virt_type == 'xenapi' %} compute_driver = xenapi.XenAPIDriver +{% if service_name == 'nova-compute' %} +host = xenapi_facts['dom0_hostname'] +{% endif %} {% else %} compute_driver = libvirt.LibvirtDriver {% endif %}