Comment 13 for bug 1896438

Revision history for this message
Przemyslaw Hausman (phausman) wrote :

The above commit (https://bugs.launchpad.net/charm-glance-simplestreams-sync/+bug/1896438/comments/12) only partially solves the problem. I understand that simplestreams need to be patched too.

@paride, it looks to me that simplestreams does not take into account OS_ENDPOINT_TYPE environment variable. And the above commit to glance-simplestreams-sync charm in fact sets this environment variable.

Since simplestreams does not process OS_ENDPOINT_TYPE environment variable, it creates swift and glance clients, that by default try to connect with the public OpenStack endpoints. In the environments where public endpoints are not accessible (e.g. there's no routing to the VLAN where OpenStack public endpoints are exposed), simplestreams will get stuck while trying to connect to swift and glance public endpoints. I believe this should be changed.

If the OS_ENDPOINT_TYPE environment variable is set, simplestreams should populate the os_options['endpoint_type'] parameter with the value of OS_ENDPOINT_TYPE (e.g. 'internal') while creating swift and glance clients in functions get_swiftclient() [1] and get_glanceclient() [2].

1. https://git.launchpad.net/simplestreams/tree/simplestreams/objectstores/swift.py#n27
2. https://git.launchpad.net/simplestreams/tree/simplestreams/mirrors/glance.py#n34

Also both get_swiftclient() and get_glanceclient() functions should not reuse session (if it already exists) because this session does not have os_options populated.

To make the above work, two other places need to be patched.

openstack.load_keystone_creds() [3] does not read environment variable OS_ENDPOINT_TYPE set by glance-simplestreams-sync charm in [4]. This needs to be patched by adding 'OS_ENDPOINT_TYPE' to OS_ENV_VARS [5].

3. https://git.launchpad.net/simplestreams/tree/simplestreams/openstack.py#n73
4. https://opendev.org/openstack/charm-glance-simplestreams-sync/src/commit/6733e22006750fa0a0dc405278b0446fd4aecac4/files/glance_simplestreams_sync.py#L239
5. https://git.launchpad.net/simplestreams/tree/simplestreams/openstack.py#n33

openstack.get_service_conn_info() [6] does not return 'endpoint_type' key in the 'info' dict. This needs to be patched, e.g. by adding 'endpoint_type': kwargs.get('endpoint_type')} to info dict.

6. https://git.launchpad.net/simplestreams/tree/simplestreams/openstack.py#n194

Hope it makes sense,
Przemyslaw