[libvirt-users] Port forwarding for KVM

Daniel P. Berrange berrange at redhat.com
Fri Apr 12 11:12:54 UTC 2013


On Fri, Apr 12, 2013 at 07:06:45PM +0800, 陳韋任 (Wei-Ren Chen) wrote:
> Hi all,
> 
>   Let me illustrate what I want to do. I want to launch a QEMU
> "inside" a KVM virtual machine, then get that QEMU's vnc output.
> I am using libvirt 0.9.13 (`libvirtd --version`), and attach is
> my vm's original config xml. Is there a simple way to achieve my goal?
> I was told that iptable solution I found on the web is for "tap"
> interface, and I can use "hostfwd" QEMU option if I use "user"
> interface. For the latter approach, I basically follow this one [1]
> with the QEMU cmdline option below:
> 
>   <qemu:commandline>
>     <qemu:arg value='-net user,hostfwd=::5902-:5901'/>
>   </qemu:commandline>
> 
> But virsh always keep saying:
> 
>   error: internal error Process exited while reading console log output:
>   kvm: -net user,hostfwd=::5902-:5901: invalid option   

You are trying to pass 2 arguments in one go. You need

   <qemu:commandline>
     <qemu:arg value='-net'/>
     <qemu:arg value='user,hostfwd=::5902-:5901'/>
   </qemu:commandline>

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list