app: update handling features/service os ClockVM
Threis no more ntpd service used - new approach do not conflict with ntpd. Because of this, new feature is named 'service.clocksync', and should be _enabled_ in ClockVM ('ntpd' was disabled there). QubesOS/qubes-issues#1230
This commit is contained in:
parent
c17e63588e
commit
e738a7596d
26
qubes/app.py
26
qubes/app.py
@ -663,7 +663,7 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
doc='''Which VM to use as `yum` proxy for updating AdminVM and
|
doc='''Which VM to use as `yum` proxy for updating AdminVM and
|
||||||
TemplateVMs''')
|
TemplateVMs''')
|
||||||
clockvm = qubes.VMProperty('clockvm', load_stage=3,
|
clockvm = qubes.VMProperty('clockvm', load_stage=3,
|
||||||
allow_none=True,
|
default=None, allow_none=True,
|
||||||
doc='Which VM to use as NTP proxy for updating AdminVM')
|
doc='Which VM to use as NTP proxy for updating AdminVM')
|
||||||
default_kernel = qubes.property('default_kernel', load_stage=3,
|
default_kernel = qubes.property('default_kernel', load_stage=3,
|
||||||
doc='Which kernel to use when not overriden in VM')
|
doc='Which kernel to use when not overriden in VM')
|
||||||
@ -803,17 +803,6 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
self.property_require('clockvm', allow_none=True)
|
self.property_require('clockvm', allow_none=True)
|
||||||
self.property_require('updatevm', allow_none=True)
|
self.property_require('updatevm', allow_none=True)
|
||||||
|
|
||||||
# Disable ntpd in ClockVM - to not conflict with ntpdate (both are
|
|
||||||
# using 123/udp port)
|
|
||||||
if hasattr(self, 'clockvm') and self.clockvm is not None:
|
|
||||||
if self.clockvm.features.get('service.ntpd', False):
|
|
||||||
self.log.warning(
|
|
||||||
'VM set as clockvm (%r) has enabled \'ntpd\' service! '
|
|
||||||
'Expect failure when syncing time in dom0.',
|
|
||||||
self.clockvm)
|
|
||||||
else:
|
|
||||||
self.clockvm.features['service.ntpd'] = ''
|
|
||||||
|
|
||||||
for vm in self.domains:
|
for vm in self.domains:
|
||||||
vm.events_enabled = True
|
vm.events_enabled = True
|
||||||
vm.fire_event('domain-load')
|
vm.fire_event('domain-load')
|
||||||
@ -1149,13 +1138,14 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
# pylint: disable=unused-argument,no-self-use
|
# pylint: disable=unused-argument,no-self-use
|
||||||
if newvalue is None:
|
if newvalue is None:
|
||||||
return
|
return
|
||||||
if newvalue.features.get('service.ntpd', False):
|
if 'service.clocksync' not in newvalue.features:
|
||||||
raise qubes.exc.QubesVMError(newvalue,
|
newvalue.features['service.clocksync'] = True
|
||||||
'Cannot set {!r} as {!r} since it has ntpd enabled.'.format(
|
|
||||||
newvalue.name, name))
|
|
||||||
else:
|
|
||||||
newvalue.features['service.ntpd'] = ''
|
|
||||||
|
|
||||||
|
@qubes.events.handler('property-set:clockvm')
|
||||||
|
def on_property_set_clockvm(self, event, name, newvalue, oldvalue=None):
|
||||||
|
# pylint: disable=unused-argument,no-self-use
|
||||||
|
if oldvalue and oldvalue.features.get('service.clocksync', False):
|
||||||
|
del oldvalue.features['service.clocksync']
|
||||||
|
|
||||||
@qubes.events.handler(
|
@qubes.events.handler(
|
||||||
'property-pre-set:default_netvm',
|
'property-pre-set:default_netvm',
|
||||||
|
Loading…
Reference in New Issue
Block a user