WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] [UPDATE] stubdoms: generate stubdom config file

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] [UPDATE] stubdoms: generate stubdom config file
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 22 Apr 2009 18:25:03 +0100
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Wed, 22 Apr 2009 10:25:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080505)
Hi all,
this patch removes the need for a second configuration file for
stubdoms: it is going to be automatically generated by the script
stubdom-dm using command line options and xenstore to find any needed
information.
The configuration script will be placed under /etc/xen/stubdoms and
automatically removed when the domain is destroyed.
The only change needed in xend is not to write on xenstore sdl,
opengl and serial command line options for qemu, because stubdoms do not
support them.
It is safe to remove those two options from xenstore because qemu does
not use xenstore to read commans line options.
Finally this patch fixes blkfront disconnections from backends and
display and xauthority variables for pv guests.

I realize that it is late to make these changes for 3.4 but I think they
contain important fixes and have the nice side effect of allowing pv
drivers to work properly on stubdom based guests.
Besides they do not affect the normal qemu case.
If anyone that uses stubdoms is against these changes for 3.4, now is the
time to speak up.

update: removed any change that affect non-stubdom cases, to be sent
separately afterwards.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> 

---

diff -r df61fe72ac66 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Wed Apr 22 17:05:51 2009 +0100
+++ b/extras/mini-os/blkfront.c Wed Apr 22 18:16:39 2009 +0100
@@ -244,10 +244,6 @@
     xenbus_wait_for_value(path, "5", &dev->events);
 
     err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6);
-    xenbus_wait_for_value(path, "6", &dev->events);
-
-    err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 1);
-    xenbus_wait_for_value(path, "2", &dev->events);
 
     xenbus_unwatch_path(XBT_NIL, path);
 
diff -r df61fe72ac66 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm        Wed Apr 22 17:05:51 2009 +0100
+++ b/stubdom/stubdom-dm        Wed Apr 22 18:16:39 2009 +0100
@@ -15,7 +15,10 @@
 vncviewer=0
 vncpid=
 extra=
-videoram=4
+sdl=0
+opengl=1
+vnc=0
+vncunused=0
 while [ "$#" -gt 0 ];
 do
     if [ "$#" -ge 2 ];
@@ -31,22 +34,30 @@
                 shift
                 ;;
            -vnc)
-               ip=${2%:*};
-               vnc_port=${2#*:};
+                vnc=1
+                op=${2%,*}
+               ip=${op%:*};
+               vnc_port=${op#*:};
                shift
                ;;
+            -vncunused)
+                vncunused=1
+                shift
+                ;;
             -loadvm)
                 extra="$extra -loadvm $2";
                 shift
                 ;;
-           -videoram)
-               videoram="$2"
-               shift
-               ;;
+            -k)
+                keymap=$2
+                shift
+                ;;
        esac
     fi
     case "$1" in
        -vncviewer) vncviewer=1 ;;
+        -sdl) sdl=1 ;;
+        -disable-opengl) opengl=0 ;;
     esac
     shift
 done
@@ -61,7 +72,7 @@
     (
        [ -n "$vncpid" ] && kill -9 $vncpid
        xm destroy $domname-dm
-       #xm destroy $domname
+        rm /etc/xen/stubdoms/$domname-dm
     ) &
     # We need to exit immediately so as to let xend do the commands above
     exit 0
@@ -77,7 +88,58 @@
        sleep 1
 done
 
-creation="xm create -c $domname-dm target=$domid memory=32 videoram=$videoram 
extra=\"$extra\""
+# Generate stubdom config file
+mkdir -p /etc/xen/stubdoms &>/dev/null
+echo "#This file is autogenerated, edit $domname instead!" > 
/etc/xen/stubdoms/$domname-dm
+echo "kernel = '/usr/lib/xen/boot/ioemu-stubdom.gz'" >> 
/etc/xen/stubdoms/$domname-dm
+
+vfb="sdl=$sdl, opengl=$opengl"
+test "$DISPLAY" && vfb="$vfb, display=$DISPLAY"
+test "$XAUTHORITY" && vfb="$vfb, xauthority=$XAUTHORITY"
+test $vnc != 0 && vfb="$vfb, vnc=$vnc, vncdisplay=$vnc_port, vnclisten=$ip, 
vncunused=$vncunused"
+vncpasswd=`xenstore-read /local/domain/0/backend/vfb/$domid/0/vncpasswd 
2>/dev/null`
+test "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
+test "$keymap" && vfb="$vfb, keymap=$keymap"
+echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
+
+echo -n "disk = [ " >> /etc/xen/stubdoms/$domname-dm
+j=0
+for i in `xenstore-ls /local/domain/$domid/device/vbd | grep 'backend =' | awk 
'{print $3}'`
+do
+    i=${i%\"}
+    i=${i#\"}
+    vbd_mode=`xenstore-read $i/mode`
+    vbd_disk=`xenstore-read $i/params`
+    vbd_type=`xenstore-read $i/type`
+    vbd_dev=`xenstore-read $i/dev`
+    if [ $vbd_type = "file" ]
+    then
+        vbd_type="tap:aio"
+    fi
+    if [ $j -ne 0 ]
+    then
+        echo -n "," >> /etc/xen/stubdoms/$domname-dm
+    fi
+    echo -n "'$vbd_type:$vbd_disk,$vbd_dev,$vbd_mode'" >> 
/etc/xen/stubdoms/$domname-dm
+    j=$(( $j + 1 ))
+done
+echo " ] " >> /etc/xen/stubdoms/$domname-dm
+echo -n "vif = [ " >> /etc/xen/stubdoms/$domname-dm
+j=0
+for i in `xenstore-ls /local/domain/$domid/device/vif | grep 'backend =' | awk 
'{print $3}'`
+do
+    i=${i%\"}
+    i=${i#\"}
+    vif_mac=`xenstore-read $i/mac`
+    if [ $j -ne 0 ]
+    then
+        echo -n "," >> /etc/xen/stubdoms/$domname-dm
+    fi
+    echo -n "'mac=$vif_mac'" >> /etc/xen/stubdoms/$domname-dm
+    j=$(( $j + 1 ))
+done
+echo " ] " >> /etc/xen/stubdoms/$domname-dm
+creation="xm create -c /etc/xen/stubdoms/$domname-dm target=$domid memory=32 
extra=\"$extra\""
 
 (while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
 #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to 
shut down ; read" &
diff -r df61fe72ac66 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Wed Apr 22 17:05:51 2009 +0100
+++ b/tools/python/xen/xend/image.py    Wed Apr 22 18:16:39 2009 +0100
@@ -729,7 +729,12 @@
 
         if not self.display :
             self.display = ''
-        self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
+        # Do not store sdl, opengl and serial related qemu cli options
+        self.vm.storeVm(("image/dmargs", " ".join([ x for x in self.dmargs
+                        if x != "-sdl"
+                        and x != "-disable-opengl"
+                        and x != "-serial"
+                        and x != "pty" ])),
                         ("image/device-model", self.device_model),
                         ("image/display", self.display))
         self.vm.permissionsVm("image/dmargs", { 'dom': self.vm.getDomid(), 
'read': True } )

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

<Prev in Thread] Current Thread [Next in Thread>