Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
qemu-kvm for illumos-kvm
C C++ Haxe Assembly Perl Makefile Other
branch: release-201309…

This branch is 10 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
QMP
audio
bin
block
bsd-user
compat/sys
darwin-user
default-configs
docs
etc/qemu
fpu
fsdev
gdb-xml
hw
kvm
linux-user
net
pc-bios
scripts
share/qemu
slirp
sysconfigs/target
target-alpha
target-arm
target-cris
target-i386
target-ia64
target-m68k
target-microblaze
target-mips
target-ppc
target-s390x
target-sh4
target-sparc
tcg
tests
ui
.gitignore
.gitmodules
CODING_STYLE
COPYING
COPYING.LIB
Changelog
HACKING
LICENSE
MAINTAINERS
Makefile
Makefile.dis
Makefile.hw
Makefile.joyent
Makefile.objs
Makefile.target
Makefile.user
README.md
README.qemu
TODO
VERSION
a.out.h
acl.c
acl.h
aes.c
aes.h
aio.c
alpha-dis.c
alpha.ld
arch_init.c
arch_init.h
arm-dis.c
arm-semi.c
arm.ld
async.c
balloon.c
balloon.h
block-migration.c
block-migration.h
block.c
block.h
block_int.h
blockdev.c
blockdev.h
bswap.h
bt-host.c
bt-host.h
bt-vhci.c
buffered_file.c
buffered_file.h
build.sh
cache-utils.c
cache-utils.h
check-qdict.c
check-qfloat.c
check-qint.c
check-qjson.c
check-qlist.c
check-qstring.c
cmd.c
cmd.h
compatfd.c
compatfd.h
config.h
configure
console.c
console.h
cpu-all.h
cpu-common.h
cpu-defs.h
cpu-exec.c
cpus.c
cpus.h
cris-dis.c
ctf.sh
cursor.c
cursor_hidden.xpm
cursor_left_ptr.xpm
cutils.c
def-helper.h
device_tree.c
device_tree.h
dis-asm.h
disas.c
disas.h
dma-helpers.c
dma.h
dyngen-exec.h
elf.h
envlist.c
envlist.h
exec-all.h
exec.c
gdbstub.c
gdbstub.h
gen-icount.h
hmp-commands.hx
host-utils.c
host-utils.h
hpet.h
hppa-dis.c
hppa.ld
i386-dis.c
i386.ld
ia64-dis.c
ia64.ld
ia64intrin.h
input.c
ioport-user.c
ioport.c
ioport.h
iorange.h
iov.c
iov.h
json-lexer.c
json-lexer.h
json-parser.c
json-parser.h
json-streamer.c
json-streamer.h
kvm-all.c
kvm-stub.c
kvm-tpr-opt.c
kvm.h
libfdt_env.h
linux-aio.c
m68k-dis.c
m68k-semi.c
m68k.ld
manifest
microblaze-dis.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
migration.h
mips-dis.c
mips.ld
module.c
module.h
monitor.c
monitor.h
nbd.c
nbd.h
net-checksum.c
net.c
net.h
notify.c
notify.h
os-posix.c
os-win32.c
osdep.c
osdep.h
oslib-posix.c
oslib-win32.c
path.c
pci-ids.txt
pflib.c
pflib.h
poison.h
posix-aio-compat.c
ppc-dis.c
ppc.ld
ppc64.ld
qbool.c
qbool.h
qdict-test-data.txt
qdict.c
qdict.h
qemu-aio.h
qemu-barrier.h
qemu-char.c
qemu-char.h
qemu-common.h
qemu-config.c
qemu-config.h
qemu-doc.texi
qemu-error.c
qemu-error.h
qemu-img-cmds.hx
qemu-img.c
qemu-img.texi
qemu-io.c
qemu-kvm-ia64.c
qemu-kvm-x86.c
qemu-kvm.c
qemu-kvm.h
qemu-lock.h
qemu-log.h
qemu-malloc.c
qemu-nbd.c
qemu-nbd.texi
qemu-objects.h
qemu-option.c
qemu-option.h
qemu-options.h
qemu-options.hx
qemu-os-posix.h
qemu-os-win32.h
qemu-queue.h
qemu-sockets.c
qemu-tech.texi
qemu-thread.c
qemu-thread.h
qemu-timer-common.c
qemu-timer.c
qemu-timer.h
qemu-tool.c
qemu-x509.h
qemu.sasl
qemu_mdb.c
qemu_socket.h
qerror.c
qerror.h
qfloat.c
qfloat.h
qint.c
qint.h
qjson.c
qjson.h
qlist.c
qlist.h
qmp-commands.hx
qobject.h
qstring.c
qstring.h
range.h
readline.c
readline.h
rules.mak
rwhandler.c
rwhandler.h
s390-dis.c
s390.ld
savevm.c
sh4-dis.c
simpletrace.c
simpletrace.h
softmmu-semi.h
softmmu_defs.h
softmmu_exec.h
softmmu_header.h
softmmu_template.h
sparc-dis.c
sparc.ld
sparc64.ld
spice-qemu-char.c
sysemu.h
targphys.h
tcg-runtime.c
thunk.c
thunk.h
trace-events
translate-all.c
uboot_image.h
usb-bsd.c
usb-linux.c
usb-stub.c
version.rc
vgafont.h
vl.c
x86_64.ld

