summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrent s <bts@square-r00t.net>2019-11-29 07:37:00 -0500
committerbrent s <bts@square-r00t.net>2019-11-29 07:37:00 -0500
commitadd247d62212e6b5557f4bbc45d6303809f13c19 (patch)
treed561f448f032c3c27149e4f08b4c6f95d5277f84
parent542166de67a6c5fed4164b52daf49008a7dc3a9f (diff)
downloadOpTools-add247d62212e6b5557f4bbc45d6303809f13c19.tar.xz
can't start an active guest and vice versa
-rwxr-xr-xlibvirt/better_virsh.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/libvirt/better_virsh.py b/libvirt/better_virsh.py
index eb14d5d..8be73b4 100755
--- a/libvirt/better_virsh.py
+++ b/libvirt/better_virsh.py
@@ -121,14 +121,14 @@ class LV(object):
return(results)
def restart(self, target, *args, **kwargs):
- self.stop(target, **kwargs)
- self.start(target, **kwargs)
+ self.stop(target, state = 'active', **kwargs)
+ self.start(target, state = 'inactive', **kwargs)
return()
def start(self, target, **kwargs):
if not self.conn:
self.startConn()
- targets = self._getTargets(target, **kwargs)
+ targets = self._getTargets(target, state = 'inactive', **kwargs)
for t in targets:
t.create()
return()
@@ -136,7 +136,7 @@ class LV(object):
def stop(self, target, force = False, *args, **kwargs):
if not self.conn:
self.startConn()
- targets = self._getTargets(target, **kwargs)
+ targets = self._getTargets(target, state = 'active', **kwargs)
for t in targets:
if not force:
t.shutdown()
@@ -218,5 +218,6 @@ def main():
print('\n'.join(f))
return()
+
if __name__ == '__main__':
main()