Add CentOS support for os_nova

* only kvm host are supported right now.

Depends-On: Iff4a5999be0263a2c1843d7ca29843468cbc0ccc
Depends-On: I78fb85d44b5b0e1643bd07af3e15462c02041c89
Change-Id: Ie05c243daa7d2d46b5e8779371a363d95cc990e9
This commit is contained in:
Marc Gariepy 2016-09-28 15:10:29 -04:00
parent ca79eed523
commit 83a9864b0d
14 changed files with 221 additions and 24 deletions

View File

@ -13,12 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Restart libvirt-bin
service:
name: "libvirt-bin"
state: "restarted"
pattern: "libvirt-bin"
- name: Reload systemd daemon - name: Reload systemd daemon
command: "systemctl daemon-reload" command: "systemctl daemon-reload"
notify: notify:
@ -29,6 +23,12 @@
notify: notify:
- Restart nova services - Restart nova services
- name: Restart libvirt-bin
service:
name: "{{ libvirt_service_name }}"
state: "restarted"
pattern: "{{ libvirt_service_name }}"
- name: Restart nova services - name: Restart nova services
service: service:
name: "{{ item.value.service_name }}" name: "{{ item.value.service_name }}"

View File

@ -0,0 +1,3 @@
---
features:
- CentOS7/RHEL support has been added to the os_nova role.

View File

@ -18,7 +18,7 @@
- name: Add nova user to libvirtd group - name: Add nova user to libvirtd group
user: user:
name: "{{ nova_system_user_name }}" name: "{{ nova_system_user_name }}"
groups: "libvirtd" groups: "{{ libvirt_group }}"
append: "yes" append: "yes"
tags: tags:
- nova-libvirt - nova-libvirt
@ -56,25 +56,57 @@
- nova-kvm - nova-kvm
- nova-libvirt - nova-libvirt
- name: Set libvirt runtime options - name: Set libvirt runtime options (Ubuntu)
lineinfile: lineinfile:
dest: "/etc/default/libvirt-bin" dest: "/etc/default/libvirt-bin"
line: 'libvirtd_opts="-d -l"' line: 'libvirtd_opts="-d -l"'
regexp: "^libvirtd_opts=" regexp: "^libvirtd_opts="
backup: "yes" backup: "yes"
when: nova_libvirtd_listen_tcp == 1 when:
- nova_libvirtd_listen_tcp == 1
- ansible_pkg_mgr == 'apt'
notify: Restart libvirt-bin notify: Restart libvirt-bin
tags: tags:
- nova-kvm - nova-kvm
- nova-libvirt - nova-libvirt
- name: Set libvirt runtime options - name: Set libvirt runtime options (Ubuntu)
lineinfile: lineinfile:
dest: "/etc/default/libvirt-bin" dest: "/etc/default/libvirt-bin"
line: 'libvirtd_opts="-d"' line: 'libvirtd_opts="-d"'
regexp: "^libvirtd_opts=" regexp: "^libvirtd_opts="
backup: "yes" backup: "yes"
when: nova_libvirtd_listen_tcp == 0 when:
- nova_libvirtd_listen_tcp == 0
- ansible_pkg_mgr == 'apt'
notify: Restart libvirt-bin
tags:
- nova-kvm
- nova-libvirt
- name: Set libvirt runtime options (CentOS)
lineinfile:
dest: "/etc/sysconfig/libvirtd"
line: 'LIBVIRTD_ARGS="-l"'
regexp: "^(#)?LIBVIRTD_ARGS=*"
backup: "yes"
when:
- nova_libvirtd_listen_tcp == 1
- ansible_pkg_mgr == 'yum'
notify: Restart libvirt-bin
tags:
- nova-kvm
- nova-libvirt
- name: Set libvirt runtime options (CentOS)
lineinfile:
dest: "/etc/sysconfig/libvirtd"
line: 'LIBVIRTD_ARGS=""'
regexp: "^(#)?LIBVIRTD_ARGS=*"
backup: "yes"
when:
- nova_libvirtd_listen_tcp == 0
- ansible_pkg_mgr == 'yum'
notify: Restart libvirt-bin notify: Restart libvirt-bin
tags: tags:
- nova-kvm - nova-kvm

