From f976f7ec6cccdfd626c53849d7e5c4826eb7da06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 23 Jun 2017 02:35:49 +0200 Subject: [PATCH] storage: simplify coroutine handling Suggested by @woju --- qubes/storage/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index f5126c5d..1f80c2bb 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -456,9 +456,8 @@ class Storage(object): # clone/import functions may be either synchronous or asynchronous # in the later case, we need to wait for them to finish if asyncio.iscoroutine(clone_op_ret): - self.vm.volumes[name] = yield from clone_op_ret - else: - self.vm.volumes[name] = clone_op_ret + clone_op_ret = yield from clone_op_ret + self.vm.volumes[name] = clone_op_ret return self.vm.volumes[name] @asyncio.coroutine