]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
systemd support for agents
authorgustavo panizzo <gfa@zumbi.com.ar>
Tue, 29 Jul 2014 19:48:21 +0000 (16:48 -0300)
committergustavo panizzo <gfa@zumbi.com.ar>
Tue, 29 Jul 2014 19:48:21 +0000 (16:48 -0300)
Rewritten-From: 7a9de17ab339a93f69a03faefe322d7cc0dde35d

16 files changed:
xenial/debian/neutron-dhcp-agent.init
xenial/debian/neutron-dhcp-agent.service [new file with mode: 0644]
xenial/debian/neutron-l3-agent.init
xenial/debian/neutron-l3-agent.service [new file with mode: 0644]
xenial/debian/neutron-lbaas-agent.init
xenial/debian/neutron-lbaas-agent.service [new file with mode: 0644]
xenial/debian/neutron-metadata-agent.init
xenial/debian/neutron-metadata-agent.service [new file with mode: 0644]
xenial/debian/neutron-metering-agent.init
xenial/debian/neutron-metering-agent.service [new file with mode: 0644]
xenial/debian/neutron-plugin-linuxbridge-agent.init
xenial/debian/neutron-plugin-linuxbridge-agent.service [new file with mode: 0644]
xenial/debian/neutron-plugin-openvswitch-agent.init
xenial/debian/neutron-plugin-openvswitch-agent.service [new file with mode: 0644]
xenial/debian/neutron-vpn-agent.init
xenial/debian/neutron-vpn-agent.service [new file with mode: 0644]

index 45e5dfbae2eba15e41a0f32ae2f02e421159f6ff..af48fe420fa95269b6517a6c01808bc21c1e25e2 100644 (file)
@@ -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/xenial/debian/neutron-dhcp-agent.service b/xenial/debian/neutron-dhcp-agent.service
new file mode 100644 (file)
index 0000000..ad73bf7
--- /dev/null
@@ -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
+
index 5c7bf0e6d08366462746b8fb935f00a1f8de95c8..0db175f3b58593d4634d1b25f6d5c747fc7a41e5 100644 (file)
@@ -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/xenial/debian/neutron-l3-agent.service b/xenial/debian/neutron-l3-agent.service
new file mode 100644 (file)
index 0000000..0f41918
--- /dev/null
@@ -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
+
index 0d73a6791c991f3ca09023f05a7cc5f44323d1a3..cbdae9943a28805328ab281eb9d33387df66de83 100644 (file)
@@ -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/xenial/debian/neutron-lbaas-agent.service b/xenial/debian/neutron-lbaas-agent.service
new file mode 100644 (file)
index 0000000..b25da41
--- /dev/null
@@ -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
+
index 796549a3b4d7736d860392e2c899642837178f06..1ae38b375d4decf6667b10ce752347ed24d64118 100644 (file)
@@ -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/xenial/debian/neutron-metadata-agent.service b/xenial/debian/neutron-metadata-agent.service
new file mode 100644 (file)
index 0000000..5ebab49
--- /dev/null
@@ -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
+
index 8fb4653f14c7d91bc95eb6493961747dafbdb113..dbad51799aab2a829d25169b775cde447e1c4770 100644 (file)
@@ -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/xenial/debian/neutron-metering-agent.service b/xenial/debian/neutron-metering-agent.service
new file mode 100644 (file)
index 0000000..0bc14a5
--- /dev/null
@@ -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
+
index b08ed895a4ab1feb41cf47c14eebd0767b44e283..24f8f5adfa6bea82e54d8092471180c0f0e39be6 100644 (file)
@@ -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/xenial/debian/neutron-plugin-linuxbridge-agent.service b/xenial/debian/neutron-plugin-linuxbridge-agent.service
new file mode 100644 (file)
index 0000000..f4d9351
--- /dev/null
@@ -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
+
index 27c0f79c7bc0abb79a06f1c38a92afb431736aa2..76397db900d43ba66d19ecdd9d88bc2b0e6f3b64 100644 (file)
@@ -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/xenial/debian/neutron-plugin-openvswitch-agent.service b/xenial/debian/neutron-plugin-openvswitch-agent.service
new file mode 100644 (file)
index 0000000..3e579ff
--- /dev/null
@@ -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
+
index b4868fb81c138aaf5f78df01f080c67b29eb3722..04dec0b99b53673bf87609a17dbbaeefe45cd42c 100644 (file)
@@ -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/xenial/debian/neutron-vpn-agent.service b/xenial/debian/neutron-vpn-agent.service
new file mode 100644 (file)
index 0000000..adcdec5
--- /dev/null
@@ -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
+