[Libvir] <model>e1000</model> - Specifying model in XML Configs

Richard W.M. Jones rjones at redhat.com
Tue Apr 8 09:13:01 UTC 2008

On Tue, Apr 08, 2008 at 04:45:23AM -0400, Daniel Veillard wrote:
> Then what happen if you pass a wrong string ? Is there any way to get a
> meaningful error back from qemu and report it. Thet would IMHO be quite
> better than tracking the evolution of the emulation in QEmu, plus the
> added benefit of not being tied to a strict version of QEmu,

The error handling in this part of the code seems a bit confused at
the moment.  For example:

    if (virExecNonBlock(conn, argv, &vm->pid,
                        vm->stdin, &vm->stdout, &vm->stderr) == 0) {
		/* [add new qemu to list of VMs] */

    /* [free up various resources] */

    if (virEventAddHandle(vm->stdout,
                          POLLIN | POLLERR | POLLHUP,
                          driver) < 0) {
        qemudShutdownVMDaemon(conn, driver, vm);
        return -1;

    /* [another call to virEventAddHandle] */

    if (qemudWaitForMonitor(conn, driver, vm) < 0) {
        qemudShutdownVMDaemon(conn, driver, vm);
        return -1;

    return 0;

If virExecNonBlock fails, because one of the system calls such as
fork(2) or pipe(2) fails, then vm->stdout may be uninitialized.  I
think it will assume the value 0 in this case and virEventAddHandle
will quite happily register a handler for fd 0.

On the other hand it is tricky to know what to do when launching a
process.  In the case where KVM doesn't understand part of the command
line arguments, the fork & exec will both succeed and the earliest
point where we will see any error will be at qemudWaitForMonitor
(because the monitor won't come up -- note this code is synchronous).


Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

More information about the libvir-list mailing list