I was just trying to do the same thing, I was going to use power management, and the api.

I asked if this feature already exists in the cluster policy.

With the cluster policy you can control how the vms get distributed, and then I was going to write a script on the engine that would use the api to put the host in maintenance, then use the api to tell power management to turn off the host... When load gets above 75%, the script would power a server on, and then take it out of maintenance. The cluster policy would take care of the rest.

Anyone else doing something like this?

-Donny D

On Sep 24, 2015 2:18 AM, "Nir Soffer" <nsoffer@redhat.com> wrote:
On Fri, Sep 18, 2015 at 4:26 PM, Luca Bertoncello <L.Bertoncello@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@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@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users