vm/adminvm: setup libvirt_domain property
Since libvirt do provide object for dom0 too, return it here. It's much easier than special-casing AdminVM everywhere. And in fact sometimes it is actually useful (for example attaching devices from/to dom0, adjusting memory).
This commit is contained in:
parent
e5de8f4115
commit
3721ae3e8b
@ -49,6 +49,11 @@ class AdminVM(qubes.vm.BaseVM):
|
|||||||
default='00000000-0000-0000-0000-000000000000',
|
default='00000000-0000-0000-0000-000000000000',
|
||||||
setter=qubes.property.forbidden)
|
setter=qubes.property.forbidden)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self._libvirt_domain = None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@ -71,12 +76,14 @@ class AdminVM(qubes.vm.BaseVM):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def libvirt_domain(self):
|
def libvirt_domain(self):
|
||||||
'''Always :py:obj:`None`.
|
'''Libvirt object for dom0.
|
||||||
|
|
||||||
.. seealso:
|
.. seealso:
|
||||||
:py:attr:`qubes.vm.qubesvm.QubesVM.libvirt_domain`
|
:py:attr:`qubes.vm.qubesvm.QubesVM.libvirt_domain`
|
||||||
'''
|
'''
|
||||||
return None
|
if self._libvirt_domain is None:
|
||||||
|
self._libvirt_domain = self.app.vmm.libvirt_conn.lookupByID(0)
|
||||||
|
return self._libvirt_domain
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_running():
|
def is_running():
|
||||||
|
Loading…
Reference in New Issue
Block a user