diff --git a/nova/api/openstack/compute/views/servers.py b/nova/api/openstack/compute/views/servers.py index dbad475c28..9cd57c8046 100644 --- a/nova/api/openstack/compute/views/servers.py +++ b/nova/api/openstack/compute/views/servers.py @@ -215,7 +215,8 @@ class ViewBuilder(common.ViewBuilder): host = instance.get("host") project = str(instance.get("project_id")) if host: - sha_hash = hashlib.sha224(project + host) + data = (project + host).encode('utf-8') + sha_hash = hashlib.sha224(data) return sha_hash.hexdigest() def _get_addresses(self, request, instance, extend_address=False): diff --git a/nova/tests/unit/api/openstack/compute/test_server_actions.py b/nova/tests/unit/api/openstack/compute/test_server_actions.py index 96ad3d8b30..8606dca7b7 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_actions.py +++ b/nova/tests/unit/api/openstack/compute/test_server_actions.py @@ -315,7 +315,7 @@ class ServerActionsControllerTestV21(test.TestCase): self.assertEqual(len(body['server']['adminPass']), CONF.password_length) - self.assertEqual(robj['location'], self_href) + self.assertEqual(robj['location'], self_href.encode('utf-8')) def test_rebuild_instance_with_image_uuid(self): info = dict(image_href_in_call=None) @@ -379,7 +379,7 @@ class ServerActionsControllerTestV21(test.TestCase): self.assertEqual(body['server']['image']['id'], '2') self.assertNotIn("adminPass", body['server']) - self.assertEqual(robj['location'], self_href) + self.assertEqual(robj['location'], self_href.encode('utf-8')) def test_rebuild_raises_conflict_on_invalid_state(self): body = { diff --git a/tests-py3.txt b/tests-py3.txt index 341b746f90..d4d0f681e0 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -20,7 +20,6 @@ nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecu nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecurityGroupDefaultRulesV21 nova.tests.unit.api.openstack.compute.test_security_groups.SecurityGroupsOutputTestV21 nova.tests.unit.api.openstack.compute.test_security_groups.TestSecurityGroupRulesV21 -nova.tests.unit.api.openstack.compute.test_server_actions.ServerActionsControllerTestV21 nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerCreateTest nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildInstanceTest nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildTestV219