From 439d33aee360df3effe81c60824ec09628f122cf Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Mon, 24 Nov 2014 15:37:01 +0000 Subject: FIXUPME: Fix nova-setup script: add services, add needed directories and sort them by runtime dependencies --- openstack/usr/share/openstack/openstack-nova-setup | 58 +++++++++++++++------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/openstack/usr/share/openstack/openstack-nova-setup b/openstack/usr/share/openstack/openstack-nova-setup index a2128095..28b6db01 100644 --- a/openstack/usr/share/openstack/openstack-nova-setup +++ b/openstack/usr/share/openstack/openstack-nova-setup @@ -39,12 +39,6 @@ keystone endpoint-create --service-id $(keystone service-list | awk '/ compute --adminurl ##NOVA_ADMIN_URL## \ --region ##NOVA_REGION## -# Setup the nova database -if [ ! -e /var/lib/nova/nova.sqlite ]; then - chown -R nova:nova /var/lib/nova - sudo -u nova nova-manage db sync -fi - # Nova compute configuration if [ ! -d /var/run/nova ]; then mkdir -p /var/run/nova @@ -56,48 +50,74 @@ if [ ! -d /var/lock/nova ]; then chown -R nova:nova /var/lock/nova fi +if [ ! -d /var/log/nova ]; then + mkdir -p /var/log/nova + chown -R nova:nova /var/log/nova +fi + if [ ! -d /var/lib/nova/instances ]; then mkdir /var/lib/nova/instances chown -R nova:nova /var/lib/nova/instances fi +# Setup the nova database +if [ ! -e /var/lib/nova/nova.sqlite ]; then + chown -R nova:nova /var/lib/nova + sudo -u nova nova-manage db sync +fi + # Nova compute needs to write in /var/run/libvirt/libvirt-sock # to start the hypervisor chmod 766 /var/run/libvirt/libvirt-sock +# Nova novncproxy needs /usr/share/novnc folder available +if [ ! -d /usr/share/novnc ]; then + mkdir /usr/share/novnc + chown -R nova:nova /usr/share/novnc +fi + # Check existence of Network Block Device module in the kernel # NOTE: modprobe does not work actually and returns always # failure, enable this check when modprobe is fixed. #modprobe nbd +# Remove the one-shot setup service +rm /etc/systemd/system/multi-user.target.wants/openstack-nova-setup.service + +# Start nova services systemctl start openstack-nova-compute # [1] Never enable openstack-nova-conductor service in a node with # openstack-nova-compute or the security benefits of removing # database access from nova-compute will be negated #systemctl start openstack-nova-conductor -#systemctl start openstack-nova-api -#systemctl start openstack-nova-cert -#systemctl start openstack-nova-consoleauth -#systemctl start openstack-nova-scheduler -#systemctl start openstack-nova-novncproxy +systemctl start openstack-nova-api +systemctl start openstack-nova-cert +systemctl start openstack-nova-consoleauth +systemctl start openstack-nova-scheduler +systemctl start openstack-nova-novncproxy #systemctl start openstack-nova-xvpnvncproxy -# TODO, need to start more nova services. - +# Create the links to run nova services when system start next times. ln -s "/etc/systemd/system/openstack-nova-compute.service" \ "/etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service" # See description of why this shouldn't run in a openstack in one node in [1] #ln -s "/etc/systemd/system/openstack-nova-conductor.service" \ # "/etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service" -#ln -s "/etc/systemd/system/openstack-nova-api.service" \ -# "/etc/systemd/system/multi-user.target.wants/openstack-nova-api.service" +ln -s "/etc/systemd/system/openstack-nova-api.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-nova-api.service" + +ln -s "/etc/systemd/system/openstack-nova-cert.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-nova-cert.service" + +ln -s "/etc/systemd/system/openstack-nova-consoleauth.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service" -#ln -s "/etc/systemd/system/openstack-nova-api.service" \ -# "/etc/systemd/system/multi-user.target.wants/openstack-nova-api.service" +ln -s "/etc/systemd/system/openstack-nova-scheduler.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service" -#ln -s "/etc/systemd/system/openstack-nova-cert.service" \ -# "/etc/systemd/system/multi-user.target.wants/openstack-nova-cert.service" +ln -s "/etc/systemd/system/openstack-nova-novncproxy.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service" exit 0 -- cgit v1.2.1