Get image metadata in to_xml for generating xml

The to_xml method of libvirt driver will generate xml file of instance
during hard reboot/spawn/rescue/migrate and other operations, and the
image_meta is used for generating correct xml of instance.
But the accurate image_meta may not be passed into the get_guest_config,
so some configs related to the image_meta will be lost, we need to get the
image metadata if it is not passed to the to_xml method.

Fixes bug 1206809
Change-Id: I6942837905334a652cda64d7dd41d3b575846d93
Merge "Get image metadata in to_xml for generating xml"