From 53808945f68f24406b42d9fbb85de010cafbddbd Mon Sep 17 00:00:00 2001 From: Thiago Paiva Date: Tue, 2 Aug 2016 11:34:31 -0300 Subject: [PATCH] Comply with iLO model of usage for one-time boot After a review from Shivanand and a talk in the #openstack-ironic channel, the understanding is that we should use the BootSourceOverrideEnabled=Once to comply with iLO's model to use that REST endpoint. http://eavesdrop.openstack.org/irclogs/%23openstack-ironic/%23openstack-ironic.2016-08-02.log.html#t2016-08-02T14:09:58 Change-Id: Ic650defd699f9330d54c2345fcaa0797a3e79e55 --- oneview_client/ilo_utils.py | 4 +++- oneview_client/tests/functional/test_oneview_client.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/oneview_client/ilo_utils.py b/oneview_client/ilo_utils.py index 3831708..781a00c 100644 --- a/oneview_client/ilo_utils.py +++ b/oneview_client/ilo_utils.py @@ -196,7 +196,9 @@ def set_onetime_boot(host_ip, x_auth_token, boot_target, allow_insecure=False): raise exceptions.IloException( "ERROR: %s is not a supported boot option.\n" % boot_target) else: - body = {"Boot": {"BootSourceOverrideTarget": boot_target}} + body = {"Boot": {"BootSourceOverrideTarget": boot_target, + "BootSourceOverrideEnabled": "Once"} + } headers = {"Content-Type": "application/json"} status_code, _, response = rest_patch(host_ip, member_uri, headers, body, x_auth_token, diff --git a/oneview_client/tests/functional/test_oneview_client.py b/oneview_client/tests/functional/test_oneview_client.py index 6a4750a..7b0913c 100644 --- a/oneview_client/tests/functional/test_oneview_client.py +++ b/oneview_client/tests/functional/test_oneview_client.py @@ -16,6 +16,7 @@ # limitations under the License. import copy +import json import mock import requests import six.moves.http_client as http_client @@ -392,7 +393,8 @@ class OneViewClientTestCase(unittest.TestCase): oneview_client.set_boot_device(node_info, 'HardDisk', onetime=True) mock_patch.assert_called_once_with( 'https://' + my_host + '/rest/v1/Systems/1', - data='{"Boot": {"BootSourceOverrideTarget": "Hdd"}}', + data=json.dumps({"Boot": {"BootSourceOverrideTarget": "Hdd", + "BootSourceOverrideEnabled": "Once"}}), headers={ 'Content-Type': 'application/json', 'X-Auth-Token': key},