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()