Milan Zamazal has uploaded a new change for review.

Change subject: virt: Prevent monitoring of VMs in post-copy

virt: Prevent monitoring of VMs in post-copy

Migrating VMs in post-copy mode on the source end are paused.  It makes
no sense to monitor them and we don't want to get error messages in the
log or experience other problems.  So we skip VMs in that state in
periodic operations.

We also skip the VMs that just successfully initiated switching to
post-copy mode.  Under normal circumstances, they should enter post-copy
mode shortly afterwards, so it's better to skip them immediately.

We still can't guarantee (without excessive locking) that VM doesn't
switch to post-copy (and gets paused), so we handle the corresponding
contingent failure as well.

Note that we still gather stats, since we need to know the migration

Change-Id: I010d3311ce497081720a871e2a3c715f53dcb299
Signed-off-by: Milan Zamazal <>
M lib/vdsm/virt/
M vdsm/virt/
2 files changed, 10 insertions(+), 1 deletion(-)

  git pull ssh:// refs/changes/46/64146/7

diff --git a/lib/vdsm/virt/ b/lib/vdsm/virt/
index 132fe93..959ff1b 100644
--- a/lib/vdsm/virt/
+++ b/lib/vdsm/virt/
@@ -290,7 +290,8 @@
     def required(self):
         # Disable everything until the migration destination VM
         # is fully started, to avoid false positives log spam.
-        return not self._vm.incomingMigrationPending()
+        return (not self._vm.incomingMigrationPending() and
+                not self._vm.post_copy_initiated)
     def runnable(self):
@@ -307,6 +308,9 @@
             self._vm.log.warning('could not run on %s: domain not connected',
         except libvirt.libvirtError as e:
+            if self._vm.in_post_copy:
+                # race on entering post-copy, VM paused now
+                return
             if e.get_error_code() in (
                 # race on shutdown/migration completion
diff --git a/vdsm/virt/ b/vdsm/virt/
index f806c45..2fb498a 100644
--- a/vdsm/virt/
+++ b/vdsm/virt/
@@ -323,6 +323,11 @@
     def in_post_copy(self):
         return self._in_post_copy
+    @property
+    def post_copy_initiated(self):
+        return (self._in_post_copy or
+                self._migrationSourceThread.post_copy_initiated)
     def _get_lastStatus(self):
         # note that we don't use _statusLock here. One of the reasons is the
         # non-obvious recursive locking in the following flow:

To view, visit
To unsubscribe, visit

Gerrit-MessageType: newchange
Gerrit-Change-Id: I010d3311ce497081720a871e2a3c715f53dcb299
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <>
Gerrit-Reviewer: Francesco Romani <>
Gerrit-Reviewer: gerrit-hooks <>
vdsm-patches mailing list --
To unsubscribe send an email to

Reply via email to