Reading from the qemu monitor pulls in a whole bunch of
useless control characters. For example, sending the
command 'somecomm' to the monitor returns:
somecomm
unknown command: 'somecomm'
(qemu)
Which is 36 characters, however we end up reading over 200.
The amount we read actually grows quadratically as a function
of the command length. This prevents us from reporting monitor
output to the user (incase some command fails) and seriously
diminishes the value of the domain logfiles.
The attached patch tries to sanitize this a bit. After reading
all the output, we search for the first occurrence of the full
command string. If found, we search from there for the first
newline (which marks the beginning of the monitor response).
If these are found, we only return the command, and everything
after the newline. If only the command is found, we just drop
everything before it.
I've tested this on f9 and f8, there didn't seem to be any
problems. I think this should be pretty future proof as
well, so we hopefully won't be throwing out anything
valuable.
Thanks,
Cole