Francesco Romani has uploaded a new change for review.
Change subject: migration: coalesce join() into stop()
......................................................................
migration: coalesce join() into stop()
we always call join() after stop(), so coalesce the two
method in stop().
Doing so, we can also get rid of most of the remnants of the thread
interface that pollutes DowntimeThread, MonitorThread and SourceThread.
Change-Id: Ib6def55d50a61ac983b45e826c05e09887fe5ee0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 5 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/62587/1
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 28963bf..e66fab2 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -495,13 +495,10 @@
with utils.running(self._monitorThread):
self._perform_migration(duri, muri)
- self._monitorThread.join()
-
def _perform_with_conv_schedule(self, duri, muri):
self._vm.log.debug('performing migration with conv schedule')
with utils.running(self._monitorThread):
self._perform_migration(duri, muri)
- self._monitorThread.join()
def set_max_bandwidth(self, bandwidth):
self._vm.log.debug('setting migration max bandwidth to %d', bandwidth)
@@ -556,12 +553,6 @@
def start(self):
self._thread.start()
- def join(self):
- return self._thread.join()
-
- def is_alive(self):
- return self._thread.is_alive()
-
@utils.traceback()
def run(self):
self._vm.log.debug('migration downtime thread started (%i steps)',
@@ -583,6 +574,10 @@
def stop(self):
self._vm.log.debug('stopping migration downtime thread')
self._stop.set()
+ if self._thread.is_alive():
+ # on very short migrations, the downtime thread
+ # may not be started at all.
+ self._thread.join()
def _set_downtime(self, downtime):
self._vm.log.debug('setting migration downtime to %d', downtime)
@@ -598,12 +593,6 @@
def stop(self):
pass
-
- def join(self):
- pass
-
- def is_alive(self):
- return False
def set_initial_downtime(self):
pass
@@ -628,9 +617,6 @@
def start(self):
self._thread.start()
- def join(self):
- self._thread.join()
-
@property
def enabled(self):
return MonitorThread._MIGRATION_MONITOR_INTERVAL > 0
@@ -643,10 +629,6 @@
self.monitor_migration()
finally:
self.downtime_thread.stop()
- if self.downtime_thread.is_alive():
- # on very short migrations, the downtime thread
- # may not be started at all.
- self.downtime_thread.join()
self._vm.log.debug('stopped migration monitor thread')
else:
self._vm.log.info('migration monitor thread disabled'
@@ -735,6 +717,7 @@
def stop(self):
self._vm.log.debug('stopping migration monitor thread')
self._stop.set()
+ self._thread.join()
def _next_action(self, stalling):
head = self._conv_schedule['stalling'][0]
--
To view, visit
https://gerrit.ovirt.org/62587
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6def55d50a61ac983b45e826c05e09887fe5ee0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>