diff --git a/debian/pvc-daemon.install b/debian/pvc-daemon.install index e7183947..6895f6a5 100644 --- a/debian/pvc-daemon.install +++ b/debian/pvc-daemon.install @@ -1,4 +1,6 @@ node-daemon/pvcd.py usr/share/pvc -node-daemon/pvcd.service lib/systemd/system node-daemon/pvcd.sample.yaml etc/pvc node-daemon/pvcd usr/share/pvc +node-daemon/pvcd.target lib/systemd/system +node-daemon/pvcd.service lib/systemd/system +node-daemon/pvc-flush.service lib/systemd/system diff --git a/debian/pvc-daemon.postinst b/debian/pvc-daemon.postinst index 9ae80517..895a66e8 100644 --- a/debian/pvc-daemon.postinst +++ b/debian/pvc-daemon.postinst @@ -1,10 +1,17 @@ #!/bin/sh -# Enable the service +# Enable the service and target systemctl enable /lib/systemd/system/pvcd.service +systemctl enable /lib/systemd/system/pvcd.target -if systemctl is-active --quiet pvcd.service; then - echo "The PVC node daemon has not been restarted; this is up to the administrator." -else - echo "The PVC node daemon has not been started; create a config file at /etc/pvc/pvcd.conf then start it." +# Inform administrator of the autoflush daemon if it is not enabled +if ! systemctl is-active --quiet pvc-flush.service; then + echo "The PVC autoflush daemon (pvc-flush.service) is not enabled by default; enable it to perform automatic flush/unflush actions on host shutdown/startup." +fi + +# Inform administrator of the service restart/startup not occurring automatically +if systemctl is-active --quiet pvcd.service; then + echo "The PVC node daemon (pvcd.service) has not been restarted; this is up to the administrator." +else + echo "The PVC node daemon (pvcd.service) has not been started; create a config file at /etc/pvc/pvcd.yaml then start it." fi diff --git a/debian/pvc-daemon.prerm b/debian/pvc-daemon.prerm index 09aaa5c3..a6e8c6ab 100644 --- a/debian/pvc-daemon.prerm +++ b/debian/pvc-daemon.prerm @@ -1,4 +1,6 @@ #!/bin/sh -# Disable the service +# Disable the services +systemctl disable pvc-flush.service systemctl disable pvcd.service +systemctl disable pvcd.target diff --git a/node-daemon/pvc-flush.service b/node-daemon/pvc-flush.service new file mode 100644 index 00000000..814f7306 --- /dev/null +++ b/node-daemon/pvc-flush.service @@ -0,0 +1,15 @@ +# Parallel Virtual Cluster autoflush daemon + +[Unit] +Description = Parallel Virtual Cluster autoflush daemon +After = pvcd.service + +[Service] +Type = oneshot +WorkingDirectory = /usr/share/pvc +ExecStart = /usr/bin/pvc node unflush +ExecStop = /usr/bin/pvc node flush +Restart = never + +[Install] +WantedBy = pvcd.target diff --git a/node-daemon/pvcd.service b/node-daemon/pvcd.service index 74dfa8d2..fd2ec8b8 100644 --- a/node-daemon/pvcd.service +++ b/node-daemon/pvcd.service @@ -1,4 +1,5 @@ # Parallel Virtual Cluster node daemon unit file + [Unit] Description = Parallel Virtual Cluster node daemon After = network-online.target libvirtd.service zookeeper.service @@ -12,4 +13,4 @@ ExecStart = /usr/share/pvc/pvcd.py Restart = on-failure [Install] -WantedBy = multi-user.target +WantedBy = pvcd.target diff --git a/node-daemon/pvcd.target b/node-daemon/pvcd.target new file mode 100644 index 00000000..96f8adb6 --- /dev/null +++ b/node-daemon/pvcd.target @@ -0,0 +1,7 @@ +# Parallel Virtual Cluster startup target + +[Unit] +Description = Parallel Virtual Cluster target for managing all services collectively + +[Install] +WantedBy = multi-user.target