Overview
Comment: | Fix problem which occurs if stray (qemu) promt is left in the monitor socket before command execution |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3e92401463c0a9448f7b9d9efb6ca3bd |
User & Date: | vitus on 2018-07-17 14:13:57 |
Other Links: | manifest | tags |
Context
2018-07-17
| ||
14:24 | Set version to 0.6 check-in: 0f1753d7e3 user: vitus tags: trunk | |
14:13 | Fix problem which occurs if stray (qemu) promt is left in the monitor socket before command execution check-in: 3e92401463 user: vitus tags: trunk | |
2018-07-13
| ||
15:00 | Added RemainAfterExit to service file to mark service running even if no autostart VMs exist. This allows to stop manually stared machines during system shutdown check-in: 942bcecae4 user: vitus tags: trunk | |
Changes
Modified vws from [f931d28fe4] to [8e374cbb8b].
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | dummy_greeting = sock.recv(1024) return sock def send_command(sock, command): """ Sends monitor command to given socket and returns answer """ fcntl.flock(sock, fcntl.LOCK_EX) try: sock.send(command + "\n") answer = "" while not answer.endswith("(qemu) "): chunk = sock.recv(1024) if chunk == '': raise IOError("Unexpected EOF from monitor") answer += chunk | > > > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | dummy_greeting = sock.recv(1024) return sock def send_command(sock, command): """ Sends monitor command to given socket and returns answer """ fcntl.flock(sock, fcntl.LOCK_EX) try: # There can be stray (qemu) prompt in the socket. Try to drain # it try: sock.recv(64,socket.MSG_DONTWAIT) except socket.error as e: if e.errno != errno.EAGAIN and e.errno!=errno.EWOULDBLOCK: raise e sock.send(command + "\n") answer = "" while not answer.endswith("(qemu) "): chunk = sock.recv(1024) if chunk == '': raise IOError("Unexpected EOF from monitor") answer += chunk |
︙ | ︙ |