summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorAarti Kriplani <aarti.kriplani@RACKSPACE.COM>2013-03-22 09:54:35 +0530
committerAarti Kriplani <aarti.kriplani@RACKSPACE.COM>2013-06-05 11:05:49 +0530
commit9694ea7fd553efa250448b2e42fcd8a81a2fdbe5 (patch)
tree3763d8275eb37450b5f28f6c3326a574c38003db /nova/tests
parent17cbb833aba3bedab8eb80ed89a76bdd52a94ce7 (diff)
downloadnova-9694ea7fd553efa250448b2e42fcd8a81a2fdbe5.tar.gz
nova-9694ea7fd553efa250448b2e42fcd8a81a2fdbe5.tar.xz
nova-9694ea7fd553efa250448b2e42fcd8a81a2fdbe5.zip
xenapi: Added logging for sparse copy
After 300 seconds(default), logs how many bytes have been written already, and how many are left, so as to be able to track progress of the long running task. Implements blueprint log-progress-of-sparse-copy Change-Id: I289ab978ec4b31f1015c783111c01a460de33f09
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/virt/xenapi/test_vm_utils.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/tests/virt/xenapi/test_vm_utils.py b/nova/tests/virt/xenapi/test_vm_utils.py
index 3f7de1521..f2a75d899 100644
--- a/nova/tests/virt/xenapi/test_vm_utils.py
+++ b/nova/tests/virt/xenapi/test_vm_utils.py
@@ -24,6 +24,7 @@ from nova.compute import flavors
from nova import context
from nova import db
from nova import exception
+from nova.openstack.common import timeutils
from nova import test
from nova.tests.virt.xenapi import stubs
from nova import utils
@@ -364,6 +365,26 @@ class ResizeHelpersTestCase(test.TestCase):
vm_utils._resize_part_and_fs("fake", 0, 20, 10)
+ def test_log_progress_if_required(self):
+ self.mox.StubOutWithMock(vm_utils.LOG, "debug")
+ vm_utils.LOG.debug(_("Sparse copy in progress, "
+ "%(complete_pct).2f%% complete. "
+ "%(left) bytes left to copy"),
+ {"complete_pct": 50.0, "left": 1})
+ current = timeutils.utcnow()
+ timeutils.set_time_override(current)
+ timeutils.advance_time_seconds(vm_utils.PROGRESS_INTERVAL_SECONDS + 1)
+ self.mox.ReplayAll()
+ vm_utils._log_progress_if_required(1, current, 2)
+
+ def test_log_progress_if_not_required(self):
+ self.mox.StubOutWithMock(vm_utils.LOG, "debug")
+ current = timeutils.utcnow()
+ timeutils.set_time_override(current)
+ timeutils.advance_time_seconds(vm_utils.PROGRESS_INTERVAL_SECONDS - 1)
+ self.mox.ReplayAll()
+ vm_utils._log_progress_if_required(1, current, 2)
+
def test_resize_part_and_fs_down_fails_disk_too_big(self):
self.mox.StubOutWithMock(vm_utils, "_repair_filesystem")
self.mox.StubOutWithMock(utils, 'execute')