A functional libvirt + nova_compute + nova_network

This imports sdakes' nova-docker codebase to show that atomic upgrades
work atleast with nova networking.  This has many corrections.

For more details read:

http://sdake.io/2015/01/28/an-atomic-upgrade-process-for-openstack-compute-nodes/

Implements-blueprint: blueprint libvirt-container
Partially-implements; blueprint container-set-compute-operation-nova

Change-Id: I858ea113c5656b6da5d2fd13502fecdbd085c8da
This commit is contained in:
Steven Dake 2015-02-24 00:32:03 -07:00
parent 8d12ee76ab
commit 7eca70b1a6
9 changed files with 24 additions and 64 deletions

View File

@ -10,10 +10,13 @@
: ${RABBIT_USERID:=guest}
: ${RABBIT_PASSWORD:=guest}
: ${NETWORK_MANAGER:=nova}
: ${FLAT_NETWORK:=eth0}
: ${PUBLIC_NETWORK:=eth1}
check_required_vars KEYSTONE_ADMIN_TOKEN NOVA_DB_PASSWORD \
RABBITMQ_SERVICE_HOST GLANCE_API_SERVICE_HOST \
KEYSTONE_PUBLIC_SERVICE_HOST PUBLIC_IP
KEYSTONE_PUBLIC_SERVICE_HOST PUBLIC_IP \
PUBLIC_INTERFACE FLAT_INTERFACE
cfg=/etc/nova/nova.conf
@ -72,9 +75,9 @@ if [ "${NETWORK_MANAGER}" == "nova" ] ; then
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_interface eth0
crudini --set $cfg DEFAULT flat_interface $FLAT_INTERFACE
crudini --set $cfg DEFAULT flat_network_bridge br100
crudini --set $cfg DEFAULT public_interface eth1
crudini --set $cfg DEFAULT public_interface $PUBLIC_INTERFACE
elif [ "${NETWORK_MANAGER}" == "neutron" ] ; then
check_required_vars NEUTRON_SHARED_SECRET
crudini --set $cfg DEFAULT service_neutron_metadata_proxy True

View File

@ -1,16 +1,13 @@
FROM kollaglue/fedora-rdo-nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-nova-compute \
libvirtd; yum clean all
RUN yum -y install openstack-nova-compute sysfsutils \
libvirt-daemon-config-nwfilter ; yum clean all
ADD config-nova-compute.sh /opt/kolla/config-nova-compute.sh
ADD libvirt-start.sh /opt/kolla/libvirt-start.sh
ADD ./start.sh /start.sh
RUN mkdir -p /var/lib/libvirt/images/
VOLUME [ "/sys/fs/cgroup" ]
VOLUME [ "/var/lib/nova" ]
VOLUME [ "/var/lib/libvirt" ]

View File

@ -3,12 +3,12 @@
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-nova.sh
#check_required_vars NOVA_LIBVIRT_SERVICE_HOST
cfg=/etc/nova/nova.conf
crudini --set $cfg libvirt virt_type qemu
# separate containers don't work because of libguestfs bug
# https://bugzilla.redhat.com/show_bug.cgi?id=1154408
#crudini --set $cfg libvirt \
# connection_uri qemu+tcp://${NOVA_LIBVIRT_SERVICE_HOST}/system
# 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

View File

@ -1,13 +0,0 @@
#!/bin/sh
#/bin/chmod 666 /dev/kvm
echo "Starting guests."
/usr/libexec/libvirt-guests.sh start
echo "Starting virtlockd."
/usr/sbin/virtlockd &
sleep 3
echo "Starting libvirtd."
/usr/sbin/libvirtd &

View File

@ -4,10 +4,7 @@ set -e
. /opt/kolla/config-nova-compute.sh
# ideally this would be a separate container, but because of libguestfs RFEs
# this is not possible.
. /opt/kolla/libvirt-start.sh
sleep 5
sleep 6
echo "Starting nova-compute."
exec /usr/bin/nova-compute

View File

@ -1,18 +1,8 @@
FROM kollaglue/fedora-rdo-base
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install libvirt-daemon-driver-* libvirt-daemon libvirt-daemon-kvm qemu-kvm && yum clean all
EXPOSE 16509
RUN echo "listen_tls = 0" >> /etc/libvirt/libvirtd.conf; \
echo 'listen_tcp = 1' >> /etc/libvirt/libvirtd.conf; \
echo 'tls_port = "16514"' >> /etc/libvirt/libvirtd.conf; \
echo 'tcp_port = "16509"' >> /etc/libvirt/libvirtd.conf; \
echo 'auth_tcp = "none"' >> /etc/libvirt/libvirtd.conf
RUN echo 'LIBVIRTD_ARGS="--listen"' >> /etc/sysconfig/libvirtd
RUN mkdir -p /var/lib/libvirt/images/
RUN yum -y install libvirtd libguestfs qemu-system-x86 \
libvirt-daemon-config-nwfilter; yum clean all
VOLUME [ "/sys/fs/cgroup" ]
VOLUME [ "/var/lib/nova" ]

View File

@ -1,13 +1,3 @@
#!/bin/sh
/bin/chmod 666 /dev/kvm
echo "Starting guests."
/usr/libexec/libvirt-guests.sh start
echo "Starting virtlockd."
/usr/sbin/virtlockd &
sleep 3
echo "Starting libvirtd."
exec /usr/sbin/libvirtd --listen
exec /usr/sbin/libvirtd

View File

@ -2,7 +2,7 @@ FROM kollaglue/fedora-rdo-nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-nova-network \
bridge-utils && yum clean all
bridge-utils initscripts && yum clean all
ADD config-nova-network.sh /opt/kolla/config-nova-network.sh
ADD ./start.sh /start.sh

View File

@ -2,18 +2,16 @@
. /opt/kolla/config-nova.sh
check_required_vars CONFIG_NETWORK
# Configure eth1 as a physcial interface for nova flat network
cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
DEVICE="eth1"
cat > /etc/sysconfig/network-scripts/ifcfg-$FLAT_INTERFACE <<EOF
DEVICE="$FLAT_INTERFACE"
BOOTPROTO="none"
ONBOOT="yes"
DEFROUTE="yes"
TYPE="Ethernet"
EOF
/sbin/ifup eth1
/usr/sbin/ifup $FLAT_INTERFACE
cfg=/etc/nova/nova.conf
@ -25,6 +23,4 @@ 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_interface eth1
crudini --set $cfg DEFAULT flat_network_bridge br100
crudini --set $cfg DEFAULT public_interface eth0