diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-10-23 08:46:52 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-10-23 08:46:52 +0000 |
commit | 1b3d69f33323e3d2fbdd4986768b0591f63c8a8d (patch) | |
tree | 9a80c16427143c79457323fc787c8d4d9f713677 /ironic/drivers/modules | |
parent | a18361903bc7f90218197e41808e81169582e895 (diff) | |
parent | 4755e2adf3f15ef5875ee3933a85d0de6125ccb5 (diff) | |
download | ironic-1b3d69f33323e3d2fbdd4986768b0591f63c8a8d.tar.gz |
Merge "DRAC BIOS vendor_passthru: enable rebooting the node"
Diffstat (limited to 'ironic/drivers/modules')
-rw-r--r-- | ironic/drivers/modules/drac/bios.py | 6 | ||||
-rw-r--r-- | ironic/drivers/modules/drac/management.py | 10 | ||||
-rw-r--r-- | ironic/drivers/modules/drac/vendor_passthru.py | 10 |
3 files changed, 19 insertions, 7 deletions
diff --git a/ironic/drivers/modules/drac/bios.py b/ironic/drivers/modules/drac/bios.py index e6b6b1a56..2c1906659 100644 --- a/ironic/drivers/modules/drac/bios.py +++ b/ironic/drivers/modules/drac/bios.py @@ -388,10 +388,12 @@ def set_config(task, **kwargs): @task_manager.require_exclusive_lock -def commit_config(task): +def commit_config(task, reboot=False): """Commits pending changes added by set_config :param task: is the ironic task for running the config job. + :param reboot: indicates whether a reboot job should be automatically + created with the config job. :raises: DracClientError on an error from pywsman library. :raises: DracPendingConfigJobExists if the job is already created. :raises: DracOperationFailed if the client received response with an @@ -402,7 +404,7 @@ def commit_config(task): """ node = task.node management.check_for_config_job(node) - management.create_config_job(node) + management.create_config_job(node, reboot) @task_manager.require_exclusive_lock diff --git a/ironic/drivers/modules/drac/management.py b/ironic/drivers/modules/drac/management.py index 0e637004b..106dc32a8 100644 --- a/ironic/drivers/modules/drac/management.py +++ b/ironic/drivers/modules/drac/management.py @@ -44,6 +44,10 @@ _BOOT_DEVICES_MAP = { TARGET_DEVICE = 'BIOS.Setup.1-1' +# RebootJobType constants + +_GRACEFUL_REBOOT_WITH_FORCED_SHUTDOWN = '3' + # IsNext constants PERSISTENT = '1' @@ -221,7 +225,7 @@ def _get_boot_list_for_boot_device(node, device, controller_version): return {'boot_list': boot_list, 'boot_device_id': boot_device_id} -def create_config_job(node): +def create_config_job(node, reboot=False): """Create a configuration job. This method is used to apply the pending values created by @@ -241,6 +245,10 @@ def create_config_job(node): 'SystemName': 'DCIM:ComputerSystem'} properties = {'Target': TARGET_DEVICE, 'ScheduledStartTime': 'TIME_NOW'} + + if reboot: + properties['RebootJobType'] = _GRACEFUL_REBOOT_WITH_FORCED_SHUTDOWN + try: client.wsman_invoke(resource_uris.DCIM_BIOSService, 'CreateTargetedConfigJob', selectors, properties, diff --git a/ironic/drivers/modules/drac/vendor_passthru.py b/ironic/drivers/modules/drac/vendor_passthru.py index 0be681f2d..fa96fe927 100644 --- a/ironic/drivers/modules/drac/vendor_passthru.py +++ b/ironic/drivers/modules/drac/vendor_passthru.py @@ -79,14 +79,16 @@ class DracVendorPassthru(base.VendorInterface): return {'commit_needed': bios.set_config(task, **kwargs)} @base.passthru(['POST'], async=False) - def commit_bios_config(self, task, **kwargs): + def commit_bios_config(self, task, reboot=False, **kwargs): """Commit a BIOS configuration job. This method is used to commit a BIOS configuration job. submitted through set_bios_config(). :param task: the ironic task for running the config job. - :param kwargs: not used. + :param reboot: indicates whether a reboot job should be automatically + created with the config job. + :param kwargs: additional arguments sent via vendor passthru. :raises: DracClientError on an error from pywsman library. :raises: DracPendingConfigJobExists if the job is already created. :raises: DracOperationFailed if the client received response with an @@ -96,8 +98,8 @@ class DracVendorPassthru(base.VendorInterface): :returns: A dictionary containing the committing key with no return value, and the reboot_needed key with a value of True. """ - bios.commit_config(task) - return {'committing': None, 'reboot_needed': True} + bios.commit_config(task, reboot=reboot) + return {'committing': None, 'reboot_needed': not reboot} @base.passthru(['DELETE'], async=False) def abandon_bios_config(self, task, **kwargs): |