Hi Apollon,

Should we add support for the metadata and KVM daemons (i.e., metad
and kvmd).  It is true that they are started automatically by Ganeti,
although currently they do not call 'daemon-util'.  But it should
possible to stop them in any case.

What do you think?

Cheers,
Jose

On Apr 14 14:37, Apollon Oikonomopoulos wrote:
> We add templates for systemd service files and systemd targets under
> doc/examples/systemd and flag them to be built. The generated files are
> also added to .gitignore.
> 
> Signed-off-by: Apollon Oikonomopoulos <[email protected]>
> ---
>  .gitignore                                     |  1 +
>  Makefile.am                                    |  9 ++++++++-
>  doc/examples/systemd/ganeti-common.service.in  |  6 ++++++
>  doc/examples/systemd/ganeti-confd.service.in   | 17 +++++++++++++++++
>  doc/examples/systemd/ganeti-luxid.service.in   | 18 ++++++++++++++++++
>  doc/examples/systemd/ganeti-master.target      |  8 ++++++++
>  doc/examples/systemd/ganeti-masterd.service.in | 18 ++++++++++++++++++
>  doc/examples/systemd/ganeti-mond.service.in    | 14 ++++++++++++++
>  doc/examples/systemd/ganeti-node.target        |  8 ++++++++
>  doc/examples/systemd/ganeti-noded.service.in   | 17 +++++++++++++++++
>  doc/examples/systemd/ganeti-rapi.service.in    | 19 +++++++++++++++++++
>  doc/examples/systemd/ganeti.service            | 18 ++++++++++++++++++
>  doc/examples/systemd/ganeti.target             |  8 ++++++++
>  13 files changed, 160 insertions(+), 1 deletion(-)
>  create mode 100644 doc/examples/systemd/ganeti-common.service.in
>  create mode 100644 doc/examples/systemd/ganeti-confd.service.in
>  create mode 100644 doc/examples/systemd/ganeti-luxid.service.in
>  create mode 100644 doc/examples/systemd/ganeti-master.target
>  create mode 100644 doc/examples/systemd/ganeti-masterd.service.in
>  create mode 100644 doc/examples/systemd/ganeti-mond.service.in
>  create mode 100644 doc/examples/systemd/ganeti-node.target
>  create mode 100644 doc/examples/systemd/ganeti-noded.service.in
>  create mode 100644 doc/examples/systemd/ganeti-rapi.service.in
>  create mode 100644 doc/examples/systemd/ganeti.service
>  create mode 100644 doc/examples/systemd/ganeti.target
> 
> diff --git a/.gitignore b/.gitignore
> index 8a6d1ac..801316e 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -83,6 +83,7 @@
>  /doc/examples/ganeti-node-role.ocf
>  /doc/examples/gnt-config-backup
>  /doc/examples/hooks/ipsec
> +/doc/examples/systemd/ganeti-*.service
>  
>  # lib
>  /lib/_constants.py
> diff --git a/Makefile.am b/Makefile.am
> index eb39b74..0df7ea9 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -337,7 +337,14 @@ BUILT_EXAMPLES = \
>       doc/examples/ganeti-master-role.ocf \
>       doc/examples/ganeti-node-role.ocf \
>       doc/examples/gnt-config-backup \
> -     doc/examples/hooks/ipsec
> +     doc/examples/hooks/ipsec \
> +     doc/examples/systemd/ganeti-common.service \
> +     doc/examples/systemd/ganeti-confd.service \
> +     doc/examples/systemd/ganeti-luxid.service \
> +     doc/examples/systemd/ganeti-masterd.service \
> +     doc/examples/systemd/ganeti-mond.service \
> +     doc/examples/systemd/ganeti-noded.service \
> +     doc/examples/systemd/ganeti-rapi.service
>  
>  dist_ifup_SCRIPTS = \
>       tools/kvm-ifup-os
> diff --git a/doc/examples/systemd/ganeti-common.service.in 
> b/doc/examples/systemd/ganeti-common.service.in
> new file mode 100644
> index 0000000..e267323
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-common.service.in
> @@ -0,0 +1,6 @@
> +[Unit]
> +Description = Ganeti one-off setup
> +
> +[Service]
> +Type = oneshot
> +ExecStart = @PKGLIBDIR@/ensure-dirs
> diff --git a/doc/examples/systemd/ganeti-confd.service.in 
> b/doc/examples/systemd/ganeti-confd.service.in
> new file mode 100644
> index 0000000..db3a913
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-confd.service.in
> @@ -0,0 +1,17 @@
> +[Unit]
> +Description = Ganeti configuration daemon (confd)
> +Documentation = man:ganeti-confd(8)
> +Requires = ganeti-common.service
> +After = ganeti-common.service
> +PartOf = ganeti-node.target
> +ConditionPathExists = @LOCALSTATEDIR@/lib/ganeti/config.data
> +
> +[Service]
> +Type = simple
> +User = @GNTCONFDUSER@
> +Group = @GNTCONFDGROUP@
> +ExecStart = @SBINDIR@/ganeti-confd -f
> +Restart = on-failure
> +
> +[Install]
> +WantedBy = ganeti-node.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti-luxid.service.in 
> b/doc/examples/systemd/ganeti-luxid.service.in
> new file mode 100644
> index 0000000..2fbcb4a
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-luxid.service.in
> @@ -0,0 +1,18 @@
> +[Unit]
> +Description = Ganeti query daemon (luxid)
> +Documentation = man:ganeti-luxid(8)
> +Requires = ganeti-common.service
> +After = ganeti-common.service
> +PartOf = ganeti-master.target
> +ConditionPathExists = @LOCALSTATEDIR@/lib/ganeti/config.data
> +
> +[Service]
> +Type = simple
> +User = @GNTLUXIDUSER@
> +Group = @GNTLUXIDGROUP@
> +ExecStart = @SBINDIR@/ganeti-luxid -f
> +Restart = on-failure
> +SuccessExitStatus = 0 11
> +
> +[Install]
> +WantedBy = ganeti-master.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti-master.target 
> b/doc/examples/systemd/ganeti-master.target
> new file mode 100644
> index 0000000..ec1a980
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-master.target
> @@ -0,0 +1,8 @@
> +[Unit]
> +Description = Ganeti master functionality
> +Documentation = man:ganeti(7)
> +After = syslog.target
> +PartOf = ganeti.target
> +
> +[Install]
> +WantedBy = ganeti.target
> diff --git a/doc/examples/systemd/ganeti-masterd.service.in 
> b/doc/examples/systemd/ganeti-masterd.service.in
> new file mode 100644
> index 0000000..2547dd3
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-masterd.service.in
> @@ -0,0 +1,18 @@
> +[Unit]
> +Description = Ganeti master daemon (masterd)
> +Documentation = man:ganeti-masterd(8)
> +Requires = ganeti-common.service
> +After = ganeti-common.service
> +PartOf = ganeti-master.target
> +ConditionPathExists = @LOCALSTATEDIR@/lib/ganeti/config.data
> +
> +[Service]
> +Type = simple
> +User = @GNTMASTERUSER@
> +Group = @GNTMASTERDGROUP@
> +ExecStart = @SBINDIR@/ganeti-masterd -f
> +Restart = on-failure
> +SuccessExitStatus = 0 11
> +
> +[Install]
> +WantedBy = ganeti-master.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti-mond.service.in 
> b/doc/examples/systemd/ganeti-mond.service.in
> new file mode 100644
> index 0000000..e526ae0
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-mond.service.in
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description = Ganeti monitoring daemon (mond)
> +Documentation = man:ganeti-mond(8)
> +Requires = ganeti-common.service
> +After = ganeti-common.service
> +PartOf = ganeti-node.target
> +
> +[Service]
> +Type = simple
> +ExecStart = @SBINDIR@/ganeti-mond -f
> +Restart = on-failure
> +
> +[Install]
> +WantedBy = ganeti-node.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti-node.target 
> b/doc/examples/systemd/ganeti-node.target
> new file mode 100644
> index 0000000..d38ba28
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-node.target
> @@ -0,0 +1,8 @@
> +[Unit]
> +Description = Ganeti node functionality
> +Documentation = man:ganeti(7)
> +After = syslog.service
> +PartOf = ganeti.target
> +
> +[Install]
> +WantedBy = ganeti.target
> diff --git a/doc/examples/systemd/ganeti-noded.service.in 
> b/doc/examples/systemd/ganeti-noded.service.in
> new file mode 100644
> index 0000000..64d1ed7
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-noded.service.in
> @@ -0,0 +1,17 @@
> +[Unit]
> +Description = Ganeti node daemon (noded)
> +Documentation = man:ganeti-noded(8)
> +After = ganeti-common.service
> +Requires = ganeti-common.service
> +PartOf = ganeti-node.target
> +ConditionPathExists = @LOCALSTATEDIR@/lib/ganeti/server.pem
> +
> +[Service]
> +Type = simple
> +ExecStart = @SBINDIR@/ganeti-noded -f
> +Restart = on-failure
> +# Important: do not kill any KVM processes
> +KillMode = process
> +
> +[Install]
> +WantedBy = ganeti-node.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti-rapi.service.in 
> b/doc/examples/systemd/ganeti-rapi.service.in
> new file mode 100644
> index 0000000..260473b
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti-rapi.service.in
> @@ -0,0 +1,19 @@
> +[Unit]
> +Description = Ganeti RAPI daemon (rapi)
> +Documentation = man:ganeti-rapi(8)
> +Requires = ganeti-common.service
> +Requisite = ganeti-masterd.service
> +After = ganeti-common.service
> +PartOf = ganeti-master.target
> +ConditionPathExists = @LOCALSTATEDIR@/lib/ganeti/rapi.pem
> +
> +[Service]
> +Type = simple
> +User = @GNTRAPIUSER@
> +Group = @GNTRAPIGROUP@
> +ExecStart = @SBINDIR@/ganeti-rapi -f
> +SuccessExitStatus = 0 11
> +Restart = on-failure
> +
> +[Install]
> +WantedBy = ganeti-master.target ganeti.target
> diff --git a/doc/examples/systemd/ganeti.service 
> b/doc/examples/systemd/ganeti.service
> new file mode 100644
> index 0000000..f4ada5d
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti.service
> @@ -0,0 +1,18 @@
> +# This is a dummy service, provided only for compatibility with SysV.
> +# Systemd will automatically create a SysV service called
> +# ganeti.service, attempting to start the initscript. Since there is no
> +# way to tell systemd that the initscript acts as ganeti.target (and not
> +# ganeti.service), we create a stub service requiring ganeti.target.
> +#
> +# This service is for compatibility only and so will not be marked for
> +# installation.
> +
> +[Unit]
> +Description = Dummy Ganeti SysV compatibility service
> +Documentation = man:ganeti(7)
> +After = ganeti.target
> +Requires = ganeti.target
> +
> +[Service]
> +Type = oneshot
> +ExecStart = /bin/true
> diff --git a/doc/examples/systemd/ganeti.target 
> b/doc/examples/systemd/ganeti.target
> new file mode 100644
> index 0000000..fc2a3bd
> --- /dev/null
> +++ b/doc/examples/systemd/ganeti.target
> @@ -0,0 +1,8 @@
> +[Unit]
> +Description = Ganeti virtualization cluster manager
> +Documentation = man:ganeti(7)
> +PartOf = ganeti.service
> +
> +[Install]
> +WantedBy = multi-user.target
> +Also = ganeti-node.target ganeti-master.target
> -- 
> 1.9.1
> 

-- 
Jose Antonio Lopes
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to