[Nut-upsuser] Trying to understand sdorder
Roger Price
roger at rogerprice.org
Sat Jul 8 08:20:10 UTC 2017
My understanding is that NUT provides a mechanism to shut down multiple
systems protected by multiple UPS's in a given order. For example to
shutdown the users before their NFS server.
1. man ups.conf says
sdorder Optional. When you have multiple UPSes on your system, you
usually need to turn them off in a certain order. upsdrvctl shuts down all
the 0s, then the 1s, 2s, and so on. To exclude a UPS from the shutdown
sequence, set this to -1.
2. config-notes.txt gives an example
To set the order in which your UPSes receive the shutdown commands, define
the 'sdorder' value in your ups.conf.
[bigone]
driver = usbhid-ups
port = auto
sdorder = 2
[littleguy]
driver = mge-shut
port = /dev/ttyS0
sdorder = 1
[misc]
driver = blazer_ser
port = /dev/ttyS1
sdorder = 0
The order runs from 0 to the highest number available. So, for this
configuration, the order of shutdowns would be 'misc', 'littleguy', and
then 'bigone'.
3. But in upsdrvctl.c I see
/* walk UPS table and send command to all UPSes according to sdorder */
static void send_all_drivers(void (*command)(const ups_t *))
{
ups_t *ups;
int i;
...
for (i = 0; i <= maxsdorder; i++) {
ups = upstable;
while (ups) {
if (ups->sdorder == i)
command(ups);
ups = ups->next;
}
}
}
These nested loops will execute in a few milleseconds, effectively
shutting down all the UPS units at the same time rather than in a paced
sequence.
I see nothing that ensures that all the "0"s are effectively shut down
before starting the shutdown of the "1"s.
Is there something in the sdorder logic that I am missing?
Roger
More information about the Nut-upsuser
mailing list