On Tue, May 15, 2007 at 11:27:11PM +0100, Daniel P. Berrange wrote:
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.
Bah, discovered a really nasty issue. The (existing) code assumed that the
revents field in poll struct would be POLLIN *or* POLLHUP. 70% of the time
that was true, but sometimes it was POLLIN & POLLHUP in which case we were
throwing away valuable log output.
- 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.
With my fix to deal with poll we can actually reliably get this info from
QEMU directly. Also having libvirt do stat() was failing with disk > 2GB
since we don't currently build with LFS enabled. So I've riped this out of
my latest patch.
- 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.
This lets us also catch errors about missing 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
This now loooks like
# virsh --connect qemu:///system start wizz
libvir: QEMU error : internal error QEMU quit during console startup
qemu: could not open hard disk image
'/home/berrange/src/xen/virtinst--devel/demo2'
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 -=|