qubes: Unify event names
Events will be named <object>-[pre-]-<verb>, where verb is in infinitive form.
This commit is contained in:
parent
d09bd5ab6a
commit
75dd882b83
@ -448,7 +448,7 @@ class VMCollection(object):
|
||||
|
||||
self._dict[value.qid] = value
|
||||
value.events_enabled = True
|
||||
self.app.fire_event('domain-added', value)
|
||||
self.app.fire_event('domain-add', value)
|
||||
|
||||
return value
|
||||
|
||||
@ -474,7 +474,7 @@ class VMCollection(object):
|
||||
def __delitem__(self, key):
|
||||
vm = self[key]
|
||||
del self._dict[vm.qid]
|
||||
self.app.fire_event('domain-deleted', vm)
|
||||
self.app.fire_event('domain-delete', vm)
|
||||
|
||||
|
||||
def __contains__(self, key):
|
||||
@ -677,19 +677,19 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
|
||||
has_oldvalue = False
|
||||
|
||||
if has_oldvalue:
|
||||
instance.fire_event_pre('property-pre-deleted:' + self.__name__,
|
||||
instance.fire_event_pre('property-pre-del:' + self.__name__,
|
||||
self.__name__, oldvalue)
|
||||
else:
|
||||
instance.fire_event_pre('property-pre-deleted:' + self.__name__,
|
||||
instance.fire_event_pre('property-pre-del:' + self.__name__,
|
||||
self.__name__)
|
||||
|
||||
delattr(instance, self._attr_name)
|
||||
|
||||
if has_oldvalue:
|
||||
instance.fire_event('property-deleted:' + self.__name__,
|
||||
instance.fire_event('property-del:' + self.__name__,
|
||||
self.__name__, oldvalue)
|
||||
else:
|
||||
instance.fire_event('property-deleted:' + self.__name__,
|
||||
instance.fire_event('property-del:' + self.__name__,
|
||||
self.__name__)
|
||||
|
||||
|
||||
@ -992,7 +992,7 @@ class PropertyHolder(qubes.events.Emitter):
|
||||
except AttributeError:
|
||||
continue
|
||||
|
||||
self.fire_event('cloned-properties', src, proplist)
|
||||
self.fire_event('clone-properties', src, proplist)
|
||||
|
||||
|
||||
def property_require(self, prop, allow_none=False, hard=False):
|
||||
@ -1271,7 +1271,7 @@ class Qubes(PropertyHolder):
|
||||
|
||||
for vm in self.domains:
|
||||
vm.events_enabled = True
|
||||
vm.fire_event('domain-loaded')
|
||||
vm.fire_event('domain-load')
|
||||
|
||||
# get a file timestamp (before closing it - still holding the lock!),
|
||||
# to detect whether anyone else have modified it in the meantime
|
||||
|
@ -301,6 +301,4 @@ class NetVMMixin(object):
|
||||
self.attach_network()
|
||||
|
||||
# TODO documentation
|
||||
new_netvm.fire_event('net-domain-connected', self)
|
||||
|
||||
|
||||
new_netvm.fire_event('net-domain-connect', self)
|
||||
|
@ -695,7 +695,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
and os.path.exists('/var/run/shm.id'):
|
||||
self.start_guid()
|
||||
|
||||
self.fire_event('domain-started',
|
||||
self.fire_event('domain-start',
|
||||
preparing_dvm=preparing_dvm, start_guid=start_guid)
|
||||
|
||||
except: # pylint: disable=bare-except
|
||||
@ -713,7 +713,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
if not self.is_running(): # TODO not self.is_halted()
|
||||
raise qubes.exc.QubesVMNotStartedError(self)
|
||||
|
||||
self.fire_event_pre('pre-domain-shutdown', force=force)
|
||||
self.fire_event_pre('domain-pre-shutdown', force=force)
|
||||
|
||||
# try to gracefully detach PCI devices before shutdown, to mitigate
|
||||
# timeouts on forcible detach at domain destroy; if that fails, too bad
|
||||
@ -1075,7 +1075,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
shutil.copy(self.label.icon_path, self.icon_path)
|
||||
|
||||
# fire hooks
|
||||
self.fire_event('domain-created-on-disk', source_template)
|
||||
self.fire_event('domain-create-on-disk', source_template)
|
||||
|
||||
|
||||
# TODO move to storage
|
||||
@ -1146,7 +1146,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
|
||||
def remove_from_disk(self):
|
||||
'''Remove domain remnants from disk.'''
|
||||
self.fire_event('domain-removed-from-disk')
|
||||
self.fire_event('domain-remove-from-disk')
|
||||
self.storage.remove_from_disk()
|
||||
|
||||
|
||||
@ -1178,7 +1178,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
shutil.copy(src.icon_path, self.icon_path)
|
||||
|
||||
# fire hooks
|
||||
self.fire_event('cloned-files', src)
|
||||
self.fire_event('domain-clone-files', src)
|
||||
|
||||
|
||||
#
|
||||
@ -1594,7 +1594,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
'VM initramfs does not exist: {0}'.format(
|
||||
os.path.join(self.storage.kernels_dir, 'initramfs')))
|
||||
|
||||
self.fire_event('verify-files')
|
||||
self.fire_event('domain-verify-files')
|
||||
|
||||
return True
|
||||
|
||||
@ -1724,7 +1724,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
'/local/domain/{}/memory'.format(self.xid),
|
||||
[{'dom': self.xid}])
|
||||
|
||||
self.fire_event('qdb-created')
|
||||
self.fire_event('domain-qdb-create')
|
||||
|
||||
|
||||
def _update_libvirt_domain(self):
|
||||
|
Loading…
Reference in New Issue
Block a user