add verbose output in actiony.py
authorJens Kasten <jens@kasten-edv.de>
Tue, 10 Apr 2012 08:48:32 +0200
changeset 121 886baf99fea5
parent 120 0316dca56534
child 122 c8c86db080e3
add verbose output in actiony.py
kvmtools/kvm/action.py
--- a/kvmtools/kvm/action.py	Tue Apr 10 08:23:12 2012 +0200
+++ b/kvmtools/kvm/action.py	Tue Apr 10 08:48:32 2012 +0200
@@ -72,6 +72,8 @@
             for key, value in self.bridge.iteritems():
                 env[key] = value
         try:
+            if self.verbose:
+                print "booting ..."
             result = Popen(self.command[0], env=env, stdin=PIPE, stdout=PIPE)
             result.wait()
             return (True, "")
@@ -134,7 +136,6 @@
                     sys.stdout.write("\t\tkilled in %0.1f seconds.\r" % \
                         ((timer + self.shutdown_time_out) - time() - 0.05))
                     sys.stdout.flush()
-                    
                 if (timer + self.shutdown_time_out) < (time() -0.05):
                     self.kvm_kill_action()
         else:
@@ -147,8 +148,11 @@
         if not self.is_running():
             print ("Guest is not running.")
             return False
-        try:    
+        try:
             os.kill(self.kvm_pid, 9)
+            if self.verbose:
+                sys.stdout.write("killed ...                                \n")
+                sys.stdout.flush()
             sleep(0.8)
             self.is_running()
             sys.exit(0)