"If QEMU fails during startup" ... please tell me how to start QEMU as a service!
Thanks, smoyer
-----Original Message-----
From: libvir-list-bounces@xxxxxxxxxx on behalf of Daniel P. Berrange
Sent: Tue 5/15/2007 6:27 PM
To: Mark McLoughlin
Cc: libvir-list@xxxxxxxxxx
Subject: Re: PATCH: Create a logfile for each QEMU vm
On Tue, May 15, 2007 at 06:37:40PM +0100, Daniel P. Berrange wrote:
> On Tue, May 15, 2007 at 05:15:04PM +0100, Daniel P. Berrange wrote:
> > On Tue, May 15, 2007 at 05:09:56PM +0100, Mark McLoughlin wrote:
> > > On Tue, 2007-05-15 at 17:04 +0100, Daniel P. Berrange wrote:
> > >
> > > > For every VM we start it will create a logfile
> > > >
> > > > /etc/libvirt/qemu/logs/[vmname].log
> > >
> > > Why not /var/log? /etc/ isn't the place for this kind of stuff, surely.
> >
> > True - though we'd have to code different behaviour when running as an
> > unprivileged user. Shouldn't complicate things too much i guess.
>
> Attached a new version which does this. If using qemu:///system they get
> put into /var/log/libvirt/qemu, while if using qemu://session they go into
> $HOME/.libvirt/qemu/log
Ok, attached is my final version.
- qemu:///system per-VM logs are created in /var/log/libvirt/qemu/[vmname].log
- qemu:///session per-VM logs are created in $HOME/.libvirt/qemu/log/[vmname].log
- The exact QEMU command line argv is logged in aforementioned files
- All data written to stderr/out by QEMU is logged in aforementioned files
- There is a qemudValidateConfig() method we call before starting a VM which
checks the path for kernel, initrd, each disk, and any script given for
a network device setup.
- The horrible 'End-of-file while reading PTY startup output' is replaced
with less horrible 'QEMU quit during console startup'. Though I might
reword that a little more
- If QEMU fails during startup, we capture the contents of stderr and
include them in the libvirt error message reported. I'm not entirely
happy with this because this can make messages quite verbose, but at
the same time we really need to feed this info back to the user. This
is even more important with remote management where there's no easy
access to log files.
So, here's some examples:
- Starting a guest with mem set to 8 G - in this case QEMU provides zero
useful error message, so we get the generic:
# virsh --connect qemu:///system start wizz
libvir: QEMU error : internal error QEMU shutdown while reading console startup output
error: Failed to start domain wizz
- Starting a guest with mem set to 1.9 G - this this case there is not
enough free ram:
# virsh --connect qemu:///system start wizz
libvir: QEMU error : internal error QEMU shutdown while reading console startup output
You do not have enough space in '/dev/shm' for the 1503 MB of QEMU virtual RAM.
To have more space available provided you have enough RAM and swap, do as root:
umount /dev/shm
mount -t tmpfs -o size=1519m none /dev/shm
Or disable the accelerator module with -no-kqemu
error: Failed to start domain wizz
- Starting a guest with a disk which doesn't exist:
# virsh --connect qemu:///system start wizz
libvir: QEMU error : internal error Cannot access disk hda at /home/berrange/src/xen/virtinst--devel/demo2: No such file or directory
error: Failed to start domain wizz
Regards,
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 -=|