Nir Soffer has uploaded a new change for review.
Change subject: procwatch: Rename closed property to watching ......................................................................
procwatch: Rename closed property to watching
Closed is good term for a stream, but this class is not a stream. The meaning of the "closed" state is that the watcher has nothing to watch, so "watching" seems like a good name.
Change-Id: I6d6ec49a848af3ba95ebbcb70333e63b9a28b732 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M lib/vdsm/procwatch.py M lib/vdsm/qemuimg.py M tests/procwatch_test.py 3 files changed, 8 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/65079/1
diff --git a/lib/vdsm/procwatch.py b/lib/vdsm/procwatch.py index a75cbc7..3cc628b 100644 --- a/lib/vdsm/procwatch.py +++ b/lib/vdsm/procwatch.py @@ -63,8 +63,9 @@ self._poll_event(fileno)
@property - def closed(self): - return len(self._iocb) == 0 + def watching(self): + return bool(self._iocb) +
def receive(self, timeout=None): """ @@ -76,7 +77,7 @@ else: endtime = utils.monotonic_time() + timeout
- while not self.closed: + while self.watching: if timeout is not None: poll_remaining = endtime - utils.monotonic_time() if poll_remaining <= 0: diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py index 9133587..d5a10c9 100644 --- a/lib/vdsm/qemuimg.py +++ b/lib/vdsm/qemuimg.py @@ -249,7 +249,7 @@ def poll(self, timeout=None): self._watcher.receive(timeout=timeout)
- if not self._watcher.closed: + if self._watcher.watching: return
self._process.wait() diff --git a/tests/procwatch_test.py b/tests/procwatch_test.py index 53f2548..269142b 100644 --- a/tests/procwatch_test.py +++ b/tests/procwatch_test.py @@ -54,7 +54,7 @@ recv_data if recv_out else self.unexpected_data, recv_data if recv_err else self.unexpected_data)
- while not watcher.closed: + while watcher.watching: watcher.receive()
retcode = process.wait() @@ -85,7 +85,7 @@ process.stdin.flush() process.stdin.close()
- while not watcher.closed: + while watcher.watching: watcher.receive()
retcode = process.wait() @@ -101,7 +101,7 @@ with self.assertElapsed(2): watcher.receive(2)
- self.assertEqual(watcher.closed, False) + self.assertEqual(watcher.watching, True)
process.terminate()
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 1:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 2:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 3:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 4:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 5:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: procwatch: Rename closed property to watching ......................................................................
Patch Set 6:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
vdsm-patches@lists.fedorahosted.org