View File

@ -13,6 +13,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Make sure libvirt is started
service:
name: "{{ libvirt_service_name }}"
state: "started"
pattern: "{{ libvirt_service_name }}"
- name: Check the state of the default qemu save directory - name: Check the state of the default qemu save directory
stat: stat:
path: "/var/lib/libvirt/qemu/save" path: "/var/lib/libvirt/qemu/save"

View File

@ -25,6 +25,7 @@
service: service:
name: "{{ item.value.service_name }}" name: "{{ item.value.service_name }}"
enabled: "yes" enabled: "yes"
state: "started"
with_dict: "{{ nova_services }}" with_dict: "{{ nova_services }}"
when: inventory_hostname in groups[item.value.group] when: inventory_hostname in groups[item.value.group]
notify: notify:

View File

@ -16,6 +16,9 @@
- include: nova_install_apt.yml - include: nova_install_apt.yml
when: ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'
- include: nova_install_yum.yml
when: ansible_pkg_mgr == 'yum'
- name: Create developer mode constraint file - name: Create developer mode constraint file
copy: copy:
dest: "/opt/developer-pip-constraints.txt" dest: "/opt/developer-pip-constraints.txt"

View File

@ -0,0 +1,86 @@
---
# Copyright 2014, Rackspace US, Inc.
#
# 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: Install RDO package
yum:
pkg: "{{ rdo_package }}"
state: "present"
register: install_cloud_rdo_package
until: install_cloud_rdo_package | success
retries: 5
delay: 2
- name: Install yum packages (common)
yum:
pkg: "{{ item }}"
state: "{{ nova_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_distro_packages }}"
tags:
- nova-install
- nova-yum-packages
- name: Remove known problem packages for the Spice console
yum:
pkg: "{{ item }}"
state: absent
register: remove_packages
until: remove_packages|success
retries: 5
delay: 2
with_items: "{{ nova_spice_distro_packages }}"
when:
- inventory_hostname in groups['nova_console']
- nova_console_type == "spice"
tags:
- nova-install
- nova-yum-packages
- nova-spice-yum-packages
- name: Install yum packages (novnc console)
yum:
pkg: "{{ item }}"
state: "{{ nova_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_novnc_distro_packages }}"
when:
- inventory_hostname in groups['nova_console']
- nova_console_type == "novnc"
tags:
- nova-install
- nova-yum-packages
- nova-novnc-apt-packages
- name: Install yum packages (compute - KVM)
yum:
pkg: "{{ item }}"
state: "{{ nova_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_compute_kvm_distro_packages }}"
when:
- inventory_hostname in groups['nova_compute']
- nova_virt_type == 'kvm' or nova_virt_type == 'qemu'
tags:
- nova-yum-packages
- nova-compute-kvm-yum-packages

View File

@ -8,7 +8,7 @@ log_outputs="1:file:/var/log/libvirt/libvirtd.log"
{% endif %} {% endif %}
listen_tls = {{ nova_libvirtd_listen_tls }} listen_tls = {{ nova_libvirtd_listen_tls }}
listen_tcp = {{ nova_libvirtd_listen_tcp }} listen_tcp = {{ nova_libvirtd_listen_tcp }}
unix_sock_group = "libvirtd" unix_sock_group = "{{ libvirt_group }}"
unix_sock_ro_perms = "0777" unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770" unix_sock_rw_perms = "0770"
auth_unix_ro = "none" auth_unix_ro = "none"

View File

