vm: expose to VM only features with 'service/' prefix
And place them in /qubes-service/ QubesDB directory. This allows extensions to easily store some data not exposed to VM, but also have control what VM will see. And at the same time, it make it compatible with existing services framework QubesOS/qubes-issues#1637
This commit is contained in:
parent
2c01504a50
commit
e54cc11a2c
@ -162,7 +162,9 @@ class R3Compatibility(qubes.ext.Extension):
|
||||
|
||||
def write_services(self, vm):
|
||||
for feature, value in vm.features.items():
|
||||
service = self.features_to_services.get(feature, feature)
|
||||
service = self.features_to_services.get(feature, None)
|
||||
if service is None:
|
||||
continue
|
||||
# forcefully convert to '0' or '1'
|
||||
vm.qdb.write('/qubes-service/{}'.format(service),
|
||||
str(int(bool(value))))
|
||||
|
@ -1819,8 +1819,12 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
self.qdb.write('/qubes-timezone', tzname)
|
||||
|
||||
for feature, value in self.features.items():
|
||||
self.qdb.write('/features/{0}'.format(feature),
|
||||
str(value) if value else '')
|
||||
if not feature.startswith('service/'):
|
||||
continue
|
||||
service = feature[len('service/'):]
|
||||
# forcefully convert to '0' or '1'
|
||||
self.qdb.write('/qubes-service/{}'.format(service),
|
||||
str(int(bool(value))))
|
||||
|
||||
self.qdb.write('/qubes-block-devices', '')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user