On 6/13/21 6:29 PM, Arnaldo Viegas de Lima wrote:
Hi and thanks for the reply!

The “real” scenario is a bit more complex. There is more than one file server and they must be shutdown only after the VM’s are down. And there are 2 VMWare servers...

UPS can be connected using USB cable or SNMP. All involved machines and network switches are connected the same UPS. A simplified scenario is:

1-Server “A” runs VMWare and has a USB connection to the UPS (3KVA APC)
2-Server “B” also runs VMWare
3-Servers “C”. And “D” are file servers
(Linux based) providing iSCSI
disks to the VMWare servers
4-All machines are connected to one switch that is also connected to the UPS 5-All VMs running on servers “A” and “B”
have their disks coming from
servers “C” and “D”, except from the NUT VM
6-VM running NUT runs from the local filesystem on server “A” (or “B”). This allow for the fileservers to be shutdown independently.

The requirement is that before servers “C” and “D” can shutdown, all VM’s running on servers “A” and “B” must be properly shutdown. I have a script that shutdown (or power down) all VMs on both VMWare servers, except for the NUT VM. Also shutdown is performed in a particular sequence to allow for dependencies, multiple machines at the same time (accounting for disk and CPU bottlenecks) and for VM’s without VMWare/Open VMTools. The script uses VMWare remote API (much like their Web based management). This part is great and works very nice.

I also have a script, that fired from the NUT VM that commands a delayed shutdown of the host VMWare system (that should have no VM’s running except the NUT one) and shuts itself down (ahead of the host VMWare). It will also command the UPS off.
 This is the shutdown command for the master upsmon.

Those 2 pieces work fine, if tested independently.

My problem is that after shutdown all VMs and before shutting down the NUT VM and associated VMWAre host, I must shutdown the fileservers “C” and “D”. I can do that running upsmon in slave mode. But I must ensure that it will not happen before all VMs are properly down. So there are 3 synchronous steps, after OB+LB:

1-Shutdown all VMs (except NUT’s)
2-Shutdown fileservers
3-Command VMWare and UPS delayed off and shutdown NUT VM.

Since 3 is a script, I can have it wait for 2 to complete (time or use a network based test). My main problem is to delay “2” until the end of “1”.

have step 2 wait for a semaphore set immediately before exit by the script that implements step 1.  brute force approach would be a wrapper around if(ping) ( ping returns "1" if target is unreachable and "0" in case of success ) but smarter methods can be imagined




_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to