[ovirt-users] Systemd-Script to put the node in "maintenance" on shutdown

Nir Soffer nsoffer at redhat.com
Thu Sep 24 06:18:19 UTC 2015


On Fri, Sep 18, 2015 at 4:26 PM, Luca Bertoncello <
L.Bertoncello at queo-group.com> wrote:

> Hi again,
>
> I'm trying to write a systemd-script (for CentOS7) in order to
> automatically put the host in "maintenance" on shutdown and to activate it
> after boot.
> I wrote a python-script that to that and it works so that I can start it
> and see the host in "maintenance" and having all VMs migrated.
>
> Unfortunately I can't call this script on shutdown/reboot and wait until
> all VMs are migrated and the host is in maintenance.
>

I don't think this will work, since you must put the host into maintenance,
and wait until all vms were migrated before you reboot the host.

All this can be done only by controlling engine, not from the host that is
going to shutdown.

If you want to trigger this from the host itself, I would write an
ovirt-shutdown tool, ask engine to put the host into maintenance, wait
until all vms migrate, and the invoke the real shutdown command.

I guess it would be more useful to run this tool not on the host you want
to reboot but on another machine.

It may be possible to somehow get systemd to use this tool instead of the
shutdown command, but I don't think it is a good idea. This will make your
host fail to shutdown if your tool is buggy.

Maybe ask on systemd mailing list about this.


>
> Here my script:
>
> [Unit]
> Description=oVirt interface for managing host
> After=remote-fs.target vdsmd.service multipathd.service libvirtd.service
> time-sync.target iscsid.service rpcbind.service supervdsmd.service
> sanlock.service vdsm-network.service
> Wants=remote-fs.target vdsmd.service multipathd.service libvirtd.service
> time-sync.target iscsid.service rpcbind.service supervdsmd.service
> sanlock.service vdsm-network.service
>
> [Service]
> Type=simple
> RemainAfterExit=yes
> ExecStart=/usr/local/bin/ovirt-maintenance.sh active
> ExecStop=/usr/local/bin/ovirt-maintenance.sh maintenance
> KillMode=none
>
> [Install]
> WantedBy=multi-user.target
>
> Could someone help me and say what I'm doing wrong?
>
> Thanks a lot
>
> Mit freundlichen Grüßen
>
> Luca Bertoncello
>
> --
> Besuchen Sie unsere Webauftritte:
>
> www.queo.biz            Agentur für Markenführung und Kommunikation
> www.queoflow.com        IT-Consulting und Individualsoftwareentwicklung
>
> Luca Bertoncello
> Administrator
> Telefon:        +49 351 21 30 38 0
> Fax:            +49 351 21 30 38 99
> E-Mail: l.bertoncello at queo-group.com
>
> queo GmbH
> Tharandter Str. 13
> 01159 Dresden
> Sitz der Gesellschaft: Dresden
> Handelsregistereintrag: Amtsgericht Dresden HRB 22352
> Geschäftsführer: Rüdiger Henke, André Pinkert
> USt-IdNr.: DE234220077
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20150924/a5eb65c9/attachment-0001.html>


More information about the Users mailing list