qubes/vm/qubesvm: return self from methods modifying state
This is helpful when writing oneliners. QubesOS/qubes-issues#866
This commit is contained in:
parent
27d0e11872
commit
476b681749
@ -758,6 +758,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
self.force_shutdown()
|
||||
raise
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def shutdown(self, force=False):
|
||||
'''Shutdown domain.
|
||||
@ -787,6 +789,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
self.libvirt_domain.shutdown()
|
||||
self.storage.stop()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def kill(self):
|
||||
'''Forcefuly shutdown (destroy) domain.
|
||||
@ -801,6 +805,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
self.libvirt_domain.destroy()
|
||||
self.storage.stop()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def force_shutdown(self, *args, **kwargs):
|
||||
'''Deprecated alias for :py:meth:`kill`'''
|
||||
@ -809,6 +815,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
DeprecationWarning, stacklevel=2)
|
||||
self.kill(*args, **kwargs)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def suspend(self):
|
||||
'''Suspend (pause) domain.
|
||||
@ -832,6 +840,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
else:
|
||||
self.libvirt_domain.suspend()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def pause(self):
|
||||
'''Pause (suspend) domain. This currently delegates to \
|
||||
@ -842,6 +852,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
|
||||
self.suspend()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def resume(self):
|
||||
'''Resume suspended domain.
|
||||
@ -856,6 +868,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
else:
|
||||
self.unpause()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def unpause(self):
|
||||
'''Resume (unpause) a domain'''
|
||||
@ -864,6 +878,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
|
||||
self.libvirt_domain.resume()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def run(self, command, user=None, autostart=False, notify_function=None,
|
||||
passio=False, passio_popen=False, passio_stderr=False,
|
||||
|
Loading…
Reference in New Issue
Block a user