openstack4j icon indicating copy to clipboard operation
openstack4j copied to clipboard

Glance. Cant retrieve image locations.

Open grantallonanytable opened this issue 3 years ago • 0 comments

Issue description

Get image meta info via REST GET /images/{image-id}. It respondes with such json:

{
	"os_glance_importing_to_stores": "",
	"os_glance_failed_import": "",
	"os_glance_import_task": "00000000-1234-1234-1234-95499f28c9a6",
	...
	"locations": [
		{
			"url": "file:///var/lib/glance/images/00000000-1234-1234-1234-123456781234",
			"metadata": {
				"store": "file"
			}
		},
		{
			"url": "s3://s3user:[email protected]:9000/my-bucket/00000000-1234-1234-1234-123456781234",
			"metadata": {
				"store": "store-name"
			}
		}
	],
	....
}

SDK call is

OSClient.OSClientV3 osClientV3 = OSFactory.clientFromToken(token);
Image image = osClientV3.imagesV2().get(imageId);

I can`t extract stores name like

image.getLocations().stream(Location::get-metadate-method).collect(toList())

because org.openstack4j.openstack.image.v2.domain.GlanceImage.Location does not has @Getter annotation nor getters for fields.

Class org.openstack4j.openstack.image.v2.domain.GlanceImage.Location needs getters.

grantallonanytable avatar May 15 '23 16:05 grantallonanytable