Hello Federico Simoncelli, Francesco Romani,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: Live Merge: Suspend disk stats collection during pivot ......................................................................
Live Merge: Suspend disk stats collection during pivot
When pivoting to the new volume after an active layer merge, there is a brief period where the vdsm metadata is out of sync. During this time, the disk stats collection thread will raise an exception since the drive cannot be referred to by its old path. Therefore we disable stats collection during this short window until the metadata can be synchronized.
Change-Id: I08689aec4d61871a568a6f92661b560fbf4d0b57 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1109918 Signed-off-by: Adam Litke alitke@redhat.com Reviewed-on: http://gerrit.ovirt.org/31367 Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Federico Simoncelli fsimonce@redhat.com --- M vdsm/virt/vm.py 1 file changed, 19 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/32326/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 8c18fd3..94a6b76 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -5931,11 +5931,25 @@ self.drive.imageID, self.drive['volumeID'], newVols)
+ # A pivot changes the top volume being used for the VM Disk. Until + # we can correct our metadata following the pivot we should not + # attempt to collect disk stats. + # TODO: Stop collection only for the live merge disk + self.vm.stopDisksStatsCollection() + self.vm.log.info("Requesting pivot to complete active layer commit " "(job %s)", self.jobId) - flags = libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT - if self.vm._dom.blockJobAbort(self.drive.name, flags) != 0: - raise RuntimeError("pivot failed") + try: + flags = libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT + ret = self.vm._dom.blockJobAbort(self.drive.name, flags) + except: + self.vm.startDisksStatsCollection() + raise + else: + if ret != 0: + self.vm.log.error("Pivot failed for job %s (rc=%i)", + self.jobId, ret) + raise RuntimeError("pivot failed") self.vm.log.info("Pivot completed (job %s)", self.jobId)
@utils.traceback() @@ -5945,6 +5959,8 @@ self.vm.log.info("Synchronizing volume chain after live merge " "(job %s)", self.jobId) self.vm._syncVolumeChain(self.drive) + if self.doPivot: + self.vm.startDisksStatsCollection() self.success = True self.vm.log.info("Synchronization completed (job %s)", self.jobId)