From b6d8c7fb815eedc6fcee3707ece2f7fed744c7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 7 Mar 2016 03:22:59 +0100 Subject: [PATCH] ext/r3compatibility: features/services QubesOS/qubes-issues#1812 --- qubes/ext/r3compatibility.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qubes/ext/r3compatibility.py b/qubes/ext/r3compatibility.py index fdbf3bd7..c3cabd55 100644 --- a/qubes/ext/r3compatibility.py +++ b/qubes/ext/r3compatibility.py @@ -37,6 +37,14 @@ class R3Compatibility(qubes.ext.Extension): '''Maintain VM interface compatibility with R3.0 and R3.1. At lease where possible. ''' + + features_to_services = { + 'services/ntpd': 'ntpd', + 'check-updates': 'qubes-update-check', + 'dvm': 'qubes-dvm', + + } + # noinspection PyUnusedLocal @qubes.ext.handler('qdb-created') def on_qdb_created(self, vm, event): @@ -107,6 +115,8 @@ class R3Compatibility(qubes.ext.Extension): vm.qdb.write("/qubes-iptables-error", '') self.write_iptables_qubesdb_entry(vm) + self.write_services(vm) + # FIXME use event after creating Xen domain object, but before "resume" @qubes.ext.handler('domain-started') def on_domain_started(self, vm, event, **kwargs): @@ -212,3 +222,10 @@ class R3Compatibility(qubes.ext.Extension): # no need for ending -A FORWARD -j DROP, cause default action is DROP firewallvm.qdb.write("/qubes-iptables", 'reload') + + def write_services(self, vm): + for feature, value in vm.features.items(): + service = self.features_to_services.get(feature, feature) + # forcefully convert to '0' or '1' + vm.qdb.write('/qubes-service/{}'.format(service), + str(int(bool(value))))