make xs_domain_open fallback to /proc/xen/xenbus if unix domain socket fails because xenstore is in a stubdomain
PATCH 9/24 make xs_domain_open fallback to /proc/xen/xenbus if unix domain socket fails because xenstore is in a stubdomain
If xenstored is running in a stub domain clients won't be able to open a unix domain socket to it, but will be able to access it via xenbus.
To handle this situation this patch makes xs_daemon_open() fall back to xs_domain_open() - which tries to open a connection via xenbus - if it cannot open a unix domain socket.
Depends on linux xenbus commands whitelist patch. Enhanced by linux xenbus aborting read/write if not ready, part of my big linux xenbus patch.
I wasn't so sure what to do about the read-only connection, but I made it fall back to the non-read-only socket/device if the read-only socket isn't available.
---
tools/xenstore/xs.c +15 -2
@@ -210,12 +210,25 @@struct xs_handle *xs_daemon_open (void ) { -return get_handle (xs_daemon_socket ()); +struct xs_handle *xsh; + + xsh =get_handle (xs_daemon_socket ()); +if (xsh !=NULL ) +return xsh; + +return xs_domain_open (); }struct xs_handle *xs_daemon_open_readonly (void ) { -return get_handle (xs_daemon_socket_ro ()); +struct xs_handle *xsh; + + xsh =get_handle (xs_daemon_socket_ro ()); +if (xsh !=NULL ) +return xsh; + +/* fall back to a read-write connection */ +return xs_daemon_open (); }struct xs_handle *xs_domain_open (void )
tools/xenstore/xs.h +1 -0
@@ -37,6 +37,7 @@/* Connect to the xs daemon (readonly for non-root clients). * Returns a handle or NULL. +* Note: this may fall back to a read/write connection. */ struct xs_handle *xs_daemon_open_readonly (void );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel