With the current QEMU driver we simply spawn the QEMU process and return to
the caller immediately. If the QEMU process dies immediately for some reason
the user will never no - their domain will simply never appear. To address
this, the attached patch will spawn the QEMU process and then immeditely
process stderr to look for the monitor PTY - or EOF indicating failure. If
it finds the monitor it will also try to connect to it - if this fails in
any way then the domain is terminated with extreme prejudice - we absolutely
need the monitor connection for other operations to work. This should at
least cause a 'Domain startup failed' message to be returned to the user
although more work is needed to try and extract a useful error message
from the stuff written to stderr.
Also in this patch I have reversed the order in which file descriptors are
added to the poll array. Currently they are added server, then client,
then VMs. The trouble with this is that when processing the server event,
if a new client is added to the daemon then processing of subsequent FDs
is out of sync. Likewise if a client message causes a new VM to startup
then processing of subsquent VM FDs is out of sync. Reversing the order
trivially solves it, because VM FDs s are now processed before client
FDs, and thus any new VMs started by a client don't mess things up. Likewise
client FDs are processed before server FDs. A more robust long term fix
would be to carry around some extra metadata instead of relying on ordering
when dispatching events.
Finally this patch also fixes the 'resume' operation, and allows for the
VM state to be reported correctly - ie we can now report 'paused' as well
as shutdown/running.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|