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] xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" o

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on cmdline
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Tue, 14 Dec 2010 16:58:05 +0000
Delivery-date: Tue, 14 Dec 2010 08:59:39 -0800
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
I have just applied the change below, which I think will help unbreak
the tests.

# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1292345814 0
# Node ID f46d49257da5b0d6c7042c9539d40372c0ddf1a3
# Parent  618ba64260faf45e6ec391582099d7388f013e81
xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on tools' cmdline

The "-s" option to xenstore-ls is used by the xencommons startup
script to check whether xenstored is already running, before starting
it.

Since 22498:a40455ae9ad3, "-s" has been a no-op, and libxenstore will
always fall back to using xenbus.  The combined effect is that the
xencommons script deadlocks: xenstore-ls hangs waiting for xenstored,
which isn't started by xencommons because xencommons is waiting for
xenstore-ls.

In this patch, we:
 * Introduce a new XS_OPEN_SOCKETONLY flag which disables the
   fallback behaviour;
 * Make the xenstore command line tools use the new xs_open call
   rather than the old, deprecated xs_open_* calls (which are
   now identical).
 * Plumb the xenstore command line tools "-s" option to set the
   XS_OPEN_SOCKETONLY flag.
 * Change the type of the XS_OPEN_* flags so that they naturally have
   type unsigned long.

The "-s" option to xenstore-ls et al, and the XS_OPEN_SOCKETONLY flag,
are intended for use by toolstack infrastructure and should not
normally be used by higher-level code.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 618ba64260fa -r f46d49257da5 tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c  Tue Dec 14 09:54:10 2010 +0000
+++ b/tools/xenstore/xenstore_client.c  Tue Dec 14 16:56:54 2010 +0000
@@ -633,9 +633,8 @@ main(int argc, char **argv)
            max_width = ws.ws_col - 2;
     }
 
-    xsh = socket ? xs_daemon_open() : xs_domain_open();
-    if (xsh == NULL)
-       err(1, socket ? "xs_daemon_open" : "xs_domain_open");
+    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
+    if (xsh == NULL) err(1, "xs_open");
 
 again:
     if (transaction) {
diff -r 618ba64260fa -r f46d49257da5 tools/xenstore/xs.c
--- a/tools/xenstore/xs.c       Tue Dec 14 09:54:10 2010 +0000
+++ b/tools/xenstore/xs.c       Tue Dec 14 16:56:54 2010 +0000
@@ -262,7 +262,7 @@ struct xs_handle *xs_open(unsigned long 
        else
                xsh = get_handle(xs_daemon_socket(), flags);
 
-       if (!xsh)
+       if (!xsh && !(flags & XS_OPEN_SOCKETONLY))
                xsh = get_handle(xs_domain_dev(), flags);
 
        return xsh;
diff -r 618ba64260fa -r f46d49257da5 tools/xenstore/xs.h
--- a/tools/xenstore/xs.h       Tue Dec 14 09:54:10 2010 +0000
+++ b/tools/xenstore/xs.h       Tue Dec 14 16:56:54 2010 +0000
@@ -24,7 +24,8 @@
 
 #define XBT_NULL 0
 
-#define XS_OPEN_READONLY       1<<0
+#define XS_OPEN_READONLY       1UL<<0
+#define XS_OPEN_SOCKETONLY      1UL<<1
 
 struct xs_handle;
 typedef uint32_t xs_transaction_t;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xenstore: new XS_OPEN_SOCKETONLY flag; honour "-s" on cmdline, Ian Jackson <=