storage: simplify coroutine handling

Suggested by @woju
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-23 02:35:49 +02:00
parent 9242202db2
commit f976f7ec6c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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