When a Libvirt host is rebooted, we can optionally choose to automatically
spin back up the instances using the `resume_state_on_host_boot` call. This,
in turn, uses `_hard_reboot` to bring back the instances.
The problem is that `_get_guest_xml` which `_hard_reboot` is using is always
making a call to Glance.show since `image_meta` isn't being passed into it. In
addition to this being an extra latency-heavy call, this is big problem
because the request is *server-generated* not *user-generated* so we won't
have the necessary user-request context to make the Glance call.
In the absense of a general user-impersonation mechanism, the current
workaround is to use cached image-metadata, which works in this case as well.
So the fix is to pass that `image_meta` that we already pull from instance
metadata in `_hard_reboot` and pass it into `_get_guest_xml` and thus avoid
the extra request to Glance.
Reviewed: https:/ /review. openstack. org/105613 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=65341b2547c 5eedef720f6a674 2cdfe436141907
Committed: https:/
Submitter: Jenkins
Branch: master
commit 65341b2547c5eed ef720f6a6742cdf e436141907
Author: Rick Harris <email address hidden>
Date: Tue Jul 8 17:31:27 2014 -0500
libvirt: Avoid Glance.show on hard_reboot
When a Libvirt host is rebooted, we can optionally choose to automatically state_on_ host_boot` call. This,
spin back up the instances using the `resume_
in turn, uses `_hard_reboot` to bring back the instances.
The problem is that `_get_guest_xml` which `_hard_reboot` is using is always
making a call to Glance.show since `image_meta` isn't being passed into it. In
addition to this being an extra latency-heavy call, this is big problem
because the request is *server-generated* not *user-generated* so we won't
have the necessary user-request context to make the Glance call.
In the absense of a general user-impersonation mechanism, the current
workaround is to use cached image-metadata, which works in this case as well.
So the fix is to pass that `image_meta` that we already pull from instance
metadata in `_hard_reboot` and pass it into `_get_guest_xml` and thus avoid
the extra request to Glance.
Change-Id: I2203ac709405ee 784ee5ec017aa47 5575a46a0df
Closes-Bug: 1339386