Merge "Follow up for per-instance serial number change"

This commit is contained in:
Zuul 2019-02-05 13:01:38 +00:00 committed by Gerrit Code Review
commit 6d7336a11f
4 changed files with 20 additions and 15 deletions

View File

@ -721,25 +721,25 @@ http://man7.org/linux/man-pages/man7/random.7.html.
('none', 'A serial number entry is not added to the guest '
'domain xml.'),
('os', 'A UUID serial number is generated from the host '
'``/etc/machine-id`` file. This will also affect '
'existing instances on this host once they stop '
'and start again.'),
'``/etc/machine-id`` file.'),
('hardware', 'A UUID for the host hardware as reported by '
'libvirt. This is typically from the host '
'SMBIOS data, unless it has been overridden '
'in ``libvirtd.conf``.'),
('auto', 'Uses the "os" source if possible, else '
'"hardware".'),
('unique', 'Uses instance UUID as the serial number. '
'This will also affect existing instances '
'on this host once they stop and start again.'),
('unique', 'Uses instance UUID as the serial number.'),
),
help='The data source used to the populate the host "serial" '
'UUID exposed to guest in the virtual BIOS. All choices '
'except ``unique`` will change the serial when migrating '
'instance to other host. Changing the choice of this '
'option will also affect existing instances on this host '
'once they stopped and started again.'
help="""
The data source used to the populate the host "serial" UUID exposed to guest
in the virtual BIOS. All choices except ``unique`` will change the serial when
migrating the instance to another host. Changing the choice of this option will
also affect existing instances on this host once they are stopped and started
again. It is recommended to use the default choice (``unique``) since that will
not change when an instance is migrated. However, if you have a need for
per-host serials in addition to per-instance serial numbers, then consider
restricting flavors via host aggregates.
"""
),
cfg.IntOpt('mem_stats_period_seconds',
default=10,

View File

@ -17928,7 +17928,7 @@ class TestGuestConfigSysinfoSerialOS(test.NoDBTestCase):
self.assertEqual(version.version_string_with_package(),
cfg.system_version)
if expected_serial == 'instance_uuid':
expected_serial = instance_ref['uuid']
expected_serial = instance_ref.uuid
self.assertEqual(expected_serial,
cfg.system_serial)
self.assertEqual(instance_ref['uuid'],

View File

@ -366,6 +366,9 @@ class LibvirtDriver(driver.ComputeDriver):
self._volume_api = cinder.API()
self._image_api = image.API()
# The default choice for the sysinfo_serial config option is "unique"
# which does not have a special function since the value is just the
# instance.uuid.
sysinfo_serial_funcs = {
'none': lambda: None,
'hardware': self._get_host_sysinfo_serial_hardware,

View File

@ -3,5 +3,7 @@ upgrade:
- |
Added a new ``unique`` choice to the ``[libvirt]/sysinfo_serial``
configuration which if set will result in the guest serial number being
set to ``instance.uuid`` on this host. This is now the default value
of ``[libvirt]/sysinfo_serial`` config option.
set to ``instance.uuid``. This is now the default value
of the ``[libvirt]/sysinfo_serial`` config option and is the recommended
choice since it ensures the guest serial is the same even if the instance
is migrated between hosts.