[openstack-dev] [nova] "correct" API for getting image metadata for an instance ?
Feodor Tersin
ftersin at cloudscaling.com
Thu May 28 13:45:17 UTC 2015
Yes, my mistake. I missed that utils.get_image_from_system_metadata just
converts a passed metadata, but do not get metadata from the instance.
So non-inhertable properties are omitted in both result sets.
But compute.utils.get_image_metadata returns not trucated long properties.
It reads truncated value by utils.instance_sys_meta and updates it to full
value from image_system_metadata.
So if replace call of compute.utils.get_image_metadata(.., instance) to
utils.get_image_from_system_metadata(instance.system_metadata), it will get
truncated props.
On Thu, May 28, 2015 at 12:33 PM, Daniel P. Berrange <berrange at redhat.com>
wrote:
> 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
> :|
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150528/5557559d/attachment.html>
More information about the OpenStack-dev
mailing list