Francesco Romani has uploaded a new change for review.

Change subject: migration: add 'transferring' property
......................................................................

migration: add 'transferring' property

Add 'transferring' property to migration.SourceThread,
to let the client code learn if the code is performing
some useful data-transfer task, or if it is busy doing
setup/teardown duties.

The intended usage is:

sourceThread.is_alive()=True, transferring=True:
  actual migration, moving data from src to dst

sourceThread.is_alive()=True, transferring=False:
  setup/teardown in progress.

sourceThread.is_alive()=False, transferring=*
  no migration-related activity in progress

Change-Id: I78fb89f8f150fb7eaad1318cbd54d057ac9da807
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/50337/1

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index e2e067d..f460f8f 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -111,6 +111,11 @@
         self._monitorThread = None
         self._abort_reason_lock = threading.Lock()
         self._abort_reason = None
+        self._transferring = True
+
+    @property
+    def transferring(self):
+        return self._transferring
 
     @property
     def hibernating(self):
@@ -288,6 +293,7 @@
         raise e
 
     def run(self):
+        self._transferring = True
         try:
             self._clear_abort_reason()
             startTime = time.time()
@@ -307,8 +313,13 @@
                     'dstparams': self._dstparams,
                     'dstqemu': self._dstqemu}
                 self._vm.saveState()
-                self._migrate(time.time())
+                try:
+                    self._migrate(time.time())
+                except:
+                    self._transferring = False
+                    raise
                 self._finishSuccessfully()
+                self._transferring = False
             except libvirt.libvirtError as e:
                 if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED:
                     self._last_status = response.error(


-- 
To view, visit https://gerrit.ovirt.org/50337
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78fb89f8f150fb7eaad1318cbd54d057ac9da807
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to