Skip to content

Commit 809c367

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Stop handling cells v1 for instance naming"
2 parents ee9bfb5 + 59784cf commit 809c367

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

nova/compute/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ def _populate_instance_names(self, instance, num_instances, index):
16611661
default_hostname = 'Server-%s' % instance.uuid
16621662
instance.hostname = utils.sanitize_hostname(
16631663
instance.display_name, default_hostname)
1664-
elif num_instances > 1 and self.cell_type != 'api':
1664+
elif num_instances > 1:
16651665
old_display_name = instance.display_name
16661666
new_display_name = '%s-%d' % (old_display_name, index + 1)
16671667

nova/tests/unit/compute/test_compute.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9975,8 +9975,6 @@ def test_single_instance_display_name(self):
99759975
"""Verify building one instance doesn't do anything funky with
99769976
the display and host names.
99779977
"""
9978-
# TODO(stephenfin): Remove cells_enabled parameter when we removed
9979-
# cells v1
99809978
num_instances = 1
99819979
refs, _ = self.compute_api.create(self.context,
99829980
self.default_flavor,
@@ -9987,23 +9985,20 @@ def test_single_instance_display_name(self):
99879985
self.assertEqual(refs[0]['display_name'], name)
99889986
self.assertEqual(refs[0]['hostname'], name)
99899987

9990-
def test_multi_instance_display_name(self, cells_enabled=False):
9988+
def test_multi_instance_display_name(self):
99919989
"""Verify building two instances at once results in a unique
99929990
display and host name.
99939991
"""
9994-
# TODO(stephenfin): Remove cells_enabled parameter when we removed
9995-
# cells v1
99969992
num_instances = 2
99979993
refs, _ = self.compute_api.create(self.context,
99989994
self.default_flavor,
99999995
image_href=uuids.image_href_id,
100009996
min_count=num_instances, max_count=num_instances,
100019997
display_name='x')
100029998
for i in range(num_instances):
10003-
name = 'x' if cells_enabled else 'x-%s' % (i + 1,)
10004-
hostname = None if cells_enabled else name
9999+
name = 'x-%s' % (i + 1,)
1000510000
self.assertEqual(refs[i]['display_name'], name)
10006-
self.assertEqual(refs[i]['hostname'], hostname)
10001+
self.assertEqual(refs[i]['hostname'], name)
1000710002

1000810003
def test_instance_architecture(self):
1000910004
# Test the instance architecture.

nova/tests/unit/compute/test_compute_api.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5423,19 +5423,13 @@ def test_populate_instance_names_host_name_multi(self):
54235423
params = dict(display_name="vm")
54245424
instance = self._create_instance_obj(params=params)
54255425
self.compute_api._populate_instance_names(instance, 2, 1)
5426-
if self.cell_type != 'api':
5427-
self.assertEqual('vm-2', instance.hostname)
5428-
else:
5429-
self.assertNotIn('hostname', instance)
5426+
self.assertEqual('vm-2', instance.hostname)
54305427

54315428
def test_populate_instance_names_host_name_is_empty_multi(self):
54325429
params = dict(display_name=u'\u865a\u62df\u673a\u662f\u4e2d\u6587')
54335430
instance = self._create_instance_obj(params=params)
54345431
self.compute_api._populate_instance_names(instance, 2, 1)
5435-
if self.cell_type != 'api':
5436-
self.assertEqual('Server-%s' % instance.uuid, instance.hostname)
5437-
else:
5438-
self.assertNotIn('hostname', instance)
5432+
self.assertEqual('Server-%s' % instance.uuid, instance.hostname)
54395433

54405434
def test_host_statuses(self):
54415435
instances = [

nova/tests/unit/compute/test_compute_cells.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,10 @@ def cast(context, method, *args, **kwargs):
456456
self.assertEqual(1, mock_msg.call_count)
457457

458458
def test_populate_instance_for_create(self):
459-
super(CellsComputeAPITestCase, self).test_populate_instance_for_create(
460-
num_instances=2)
459+
self.skipTest("Removing cells v1")
461460

462461
def test_multi_instance_display_name(self):
463-
super(CellsComputeAPITestCase,
464-
self).test_multi_instance_display_name(cells_enabled=True)
462+
self.skipTest("Removing cells v1")
465463

466464
@ddt.data(True, False)
467465
def test_rdp_console(self, enabled_consoleauth):

0 commit comments

Comments
 (0)