qemu-devel usage

Scott Furry scott.wl.furry at gmail.com
Wed Mar 4 00:03:11 UTC 2015

Yeah! I was able to setup qemu-devel(ver 2.20) to use existing qcow2 
images from linux. Sort of...

The biggest pain I had was getting networking to play along. No matter 
what settings, modules or otherwise I tried, I could not get the VM 
image to use an existing tap interface accepting DHCP from my server. 
Turns out the problem was rather undocumented and buried in installed files.

The files "/usr/local/etc/qemu-if[up|down]" are two lines each. One is 
the sh-bang, the other is a line saying "exec true". And this is the 
default installed to the system by the port files. The 
qemu-ifXXXX.sample files are not much help either as they contain the 
exact same content. Link(1)(see refs below) makes no mention of the 
default ifup|down script files. Would it be prudent to setup an 
/etc/qemu folder so users can place their local networking scripts 
there? Is this the correct location?

FWIW, my solution was to "edit" the scripts. I replaced the "exec true" 
in qemu-ifup with "/sbin/ifconfig bridge0 addm ${1} up" to add a tap to 
the existing bridge. In the qemu-ifdown, "exec true" was replaced with 
"/sbin/ifconfig ${1} destroy". End result - still need root access to 
start VM because of networking.

I didn't have to go to this extreme when I setup qemu networking on a 
linux box. However, new OS. :)

 From my original setup files for qemu, I had used the -enable-kvm and 
-cpu host flags (see 2 below). Qemu on BSD just didn't want to accept 
"host" as a cpu option. The reference did point out how the flag worked, 
something I didn't realize. However, it would be really good to have the 
"host" flag to pass along the cpu accelerators to the VM without having 
to call them individually. Is anyone working on this?

And on the topic of cpu's, when I get a listing of the supported cpu's ( 
qemu -cpu help ), it seems the listing is abbreviated. There is no 
mention of later cpu types (either intel or AMD). Am I missing something?

Ref (3) talks about using kqemu-kmod. A kqemu-kmod-devel exists in the 
ports tree. However, I saw a reference on the KVM page (which I can't 
find again :< ) talking about how kvm aspects including kqemu were being 
absorbed into qemu mainline. Can someone clarify, please. Are there any 
kernel modules required for normal usage? Documentation seems a little 
sparse for FreeBSD/qemu hosts. Is the -enable-kvm flag mentioned earlier 
still required here?


(1) https://wiki.freebsd.org/qemu
(2) http://www.linux-kvm.org/page/Tuning_KVM
(3) http://www.linux-kvm.org/page/BSD

More information about the freebsd-ports mailing list