Avoid libvirt access in qubes.vm.qubesvm.QubesVM

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-06-23 18:41:11 +02:00
parent 1ff1ca37a1
commit bba9b38e8e
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE

View File

@ -1099,7 +1099,11 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
:param qubes.vm.qubesvm.QubesVM src: source VM
'''
if not self.is_halted():
# If the current vm name is not a part of `self.app.domains.keys()`,
# then the current vm is in creation process. Calling
# `self.is_halted()` at this point, would instantiate libvirt, we want
# avoid that.
if self.name in self.app.domains.keys() and not self.is_halted():
raise qubes.exc.QubesVMNotHaltedError(
self, 'Cannot clone a running domain {!r}'.format(self.name))