@ -95,7 +95,8 @@ force_dhcp_release = True
dhcpbridge_flagfile = /etc/nova/nova.conf dhcpbridge_flagfile = /etc/nova/nova.conf
firewall_driver = {{ nova_firewall_driver }} firewall_driver = {{ nova_firewall_driver }}
use_forwarded_for = {{ nova_network_services[nova_network_type]['use_forwarded_for'] | bool }} use_forwarded_for = {{ nova_network_services[nova_network_type]['use_forwarded_for'] | bool }}
my_ip = {{ nova_management_address }} my_ip = {% if nova_management_address == 'localhost' %}127.0.0.1{% else %}{{ nova_management_address }}{% endif %}
default_floating_pool = public default_floating_pool = public
use_neutron = True use_neutron = True
@ -162,8 +163,10 @@ enabled = {{ nova_console_agent_enabled }}
keymap = {{ nova_console_keymap }} keymap = {{ nova_console_keymap }}
# Console Url and binds # Console Url and binds
html5proxy_base_url = {{ nova_spice_html5proxy_base_url }} html5proxy_base_url = {{ nova_spice_html5proxy_base_url }}
server_listen = {{ nova_management_address }} server_listen = {% if nova_management_address == 'localhost' %}127.0.0.1{% else %}{{ nova_management_address }}{% endif %}
server_proxyclient_address = {{ nova_management_address }}
server_proxyclient_address = {% if nova_management_address == 'localhost' %}127.0.0.1{% else %}{{ nova_management_address }}{% endif %}
[vnc] [vnc]
enabled = False enabled = False

View File

@ -18,7 +18,6 @@ neutron_provider_networks:
network_mappings: "flat:eth12" network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000" network_vxlan_ranges: "1:1000"
ansible_become: True ansible_become: True
ansible_host: 127.0.0.1
neutron_local_ip: 10.1.2.1 neutron_local_ip: 10.1.2.1
ansible_python_interpreter: "/usr/bin/python2" ansible_python_interpreter: "/usr/bin/python2"
bridges: bridges:

View File

@ -13,14 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Prepare the user ssh keys # Setup the host
- include: common/test-prepare-keys.yml - include: common/test-setup-host.yml
# Prepare the host
- include: common/test-prepare-host.yml
# Prepare the containers
- include: common/test-prepare-containers.yml
# Install RabbitMQ/MariaDB # Install RabbitMQ/MariaDB
- include: common/test-install-infra.yml - include: common/test-install-infra.yml

64
vars/redhat-7.yml Normal file
View File

@ -0,0 +1,64 @@
---
# Copyright 2014, Rackspace US, Inc.
#
# 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.
nova_qemu_user: qemu
nova_qemu_group: qemu
libvirt_group: libvirt
libvirt_service_name: libvirtd
# Common yum packages
nova_distro_packages:
- genisoimage
- git
- iptables
- libpqxx-devel
# Spice console yum packages
nova_spice_distro_packages:
- spice-html5
nova_novnc_distro_packages:
- js-jquery
- js-underscore
- librabbitmq
- libyaml
nova_compute_kvm_distro_packages:
- bridge-utils
- device-mapper-multipath
- dosfstools
- genisoimage
- iscsi-initiator-utils
- kpartx
- libvirt-daemon-config-nwfilter
- libvirt-daemon-kvm
- libvirt-devel
- libvirt-python
- nfs-utils
- python-libguestfs
- qemu
- qemu-img-ev
- sysfsutils
- vconfig
# TODO: add support for LXD on CentOS at some point.
nova_compute_lxd_distro_packages: []
# TODO: add support for PowerVM/NovaLink on CentOS at some point.
nova_compute_powervm_distro_packages: []
novalink_gpg_keys: []
rdo_package: "https://rdoproject.org/repos/rdo-release.rpm"

View File

@ -16,6 +16,9 @@
## APT Cache options ## APT Cache options
cache_timeout: 600 cache_timeout: 600
libvirt_group: libvirtd
libvirt_service_name: libvirt-bin
# Common apt packages # Common apt packages
nova_distro_packages: nova_distro_packages:
- genisoimage - genisoimage

View File

@ -16,6 +16,9 @@
## APT Cache options ## APT Cache options
cache_timeout: 600 cache_timeout: 600
libvirt_group: libvirtd
libvirt_service_name: libvirt-bin
# Common apt packages # Common apt packages
nova_distro_packages: nova_distro_packages:
- genisoimage - genisoimage