From 17852167b8cb19a82c07cf763a58e9e0261b3cc6 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Thu, 15 Jun 2023 07:33:04 +0000 Subject: [PATCH] Bug 2109. Fix VIM info DB update after vertical scaling, migrate and operate Fix the path of the VDU record to update. Fix unexpected keyword argument 'disk_over_commit' in live_migrate method because of Nova microversion change (Bug 2262) Handle the OS-EXT-SRV-ATTR:host KeyError as this key is raised if the VIM account does not have admin credentials Expand unit tests for vertical_scale, migrate and operate task creations Change-Id: Ic7c1fe639fc0b8f917c46c6fe61fd4089a6970b4 Signed-off-by: Patricia Reinoso --- NG-RO/osm_ng_ro/ns.py | 12 +- NG-RO/osm_ng_ro/tests/test_ns.py | 392 +++++++++++++----- .../osm_rovim_openstack/vimconn_openstack.py | 55 ++- RO-plugin/osm_ro_plugin/vimconn.py | 9 +- ...for_vertical_scaling-1493168979026c91.yaml | 27 ++ 5 files changed, 380 insertions(+), 115 deletions(-) create mode 100644 releasenotes/notes/fix_bug_2109_for_vertical_scaling-1493168979026c91.yaml diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index ba5582ed..7de864e2 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -2897,7 +2897,9 @@ class Ns(object): extra_dict, ): self._assign_vim(target_vim) - target_record = "vnfrs:{}:vdur.{}".format(vnf_id, vdu_index) + target_record = "vnfrs:{}:vdur.{}.vim_info.{}".format( + vnf_id, vdu_index, target_vim + ) target_record_id = "vnfrs:{}:vdur.{}".format(vnf_id, vdu_id) deployment_info = { "action_id": action_id, @@ -3003,7 +3005,9 @@ class Ns(object): ): target_vim, vim_info = next(k_v for k_v in vdu["vim_info"].items()) self._assign_vim(target_vim) - target_record = "vnfrs:{}:vdur.{}".format(vnf["_id"], vdu_index) + target_record = "vnfrs:{}:vdur.{}.vim_info.{}".format( + vnf["_id"], vdu_index, target_vim + ) target_record_id = "vnfrs:{}:vdur.{}".format(vnf["_id"], vdu["id"]) deployment_info = { "action_id": action_id, @@ -3117,7 +3121,9 @@ class Ns(object): ): target_vim, vim_info = next(k_v for k_v in vdu["vim_info"].items()) self._assign_vim(target_vim) - target_record = "vnfrs:{}:vdur.{}".format(vnf["_id"], vdu_index) + target_record = "vnfrs:{}:vdur.{}.vim_info.{}".format( + vnf["_id"], vdu_index, target_vim + ) target_record_id = "vnfrs:{}:vdur.{}".format(vnf["_id"], vdu["id"]) deployment_info = { "action_id": action_id, diff --git a/NG-RO/osm_ng_ro/tests/test_ns.py b/NG-RO/osm_ng_ro/tests/test_ns.py index 79e98c38..fcfe897f 100644 --- a/NG-RO/osm_ng_ro/tests/test_ns.py +++ b/NG-RO/osm_ng_ro/tests/test_ns.py @@ -326,6 +326,77 @@ runcmd: - [ ls, -l, / ] - [ sh, -xc, "echo $(date) '& rm -rf /'" ] """ +vdu_id = "bb9c43f9-10a2-4569-a8a8-957c3528b6d1" +vnf_id = "665b4165-ce24-4320-bf19-b9a45bade49f" +target_vim = "vim:f9f370ac-0d44-41a7-9000-457f2332bc35" +action_id = "bb937f49-3870-4169-b758-9732e1ff40f3" +nsr_id_2 = "993166fe-723e-4680-ac4b-b1af2541ae31" +target_record_1 = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.1.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" +target_record_id = ( + "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:" + "vdur.bb9c43f9-10a2-4569-a8a8-957c3528b6d1" +) +expected_result_vertical_scale = { + "target_id": target_vim, + "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", + "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", + "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:1", + "status": "SCHEDULED", + "action": "EXEC", + "item": "verticalscale", + "target_record": target_record_1, + "target_record_id": target_record_id, + "params": { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "flavor_dict": "flavor_dict", + }, +} +vdu = { + "id": vdu_id, + "vim_info": {target_vim: {"interfaces": []}}, +} +vnf = {"_id": vnf_id} +extra_dict_vertical_scale = { + "params": { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "flavor_dict": "flavor_dict", + }, +} +extra_dict_migrate = { + "params": { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "migrate_host": "migrateToHost", + }, +} +expected_result_migrate = { + "target_id": target_vim, + "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", + "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", + "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:1", + "status": "SCHEDULED", + "action": "EXEC", + "item": "migrate", + "target_record": "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.1.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35", + "target_record_id": target_record_id, + "params": { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "migrate_host": "migrateToHost", + }, +} +expected_result_rebuild_start_stop = { + "target_id": target_vim, + "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", + "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", + "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:0", + "status": "SCHEDULED", + "action": "EXEC", + "item": "update", + "target_record_id": "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.bb9c43f9-10a2-4569-a8a8-957c3528b6d1", +} + + +class TestException(Exception): + pass class CopyingMock(MagicMock): @@ -2921,143 +2992,278 @@ class TestNs(unittest.TestCase): self.assertEqual(result, expected_result) @patch("osm_ng_ro.ns.Ns._assign_vim") - def test__rebuild_start_stop_task(self, assign_vim): + def test__rebuild_start_stop_task__successful(self, assign_vim): self.ns = Ns() extra_dict = {} actions = ["start", "stop", "rebuild"] - vdu_id = "bb9c43f9-10a2-4569-a8a8-957c3528b6d1" - vnf_id = "665b4165-ce24-4320-bf19-b9a45bade49f" vdu_index = "0" - action_id = "bb937f49-3870-4169-b758-9732e1ff40f3" - nsr_id = "993166fe-723e-4680-ac4b-b1af2541ae31" task_index = 0 - target_vim = "vim:f9f370ac-0d44-41a7-9000-457f2332bc35" - t = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.bb9c43f9-10a2-4569-a8a8-957c3528b6d1" for action in actions: - expected_result = { - "target_id": "vim:f9f370ac-0d44-41a7-9000-457f2332bc35", - "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", - "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", - "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:0", - "status": "SCHEDULED", - "action": "EXEC", - "item": "update", - "target_record": "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0", - "target_record_id": t, - "params": { - "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", - "action": action, - }, + params = { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "action": action, } - extra_dict["params"] = { + extra_dict["params"] = params + expected_result = deepcopy(expected_result_rebuild_start_stop) + expected_result[ + "target_record" + ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" + expected_result["params"] = params + task = self.ns.rebuild_start_stop_task( + vdu_id, + vnf_id, + vdu_index, + action_id, + nsr_id_2, + task_index, + target_vim, + extra_dict, + ) + self.assertDictEqual(task, expected_result) + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test__rebuild_start_stop_task__empty_extra_dict__task_without_params( + self, assign_vim + ): + self.ns = Ns() + extra_dict = {} + actions = ["start", "stop", "rebuild"] + vdu_index = "0" + task_index = 0 + expected_result = deepcopy(expected_result_rebuild_start_stop) + expected_result[ + "target_record" + ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" + for _ in actions: + task = self.ns.rebuild_start_stop_task( + vdu_id, + vnf_id, + vdu_index, + action_id, + nsr_id_2, + task_index, + target_vim, + extra_dict, + ) + self.assertDictEqual(task, expected_result) + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test__rebuild_start_stop_task__different_vdu_index__target_record_changes( + self, assign_vim + ): + self.ns = Ns() + extra_dict = {} + actions = ["start", "stop", "rebuild"] + vdu_index = "4" + task_index = 0 + for action in actions: + params = { "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", "action": action, } + extra_dict["params"] = params + expected_result = deepcopy(expected_result_rebuild_start_stop) + expected_result[ + "target_record" + ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" + expected_result["params"] = params task = self.ns.rebuild_start_stop_task( vdu_id, vnf_id, vdu_index, action_id, - nsr_id, + nsr_id_2, task_index, target_vim, extra_dict, ) - self.assertEqual(task.get("action_id"), action_id) - self.assertEqual(task.get("nsr_id"), nsr_id) - self.assertEqual(task.get("target_id"), target_vim) self.assertDictEqual(task, expected_result) @patch("osm_ng_ro.ns.Ns._assign_vim") - def test_verticalscale_task(self, assign_vim): + def test__rebuild_start_stop_task__different_task_index__task_id_changes( + self, assign_vim + ): self.ns = Ns() extra_dict = {} + actions = ["start", "stop", "rebuild"] + vdu_index = "0" + task_index = 3 + for action in actions: + params = { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "action": action, + } + extra_dict["params"] = params + expected_result = deepcopy(expected_result_rebuild_start_stop) + expected_result[ + "target_record" + ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" + expected_result["params"] = params + expected_result["task_id"] = "bb937f49-3870-4169-b758-9732e1ff40f3:3" + task = self.ns.rebuild_start_stop_task( + vdu_id, + vnf_id, + vdu_index, + action_id, + nsr_id_2, + task_index, + target_vim, + extra_dict, + ) + self.assertDictEqual(task, expected_result) + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test__rebuild_start_stop_task__assign_vim_raises__task_is_not_created( + self, assign_vim + ): + self.ns = Ns() + extra_dict = {} + actions = ["start", "stop", "rebuild"] + vdu_index = "0" + task_index = 0 + for action in actions: + params = { + "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", + "action": action, + } + extra_dict["params"] = params + assign_vim.side_effect = TestException("Can not connect to VIM.") + with self.assertRaises(TestException) as err: + task = self.ns.rebuild_start_stop_task( + vdu_id, + vnf_id, + vdu_index, + action_id, + nsr_id_2, + task_index, + target_vim, + extra_dict, + ) + self.assertEqual(task, None) + self.assertEqual(str(err.exception), "Can not connect to VIM.") + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_verticalscale_task__successful(self, assign_vim): + self.ns = Ns() vdu_index = "1" - action_id = "bb937f49-3870-4169-b758-9732e1ff40f3" - nsr_id = "993166fe-723e-4680-ac4b-b1af2541ae31" task_index = 1 - target_record_id = ( - "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:" - "vdur.bb9c43f9-10a2-4569-a8a8-957c3528b6d1" + task = self.ns.verticalscale_task( + vdu, + vnf, + vdu_index, + action_id, + nsr_id_2, + task_index, + extra_dict_vertical_scale, ) + self.assertDictEqual(task, expected_result_vertical_scale) - expected_result = { - "target_id": "vim:f9f370ac-0d44-41a7-9000-457f2332bc35", - "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", - "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", - "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:1", - "status": "SCHEDULED", - "action": "EXEC", - "item": "verticalscale", - "target_record": "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.1", - "target_record_id": target_record_id, - "params": { - "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", - "flavor_dict": "flavor_dict", - }, - } - vdu = { - "id": "bb9c43f9-10a2-4569-a8a8-957c3528b6d1", - "vim_info": { - "vim:f9f370ac-0d44-41a7-9000-457f2332bc35": {"interfaces": []} - }, - } - vnf = {"_id": "665b4165-ce24-4320-bf19-b9a45bade49f"} - extra_dict["params"] = { - "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", - "flavor_dict": "flavor_dict", - } + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_verticalscale_task__task_index_changes__task_id_changes(self, assign_vim): + self.ns = Ns() + vdu_index = "1" + task_index = 2 + expected_result = deepcopy(expected_result_vertical_scale) + expected_result["task_id"] = "bb937f49-3870-4169-b758-9732e1ff40f3:2" task = self.ns.verticalscale_task( - vdu, vnf, vdu_index, action_id, nsr_id, task_index, extra_dict + vdu, + vnf, + vdu_index, + action_id, + nsr_id_2, + task_index, + extra_dict_vertical_scale, ) - self.assertDictEqual(task, expected_result) @patch("osm_ng_ro.ns.Ns._assign_vim") - def test_migrate_task(self, assign_vim): + def test_verticalscale_task__empty_extra_dict__expected_result_without_params( + self, assign_vim + ): self.ns = Ns() extra_dict = {} vdu_index = "1" - action_id = "bb937f49-3870-4169-b758-9732e1ff40f3" - nsr_id = "993166fe-723e-4680-ac4b-b1af2541ae31" task_index = 1 - target_record_id = ( - "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:" - "vdur.bb9c43f9-10a2-4569-a8a8-957c3528b6d1" + expected_result = deepcopy(expected_result_vertical_scale) + expected_result.pop("params") + task = self.ns.verticalscale_task( + vdu, vnf, vdu_index, action_id, nsr_id_2, task_index, extra_dict ) + self.assertDictEqual(task, expected_result) - expected_result = { - "target_id": "vim:f9f370ac-0d44-41a7-9000-457f2332bc35", - "action_id": "bb937f49-3870-4169-b758-9732e1ff40f3", - "nsr_id": "993166fe-723e-4680-ac4b-b1af2541ae31", - "task_id": "bb937f49-3870-4169-b758-9732e1ff40f3:1", - "status": "SCHEDULED", - "action": "EXEC", - "item": "migrate", - "target_record": "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.1", - "target_record_id": target_record_id, - "params": { - "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", - "migrate_host": "migrateToHost", - }, - } - vdu = { - "id": "bb9c43f9-10a2-4569-a8a8-957c3528b6d1", - "vim_info": { - "vim:f9f370ac-0d44-41a7-9000-457f2332bc35": {"interfaces": []} - }, - } - vnf = {"_id": "665b4165-ce24-4320-bf19-b9a45bade49f"} - extra_dict["params"] = { - "vim_vm_id": "f37b18ef-3caa-4dc9-ab91-15c669b16396", - "migrate_host": "migrateToHost", - } + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_verticalscale_task__assign_vim_raises__task_is_not_created( + self, assign_vim + ): + self.ns = Ns() + vdu_index = "1" + task_index = 1 + assign_vim.side_effect = TestException("Can not connect to VIM.") + with self.assertRaises(TestException) as err: + task = self.ns.verticalscale_task( + vdu, + vnf, + vdu_index, + action_id, + nsr_id_2, + task_index, + extra_dict_vertical_scale, + ) + self.assertEqual(task, {}) + self.assertEqual(str(err.exception), "Can not connect to VIM.") + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_migrate_task__successful(self, assign_vim): + self.ns = Ns() + vdu_index = "1" + task_index = 1 + task = self.ns.migrate_task( + vdu, vnf, vdu_index, action_id, nsr_id_2, task_index, extra_dict_migrate + ) + self.assertDictEqual(task, expected_result_migrate) + + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_migrate_task__empty_extra_dict__task_without_params(self, assign_vim): + self.ns = Ns() + extra_dict = {} + vdu_index = "1" + task_index = 1 + expected_result = deepcopy(expected_result_migrate) + expected_result.pop("params") task = self.ns.migrate_task( - vdu, vnf, vdu_index, action_id, nsr_id, task_index, extra_dict + vdu, vnf, vdu_index, action_id, nsr_id_2, task_index, extra_dict ) + self.assertDictEqual(task, expected_result) + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_migrate_task__different_vdu_index__target_record_with_different_vdu_index( + self, assign_vim + ): + self.ns = Ns() + vdu_index = "4" + task_index = 1 + expected_result = deepcopy(expected_result_migrate) + expected_result[ + "target_record" + ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35" + task = self.ns.migrate_task( + vdu, vnf, vdu_index, action_id, nsr_id_2, task_index, extra_dict_migrate + ) self.assertDictEqual(task, expected_result) + @patch("osm_ng_ro.ns.Ns._assign_vim") + def test_migrate_task__assign_vim_raises__task_is_not_created(self, assign_vim): + self.ns = Ns() + vdu_index = "1" + task_index = 1 + assign_vim.side_effect = TestException("Can not connect to VIM.") + with self.assertRaises(TestException) as err: + task = self.ns.migrate_task( + vdu, vnf, vdu_index, action_id, nsr_id, task_index, extra_dict_migrate + ) + self.assertDictEqual(task, {}) + self.assertEqual(str(err.exception), "Can not connect to VIM.") + class TestProcessVduParams(unittest.TestCase): def setUp(self): diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 8de65341..70b3f211 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -567,9 +567,15 @@ class vimconnector(vimconn.VimConnector): ksExceptions.BadRequest, ), ): + if message_error == "OS-EXT-SRV-ATTR:host": + tip = " (If the user does not have non-admin credentials, this attribute will be missing)" + raise vimconn.VimConnInsufficientCredentials( + type(exception).__name__ + ": " + message_error + tip + ) raise vimconn.VimConnException( type(exception).__name__ + ": " + message_error ) + elif isinstance( exception, ( @@ -3703,24 +3709,35 @@ class vimconnector(vimconn.VimConnector): ) as e: self._format_exception(e) - def get_vdu_state(self, vm_id): - """ - Getting the state of a vdu - param: - vm_id: ID of an instance + def get_vdu_state(self, vm_id, host_is_required=False) -> list: + """Getting the state of a VDU. + Args: + vm_id (str): ID of an instance + host_is_required (Boolean): If the VIM account is non-admin, host info does not appear in server_dict + and if this is set to True, it raises KeyError. + Returns: + vdu_data (list): VDU details including state, flavor, host_info, AZ """ self.logger.debug("Getting the status of VM") self.logger.debug("VIM VM ID %s", vm_id) - self._reload_connection() - server_dict = self._find_nova_server(vm_id) - vdu_data = [ - server_dict["status"], - server_dict["flavor"]["id"], - server_dict["OS-EXT-SRV-ATTR:host"], - server_dict["OS-EXT-AZ:availability_zone"], - ] - self.logger.debug("vdu_data %s", vdu_data) - return vdu_data + try: + self._reload_connection() + server_dict = self._find_nova_server(vm_id) + srv_attr = "OS-EXT-SRV-ATTR:host" + host_info = ( + server_dict[srv_attr] if host_is_required else server_dict.get(srv_attr) + ) + vdu_data = [ + server_dict["status"], + server_dict["flavor"]["id"], + host_info, + server_dict["OS-EXT-AZ:availability_zone"], + ] + self.logger.debug("vdu_data %s", vdu_data) + return vdu_data + + except Exception as e: + self._format_exception(e) def check_compute_availability(self, host, server_flavor_details): self._reload_connection() @@ -3787,7 +3804,7 @@ class vimconnector(vimconn.VimConnector): """ self._reload_connection() vm_state = False - instance_state = self.get_vdu_state(vm_id) + instance_state = self.get_vdu_state(vm_id, host_is_required=True) server_flavor_id = instance_state[1] server_hypervisor_name = instance_state[2] server_availability_zone = instance_state[3] @@ -3822,17 +3839,19 @@ class vimconnector(vimconn.VimConnector): http_code=vimconn.HTTP_Bad_Request, ) if available_compute_id is not None: + # disk_over_commit parameter for live_migrate method is not valid for Nova API version >= 2.25 self.nova.servers.live_migrate( server=vm_id, host=available_compute_id, block_migration=True, - disk_over_commit=False, ) state = "MIGRATING" changed_compute_host = "" if state == "MIGRATING": vm_state = self.__wait_for_vm(vm_id, "ACTIVE") - changed_compute_host = self.get_vdu_state(vm_id)[2] + changed_compute_host = self.get_vdu_state( + vm_id, host_is_required=True + )[2] if vm_state and changed_compute_host == available_compute_id: self.logger.debug( "Instance '{}' migrated to the new compute host '{}'".format( diff --git a/RO-plugin/osm_ro_plugin/vimconn.py b/RO-plugin/osm_ro_plugin/vimconn.py index b251d598..66fe1909 100644 --- a/RO-plugin/osm_ro_plugin/vimconn.py +++ b/RO-plugin/osm_ro_plugin/vimconn.py @@ -123,12 +123,19 @@ class VimConnNotSupportedException(VimConnException): class VimConnNotImplemented(VimConnException): - """The method is not implemented by the connected""" + """The method is not implemented by the connector""" def __init__(self, message, http_code=HTTP_Not_Implemented): VimConnException.__init__(self, message, http_code) +class VimConnInsufficientCredentials(VimConnException): + """The VIM account does not have efficient permissions to perform the requested operation.""" + + def __init__(self, message, http_code=HTTP_Unauthorized): + VimConnException.__init__(self, message, http_code) + + class VimConnector: """Abstract base class for all the VIM connector plugins These plugins must implement a VimConnector class derived from this diff --git a/releasenotes/notes/fix_bug_2109_for_vertical_scaling-1493168979026c91.yaml b/releasenotes/notes/fix_bug_2109_for_vertical_scaling-1493168979026c91.yaml new file mode 100644 index 00000000..5ce3d7c3 --- /dev/null +++ b/releasenotes/notes/fix_bug_2109_for_vertical_scaling-1493168979026c91.yaml @@ -0,0 +1,27 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +--- +fixes: + - | + Fix Bug 2109 + + Fix VIM info DB update after vertical scaling, migrate and operate VNF. + Fix the path of the VDU record to update. + Fix unexpected keyword argument 'disk_over_commit' in live_migrate method because of Nova microversion change (Bug 2262) + Handle the OS-EXT-SRV-ATTR:host KeyError as this key is raised if the VIM account does not have admin credentials + Expand unit tests for vertical_scale, migrate and operate task creations + -- 2.17.1