Milan Zamazal has uploaded a new change for review.

Change subject: virt: Stop guest agent before switching to post-copy

virt: Stop guest agent before switching to post-copy

Post-copy migration pauses the VM on the source.  We don't want to get
spurious log messages from the guest agent about not being able to talk
to the VM or being disconnected from the communication socket.  So we
stop the guest agent before switching to post-copy mode.

If switching to post-copy fails (which should rarely happen), we start
the agent again.  Starting the agent may fail, e.g. in case the VM got
destroyed in the meantime.  So we catch the contingent exception.

Change-Id: Ibd855ee36847b293009ac35d8d03b01521aaace8
Signed-off-by: Milan Zamazal <>
M vdsm/virt/
1 file changed, 7 insertions(+), 0 deletions(-)

  git pull ssh:// refs/changes/45/64145/7

diff --git a/vdsm/virt/ b/vdsm/virt/
index 2c73375..522a4fc 100644
--- a/vdsm/virt/
+++ b/vdsm/virt/
@@ -807,6 +807,7 @@
             vm._dom.migrateSetMaxDowntime(downtime, 0)
         elif action == CONVERGENCE_SCHEDULE_POST_COPY:
   'Switching to post-copy migration')
+            vm.guestAgent.stop()
             ret = vm.switch_migration_to_post_copy()
             if ret >= 0:
                 self._post_copy_initiated = True
@@ -814,6 +815,12 @@
                 # Do nothing for now; the next action will be invoked after
                 # a while
                 vm.log.warn('Failed to switch to post-copy migration')
+                try:
+                    vm.guestAgent.start()
+                except:
+                    self.log.exception("Failed to start guest agent after "
+                                       "unsuccessful switch to post-copy "
+                                       "migration")
         elif action == CONVERGENCE_SCHEDULE_SET_ABORT:
             vm.log.warn('Aborting migration')

To view, visit
To unsubscribe, visit

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

Reply via email to