[Nut-upsdev] MGE NMC and NutShutdownModule (and other stuff)

Arjen de Korte nut+devel at de-korte.org
Tue Oct 27 08:43:48 UTC 2009


Citeren Marco Chiappero <marco op absence.it>:

> Sorry but I'm getting bored with this discussion, I would prefer be  
> told that you do not want to include such code (which is not a  
> problem) instead of reading sometimes pointless objections. The  
> subdriver solution is not going to break backward compatibility or  
> something else, while the driver approach would provide almost full  
> NMC support to NUT without much pain. They do both integrates quite  
> correctly in the current NUT structure, even though with possible  
> limitations.

Maybe I just don't understand what you're trying to do. Suppose I have  
two NMC equipped UPS devices that are currently controlled through two  
netxml-ups drivers (and maybe a handful of clone drivers). Both  
drivers are of course running on the same machine, since that's where  
the upsd server also lives.

1) Both netxml-ups drivers can't connect at the same time via NSM to  
their respective NMC's. We must have two instances of the netxml-ups  
driver running (to provide access to all variables in the UPS) and as  
far as I can see we can only accommodate one NSM client (due to the  
listening socket that is needed for the callback from the NMC's) per  
host.

2) You can't make *any* changes to the clients, since we not only have  
installed bases of the upsmon NUT client that we provide (and granted,  
where it would be trivial to add additional functionality) but also  
quite a number of third party clients (Windows for instance). So to  
the clients, the individual outlets of the two UPS'es would need to  
appear as completely separate devices, with their own 'ups.status'  
parameter (which is basically the only thing clients that need to  
shutdown a machine look at).

As far as I can see, without changing the socket protocol between  
between driver and server, the subdriver approach would break due to  
1) and the driver approach due to 2).

What you fail to recognize is that in the existing socket protocol,  
there is one driver (one socket) per 'ups.status' variable. This isn't  
trivial. If you need multiple 'ups.status' variables to be able to  
deal with switchable outlets, you also need multiple virtual UPS  
devices in 'ups.conf, otherwise the clients will have no real/virtual  
UPS to connect to (that's why we have the clone driver) and also  
multiple driver sockets. I fail to see how either the subdriver or  
driver approach can ever add these.

The only way I see how to solve this without rewriting half the upsd  
server and/or requiring changes to the clients, is by creating a  
'netnsm-ups' listener that would connect to all NMC's, without  
actually providing a real/virtual UPS and create a special kind of  
clone driver, that would connect both to one of the 'netxml-ups'  
drivers running and also 'netnsm-ups' (to grab the 'ups.status' line).

[nsm-clone]
     driver = netnsm-ups
     port.ups1 = ups1.example.com
     port.ups2 = ups2.example.com

[nmc-a]
     # main outlet
     driver = netxml-ups
     port = ups1.example.com

[nmc-a-1]
     driver = newclone
     port = netxml-ups-nmc-a
     outlet = nsm-clone-ups1-1

[nmc-a-2]
     driver = newclone
     port = netxml-ups-nmc-a
     outlet = nsm-clone-ups1-2

[nmc-b]
     # main outlet
     driver = netxml-ups
     port = ups2.example.com

[nmc-b-1]
     driver = newclone
     port = netxml-ups-nmc-b
     outlet = nsm-clone-ups2-1

[nmc-b-2]
     driver = newclone
     port = netxml-ups-nmc-b
     outlet = nsm-clone-ups2-2

There are probably ways to automate a couple of things here, but you  
get the idea.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list