Package: xen-utils-4.1
Version: 4.1.3-4
Severity: important
Tags: patch

Bug presented in sid, with patch attached.
Similar bug is also present in stable and testing versions.


How to reproduce:

Install xen-utils-4.1 in a domU, and run:
  /etc/init.d/xen start

Expected result:
  xenstored running

(or to have any other easy way to get it running within a domU)


xenstored is not just something you need to run in a dom0, it can also
be useful in a domU.

Example of informations you can retrieve:
  # domid=`xenstore-read domid`
  # xenstore-ls /local/domain/$domid
  [...]


As some might not be aware of why else it might be usefull, here are
some presentation of what I'm using it for:

------------------------------------------------------------------------
It is also required to get backends within a specific VM, rather than a
dom0. Isn't it nice to have 2 domU able to have direct network
connection, rather than having to go through the dom0 bridge, that might
have a firewall to bypass (multiple copy, lag, ...)

Example of vif configuration, to get the backend in a vm :

  
'mac=00:16:3E:de:ad:01,backend=firewall,script=vif-bridge,vifname=sandbox,bridge=brmisc',

That require xen-utils to run in the domU named firewall. The script
vif-bridge will be launched there, expecting to get put in a bridge
'brmisc'. The interface will also have a nice name, instead of 'vifX.Y'.

Catch: it NEED to have xenstored running. I'd appreciate not to have to
patch debian init script each time I install a vm that is supposed to
receive backends.
------------------------------------------------------------------------


On the other hand, my dom0 is a debian/stable. So, when I checked if
debian/sid would run xenstore or not, I found an other bug that also
need to get fixed to have it work nicely.

xen-version (used by xen-dir) checks what hypervisor is running. Which
makes it search 4.0 directory (hypervisor from stable), though I have
xen 4.1 utils installed (sid).

Ugly patch attached, in case someone try to run a sid domU on a squeeze
dom0 with 4.0 hypervisor. (not expecting that part to get anywhere near
the repository)


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages xen-utils-4.1 depends on:
ii  e2fslibs          1.42.5-1
ii  libc6             2.13-37
ii  libgnutls26       2.12.20-2
ii  libncurses5       5.9-10
ii  libpci3           1:3.1.9-6
ii  libtinfo5         5.9-10
ii  libuuid1          2.20.1-5.2
ii  libxen-4.1        4.1.3-4
ii  libxenstore3.0    4.1.3-4
ii  python            2.7.3-3
ii  python2.7         2.7.3-5
ii  xen-utils-common  4.1.3-4
ii  zlib1g            1:1.2.7.dfsg-13

Versions of packages xen-utils-4.1 recommends:
ii  bridge-utils        1.5-6
pn  qemu-keymaps        <none>
pn  qemu-utils          <none>
pn  xen-hypervisor-4.1  <none>

Versions of packages xen-utils-4.1 suggests:
pn  xen-docs-4.1  <none>

-- no debconf information
diff -ur sid/etc/init.d/xen patched/etc/init.d/xen
--- sid/etc/init.d/xen	2012-05-22 10:22:34.000000000 +0200
+++ patched/etc/init.d/xen	2012-12-02 12:19:19.000000000 +0100
@@ -38,6 +38,8 @@
 XENSTORED="$ROOT"/bin/xenstored
 XENSTORED_PIDFILE="/var/run/xenstore.pid"
 
+ISDOM0=1
+
 modules_setup()
 {
 	modprobe xenfs 2>/dev/null
@@ -57,7 +59,10 @@
 capability_check()
 {
 	[ -e "/proc/xen/capabilities" ] || return 1
-	grep -q "control_d" /proc/xen/capabilities || return 1
+	grep -q "control_d" /proc/xen/capabilities || {
+		XENSTORED_ARGS="$XENSTORED_ARGS --no-domain-init"
+		ISDOM0=0
+	}
 	return 0
 }
 
@@ -186,7 +191,8 @@
 	start-stop-daemon --start --quiet --pidfile "$XENSTORED_PIDFILE" --exec "$XENSTORED" -- \
 		$XENSTORED_ARGS --pid-file="$XENSTORED_PIDFILE" \
 		|| return 2
-	xenstore-write "/local/domain/0/name" "Domain-0"
+	[ "$ISDOM0" = 1 ] &&
+		xenstore-write "/local/domain/0/name" "Domain-0"
 }
 
 case "$1" in
@@ -208,6 +214,10 @@
 		0|1) ;;
 		*) log_end_msg 1; exit ;;
 	esac
+	case "$ISDOM0" in
+		1) ;;
+		*) log_end_msg 255; exit ;;
+	esac
 	xenconsoled_start
 	case "$?" in
 		0|1) ;;
@@ -228,6 +238,7 @@
 	esac
 	log_daemon_msg "Stopping $DESC"
 	ret=0
+	[ "$ISDOM0" = 1 ] &&
 	xend_stop
 	case "$?" in
 		0|1) ;;
@@ -248,6 +259,7 @@
 	esac
 	log_daemon_msg "Restarting $DESC"
 	ret=0
+	[ "$ISDOM0" = 1 ] &&
 	xend_restart
 	case "$?" in
 		0|1) ;;
diff -ur sid/usr/lib/xen-common/bin/xen-version patched/usr/lib/xen-common/bin/xen-version
--- sid/usr/lib/xen-common/bin/xen-version	2012-11-20 16:01:16.000000000 +0100
+++ patched/usr/lib/xen-common/bin/xen-version	2012-12-02 11:59:58.000000000 +0100
@@ -28,4 +28,5 @@
     error "Can't find hypervisor information in sysfs!"
 fi
 
-echo "$VERSION"
+#echo "$VERSION"
+echo 4.1

Reply via email to