Rename nova-spiceproxy-url relation key to spice-proxy-url

snap-openstack-hypervisor config key for spice proxy
url is spice-proxy-url. So change the key set in
openstack-hypervisor charm to spice-proxy-url. Update
the lib nova-service to have same name in relation
data for consistency.
Fix spiceproxy url to include spice_auto.html

Change-Id: I8606519a3266d0105dc1afd7ed2a06fceef87dbe
This commit is contained in:
Hemanth Nakkina 2024-04-22 09:18:10 +05:30
parent f0adcefc64
commit ebd2cf0386
No known key found for this signature in database
GPG Key ID: 2E4970F7B143168E
4 changed files with 9 additions and 9 deletions

View File

@ -862,7 +862,7 @@ class NovaOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
if self.nova_spiceproxy_public_url: if self.nova_spiceproxy_public_url:
self.config_svc.interface.set_config( self.config_svc.interface.set_config(
relation=event.relation, relation=event.relation,
nova_spiceproxy_url=self.nova_spiceproxy_public_url, nova_spiceproxy_url=f"{self.nova_spiceproxy_public_url}/spice_auto.html",
) )
else: else:
logging.debug("Nova spiceproxy not yet set, not sending config") logging.debug("Nova spiceproxy not yet set, not sending config")
@ -872,7 +872,7 @@ class NovaOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
if self.nova_spiceproxy_public_url: if self.nova_spiceproxy_public_url:
self.config_svc.interface.set_config( self.config_svc.interface.set_config(
relation=None, relation=None,
nova_spiceproxy_url=self.nova_spiceproxy_public_url, nova_spiceproxy_url=f"{self.nova_spiceproxy_public_url}/spice_auto.html",
) )
else: else:
logging.debug("Nova spiceproxy not yet set, not sending config") logging.debug("Nova spiceproxy not yet set, not sending config")

View File

@ -505,7 +505,7 @@ class HypervisorOperatorCharm(sunbeam_charm.OSBaseOperatorCharm):
try: try:
if contexts.nova_service.nova_spiceproxy_url: if contexts.nova_service.nova_spiceproxy_url:
return { return {
"compute.nova-spiceproxy-url": contexts.nova_service.nova_spiceproxy_url, "compute.spice-proxy-url": contexts.nova_service.nova_spiceproxy_url,
} }
except AttributeError as e: except AttributeError as e:
logger.debug(f"Nova service relation not integrated: {str(e)}") logger.debug(f"Nova service relation not integrated: {str(e)}")

View File

@ -115,7 +115,7 @@ class TestCharm(test_utils.CharmTestCase):
"nova-service", "nova-service",
"nova", "nova",
app_data={ app_data={
"nova-spiceproxy-url": "http://INGRESS_IP/nova-spiceproxy" "spice-proxy-url": "http://INGRESS_IP/nova-spiceproxy/spice_auto.html"
}, },
) )
@ -147,7 +147,7 @@ class TestCharm(test_utils.CharmTestCase):
"compute.rbd-user": "nova", "compute.rbd-user": "nova",
"compute.rbd-secret-uuid": "ddd", "compute.rbd-secret-uuid": "ddd",
"compute.rbd-key": "eee", "compute.rbd-key": "eee",
"compute.nova-spiceproxy-url": "http://INGRESS_IP/nova-spiceproxy", "compute.spice-proxy-url": "http://INGRESS_IP/nova-spiceproxy/spice_auto.html",
"credentials.ovn-metadata-proxy-shared-secret": metadata, "credentials.ovn-metadata-proxy-shared-secret": metadata,
"identity.admin-role": None, "identity.admin-role": None,
"identity.auth-url": "http://10.153.2.45:80/openstack-keystone", "identity.auth-url": "http://10.153.2.45:80/openstack-keystone",
@ -206,7 +206,7 @@ class TestCharm(test_utils.CharmTestCase):
"nova-service", "nova-service",
"nova", "nova",
app_data={ app_data={
"nova-spiceproxy-url": "http://INGRESS_IP/nova-spiceproxy" "spice-proxy-url": "http://INGRESS_IP/nova-spiceproxy/spiceauto.html"
}, },
) )
@ -250,7 +250,7 @@ class TestCharm(test_utils.CharmTestCase):
"compute.rbd-user": "nova", "compute.rbd-user": "nova",
"compute.rbd-secret-uuid": "ddd", "compute.rbd-secret-uuid": "ddd",
"compute.rbd-key": "eee", "compute.rbd-key": "eee",
"compute.nova-spiceproxy-url": "http://INGRESS_IP/nova-spiceproxy", "compute.spice-proxy-url": "http://INGRESS_IP/nova-spiceproxy/spiceauto.html",
"credentials.ovn-metadata-proxy-shared-secret": metadata, "credentials.ovn-metadata-proxy-shared-secret": metadata,
"identity.admin-role": None, "identity.admin-role": None,
"identity.auth-url": "http://10.153.2.45:80/openstack-keystone", "identity.auth-url": "http://10.153.2.45:80/openstack-keystone",

View File

@ -140,7 +140,7 @@ class NovaServiceProvides(Object):
f"{relation.name}/{relation.id}" f"{relation.name}/{relation.id}"
) )
relation.data[self.charm.app][ relation.data[self.charm.app][
"nova-spiceproxy-url" "spice-proxy-url"
] = nova_spiceproxy_url ] = nova_spiceproxy_url
@ -207,4 +207,4 @@ class NovaServiceRequires(Object):
@property @property
def nova_spiceproxy_url(self) -> str | None: def nova_spiceproxy_url(self) -> str | None:
"""Return the nova_spiceproxy url.""" """Return the nova_spiceproxy url."""
return self.get_remote_app_data("nova-spiceproxy-url") return self.get_remote_app_data("spice-proxy-url")