diff options
| author | Paul Bourke <paul.bourke@oracle.com> | 2015-06-17 11:14:59 +0000 |
|---|---|---|
| committer | Paul Bourke <paul.bourke@oracle.com> | 2015-06-19 17:12:05 +0000 |
| commit | 897337cdd61f1702aa7e68da0466804bf0d21a86 (patch) | |
| tree | d8489ef0f286ff69f10ebe0b42eca6cf8b1cc123 /docker/common/nova-compute | |
| parent | c2b05b576f45ddf432571f817be45e6bcb188f75 (diff) | |
| download | kolla-897337cdd61f1702aa7e68da0466804bf0d21a86.tar.gz kolla-897337cdd61f1702aa7e68da0466804bf0d21a86.zip | |
Symlink all non Dockerfile resources in images
The only files in the docker image directories that differ majorly between
distros are the Dockerfiles (e.g. different package manager mechanisms,
different repo sources, etc).
The supporting files such as the start.sh/check.sh and config files should
largely stay the same between base images.
This change moves these files up into a "common" directory, and symlinks them
in the same way that the build script is managed. This means when adding a new
base distro only new Dockerfiles need to be created. Also, if a distro does
happen to require a vastly different start.sh script for example, one can
choose to simply not symlink to the common and instead drop in a custom one.
Implements: blueprint refactor-base-image-layout
Change-Id: Ic4db69d31ff54a1fb95af4853a2e5ae490064284
Diffstat (limited to 'docker/common/nova-compute')
5 files changed, 98 insertions, 0 deletions
diff --git a/docker/common/nova-compute/nova-compute/config-nova-compute.sh b/docker/common/nova-compute/nova-compute/config-nova-compute.sh new file mode 100755 index 000000000..9a2c12572 --- /dev/null +++ b/docker/common/nova-compute/nova-compute/config-nova-compute.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-nova.sh + +cfg=/etc/nova/nova.conf + +check_required_vars NOVA_VNCSERVER_PROXYCLIENT_ADDRESS NOVA_NOVNC_PROXY_PORT \ + NOVA_NOVNC_BASE_ADDRESS + +# Configures novnc to listen on all interfaces and instructs nova-compute to +# announce PROXYCLIENT_IP to the nova-vncproxy. Clients like Horizon will +# connect with this address. +# As such, NOVA_VNCSERVER_PROXYCLIENT_ADDRESS is unique per compute node. +crudini --set $cfg DEFAULT vnc_enabled "True" +crudini --set $cfg DEFAULT vncserver_listen "0.0.0.0" +crudini --set $cfg DEFAULT vncserver_proxyclient_address "${NOVA_VNCSERVER_PROXYCLIENT_ADDRESS}" +crudini --set $cfg DEFAULT novncproxy_base_url "http://${NOVA_NOVNC_BASE_ADDRESS}:${NOVA_NOVNC_PROXY_PORT}/vnc_auto.html" + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_COMPUTE_LOG_FILE}" + +# set qmeu emulation if no hardware acceleration found +if [[ `egrep -c '(vmx|svm)' /proc/cpuinfo` == 0 ]]; then + crudini --set $cfg libvirt virt_type qemu +fi + +mkdir -p /var/lib/nova/instances diff --git a/docker/common/nova-compute/nova-compute/start.sh b/docker/common/nova-compute/nova-compute/start.sh new file mode 100755 index 000000000..ce3d0c0c3 --- /dev/null +++ b/docker/common/nova-compute/nova-compute/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova-compute.sh + +sleep 6 + +echo "Starting nova-compute." +exec /usr/bin/nova-compute --config-file /etc/nova/nova.conf diff --git a/docker/common/nova-compute/nova-libvirt/start.sh b/docker/common/nova-compute/nova-libvirt/start.sh new file mode 100755 index 000000000..bdbe882b8 --- /dev/null +++ b/docker/common/nova-compute/nova-libvirt/start.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [[ $(cat /proc/cpuinfo | grep vmx) ]]; then + modprobe kvm_intel +elif [[ $(cat /proc/cpuinfo | grep svm) ]]; then + modprobe kvm_amd +else + echo "WARNING: Your hardware does not support hardware virtualization -" \ + "using qemu software virtualization instead" +fi + +modprobe ip6_tables ip_tables ebtable_nat + +# If libvirt is not installed on the host permissions need to be set +# If running in qemu, we don't need to set anything as /dev/kvm won't exist +if [[ -c /dev/kvm ]]; then + chmod 660 /dev/kvm + chown root:kvm /dev/kvm +fi + +echo "Starting libvirtd." +exec /usr/sbin/libvirtd diff --git a/docker/common/nova-compute/nova-network/config-nova-network.sh b/docker/common/nova-compute/nova-network/config-nova-network.sh new file mode 100755 index 000000000..6976d3a20 --- /dev/null +++ b/docker/common/nova-compute/nova-network/config-nova-network.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +. /opt/kolla/config-nova.sh + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_NETWORK_LOG_FILE}" + +# Configure eth1 as a physcial interface for nova flat network +cat > /etc/sysconfig/network-scripts/ifcfg-$FLAT_INTERFACE <<EOF +DEVICE="$FLAT_INTERFACE" +BOOTPROTO="none" +ONBOOT="yes" +TYPE="Ethernet" +EOF + +/usr/sbin/ifup $FLAT_INTERFACE + +cfg=/etc/nova/nova.conf + +crudini --set $cfg DEFAULT network_manager nova.network.manager.FlatDHCPManager +crudini --set $cfg DEFAULT firewall_driver nova.virt.libvirt.firewall.IptablesFirewallDriver +crudini --set $cfg DEFAULT network_size 254 +crudini --set $cfg DEFAULT allow_same_net_traffic False +crudini --set $cfg DEFAULT multi_host True +crudini --set $cfg DEFAULT send_arp_for_ha True +crudini --set $cfg DEFAULT share_dhcp_address True +crudini --set $cfg DEFAULT force_dhcp_release True +crudini --set $cfg DEFAULT flat_network_bridge br100 diff --git a/docker/common/nova-compute/nova-network/start.sh b/docker/common/nova-compute/nova-network/start.sh new file mode 100755 index 000000000..92381b720 --- /dev/null +++ b/docker/common/nova-compute/nova-network/start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova-network.sh + +# Start nova-network +exec /usr/bin/nova-network --config-file /etc/nova/nova.conf |
