diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 27a684a3..029d6d2a 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -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([ diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 8d206857..9d687c79 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -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,