README.md

  ___  _____ __  __ _   _
 / _ \| ____|  \/  | | | |
| | | |  _| | |\/| | | | |
| |_| | |___| |  | | |_| |
 \__\_\_____|_|  |_|\___/

For full documentation on all the various options for QEMU please see the html docs.

BUILDING

Preparing:

Edit build.sh and change the --kerneldir option to point to the directory of the kvm repository and change the --prefix option to whatever you want.

$ ./build.sh
$ make install

USING

Follow the qemu documentation for all of the various options available. The rest of this will be examples and specific pieces about how to use things with a VNIC and a ZVOL. The following is a sample configuration for qemu running a Linux VM.

$ /smartdc/bin/qemu-system-x86_64 \
    -enable-kvm \
    -nographic \
    -drive file=smartdc.iso,media=cdrom,if=ide \
    -boot order=cd \
    -smp 4 \
    -m 1024 \
    -vnc 0.0.0.0:0 \
    -net nic,vlan=0,name=net0,model=virtio,macaddr=90:b8:d0:c0:ff:ee\
    -net vnic,vlan=0,name=net0,ifname=eth0,macaddr=90:b8:d0:c0:ff:ee,\
         ip=10.88.88.50,netmask=255.255.255.0,gateway_ip=10.88.88.2,\
         server_ip=10.88.88.200,dns_ip0=8.8.4.4,dns_ip1=8.8.4.4,\
     hostname=host1,lease_time=3600 \
    -no-hpet \
    -chardev socket,id=serial0,path=/tmp/vm.console,server,nowait \
    -serial chardev:serial0 \
    -drive file=/dev/zvol/rdsk/zones/rec-8,if=virtio,index=0

ZVOLs

It is highly desirable to be able to give a virtual machine a zvol to use as a disk. This is accomplished via the -drive option. Simply pass the block device that corresponds to the zvol.

To create a zvol use a command similar to:

$ zfs create -V 10g tank/vm-hdd

VNICs

We have added an option to have a virtual machine's network interface card directly correspond to a Crossbow vnic on the system. The -net vnic has several mandatory arguments:

  • vlan must be specified and correspond to a single -net nic line
  • name must be specified and correspond to a single -net nic line
  • macaddr must be specified if the MAC Address of the VNIC does not match the MAC address on the -net nic line.
  • ifname must be specified and correspond to the name of the crossbow vnic.

To set up the crossbow vnic, simply create it. There is no need to plumb it. The device will be opened up in promiscuous mode.

To create a vnic you'll want something akin to:

$ dladm create-vnic -l e1000g0 vnic0

The -net vnic option also supports configuring networking on the virtual machine via dhcp. In this mode, qemu acts as a DHCP server for the virtual machine. To enable vnic dhcp, specify the following arguments:

  • ip (eg: 192.168.0.2) must be specified in order to enable dhcp
  • netmask (eg: 255.255.255.0) must be specified
  • gateway_ip (eg: 192.168.0.1) must be specified
  • server_ip (eg: 192.168.0.3) is optional. This allows specifying the IP address of qemu's DHCP server.
  • dns_ip (eg: 8.8.4.4) is optional, and allows specifying the DNS server the virtual machine will use. The default value is 8.8.8.8.
  • dns_ip0, dns_ip1, dns_ip2, and dns_ip3 are optional, and allow specifying a list of DNS servers, rather than just one. These options override the dns_ip option.
  • hostname (eg: myhostname) is optional. This defaults to no hostname.
  • lease_time (eg: 3600) is optional, and allows specifying the DHCP lease time in seconds. The default value is 86400 (or 1 day).

The following is a sample -net vnic line for running with DHCP:

-net vnic,vlan=0,name=net0,ifname=eth0,macaddr=90:b8:d0:c0:ff:ee, \
    ip=10.88.88.50,netmask=255.255.255.0,gateway_ip=10.88.88.2, \
    server_ip=10.88.88.200,dns_ip=8.8.4.4,hostname=host1,lease_time=3600
Something went wrong with that request. Please try again.