All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: xen-devel@lists.xensource.com
Subject: Fix handle of vncunused parameter for HVM framebuffer
Date: Tue, 3 Oct 2006 22:02:12 +0100	[thread overview]
Message-ID: <20061003210212.GE29356@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]

The 'vncunused' parameter for a guest config file is supposed to instruct
XenD (well qemu-dm) to bind to the first unused VNC display port that is
available. 

In the current xen-unstable.hg tree tough, XenD will always pass an explicit
'-vnc <display num>' parameter to qemu-dm, regardless of whether 'vncunused'
is set. So the 'vncunused' bit only takes effect if the explicitly passed
display already has something bound to it.

For example it runs

/usr/lib64/xen/bin/qemu-dm \
    -d 136 \
    -m 500  \ 
    -boot c  \
    -serial pty  \
    -vcpus 1 \
    -domain-name rhel4x86_64 \
    -net nic,vlan=1,macaddr=00:16:3e:38:17:80,model=rtl8139 \
    -net tap,vlan=1,bridge=xenbr0 \
    -vnc 136 \
    -vncunused \
    -k en-us 

This may not look too bad, but consider what happens when the host machine
has been up for a while - the Domin ID's start getting very high - in this
example domain ID is merely 136, which makes VNC attach to 6036, but as time
goes by it'll be binding to higher & higher ports. 

This plays havoc with firewalls - for example an admin may know that only
10 domains will  ever be running at any time, so they should be able to
simply open up ports 5900 -> 5910.

The correct behaviour should be:

   - If 'vncdisplay' is set, use that explicit display
   - If 'vncunused' is set non-zero, allocate first port about 5900
   - Allocate fixed port based on domain-ID

The attached patch fixes XenD so that if 'vncused' is set, it won't specify
an explicit display num to QEMU. It also fixes a dumb error in QEMU which
caused it to start trying ports from 5898 instead of 5900. This brings the
behaviour into compliance with the rules above.

   Signed-of-By: Daniel P. Berrange <berrange@redhat.com>

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

[-- Attachment #2: xen-vncunusedhvm.patch --]
[-- Type: text/plain, Size: 1192 bytes --]

diff -r 38f9bd7a4ce6 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c	Tue Oct 03 11:39:22 2006 +0100
+++ b/tools/ioemu/vl.c	Tue Oct 03 16:46:22 2006 -0400
@@ -6310,7 +6310,7 @@ int main(int argc, char **argv)
             case QEMU_OPTION_vncunused:
                 vncunused++;
                 if (vnc_display == -1)
-                    vnc_display = -2;
+                    vnc_display = 0;
                 break;
             }
         }
diff -r 38f9bd7a4ce6 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Tue Oct 03 11:39:22 2006 +0100
+++ b/tools/python/xen/xend/image.py	Tue Oct 03 16:46:22 2006 -0400
@@ -355,10 +355,12 @@ class HVMImageHandler(ImageHandler):
         if vnc:
             vncdisplay = sxp.child_value(config, 'vncdisplay',
                                          int(self.vm.getDomid()))
-            ret = ret + ['-vnc', '%d' % vncdisplay, '-k', 'en-us']
             vncunused = sxp.child_value(config, 'vncunused')
             if vncunused:
                 ret += ['-vncunused']
+            else:
+                ret += ['-vnc', '%d' % vncdisplay]
+            ret += ['-k', 'en-us']
         return ret
 
     def createDeviceModel(self):

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2006-10-03 21:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061003210212.GE29356@redhat.com \
    --to=berrange@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.