From b2c7269ee7cfae333354b8a7abeb109db71d40e1 Mon Sep 17 00:00:00 2001 From: Jianghua Wang Date: Mon, 8 Jan 2018 02:04:49 +0000 Subject: [PATCH] XenAPI: Support compute node bootstrap This is to add a bootstrap task for XenAPI to bootstrap the compute node. One compute node is composed with a XenServer and a DomU VM running on the XenServer. Before it's ready for deploying OpenStack sevices on it, we need bootstrap it firstly. The package of python-os-xenapi contains a tool and some utils which were developed to finish all of the needed bootstrap tasks e.g.: 1. configure himn(host internal management network) 2. configure ipatables to allow traffic 3. install xapi plugins to dom0 4. gather XenAPI facts and save them into a file ... The task added in this commit is to invoke that tool so that the bootstrap tasks can be completed automatically during kolla deployment. Depends-On: Ie2d7d40f2755580aac4a10f3d302190a8bd4fe6f Change-Id: I1500535a1c9a085bcbfec5db5fbddcf040e6892d blueprint: xenserver-support --- ansible/group_vars/all.yml | 2 ++ ansible/roles/nova/tasks/bootstrap.yml | 5 +++++ ansible/roles/nova/tasks/bootstrap_xenapi.yml | 9 +++++++++ 3 files changed, 16 insertions(+) create mode 100644 ansible/roles/nova/tasks/bootstrap_xenapi.yml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 3eb02f2938..d2a3cc99da 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -725,3 +725,5 @@ opendaylight_allowed_network_types: '"flat", "vlan", "vxlan"' xenserver_himn_ip: "169.254.0.1" xenserver_username: "root" xenserver_connect_protocol: "https" +# File used to save XenAPI's facts variables formatted as json. +xenapi_facts_file: "/etc/kolla/xenapi.json" diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 0706e3a852..076ddca3d6 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -45,3 +45,8 @@ - include: bootstrap_service.yml when: database.changed + +- include: bootstrap_xenapi.yml + when: + - inventory_hostname in groups['compute'] + - nova_compute_virt_type == "xenapi" diff --git a/ansible/roles/nova/tasks/bootstrap_xenapi.yml b/ansible/roles/nova/tasks/bootstrap_xenapi.yml new file mode 100644 index 0000000000..7abb543d48 --- /dev/null +++ b/ansible/roles/nova/tasks/bootstrap_xenapi.yml @@ -0,0 +1,9 @@ +- name: Install package python-os-xenapi + package: + name: python-os-xenapi + state: present + become: True + +- name: Bootstrap XenAPI compute node + command: xenapi_bootstrap -i {{ xenserver_himn_ip }} -u {{ xenserver_username }} -p {{ xenserver_password }} -f {{ xenapi_facts_file }} + become: True