vm: add stubdom_xid property

Some parts (like GUI) needs to communicate with stubdomain. Lets expose
it's XID at the API level.
This commit is contained in:
Marek Marczykowski-Górecki 2017-04-14 23:13:40 +02:00
parent acaada3fd9
commit 361ecdd6ac
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -521,6 +521,21 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
e.get_error_code()))
raise
@qubes.stateless_property
def stubdom_xid(self):
if self.xid < 0:
return -1
if self.app.vmm.xs is None:
return -1
stubdom_xid_str = self.app.vmm.xs.read('',
'/local/domain/{}/image/device-model-domid'.format(self.xid))
if stubdom_xid_str is None or not stubdom_xid_str.isdigit():
return -1
return int(stubdom_xid_str)
@property
def attached_volumes(self):
result = []