<p dir="ltr">I was just trying to do the same thing, I was going to use power management, and the api. </p>
<p dir="ltr">I asked if this feature already exists in the cluster policy.</p>
<p dir="ltr">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.</p>
<p dir="ltr">Anyone else doing something like this?</p>
<p dir="ltr">-Donny D</p>
<div class="gmail_quote">On Sep 24, 2015 2:18 AM, "Nir Soffer" <<a href="mailto:nsoffer@redhat.com">nsoffer@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 18, 2015 at 4:26 PM, Luca Bertoncello <span dir="ltr"><<a href="mailto:L.Bertoncello@queo-group.com" target="_blank">L.Bertoncello@queo-group.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi again,<br>
<br>
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.<br>
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.<br>
<br>
Unfortunately I can't call this script on shutdown/reboot and wait until all VMs are migrated and the host is in maintenance.<br></blockquote><div><br></div><div>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.</div><div><br></div><div>All this can be done only by controlling engine, not from the host that is going to shutdown.</div><div><br></div><div>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.</div><div><br></div><div>I guess it would be more useful to run this tool not on the host you want to reboot but on another machine.</div><div><br></div><div>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.</div><div><br></div><div>Maybe ask on systemd mailing list about this. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Here my script:<br>
<br>
[Unit]<br>
Description=oVirt interface for managing host<br>
After=remote-fs.target vdsmd.service multipathd.service libvirtd.service time-sync.target iscsid.service rpcbind.service supervdsmd.service sanlock.service vdsm-network.service<br>
Wants=remote-fs.target vdsmd.service multipathd.service libvirtd.service time-sync.target iscsid.service rpcbind.service supervdsmd.service sanlock.service vdsm-network.service<br>
<br>
[Service]<br>
Type=simple<br>
RemainAfterExit=yes<br>
ExecStart=/usr/local/bin/ovirt-maintenance.sh active<br>
ExecStop=/usr/local/bin/ovirt-maintenance.sh maintenance<br>
KillMode=none<br>
<br>
[Install]<br>
WantedBy=multi-user.target<br>
<br>
Could someone help me and say what I'm doing wrong?<br>
<br>
Thanks a lot<br>
<br>
Mit freundlichen Grüßen<br>
<br>
Luca Bertoncello<br>
<br>
--<br>
Besuchen Sie unsere Webauftritte:<br>
<br>
<a href="http://www.queo.biz" rel="noreferrer" target="_blank">www.queo.biz</a> Agentur für Markenführung und Kommunikation<br>
<a href="http://www.queoflow.com" rel="noreferrer" target="_blank">www.queoflow.com</a> IT-Consulting und Individualsoftwareentwicklung<br>
<br>
Luca Bertoncello<br>
Administrator<br>
Telefon: <a href="tel:%2B49%20351%2021%2030%2038%200" value="+493512130380" target="_blank">+49 351 21 30 38 0</a><br>
Fax: <a href="tel:%2B49%20351%2021%2030%2038%2099" value="+4935121303899" target="_blank">+49 351 21 30 38 99</a><br>
E-Mail: <a href="mailto:l.bertoncello@queo-group.com" target="_blank">l.bertoncello@queo-group.com</a><br>
<br>
queo GmbH<br>
Tharandter Str. 13<br>
01159 Dresden<br>
Sitz der Gesellschaft: Dresden<br>
Handelsregistereintrag: Amtsgericht Dresden HRB 22352<br>
Geschäftsführer: Rüdiger Henke, André Pinkert<br>
USt-IdNr.: DE234220077<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org" target="_blank">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
</blockquote></div><br></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
<br></blockquote></div>