[OmniOS-discuss] KVM within a child zone

Michael Mounteney gate03 at landcroft.co.uk
Tue Dec 23 10:48:15 UTC 2014


On Tue, 23 Dec 2014 10:56:30 +0100
Natxo Asenjo <natxo.asenjo at gmail.com> wrote:

Thanks to you and everyone else for their help.  I hope I'm not
polluting the list with newbie noise but hopefully this will stay on
record and help out someone else later.  My knowledge of vnics, sockets
etc. is thin, to say the least.

It is now working in a fashion.  Here's the KVM zone:

root at world:/root# zonecfg -z KVM export
create -b
set zonepath=/zone/KVM
set brand=ipkg
set autoboot=true
set ip-type=exclusive
add net
set physical=vnick0
end
add device
set match=/dev/kvm
end
add device
set match=/dev/dld
end
add device
set match=/dev/zvol/dsk/rpool/vol/*
end
add dataset
set name=rpool/vol
end

I don't need that dataset but anyway.

Within the zone, the kvm launch command is:

/usr/bin/qemu-system-x86_64 \
        -name "Gentoo XFCE" \
        -cpu host \
        -boot order=d \
        -enable-kvm \
        -chardev socket,id=monitor,path=/var/run/monitor.sock,server,nowait \
	-monitor chardev:monitor \
	-chardev socket,id=serial0,path=/var/run/console.sock,server,nowait \
	-serial chardev:serial0 \
	-vnc unix:/var/run/XFCE.sock \
        -smp 1,maxcpus=1,cores=2 \
        -m 1024 \
        -no-hpet \
        -localtime \
        -kernel ./bzImage \
        -append "root=/dev/vda1 init=/usr/lib/systemd/systemd quiet" \
        -drive file=/dev/zvol/dsk/rpool/vol/Gentoo-KVM-XFCE,cache=none,if=virtio,index=0 \
	-drive file=/dev/zvol/dsk/rpool/vol/Linuswap-XFCE,cache=none,if=virtio,index=1 \
	-net nic,vlan=0,macaddr=$mac,model=virtio,name=ncard1 \
	-net vnic,vlan=0,name=net0,ifname=5905,macaddr=$mac \
	-vga std \
	-daemonize

and that works inasmuch as the guest assigns an IP of 192.168.1.47 to
its interface, and I can ssh and xdmcp into it from elsewhere.

Now the three sockets are visible in the global zone:

root at world:/root# ls -ltr /zone/KVM/root/var/run/*.sock 
srwxr-xr-x 1 root root 0 Dec 23 20:04 /zone/KVM/root/var/run/monitor.sock
srwxr-xr-x 1 root root 0 Dec 23 20:04 /zone/KVM/root/var/run/console.sock
srwxr-x--- 1 root root 0 Dec 23 20:04 /zone/KVM/root/var/run/XFCE.sock

so how would I connect a VNC viewer on another machine on the same
subnet to the VM ?  I need this for when the guest fails to start up for whatever reason.

Michael.


More information about the OmniOS-discuss mailing list