From 4e1f19504d906e51f0dee4d0eeeb287640808468 Mon Sep 17 00:00:00 2001 From: gustavo panizzo Date: Tue, 29 Jul 2014 16:48:21 -0300 Subject: [PATCH] systemd support for agents Rewritten-From: 7a9de17ab339a93f69a03faefe322d7cc0dde35d --- trusty/debian/neutron-dhcp-agent.init | 11 +++++- trusty/debian/neutron-dhcp-agent.service | 17 +++++++++ trusty/debian/neutron-l3-agent.init | 11 +++++- trusty/debian/neutron-l3-agent.service | 17 +++++++++ trusty/debian/neutron-lbaas-agent.init | 11 +++++- trusty/debian/neutron-lbaas-agent.service | 17 +++++++++ trusty/debian/neutron-metadata-agent.init | 35 ++++++++++++++++++- trusty/debian/neutron-metadata-agent.service | 17 +++++++++ trusty/debian/neutron-metering-agent.init | 11 +++++- trusty/debian/neutron-metering-agent.service | 17 +++++++++ .../neutron-plugin-linuxbridge-agent.init | 11 +++++- .../neutron-plugin-linuxbridge-agent.service | 17 +++++++++ .../neutron-plugin-openvswitch-agent.init | 11 +++++- .../neutron-plugin-openvswitch-agent.service | 17 +++++++++ trusty/debian/neutron-vpn-agent.init | 11 +++++- trusty/debian/neutron-vpn-agent.service | 17 +++++++++ 16 files changed, 240 insertions(+), 8 deletions(-) create mode 100644 trusty/debian/neutron-dhcp-agent.service create mode 100644 trusty/debian/neutron-l3-agent.service create mode 100644 trusty/debian/neutron-lbaas-agent.service create mode 100644 trusty/debian/neutron-metadata-agent.service create mode 100644 trusty/debian/neutron-metering-agent.service create mode 100644 trusty/debian/neutron-plugin-linuxbridge-agent.service create mode 100644 trusty/debian/neutron-plugin-openvswitch-agent.service create mode 100644 trusty/debian/neutron-vpn-agent.service diff --git a/trusty/debian/neutron-dhcp-agent.init b/trusty/debian/neutron-dhcp-agent.init index 45e5dfbae..af48fe420 100644 --- a/trusty/debian/neutron-dhcp-agent.init +++ b/trusty/debian/neutron-dhcp-agent.init @@ -19,7 +19,7 @@ DESC="OpenStack Neutron DHCP agent" NAME=neutron-dhcp-agent DAEMON=/usr/bin/neutron-dhcp-agent DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -33,6 +33,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/dhcp-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -70,6 +73,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-dhcp-agent.service b/trusty/debian/neutron-dhcp-agent.service new file mode 100644 index 000000000..ad73bf7e3 --- /dev/null +++ b/trusty/debian/neutron-dhcp-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - DHCP Service +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-dhcp-agent systemd-start +ExecStop=/etc/init.d/neutron-dhcp-agent systemd-stop +PIDFile=/var/run/neutron/neutron-dhcp-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-l3-agent.init b/trusty/debian/neutron-l3-agent.init index 5c7bf0e6d..0db175f3b 100644 --- a/trusty/debian/neutron-l3-agent.init +++ b/trusty/debian/neutron-l3-agent.init @@ -20,7 +20,7 @@ DESC="OpenStack Neutron L3 agent" NAME=neutron-l3-agent DAEMON=/usr/bin/neutron-l3-agent DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/l3_agent.ini" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -34,6 +34,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/l3-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -71,6 +74,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-l3-agent.service b/trusty/debian/neutron-l3-agent.service new file mode 100644 index 000000000..0f41918e5 --- /dev/null +++ b/trusty/debian/neutron-l3-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - L3 Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service openvswitch-switch.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-l3-agent systemd-start +ExecStop=/etc/init.d/neutron-l3-agent systemd-stop +PIDFile=/var/run/neutron/neutron-l3-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-lbaas-agent.init b/trusty/debian/neutron-lbaas-agent.init index 0d73a6791..cbdae9943 100644 --- a/trusty/debian/neutron-lbaas-agent.init +++ b/trusty/debian/neutron-lbaas-agent.init @@ -19,7 +19,7 @@ DESC="OpenStack Neutron LBaaS agent" NAME=neutron-lbaas-agent DAEMON=/usr/bin/${NAME} DAEMON_ARGS="--config-file=/etc/neutron/lbaas_agent.ini --config-file=/etc/neutron/neutron.conf" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -33,6 +33,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/lbaas-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -70,6 +73,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-lbaas-agent.service b/trusty/debian/neutron-lbaas-agent.service new file mode 100644 index 000000000..b25da4139 --- /dev/null +++ b/trusty/debian/neutron-lbaas-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - LBAAS Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-lbaas-agent systemd-start +ExecStop=/etc/init.d/neutron-lbaas-agent systemd-stop +PIDFile=/var/run/neutron/neutron-lbaas-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-metadata-agent.init b/trusty/debian/neutron-metadata-agent.init index 796549a3b..1ae38b375 100644 --- a/trusty/debian/neutron-metadata-agent.init +++ b/trusty/debian/neutron-metadata-agent.init @@ -19,7 +19,7 @@ DESC="OpenStack Neutron Metadata Agent" NAME=neutron-metadata-agent DAEMON=/usr/bin/${NAME} DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/metadata_agent.ini" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -33,6 +33,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/metadata-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -70,6 +73,36 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-metadata-agent.service b/trusty/debian/neutron-metadata-agent.service new file mode 100644 index 000000000..5ebab498c --- /dev/null +++ b/trusty/debian/neutron-metadata-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - Metadata Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service openvswitch-switch.service neutron-l3-agent.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-metadata-agent systemd-start +ExecStop=/etc/init.d/neutron-metadata-agent systemd-stop +PIDFile=/var/run/neutron/neutron-metadata-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-metering-agent.init b/trusty/debian/neutron-metering-agent.init index 8fb4653f1..dbad51799 100644 --- a/trusty/debian/neutron-metering-agent.init +++ b/trusty/debian/neutron-metering-agent.init @@ -19,7 +19,7 @@ DESC="OpenStack Neutron Metering Agent" NAME=neutron-metering-agent DAEMON=/usr/bin/${NAME} DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/metering_agent.ini" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -33,6 +33,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/metering-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -70,6 +73,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-metering-agent.service b/trusty/debian/neutron-metering-agent.service new file mode 100644 index 000000000..0bc14a509 --- /dev/null +++ b/trusty/debian/neutron-metering-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - Metering Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service openvswitch-switch.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-metering-agent systemd-start +ExecStop=/etc/init.d/neutron-metering-agent systemd-stop +PIDFile=/var/run/neutron/neutron-metering-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-plugin-linuxbridge-agent.init b/trusty/debian/neutron-plugin-linuxbridge-agent.init index b08ed895a..24f8f5adf 100644 --- a/trusty/debian/neutron-plugin-linuxbridge-agent.init +++ b/trusty/debian/neutron-plugin-linuxbridge-agent.init @@ -19,7 +19,7 @@ DESC="Openstack Neutron LinuxBridge Plugin Agent" NAME=neutron-linuxbridge-agent DAEMON=/usr/bin/neutron-linuxbridge-agent DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini --log-file=/var/log/neutron/linuxbridge-agent.log" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CONF_FILE="/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini" @@ -31,6 +31,9 @@ CONF_FILE="/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini" . /lib/lsb/init-functions +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --background --quiet --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -68,6 +71,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-plugin-linuxbridge-agent.service b/trusty/debian/neutron-plugin-linuxbridge-agent.service new file mode 100644 index 000000000..f4d93513d --- /dev/null +++ b/trusty/debian/neutron-plugin-linuxbridge-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - LinuxBridge Plugin Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-linuxbridge-agent systemd-start +ExecStop=/etc/init.d/neutron-linuxbridge-agent systemd-stop +PIDFile=/var/run/neutron/neutron-linuxbridge-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-plugin-openvswitch-agent.init b/trusty/debian/neutron-plugin-openvswitch-agent.init index 27c0f79c7..76397db90 100644 --- a/trusty/debian/neutron-plugin-openvswitch-agent.init +++ b/trusty/debian/neutron-plugin-openvswitch-agent.init @@ -19,7 +19,7 @@ DESC="Openstack Neutron OpenVSwitch Plugin Agent" NAME=neutron-openvswitch-agent DAEMON=/usr/bin/neutron-openvswitch-agent DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CONF_FILE=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini @@ -61,6 +61,9 @@ else DESC="${DESC} with ${NEUTRON_PLUGIN_NAME} plugin" fi +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { if [ -x /usr/bin/neutron-ovs-cleanup ] ; then @@ -104,6 +107,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-plugin-openvswitch-agent.service b/trusty/debian/neutron-plugin-openvswitch-agent.service new file mode 100644 index 000000000..3e579ffc6 --- /dev/null +++ b/trusty/debian/neutron-plugin-openvswitch-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - OpenVSwithc Plugin Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service openvswitch-switch.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-openvswitch-agent systemd-start +ExecStop=/etc/init.d/neutron-openvswitch-agent systemd-stop +PIDFile=/var/run/neutron/neutron-openvswitch-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/trusty/debian/neutron-vpn-agent.init b/trusty/debian/neutron-vpn-agent.init index b4868fb81..04dec0b99 100644 --- a/trusty/debian/neutron-vpn-agent.init +++ b/trusty/debian/neutron-vpn-agent.init @@ -19,7 +19,7 @@ DESC="OpenStack Neutron VPN Agent" NAME=neutron-vpn-agent DAEMON=/usr/bin/${NAME} DAEMON_ARGS="--config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/vpn_agent.ini" -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/neutron/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -33,6 +33,9 @@ SCRIPTNAME=/etc/init.d/$NAME [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/vpn-agent.log" +mkdir -p /var/run/neutron +chown neutron:neutron /var/run/neutron + do_start() { start-stop-daemon --start --quiet --background --chuid neutron:neutron --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ @@ -70,6 +73,12 @@ case "$1" in status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; + systemd-start) + do_start + ;; + systemd-stop) + do_stop + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop diff --git a/trusty/debian/neutron-vpn-agent.service b/trusty/debian/neutron-vpn-agent.service new file mode 100644 index 000000000..adcdec5d8 --- /dev/null +++ b/trusty/debian/neutron-vpn-agent.service @@ -0,0 +1,17 @@ +[Unit] +Description=OpenStack Networking service - VPN Agent +Documentation=http://docs.openstack.org/ +After=network.service mysql.service postgresql.service rabbitmq-server.service keystone.service openvswitch-switch.service + +[Service] +User=neutron +Group=neutron +ExecStart=/etc/init.d/neutron-vpn-agent systemd-start +ExecStop=/etc/init.d/neutron-vpn-agent systemd-stop +PIDFile=/var/run/neutron/neutron-vpn-agent.pid +Restart=on-failure +Type=forking + +[Install] +WantedBy=multi-user.target + -- 2.45.2