diff options
author | Dan Smith <dansmith@redhat.com> | 2018-09-24 13:36:39 -0700 |
---|---|---|
committer | Matt Riedemann <mriedem.os@gmail.com> | 2018-09-25 19:04:58 -0400 |
commit | c8e2de668434861b87495e0a0f715b2f90d8ec05 (patch) | |
tree | 86a7f860362e874f0ef2bb4c664660d62cf236cb /nova/tests/unit/compute/test_host_api.py | |
parent | c9448cbdbf96e7436b13ac5c3a92addfc0f2f5a2 (diff) | |
download | nova-c8e2de668434861b87495e0a0f715b2f90d8ec05.tar.gz |
Enforce case-sensitive hostnames in aggregate host add
If we are using a case-insensitive backend database like mysql, a
user can request an aggregate host add with a non-matching hostname
and we will not signal failure. We will create a mapping which will
not actually include that host in the aggregate, which will be
confusing later. This change makes us fail if the host name does not
match exactly, which is the same behavior as if we are using a
case-sensitive backend (like postgres).
Change-Id: I597dee74d33de337913eddda74ab056fbf81a23c
Closes-Bug: #1709260
Diffstat (limited to 'nova/tests/unit/compute/test_host_api.py')
-rw-r--r-- | nova/tests/unit/compute/test_host_api.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/tests/unit/compute/test_host_api.py b/nova/tests/unit/compute/test_host_api.py index e9b364c63b..48e2dd9747 100644 --- a/nova/tests/unit/compute/test_host_api.py +++ b/nova/tests/unit/compute/test_host_api.py @@ -721,8 +721,12 @@ class ComputeAggregateAPITestCase(test.TestCase): fixtures.MockPatch('nova.objects.HostMapping.get_by_host')) self.useFixture( fixtures.MockPatch('nova.context.set_target_cell')) - self.useFixture( - fixtures.MockPatch('nova.objects.Service.get_by_compute_host')) + mock_service_get_by_compute_host = ( + self.useFixture( + fixtures.MockPatch( + 'nova.objects.Service.get_by_compute_host')).mock) + mock_service_get_by_compute_host.return_value = ( + objects.Service(host='fake-host')) @mock.patch('nova.scheduler.client.report.SchedulerReportClient.' 'aggregate_add_host') |