2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Add LED status retrieval.

This commit is contained in:
Allan Vidal 2015-08-20 10:26:29 -03:00 committed by Juliana Motira
parent 55c333b198
commit 2fb63a34ba
3 changed files with 31 additions and 1 deletions

View File

@ -207,6 +207,12 @@ noderesources = {
'default': 'ipmi',
}),
},
'led': {
'all': PluginRoute({
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
})
}
},
}

View File

@ -822,6 +822,21 @@ class KeyValueData(ConfluentMessage):
self.kvpairs = {name: kvdata}
class LEDStatus(ConfluentMessage):
readonly = True
def __init__(self, data, name):
self.notnode = name is None
self.desc = 'led status'
self.kvpairs = {}
for led_category in data:
self.kvpairs[led_category] = [data[led_category]]
if not self.notnode:
self.kvpairs = {name: self.kvpairs}
class NetworkConfiguration(ConfluentMessage):
desc = 'Network configuration'

View File

@ -594,6 +594,12 @@ class IpmiHandler(object):
return self.read_inventory(self.element[-1])
raise Exception('Unsupported scenario...')
def list_leds(self):
led_categories = {}
for category, leds in self.ipmicmd.get_leds():
led_categories[category] = leds
self.output.put(msg.LEDStatus(led_categories, self.node))
def read_inventory(self, component):
invitems = []
if component == 'all':
@ -628,8 +634,11 @@ class IpmiHandler(object):
if len(self.element) < 3:
return
self.sensorcategory = self.element[2]
if len(self.element) == 3: # list sensors per category
# list sensors per category
if len(self.element) == 3 and self.element[-2] == 'hardware':
return self.list_sensors()
elif len(self.element) == 3 and self.element[-2] == 'led':
return self.list_leds()
elif len(self.element) == 4: # resource requested
return self.read_sensors(self.element[-1])