[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: libxl_ctx_init checks for xenstored pid file
# HG changeset patch # User Kamala Narasimhan <kamala.narasimhan@xxxxxxxxx> # Date 1295974787 0 # Node ID eefb8e971be53eb0bd9f1d7337141866d9adbd1d # Parent b5579db3dabf032714cbb59b2413c3dc276ba9e8 libxl: libxl_ctx_init checks for xenstored pid file This is a proxy for whether xenstored is running. Otherwise the failure modes are unfortunate (hangs, or mysterious error messages). If and when we have a stubdom xenstored this will need to be revisited, if not before. Signed-off-by: Kamala Narasimhan <kamala.narasimhan@xxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl.c | 8 ++++++++ tools/libxl/libxl_internal.h | 1 + 2 files changed, 9 insertions(+) diff -r b5579db3dabf -r eefb8e971be5 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Tue Jan 25 16:42:00 2011 +0000 +++ b/tools/libxl/libxl.c Tue Jan 25 16:59:47 2011 +0000 @@ -40,11 +40,19 @@ int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger *lg) { + struct stat stat_buf; + if (version != LIBXL_VERSION) return ERROR_VERSION; memset(ctx, 0, sizeof(libxl_ctx)); ctx->lg = lg; memset(&ctx->version_info, 0, sizeof(libxl_version_info)); + + if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n" + "failed to stat %s", XENSTORE_PID_FILE); + return ERROR_FAIL; + } ctx->xch = xc_interface_open(lg,lg,0); if (!ctx->xch) { diff -r b5579db3dabf -r eefb8e971be5 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Tue Jan 25 16:42:00 2011 +0000 +++ b/tools/libxl/libxl_internal.h Tue Jan 25 16:59:47 2011 +0000 @@ -110,6 +110,7 @@ typedef struct { #define AUTO_PHP_SLOT 0x100 #define SYSFS_PCI_DEV "/sys/bus/pci/devices" #define SYSFS_PCIBACK_DRIVER "/sys/bus/pci/drivers/pciback" +#define XENSTORE_PID_FILE "/var/run/xenstore.pid" #define PROC_PCI_NUM_RESOURCES 7 #define PCI_BAR_IO 0x01 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |