XENAPI add duration measure to log message

The xenapi snapshot command states when the command completes
but does not put any really useful information in the message itself.
This commit adds the duration the snapshot upload took and
which image was created to the log message.

Change-Id: I684d5152e02f31772ab69e0a8e4931b365a0267c
This commit is contained in:
Christopher Lefelhocz 2014-11-05 10:43:00 -06:00
parent 051e496110
commit b9785b93a4
1 changed files with 5 additions and 1 deletions

View File

@ -815,6 +815,7 @@ class VMOps(object):
vm_ref = self._get_vm_opaque_ref(instance)
label = "%s-snapshot" % instance['name']
start_time = timeutils.utcnow()
with vm_utils.snapshot_attached_here(
self._session, instance, vm_ref, label,
post_snapshot_callback=update_task_state) as vdi_uuids:
@ -827,7 +828,10 @@ class VMOps(object):
vdi_uuids,
)
LOG.debug("Finished snapshot and upload for VM",
duration = timeutils.delta_seconds(start_time, timeutils.utcnow())
LOG.debug("Finished snapshot and upload for VM, duration: "
"%(duration).2f secs for image %(image_id)s",
{'image_id': image_id, 'duration': duration},
instance=instance)
def post_interrupted_snapshot_cleanup(self, context, instance):