Sanitize the config drive UUID
When cloud-init processes an instance to determine if it is first boot or not, it compares the config drive UUID with the VM UUID. This change makes those values the same now for a given VM / config drive pair. Change-Id: I128a0bc886b020d67241c67a874cf8d06e791b57
This commit is contained in:
parent
af0e814d62
commit
5d438733eb
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2015, 2017 IBM Corp.
|
||||
# Copyright 2015, 2018 IBM Corp.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -42,7 +42,8 @@ class TestConfigDrivePowerVM(test.NoDBTestCase):
|
|||
@mock.patch('nova.api.metadata.base.InstanceMetadata', autospec=True)
|
||||
@mock.patch('nova.virt.configdrive.ConfigDriveBuilder.make_drive',
|
||||
autospec=True)
|
||||
def test_crt_cfg_dr_iso(self, mock_mkdrv, mock_meta):
|
||||
@mock.patch('nova_powervm.virt.powervm.vm.get_pvm_uuid', autospec=True)
|
||||
def test_crt_cfg_dr_iso(self, mock_pvm_uuid, mock_mkdrv, mock_meta):
|
||||
"""Validates that the image creation method works."""
|
||||
cfg_dr_builder = m.ConfigDrivePowerVM(self.apt)
|
||||
mock_instance = mock.MagicMock()
|
||||
|
@ -55,6 +56,7 @@ class TestConfigDrivePowerVM(test.NoDBTestCase):
|
|||
mock_net)
|
||||
self.assertEqual('cfg_fake_instance.iso', file_name)
|
||||
self.assertEqual('/tmp/cfgdrv/cfg_fake_instance.iso', iso_path)
|
||||
self.assertTrue(mock_pvm_uuid.called)
|
||||
# Make sure the length is limited properly
|
||||
mock_instance.name = 'fake-instance-with-name-that-is-too-long'
|
||||
iso_path, file_name = cfg_dr_builder._create_cfg_dr_iso(mock_instance,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2015, 2017 IBM Corp.
|
||||
# Copyright 2015, 2018 IBM Corp.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -109,6 +109,9 @@ class ConfigDrivePowerVM(object):
|
|||
extra_md=extra_md,
|
||||
network_info=network_info)
|
||||
|
||||
# fix instance uuid to match uuid assigned to VM
|
||||
inst_md.uuid = vm.get_pvm_uuid(instance).lower()
|
||||
|
||||
# Make sure the path exists.
|
||||
im_path = CONF.powervm.image_meta_local_path
|
||||
if not os.path.exists(im_path):
|
||||
|
|
Loading…
Reference in New Issue