mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-15 12:17:47 +00:00
Implement retrieving license info from XCC
With changes to pyghmi, we can now get license data. Prepare API to provide information about the licenses.
This commit is contained in:
parent
2d63e68494
commit
3782127590
@ -165,6 +165,10 @@ def _init_core():
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'licenses': PluginCollection({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'net_interfaces': PluginCollection({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
|
@ -1530,12 +1530,12 @@ class NTPServer(ConfluentMessage):
|
||||
class License(ConfluentMessage):
|
||||
readonly = True
|
||||
|
||||
def __init__(self, name=None, kvm=None):
|
||||
def __init__(self, name=None, kvm=None, feature=None):
|
||||
self.notnode = name is None
|
||||
self.desc = 'License'
|
||||
|
||||
kv = []
|
||||
kv.append({'kvm_availability': str(kvm)})
|
||||
kv.append({'kvm_availability': str(kvm), 'feature': feature})
|
||||
if self.notnode:
|
||||
self.kvpairs = {'License': kv}
|
||||
else:
|
||||
|
@ -375,7 +375,8 @@ def perform_requests(operator, nodes, element, cfg, inputdata, realop):
|
||||
if datum != 'Done':
|
||||
if isinstance(datum, Exception):
|
||||
raise datum
|
||||
if hasattr(datum, 'kvpairs') and len(datum.kvpairs) == 1:
|
||||
if (hasattr(datum, 'kvpairs') and datum.kvpairs and
|
||||
len(datum.kvpairs) == 1):
|
||||
bundle.append((datum.kvpairs.keys()[0], datum))
|
||||
numnodes -= 1
|
||||
else:
|
||||
@ -617,6 +618,8 @@ class IpmiHandler(object):
|
||||
return self.handle_sysconfig(True)
|
||||
elif self.element[1:3] == ['system', 'clear']:
|
||||
return self.handle_sysconfigclear()
|
||||
elif self.element[1:3] == ['management_controller', 'licenses']:
|
||||
return self.handle_licenses()
|
||||
raise Exception('Not implemented')
|
||||
|
||||
def decode_alert(self):
|
||||
@ -1396,6 +1399,25 @@ class IpmiHandler(object):
|
||||
self.output.put(msg.License(self.node, available))
|
||||
return
|
||||
|
||||
def handle_licenses(self):
|
||||
if self.element[-1] == '':
|
||||
self.element = self.element[:-1]
|
||||
if len(self.element) == 3:
|
||||
self.output.put(msg.ChildCollection('all'))
|
||||
i = 1
|
||||
for lic in self.ipmicmd.get_licenses():
|
||||
self.output.put(msg.ChildCollection(str(i)))
|
||||
i += 1
|
||||
return
|
||||
licname = self.element[3]
|
||||
if licname == 'all':
|
||||
for lic in self.ipmicmd.get_licenses():
|
||||
self.output.put(msg.License(self.node, feature=lic['name']))
|
||||
else:
|
||||
index = int(licname)
|
||||
lic = list(self.ipmicmd.get_licenses())[index - 1]
|
||||
self.output.put(msg.License(self.node, feature=lic['name']))
|
||||
|
||||
def handle_description(self):
|
||||
dsc = self.ipmicmd.get_description()
|
||||
self.output.put(msg.KeyValueData(dsc, self.node))
|
||||
|
Loading…
x
Reference in New Issue
Block a user