diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py
index c13b520b..0c9ed55f 100644
--- a/confluent_server/confluent/messages.py
+++ b/confluent_server/confluent/messages.py
@@ -169,22 +169,25 @@ class DeletedResource(ConfluentMessage):
class ConfluentChoiceMessage(ConfluentMessage):
valid_values = set()
+ valid_paramset = {}
def html(self, extension=''):
snippet = ""
for key in self.kvpairs.iterkeys():
val = self.kvpairs[key]
snippet += key + ':'
snippet += ''.format(key)
+ snippet += 'value="{0}">
\r'.format(key)
return snippet
@@ -355,12 +358,26 @@ class BootDevice(ConfluentChoiceMessage):
'cd',
])
- def __init__(self, node, device):
+ valid_bootmodes = set([
+ 'unspecified',
+ 'bios',
+ 'uefi',
+ ])
+
+ valid_paramset = {
+ 'bootmode': valid_bootmodes,
+ }
+
+
+ def __init__(self, node, device, bootmode='unspecified'):
if device not in self.valid_values:
raise Exception("Invalid boot device argument passed in:" + device)
+ if bootmode not in self.valid_bootmodes:
+ raise Exception("Invalid boot mode argument passed in:" + bootmode)
self.kvpairs = {
node: {
'nextdevice': {'value': device},
+ 'bootmode': {'value': bootmode },
}
}
@@ -368,6 +385,7 @@ class BootDevice(ConfluentChoiceMessage):
class InputBootDevice(BootDevice):
def __init__(self, path, nodes, inputdata):
self.bootdevbynode = {}
+ self.bootmodebynode = {}
if not inputdata:
raise exc.InvalidArgumentException()
if 'nextdevice' not in inputdata:
@@ -383,6 +401,12 @@ class InputBootDevice(BootDevice):
datum['nextdevice'] + ' is not one of ' +
','.join(self.valid_values))
self.bootdevbynode[key] = datum['nextdevice']
+ if 'bootmode' in datum:
+ if datum['bootmode'] not in self.valid_bootmodes:
+ raise exc.InvalidArgumentException(
+ datum['bootmode'] + ' is not one of ' +
+ ','.join(self.valid_bootmodes))
+ self.bootmodebynode[key] = datum['bootmode']
else:
datum = inputdata
if 'nextdevice' not in datum:
@@ -394,10 +418,15 @@ class InputBootDevice(BootDevice):
','.join(self.valid_values))
for node in nodes:
self.bootdevbynode[node] = datum['nextdevice']
+ if 'bootmode' in datum:
+ self.bootmodebynode[node] = datum['bootmode']
def bootdevice(self, node):
return self.bootdevbynode[node]
+ def bootmode(self, node):
+ return self.bootmodebynode.get(node, 'unspecified')
+
class PowerState(ConfluentChoiceMessage):
valid_values = set([
diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py
index 99f32399..9cd7bb4b 100644
--- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py
+++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py
@@ -313,10 +313,18 @@ class IpmiHandler(object):
bootdev = self.ipmicmd.get_bootdev()
if bootdev['bootdev'] in self.bootdevices:
bootdev['bootdev'] = self.bootdevices[bootdev['bootdev']]
+ bootmode = 'unspecified'
+ if 'uefimode' in bootdev:
+ if bootmode['uefimode']:
+ bootmode = 'uefi'
+ else:
+ bootmode = 'bios'
return msg.BootDevice(node=self.node,
- device=bootdev['bootdev'])
+ device=bootdev['bootdev'],
+ bootmode=bootmode)
elif 'update' == self.op:
bootdev = self.inputdata.bootdevice(self.node)
+ bootmode = self.inputdata.bootmode(self.node)
bootdev = self.ipmicmd.set_bootdev(bootdev)
if bootdev['bootdev'] in self.bootdevices:
bootdev['bootdev'] = self.bootdevices[bootdev['bootdev']]