Do not render console config for s390x

Remote console access protocols such as spice,
novnc etc are not supported on s390x so do
not enable them in nova.conf as this will cause
Nova to error.

Change-Id: I84891dcb61fa2733f20b5a0586b1dfebe7ed1ff6
Closes-Bug: #2063190
This commit is contained in:
Edward Hope-Morley 2024-08-07 15:50:24 +01:00
parent 6f2474ad9e
commit e80e7163bc
2 changed files with 34 additions and 0 deletions

View File

@ -874,6 +874,12 @@ class InstanceConsoleContext(context.OSContextGenerator):
def __call__(self):
ctxt = {}
arch = platform.machine()
if arch == 's390x':
log('Skipping instance console config for arch={}'.format(arch),
level=INFO)
return {}
for rid in relation_ids('cloud-compute'):
for unit in related_units(rid):
rel = {'rid': rid, 'unit': unit}

View File

@ -1434,6 +1434,34 @@ class InstanceConsoleContextTest(CharmTestCase):
self.assertEqual(ctxt['spice_agent_enabled'], True, str(ctxt))
@patch.object(context.platform, 'machine')
@patch.object(context, 'resolve_address')
@patch.object(context, 'relation_ids')
@patch.object(context, 'related_units')
def test_spice_s390x(self, mock_related_units, mock_relation_ids,
mock_resolve_address, mock_machine):
mock_relation_ids.return_value = ['cloud-compute:15']
mock_related_units.return_value = ['nova-compute/0']
mock_resolve_address.return_value = "internal-address"
mock_machine.return_value = "s390x"
rel_settings = {
'console_access_protocol': 'spice',
'spice_agent_enabled': True,
'console_keymap': 'en-us',
'console_proxy_spice_address': 'http://1.2.3.4:56/spice_auto.html',
'console_proxy_spice_host': '1.2.3.4',
'console_proxy_spice_port': '56',
}
def rel_get(key, rid, unit):
return rel_settings[key]
self.relation_get.side_effect = rel_get
ctxt = context.InstanceConsoleContext()()
self.assertEqual(ctxt, {})
class NovaComputeCephContextTest(CharmTestCase):