Index: vws ================================================================== --- vws +++ vws @@ -50,11 +50,11 @@ sock.send(command + "\n") answer = "" while not answer.endswith("(qemu) "): chunk = sock.recv(1024) if chunk == '': - raise IOError("Unexpected EOF From monitor") + raise IOError("Unexpected EOF from monitor") answer += chunk finally: fcntl.flock(sock, fcntl.LOCK_UN) return answer @@ -130,11 +130,11 @@ def read_netinfo(filename): """ Reads network information from start script """ with open(filename,"r") as f: for line in f: - match=re.search("-net nic,macaddr=(\\S+) -net ([^,]+)",line) + match=re.search("-net nic,macaddr=(\\S+) -net ([^, ]+)",line) if match: f={"mac":match.group(1)} if match.group(2) == "user": f["iface"]="user" elif match.group(2) == "bridge": @@ -216,11 +216,18 @@ print >>sys.stderr, "VM already running" def cmd_stop(options): """ vws stop """ if snapshot_mode(options.sock) or options.hard: - print send_command(options.sock, 'quit') + try: + send_command(options.sock, 'quit') + except IOError as e: + # Expect IOError here + if e.message.find("EOF from monitor"): + print "monitor socket closed" + else: + raise e else: print send_command(options.sock, 'system_powerdown') def cmd_monitor(options): """ vws monitor """