[hypervisor] Add hostname as subject alternative names
Qemu blockdev-add command is unhappy when the hostname is not part of the sAN in the certificates (even if it's already in the CN). Add hostname to certificate's subject alternative names. If there is a migration address, it will be the prefered one for qemu migration, therefore also include hostname exposed on this address. Change-Id: I7a1f0e9e0a21f8dbc4bab94acec4f1c5b445a054 Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
parent
e911599abe
commit
5e13d3a679
charms/openstack-hypervisor
@ -240,6 +240,15 @@ class HypervisorOperatorCharm(sunbeam_charm.OSBaseOperatorCharm):
|
||||
self.enable_monitoring = False
|
||||
self.configure_charm(event)
|
||||
|
||||
def get_domain_name_sans(self) -> list[str]:
|
||||
"""Get Domain names for service."""
|
||||
sans = super().get_domain_name_sans()
|
||||
sans.append(socket.getfqdn())
|
||||
sans.append(socket.gethostname())
|
||||
if self.migration_address:
|
||||
sans.append(socket.getfqdn(self.migration_address))
|
||||
return sans
|
||||
|
||||
def get_relation_handlers(
|
||||
self, handlers: List[sunbeam_rhandlers.RelationHandler] = None
|
||||
) -> List[sunbeam_rhandlers.RelationHandler]:
|
||||
|
@ -90,6 +90,7 @@ class TestCharm(test_utils.CharmTestCase):
|
||||
"openstack-hypervisor": hypervisor_snap_mock
|
||||
}
|
||||
self.socket.getfqdn.return_value = "test.local"
|
||||
self.socket.gethostname.return_value = "test"
|
||||
self.initial_setup()
|
||||
self.harness.set_leader()
|
||||
|
||||
@ -202,6 +203,7 @@ class TestCharm(test_utils.CharmTestCase):
|
||||
"openstack-hypervisor": hypervisor_snap_mock
|
||||
}
|
||||
self.socket.getfqdn.return_value = "test.local"
|
||||
self.socket.gethostname.return_value = "test"
|
||||
self.initial_setup()
|
||||
self.harness.set_leader()
|
||||
test_utils.add_complete_amqp_relation(self.harness)
|
||||
|
Loading…
x
Reference in New Issue
Block a user