
On Mon, Nov 02, 2009 at 05:05:55PM -0500, Cole Robinson wrote:
On 10/23/2009 09:05 AM, Daniel P. Berrange wrote:
The daemonizing code lets the parent exit almost immediately. This means that it may think it has successfully started even when important failures occur like not being able to acquire the PID file. It also means network sockets are not yet open.
To address this when daemonizing the parent passes an open pipe file descriptor to the child. The child does its basic initialization and then writes a status code to the pipe indicating either success, or failure. This ensures that when daemonizing, the parent does not exit until the pidfile is acquired & basic network sockets are open.
Initialization of the libvirt drivers is still done asynchronously since this may take a very long time.
* daemon/libvirtd.c: Force parent to stay around until basic config file, pidfile & network socket init is completed
+ /* Start the stateful HV drivers + * This is delibrately done after telling the parent process + * we're ready, since it can take a long time and this will + * seriously delay OS bootup process */ + if (virStateInitialize(server->privileged) < 0) { + VIR_ERROR0("Driver state initialization failed"); + goto error; + }
This breaks qemu:///session for me.
Starting libvirtd by hand as a regular user, virStateInitialize tries to init lxc, but lxc explicitly denies non-root driver startup in lxc_driver.c:lxcStartup:
/* Check that the user is root */ if (!privileged) { return -1; }
Not sure what the proper fix is.
Sorry, this was a rebase messup. The fix for this is in the next patch in the series - lxcStartup() should only return -1 for actual errors. Running unprivileged is not an error, it should merely disable itself and return 0. I'll apply the fix now. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|