From b9785b93a4d892ad53201517eb1dc137e5a79844 Mon Sep 17 00:00:00 2001 From: Christopher Lefelhocz Date: Wed, 5 Nov 2014 10:43:00 -0600 Subject: [PATCH] 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 --- nova/virt/xenapi/vmops.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index d6844a0f18f6..8aaa8b568172 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -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):