diff --git a/defaults/main.yml b/defaults/main.yml index 92fbc8b6..2f83d689 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -124,8 +124,16 @@ nova_virt_types: nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver nova_scheduler_use_baremetal_filters: False nova_scheduler_tracks_instance_changes: True + powervm: + nova_compute_driver: nova_powervm.virt.powervm.driver.PowerVMDriver + nova_scheduler_host_manager: host_manager + nova_reserved_host_memory_mb: 8192 + nova_compute_manager: nova.compute.manager.ComputeManager + nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver + nova_scheduler_use_baremetal_filters: False + nova_scheduler_tracks_instance_changes: True -# Current supported choice: qemu or kvm or ironic +# Current supported choice: qemu or kvm or ironic or powervm # If this is not set, then the playbook will try to guess it. #nova_virt_type: kvm @@ -414,3 +422,28 @@ uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" +# nova powervm virt driver +nova_compute_powervm_apt_packages: + - bridge-utils + - genisoimage + - kpartx + - open-iscsi + - python-libguestfs + - sysfsutils + - vlan + - nfs-common + - dosfstools + - dosfstools-dbg + - multipath-tools + - pvm-novalink + +nova_compute_powervm_pip_packages: + - nova-powervm + +novalink_apt_repo: + repo: "deb [arch=ppc64el] ftp://public.dhe.ibm.com/systems/virtualization/Novalink/debian/ novalink_1.0.0 non-free" + state: "present" + +novalink_gpg_keys: + - url: "ftp://public.dhe.ibm.com/systems/virtualization/Novalink/debian/novalink-gpg-pub.key" + state: "present" diff --git a/releasenotes/notes/nova-powervm-b4eddae30abbd08e.yaml b/releasenotes/notes/nova-powervm-b4eddae30abbd08e.yaml new file mode 100644 index 00000000..e450591d --- /dev/null +++ b/releasenotes/notes/nova-powervm-b4eddae30abbd08e.yaml @@ -0,0 +1,5 @@ +--- +features: + - The os_nova role can now detect and support basic deployment of a PowerVM environment. + This sets the virtualization type to 'powervm' and installs/updates the PowerVM NovaLink + package and nova-powervm driver. diff --git a/tasks/nova_compute.yml b/tasks/nova_compute.yml index 70da214f..3983c776 100644 --- a/tasks/nova_compute.yml +++ b/tasks/nova_compute.yml @@ -16,6 +16,9 @@ - include: nova_compute_kvm.yml when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu' +- include: nova_compute_powervm.yml + when: nova_virt_type == 'powervm' + - include: nova_compute_key_populate.yml - include: nova_compute_key_distribute.yml diff --git a/tasks/nova_compute_powervm.yml b/tasks/nova_compute_powervm.yml new file mode 100644 index 00000000..f71b40bf --- /dev/null +++ b/tasks/nova_compute_powervm.yml @@ -0,0 +1,29 @@ +--- +# Copyright 2016, IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- include: nova_compute_powervm_install.yml + +- name: Add nova user to pvm_admin group + user: + name: "{{ nova_system_user_name }}" + groups: "pvm_admin" + append: "yes" + tags: + - nova-powervm + +- name: Ensure powervm permissions + shell: "udevadm trigger" + tags: + - nova-powervm diff --git a/tasks/nova_compute_powervm_install.yml b/tasks/nova_compute_powervm_install.yml new file mode 100644 index 00000000..d2cb6eee --- /dev/null +++ b/tasks/nova_compute_powervm_install.yml @@ -0,0 +1,124 @@ +--- +# Copyright 2016, IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Add novalink keys + apt_key: + url: "{{ item.url }}" + state: "{{ item.state }}" + register: add_nv_keys + until: add_nv_keys|success + retries: 5 + delay: 2 + ignore_errors: True + with_items: novalink_gpg_keys + tags: + - novalink-apt-keys + +- name: Add novalink repo + apt_repository: + repo: "{{ novalink_apt_repo.repo }}" + state: "{{ novalink_apt_repo.state }}" + register: add_nv_repos + until: add_nv_repos|success + retries: 5 + delay: 2 + tags: + - novalink-repo + +#TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache +#when https://github.com/ansible/ansible-modules-core/pull/1517 is merged +#in 1.9.x or we move to 2.0 (if tested working) +- name: Check apt last update file + stat: + path: /var/cache/apt + register: apt_cache_stat + tags: + - nova-apt-packages + - nova-compute-powervm-apt-packages + +- name: Update apt if needed + apt: + update_cache: yes + when: | + "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" + or add_nv_repos|changed + tags: + - nova-apt-packages + - nova-compute-powervm-apt-packages + +- name: Install apt packages + apt: + pkg: "{{ item }}" + state: latest + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: nova_compute_powervm_apt_packages + tags: + - nova-apt-packages + - nova-compute-powervm-apt-packages + +- name: Register pypowervm module path (venv) + command: python -c 'import pypowervm; print pypowervm.__file__' + register: pypowervm_module_path + when: + - nova_venv_enabled | bool + tags: + - nova-powervm-libs + +- name: Link pypowervm module into the venv + file: + src: "{{ pypowervm_module_path.stdout | dirname }}" + dest: "{{ nova_venv_bin | dirname }}/lib/python2.7/site-packages/pypowervm" + state: link + force: "yes" + when: + - nova_venv_enabled | bool + tags: + - nova-powervm-libs + +- name: Install pip packages (venv) + pip: + name: "{{ item }}" + state: latest + virtualenv: "{{ nova_venv_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: "{{ pip_install_options|default('') }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: nova_compute_powervm_pip_packages + when: + - nova_venv_enabled | bool + tags: + - nova-install + - nova-pip-packages + +- name: Install pip packages (no venv) + pip: + name: "{{ item }}" + state: latest + extra_args: "{{ pip_install_options|default('') }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: nova_compute_powervm_pip_packages + when: not nova_venv_enabled | bool + tags: + - nova-install + - nova-pip-packages diff --git a/tasks/nova_virt_detect.yml b/tasks/nova_virt_detect.yml index 427f8911..4ec49ef7 100644 --- a/tasks/nova_virt_detect.yml +++ b/tasks/nova_virt_detect.yml @@ -13,17 +13,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Get virt type value and store as var - shell: | - `which egrep` -c '(vmx|svm|PowerNV)' /proc/cpuinfo - register: virt_type_value +- name: Get CPU info content and store as var + shell: cat /proc/cpuinfo + register: cpuinfo_contents changed_when: false failed_when: false tags: - always -- name: Register a fact for the nova virt type +- name: Register a fact for the nova kvm virt type set_fact: - nova_virt_type: "{{ ((virt_type_value.stdout | int) > 0) | ternary('kvm', 'qemu') }}" + nova_virt_type: "kvm" + when: cpuinfo_contents.stdout.find('vmx') != -1 + or cpuinfo_contents.stdout.find('svm') != -1 + or cpuinfo_contents.stdout.find('PowerNV') != -1 + tags: + - nova-virt-type-set + +- name: Register a fact for the nova powervm virt type + set_fact: + nova_virt_type: "powervm" + when: + - cpuinfo_contents.stdout.find('pSeries') != -1 + - ansible_architecture == 'ppc64le' + tags: + - nova-virt-type-set + +- name: Register a fact for the nova qemu virt type + set_fact: + nova_virt_type: "qemu" + when: nova_virt_type is not defined tags: - always