[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] Emulating raspberry pi (arm1136-r2) in virt-manager?



On 02/15/2013 08:47 PM, Simon Lambourn wrote:
> 
> This is looking a bit more complicated than I thought... I now
> understand that I can't simply define the ARM machine in xml and define
> it using virsh, as the CPU type (arm1136-r2) is rejected by libvirt
> which can't test if it's valid or not.
> 
> So I think what Cole and Martin are suggesting is that I define a dummy
> emulator (the wrapper script) which plays with the arguments passed by
> libvirt and then calls the real emulator qemu-system-arm. I had a quick
> go at this but I couldn't work out where to put the wrapper script.  I
> tried putting a wrapper (qemu-system-pi - written in python) in
> /usr/bin, but virsh define couldn't find it.
> 

libvirt might not find the executable by default, but you can specify
the path like this:

<domain type='kvm'>
...
  <devices>
    <emulator>/path/to/your/script</emulator>
...
  </devices>
</domain>

The easiest script I just tried right now does:

#!/bin/bash
echo "Running QEMU as '$@'"
exec qemu-system-x86_64 "$@"

The point is exec-ing the qemu binary at the end, which will then take
care of everything libvirt needs to get the "hypervisor info".

To see some python wrapper script, you can have a look (instead of
googling) at for example 'vdsm-hook-faqemu' package in fedora (no
dependencies), which has two interesting files inside:
 1) /usr/libexec/vdsm/hooks/before_vm_start/10_faqemu -- a pre-start
hook that modifies the XML, just in case you'll need it in the future,
but no need for that right now.
 2) /usr/libexec/vdsm/vdsm-faqemu -- *this is what you want* -- this
script does something very similar to the thing you want, i.e. changes
the command line.  I think it's pretty well readable, so that why I
suggested it.

> I also get the impression that libvirt calls the wrapper during define,
> to validate the arguments?   So these calls also have to be caught and
> passed to the real emulator.
> 

Already covered by the 'exec-ing'.

> Overall I am tempted to stick with my original method of simply issuing
> the qemu-system-arm command directly from a script, but if anyone can
> suggest how I can get the wrapper to be found - or point me to an
> example of one - then I will keep trying.  Thanks for all the help and
> encouragement so far.
> 

I know it seems like shooting yourself in a foot before the race, but I
saw it working, so it is definitely possible.  OTOH, the only thing
you'll use libvirt for will probably be just starting/stopping the
machine and maybe attaching some usb devices.  And since you won't be
migrating, changing memory on-the-fly etc., you probably don't need it
that much.  I'll be happy to see you succeed and use it in virt-manager,
though, so good luck!

Hope this helps,
Martin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]