mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-26 10:59:53 +00:00
Implement 'persistent' option for nextdevice
Some systems provide the functionality, provide the message support to do that.
This commit is contained in:
parent
b524af08b3
commit
e949ee932a
@ -693,10 +693,10 @@ class BootDevice(ConfluentChoiceMessage):
|
||||
|
||||
valid_paramset = {
|
||||
'bootmode': valid_bootmodes,
|
||||
'persistent': set([True, False]),
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, node, device, bootmode='unspecified'):
|
||||
def __init__(self, node, device, bootmode='unspecified', persistent=False):
|
||||
if device not in self.valid_values:
|
||||
raise Exception("Invalid boot device argument passed in:" +
|
||||
repr(device))
|
||||
@ -707,6 +707,7 @@ class BootDevice(ConfluentChoiceMessage):
|
||||
node: {
|
||||
'nextdevice': {'value': device},
|
||||
'bootmode': {'value': bootmode},
|
||||
'persistent': {'value': persistent},
|
||||
}
|
||||
}
|
||||
|
||||
@ -715,6 +716,7 @@ class InputBootDevice(BootDevice):
|
||||
def __init__(self, path, nodes, inputdata):
|
||||
self.bootdevbynode = {}
|
||||
self.bootmodebynode = {}
|
||||
self.persistentbynode = {}
|
||||
if not inputdata:
|
||||
raise exc.InvalidArgumentException()
|
||||
if 'nextdevice' not in inputdata:
|
||||
@ -736,6 +738,8 @@ class InputBootDevice(BootDevice):
|
||||
datum['bootmode'] + ' is not one of ' +
|
||||
','.join(self.valid_bootmodes))
|
||||
self.bootmodebynode[key] = datum['bootmode']
|
||||
if 'persistent' in datum:
|
||||
self.bootmodebynode[key] = datum['persistent']
|
||||
else:
|
||||
datum = inputdata
|
||||
if 'nextdevice' not in datum:
|
||||
@ -749,6 +753,8 @@ class InputBootDevice(BootDevice):
|
||||
self.bootdevbynode[node] = datum['nextdevice']
|
||||
if 'bootmode' in datum:
|
||||
self.bootmodebynode[node] = datum['bootmode']
|
||||
if 'persistent' in datum:
|
||||
self.persistentbynode[node] = datum['persistent']
|
||||
|
||||
def bootdevice(self, node):
|
||||
return self.bootdevbynode[node]
|
||||
@ -756,6 +762,9 @@ class InputBootDevice(BootDevice):
|
||||
def bootmode(self, node):
|
||||
return self.bootmodebynode.get(node, 'unspecified')
|
||||
|
||||
def persistent(self, node):
|
||||
return self.persistentbynode.get(node, False)
|
||||
|
||||
|
||||
class IdentifyState(ConfluentChoiceMessage):
|
||||
valid_values = set([
|
||||
|
@ -747,16 +747,22 @@ class IpmiHandler(object):
|
||||
bootmode = 'uefi'
|
||||
else:
|
||||
bootmode = 'bios'
|
||||
persistent = False
|
||||
if 'persistent' in bootdev:
|
||||
persistent = bootdev['persistent']
|
||||
self.output.put(msg.BootDevice(node=self.node,
|
||||
device=bootdev['bootdev'],
|
||||
bootmode=bootmode))
|
||||
bootmode=bootmode,
|
||||
persistent=persistent))
|
||||
return
|
||||
elif 'update' == self.op:
|
||||
bootdev = self.inputdata.bootdevice(self.node)
|
||||
douefi = False
|
||||
if self.inputdata.bootmode(self.node) == 'uefi':
|
||||
douefi = True
|
||||
bootdev = self.ipmicmd.set_bootdev(bootdev, uefiboot=douefi)
|
||||
persistent = self.inputdata.persistent(self.node)
|
||||
bootdev = self.ipmicmd.set_bootdev(bootdev, uefiboot=douefi,
|
||||
persist=persistent)
|
||||
if bootdev['bootdev'] in self.bootdevices:
|
||||
bootdev['bootdev'] = self.bootdevices[bootdev['bootdev']]
|
||||
self.output.put(msg.BootDevice(node=self.node,
|
||||
|
Loading…
x
Reference in New Issue
Block a user