<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 04/12/2013 07:06 AM, 陳韋任 (Wei-Ren
      Chen) wrote:<br>
    </div>
    <blockquote cite="mid:20130412110645.GA30510@cs.nctu.edu.tw"
      type="cite">
      <pre wrap="">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   </pre>
    </blockquote>
    <br>
    <br>
    Aside from the problem Daniel pointed out in his reply, this is
    probably the *least* desirable way to get this functionality, and
    should only be used if you are unable to use any other network
    connection type.<br>
    <br>
    <br>
    <blockquote cite="mid:20130412110645.GA30510@cs.nctu.edu.tw"
      type="cite">
      <pre wrap="">What I am missing here? I also found there was a patch for user mode
port forwarding [2]. Does that mean I can write libvirt xml directly
to do port forwarding?</pre>
    </blockquote>
    <br>
    <br>
    No, that patch "died in committee"; in general it's a good idea, but
    it needs to be done in a way that is useful for all types of
    interface, not just usermode. Unfortunately nobody has had the
    combination of enough time + enough motivation to carry it through.<br>
    <br>
    <br>
    <blockquote cite="mid:20130412110645.GA30510@cs.nctu.edu.tw"
      type="cite">
      <pre wrap=""> If so, could someone give me hint on how to
write one? The last question is, do I have to change the interface
type from "network" to "user" so that I can do port forwarding?</pre>
    </blockquote>
    <br>
    No, you don't. Please take a look here:<br>
    <br>
     
    <a class="moz-txt-link-freetext" href="http://wiki.libvirt.org/page/Networking#Forwarding_Incoming_Connections">http://wiki.libvirt.org/page/Networking#Forwarding_Incoming_Connections</a><br>
    <br>
    Alternately (and a simpler solution), you could use a bridged or
    direct (macvtap) network connection for your guest, and then the
    guest would have an IP address directly on the physical network and
    no need to have any ports forwarded.<br>
    <br>
    <br>
    <blockquote cite="mid:20130412110645.GA30510@cs.nctu.edu.tw"
      type="cite">
      <pre wrap="">

  Thanks in advance! :)

[1] <a class="moz-txt-link-freetext" href="http://snippets.webaware.com.au/snippets/running-qemu-with-port-redirection-through-libvirt/">http://snippets.webaware.com.au/snippets/running-qemu-with-port-redirection-through-libvirt/</a>
[2] <a class="moz-txt-link-freetext" href="http://www.redhat.com/archives/libvir-list/2012-May/msg00538.html">http://www.redhat.com/archives/libvir-list/2012-May/msg00538.html</a>

Regards,
chenwj

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
libvirt-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvirt-users@redhat.com">libvirt-users@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvirt-users">https://www.redhat.com/mailman/listinfo/libvirt-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>