[openstack-dev] [nova] "correct" API for getting image metadata for an instance ?
Daniel P. Berrange
berrange at redhat.com
Thu May 28 09:33:00 UTC 2015
On Thu, May 28, 2015 at 12:22:59PM +0300, Feodor Tersin wrote:
> I mean the case:
> - an image has long property AAA and non inheritable property BBB;
> - an instance based on the image stores truncated AAA and full BBB;
> - utils.get_image_from_system_metadata returns truncated AAA but not BBB;
> - compute.utils.get_image_metadata updates the result of
> utils.get_image_from_system_metadata by the image metadata and returns full
> AAA and added BBB.
>
> This is the difference i mean.
No, your last step is wrong.
The code in compute_utils.get_image_metadata is this:
# Get the system metadata from the instance
system_meta = utils.instance_sys_meta(instance)
# Merge the metadata from the instance with the image's, if any
system_meta.update(image_system_meta)
# Convert the system metadata to image metadata
return utils.get_image_from_system_metadata(system_meta)
So the image metadata and the instance system metadata are merged into the
same dict, *before* the utils.get_image_from_system_metadata() method is
invokved. So both sets of data will be truncated & non-inheritable props
dropped.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the OpenStack-dev
mailing list