fix and enable ServicesExtension

This extension is responsible for communicating service.* features to
VMs - in other words, qvm-service framework

Fixes QubesOS/qubes-issues#3019
This commit is contained in:
Marek Marczykowski-Górecki 2017-08-14 02:30:52 +02:00
parent a32bb4ecb2
commit 3f33a7bc2c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 6 additions and 3 deletions

View File

@ -28,8 +28,9 @@ class ServicesExtension(qubes.ext.Extension):
''' '''
# pylint: disable=no-self-use # pylint: disable=no-self-use
@qubes.ext.handler('domain-qdb-create') @qubes.ext.handler('domain-qdb-create')
def on_domain_qdb_create(self, vm): def on_domain_qdb_create(self, vm, event):
'''Actually export features''' '''Actually export features'''
# pylint: disable=unused-argument
for feature, value in vm.features.items(): for feature, value in vm.features.items():
if not feature.startswith('service.'): if not feature.startswith('service.'):
continue continue
@ -39,7 +40,7 @@ class ServicesExtension(qubes.ext.Extension):
str(int(bool(value)))) str(int(bool(value))))
@qubes.ext.handler('domain-feature-set') @qubes.ext.handler('domain-feature-set')
def on_domain_feature_set(self, vm, feature, value, oldvalue=None): def on_domain_feature_set(self, vm, event, feature, value, oldvalue=None):
'''Update /qubes-service/ QubesDB tree in runtime''' '''Update /qubes-service/ QubesDB tree in runtime'''
# pylint: disable=unused-argument # pylint: disable=unused-argument
if not vm.is_running(): if not vm.is_running():
@ -52,8 +53,9 @@ class ServicesExtension(qubes.ext.Extension):
str(int(bool(value)))) str(int(bool(value))))
@qubes.ext.handler('domain-feature-delete') @qubes.ext.handler('domain-feature-delete')
def on_domain_feature_delete(self, vm, feature): def on_domain_feature_delete(self, vm, event, feature):
'''Update /qubes-service/ QubesDB tree in runtime''' '''Update /qubes-service/ QubesDB tree in runtime'''
# pylint: disable=unused-argument
if not vm.is_running(): if not vm.is_running():
return return
if not feature.startswith('service.'): if not feature.startswith('service.'):

View File

@ -51,6 +51,7 @@ if __name__ == '__main__':
'qubes.ext.r3compatibility = qubes.ext.r3compatibility:R3Compatibility', 'qubes.ext.r3compatibility = qubes.ext.r3compatibility:R3Compatibility',
'qubes.ext.pci = qubes.ext.pci:PCIDeviceExtension', 'qubes.ext.pci = qubes.ext.pci:PCIDeviceExtension',
'qubes.ext.block = qubes.ext.block:BlockDeviceExtension', 'qubes.ext.block = qubes.ext.block:BlockDeviceExtension',
'qubes.ext.services = qubes.ext.services:ServicesExtension',
], ],
'qubes.devices': [ 'qubes.devices': [
'pci = qubes.ext.pci:PCIDevice', 'pci = qubes.ext.pci:PCIDevice',