* [PATCH 01 of 15 v5] hotplug/block: get the type of block device from file path (NetBSD)
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 02 of 15 v5] libxl: add support for image files for NetBSD Roger Pau Monne
` (14 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317386335 -7200
# Node ID 8e129474fc0ac87623ba814ea865326d45cb8436
# Parent 7ca56cca09ade16645fb4806be2c5b2b0bc3332b
hotplug/block: get the type of block device from file path (NetBSD)
Guess the type of block device to attach based on the file name
present in xenstore, since new Xen versions don't make a difference
between a block device or an image.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 7ca56cca09ad -r 8e129474fc0a tools/hotplug/NetBSD/block
--- a/tools/hotplug/NetBSD/block Mon Dec 12 17:59:43 2011 +0000
+++ b/tools/hotplug/NetBSD/block Fri Sep 30 14:38:55 2011 +0200
@@ -19,9 +19,14 @@ error() {
xpath=$1
xstatus=$2
-xtype=$(xenstore-read "$xpath/type")
xparams=$(xenstore-read "$xpath/params")
+if [ -f $xparams ]; then
+ xtype="file"
+else
+ xtype="phy"
+fi
+
case $xstatus in
6)
# device removed
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 02 of 15 v5] libxl: add support for image files for NetBSD
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
2011-12-15 15:07 ` [PATCH 01 of 15 v5] hotplug/block: get the type of block device from file path (NetBSD) Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 03 of 15 v5] libxl: add libxl__forkexec function to libxl_exec Roger Pau Monne
` (13 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317386335 -7200
# Node ID 1d1fc97535c2790731e7afbc4c891f7ef6167983
# Parent 8e129474fc0ac87623ba814ea865326d45cb8436
libxl: add support for image files for NetBSD
Created a helper function to detect if the OS is capable of using
image files as phy backends. Create two OS specific files, and
changed the Makefile to choose the correct one at compile time.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 8e129474fc0a -r 1d1fc97535c2 tools/libxl/Makefile
--- a/tools/libxl/Makefile Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/Makefile Fri Sep 30 14:38:55 2011 +0200
@@ -33,6 +33,15 @@ endif
LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
+ifeq ($(CONFIG_NetBSD),y)
+LIBXL_OBJS-y += libxl_netbsd.o
+else ifeq ($(CONFIG_Linux),y)
+LIBXL_OBJS-y += libxl_linux.o
+else
+$(error Your Operating System is not supported by libxenlight, \
+please check libxl_linux.c and libxl_netbsd.c to see how to get it ported)
+endif
+
LIBXL_LIBS += -lyajl
LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
diff -r 8e129474fc0a -r 1d1fc97535c2 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_device.c Fri Sep 30 14:38:55 2011 +0200
@@ -137,15 +137,14 @@ static int disk_try_backend(disk_try_bac
a->disk->format == LIBXL_DISK_FORMAT_EMPTY)) {
goto bad_format;
}
- if (a->disk->format != LIBXL_DISK_FORMAT_EMPTY &&
- !S_ISBLK(a->stab.st_mode)) {
- LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
- " unsuitable as phys path not a block device",
- a->disk->vdev);
- return 0;
- }
- return backend;
+ if (libxl__try_phy_backend(a->stab.st_mode))
+ return backend;
+
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
+ " unsuitable as phys path not a block device",
+ a->disk->vdev);
+ return 0;
case LIBXL_DISK_BACKEND_TAP:
if (!libxl__blktap_enabled(a->gc)) {
diff -r 8e129474fc0a -r 1d1fc97535c2 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_internal.h Fri Sep 30 14:38:55 2011 +0200
@@ -271,6 +271,15 @@ _hidden int libxl__device_destroy(libxl_
_hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
_hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
+/*
+ * libxl__try_phy_backend - Check if there's support for the passed
+ * type of file using the PHY backend
+ * st_mode: mode_t of the file, as returned by stat function
+ *
+ * Returns 0 on success, and < 0 on error.
+ */
+_hidden int libxl__try_phy_backend(mode_t st_mode);
+
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
diff -r 8e129474fc0a -r 1d1fc97535c2 tools/libxl/libxl_linux.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_linux.c Fri Sep 30 14:38:55 2011 +0200
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2011
+ * Author Roger Pau Monne <roger.pau@entel.upc.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <sys/stat.h>
+
+#include "libxl_internal.h"
+
+int libxl__try_phy_backend(mode_t st_mode)
+{
+ if (!S_ISBLK(st_mode)) {
+ return 0;
+ }
+
+ return 1;
+}
diff -r 8e129474fc0a -r 1d1fc97535c2 tools/libxl/libxl_netbsd.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_netbsd.c Fri Sep 30 14:38:55 2011 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011
+ * Author Roger Pau Monne <roger.pau@entel.upc.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <sys/stat.h>
+
+#include "libxl_internal.h"
+
+int libxl__try_phy_backend(mode_t st_mode)
+{
+ if (S_ISREG(st_mode) || S_ISBLK(st_mode))
+ return 1;
+
+ return 0;
+}
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 03 of 15 v5] libxl: add libxl__forkexec function to libxl_exec
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
2011-12-15 15:07 ` [PATCH 01 of 15 v5] hotplug/block: get the type of block device from file path (NetBSD) Roger Pau Monne
2011-12-15 15:07 ` [PATCH 02 of 15 v5] libxl: add support for image files for NetBSD Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 04 of 15 v5] libxl: introduce libxl__wait_for_device_state Roger Pau Monne
` (12 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323864490 -3600
# Node ID 912b900aa74f6ce2083a48b42de19abdd6c76337
# Parent 1d1fc97535c2790731e7afbc4c891f7ef6167983
libxl: add libxl__forkexec function to libxl_exec
Add a new function to libxl_exec that performs a fork and executes
the passed arguments using libxl__exec.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 1d1fc97535c2 -r 912b900aa74f tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_exec.c Wed Dec 14 13:08:10 2011 +0100
@@ -449,6 +449,42 @@ int libxl__spawn_check(libxl__gc *gc, li
return ERROR_FAIL;
}
+int libxl__forkexec(libxl__gc *gc, int stdinfd, int stdoutfd,
+ int stderrfd, const char *arg0, char **args,
+ const char *what)
+{
+ libxl_ctx *ctx = libxl__gc_owner(gc);
+ int status;
+ int rc = 0;
+ pid_t pid = fork();
+
+ switch (pid) {
+ case -1:
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fork failed\n");
+ rc = -1;
+ break;
+ case 0:
+ libxl__exec(stdinfd, stdoutfd, stderrfd, arg0, args);
+ /* libxl__exec never returns */
+ default:
+ while (waitpid(pid, &status, 0) < 0) {
+ if (errno != EINTR) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "waitpid failed for %s\n",
+ what);
+ rc = -1;
+ break;
+ }
+ }
+ if (status)
+ libxl_report_child_exitstatus(ctx, LIBXL__LOG_ERROR,
+ what, pid, status);
+ rc = status;
+ break;
+ }
+ return rc;
+}
+
/*
* Local variables:
* mode: C
diff -r 1d1fc97535c2 -r 912b900aa74f tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_internal.h Wed Dec 14 13:08:10 2011 +0100
@@ -419,6 +419,20 @@ _hidden int libxl__spawn_check(libxl__gc
_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd,
const char *arg0, char **args); // logs errors, never returns
+/*
+ * libxl__forkexec - Executes a file synchronously
+ * argv0: file name associated with the file being executed.
+ * args: list of arguments. See execvp(3) man page for more info.
+ *
+ * Returns -1 if the execution fails or the exit status, as reported
+ * by waitpid, on success.
+ *
+ * Logs errors.
+ */
+_hidden int libxl__forkexec(libxl__gc *gc, int stdinfd, int stdoutfd,
+ int stderrfd, const char *arg0, char **args,
+ const char *what);
+
/* from xl_create */
_hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid);
_hidden int libxl__domain_build(libxl__gc *gc,
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 04 of 15 v5] libxl: introduce libxl__wait_for_device_state
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (2 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 03 of 15 v5] libxl: add libxl__forkexec function to libxl_exec Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 05 of 15 v5] libxl: wait for devices to initialize upon addition to the domain Roger Pau Monne
` (11 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323864490 -3600
# Node ID 873942d7eb6462984202e82d428e28fe9522924f
# Parent 912b900aa74f6ce2083a48b42de19abdd6c76337
libxl: introduce libxl__wait_for_device_state
This is a generic function, that waits for xs watches to reach a
certain state and then executes the passed helper function. Removed
wait_for_dev_destroy and used this new function instead. This
function will also be used by future patches that need to wait for
the initialization of devices before executing hotplug scripts.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 912b900aa74f -r 873942d7eb64 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_device.c Wed Dec 14 13:08:10 2011 +0100
@@ -369,7 +369,9 @@ int libxl__device_disk_dev_number(const
* Returns 0 if a device is removed, ERROR_* if an error
* or timeout occurred.
*/
-static int wait_for_dev_destroy(libxl__gc *gc, struct timeval *tv)
+int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
+ XenbusState state,
+ libxl__device_state_handler handler)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
int nfds, rc;
@@ -394,17 +396,14 @@ start:
default:
l1 = xs_read_watch(ctx->xsh, &n);
if (l1 != NULL) {
- char *state = libxl__xs_read(gc, XBT_NULL,
+ char *sstate = libxl__xs_read(gc, XBT_NULL,
l1[XS_WATCH_PATH]);
- if (!state || atoi(state) == 6) {
- xs_unwatch(ctx->xsh, l1[0], l1[1]);
- xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
- LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
- "Destroyed device backend at %s",
- l1[XS_WATCH_TOKEN]);
- rc = 0;
+ if (!sstate || atoi(sstate) == state) {
+ /* Call handler function if present */
+ if (handler)
+ rc = handler(gc, l1, sstate);
} else {
- /* State is not "disconnected", continue waiting... */
+ /* State is different than expected, continue waiting... */
goto start;
}
free(l1);
@@ -417,6 +416,23 @@ start:
}
/*
+ * Handler function for device destruction to be passed to
+ * libxl__wait_for_device_state
+ */
+static int destroy_device(libxl__gc *gc, char **l1, char *state)
+{
+ libxl_ctx *ctx = libxl__gc_owner(gc);
+
+ xs_unwatch(ctx->xsh, l1[0], l1[1]);
+ xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
+ "Destroyed device backend at %s",
+ l1[XS_WATCH_TOKEN]);
+
+ return 0;
+}
+
+/*
* Returns 0 (device already destroyed) or 1 (caller must
* wait_for_dev_destroy) on success, ERROR_* on fail.
*/
@@ -457,7 +473,8 @@ retry_transaction:
struct timeval tv;
tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
tv.tv_usec = 0;
- rc = wait_for_dev_destroy(gc, &tv);
+ rc = libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
+ destroy_device);
if (rc < 0) /* an error or timeout occurred, clear watches */
xs_unwatch(ctx->xsh, state_path, be_path);
xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
@@ -565,7 +582,8 @@ int libxl__devices_destroy(libxl__gc *gc
tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
tv.tv_usec = 0;
while (n_watches > 0) {
- if (wait_for_dev_destroy(gc, &tv) < 0) {
+ if (libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
+ destroy_device) < 0) {
/* function returned ERROR_* */
break;
} else {
diff -r 912b900aa74f -r 873942d7eb64 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_internal.h Wed Dec 14 13:08:10 2011 +0100
@@ -24,11 +24,14 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#include <sys/time.h>
#include <xs.h>
#include <xenctrl.h>
#include "xentoollog.h"
+#include <xen/io/xenbus.h>
+
#include "libxl.h"
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
@@ -271,6 +274,31 @@ _hidden int libxl__device_destroy(libxl_
_hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
_hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
+/* Handler for the libxl__wait_for_device_state callback */
+/*
+ * libxl__device_state_handler - Handler for the libxl__wait_for_device_state
+ * gc: allocation pool
+ * l1: array containing the path and token
+ * state: string that contains the state of the device
+ *
+ * Returns 0 on success, and < 0 on error.
+ */
+typedef int libxl__device_state_handler(libxl__gc *gc, char **l1, char *state);
+
+/*
+ * libxl__wait_for_device_state - waits a given time for a device to
+ * reach a given state
+ * gc: allocation pool
+ * tv: timeval struct containing the maximum time to wait
+ * state: state to wait for (check xen/io/xenbus.h)
+ * handler: callback function to execute when state is reached
+ *
+ * Returns 0 on success, and < 0 on error.
+ */
+_hidden int libxl__wait_for_device_state(libxl__gc *gc, struct timeval *tv,
+ XenbusState state,
+ libxl__device_state_handler handler);
+
/*
* libxl__try_phy_backend - Check if there's support for the passed
* type of file using the PHY backend
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 05 of 15 v5] libxl: wait for devices to initialize upon addition to the domain
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (3 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 04 of 15 v5] libxl: introduce libxl__wait_for_device_state Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 06 of 15 v5] hotplug NetBSD: pass an action instead of a state to hotplug scripts Roger Pau Monne
` (10 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323864490 -3600
# Node ID 08a9f86b79dfe5db150392c916a72bafc3f05137
# Parent 873942d7eb6462984202e82d428e28fe9522924f
libxl: wait for devices to initialize upon addition to the domain.
Block waiting for devices to initialize (switch to state 2). This is
necessary because we need to call the hotplug scripts when state is
2, otherwise the execution fails. Make use of the newly introduced
function libxl__wait_for_device_state.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 873942d7eb64 -r 08a9f86b79df tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl.c Wed Dec 14 13:08:10 2011 +0100
@@ -976,6 +976,8 @@ int libxl_device_disk_add(libxl_ctx *ctx
flexarray_t *front;
flexarray_t *back;
char *dev;
+ char *be_path, *state_path, *state;
+ struct timeval tv;
libxl__device device;
int major, minor, rc;
@@ -1080,6 +1082,23 @@ int libxl_device_disk_add(libxl_ctx *ctx
libxl__xs_kvs_of_flexarray(gc, back, back->count),
libxl__xs_kvs_of_flexarray(gc, front, front->count));
+ be_path = libxl__device_backend_path(gc, &device);
+ state_path = libxl__sprintf(gc, "%s/state", be_path);
+ state = libxl__xs_read(gc, XBT_NULL, state_path);
+
+ if (atoi(state) != XenbusStateInitWait) {
+ xs_watch(ctx->xsh, state_path, be_path);
+ tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
+ tv.tv_usec = 0;
+ rc = libxl__wait_for_device_state(gc, &tv, XenbusStateInitWait, NULL);
+ xs_unwatch(ctx->xsh, state_path, be_path);
+ if (rc < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "unable to initialize disk device: %s\n",
+ disk->pdev_path);
+ goto out_free;
+ }
+ }
rc = 0;
out_free:
@@ -1455,6 +1474,8 @@ int libxl_device_nic_add(libxl_ctx *ctx,
flexarray_t *back;
libxl__device device;
char *dompath, **l;
+ char *be_path, *state_path, *state;
+ struct timeval tv;
unsigned int nb, rc;
front = flexarray_make(16, 1);
@@ -1523,8 +1544,25 @@ int libxl_device_nic_add(libxl_ctx *ctx,
libxl__xs_kvs_of_flexarray(gc, back, back->count),
libxl__xs_kvs_of_flexarray(gc, front, front->count));
- /* FIXME: wait for plug */
+ be_path = libxl__device_backend_path(gc, &device);
+ state_path = libxl__sprintf(gc, "%s/state", be_path);
+ state = libxl__xs_read(gc, XBT_NULL, state_path);
+
+ if (atoi(state) != XenbusStateInitWait) {
+ xs_watch(ctx->xsh, state_path, be_path);
+ tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
+ tv.tv_usec = 0;
+ rc = libxl__wait_for_device_state(gc, &tv, XenbusStateInitWait, NULL);
+ xs_unwatch(ctx->xsh, state_path, be_path);
+ if (rc < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "unable to initialize nic device: %s\n",
+ nic->ifname);
+ goto out_free;
+ }
+ }
rc = 0;
+
out_free:
flexarray_free(back);
flexarray_free(front);
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 06 of 15 v5] hotplug NetBSD: pass an action instead of a state to hotplug scripts
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (4 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 05 of 15 v5] libxl: wait for devices to initialize upon addition to the domain Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 07 of 15 v5] libxl: execute hotplug scripts directly from libxl Roger Pau Monne
` (9 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323864490 -3600
# Node ID 7b68b9415745c8bff5d0148bbf3953f6f083e655
# Parent 08a9f86b79dfe5db150392c916a72bafc3f05137
hotplug NetBSD: pass an action instead of a state to hotplug scripts
change second parameter of NetBSD hotplug scripts to take an action
(CONNECT/DISCONNECT) instead of a xenbus state. This patch also
changes the behaviour of xenbackend to pass an action instead of a
state.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/block
--- a/tools/hotplug/NetBSD/block Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/block Wed Dec 14 13:08:10 2011 +0100
@@ -18,7 +18,7 @@ error() {
xpath=$1
-xstatus=$2
+xaction=$2
xparams=$(xenstore-read "$xpath/params")
if [ -f $xparams ]; then
@@ -27,8 +27,8 @@ else
xtype="phy"
fi
-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
case $xtype in
file)
@@ -46,7 +46,7 @@ 6)
xenstore-rm $xpath
exit 0
;;
-2)
+1)
case $xtype in
file)
# Store the list of available vnd(4) devices in
diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/vif-bridge
--- a/tools/hotplug/NetBSD/vif-bridge Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/vif-bridge Wed Dec 14 13:08:10 2011 +0100
@@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P
export PATH
xpath=$1
-xstatus=$2
+xaction=$2
-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
xenstore-rm $xpath
exit 0
;;
-2)
+1)
xbridge=$(xenstore-read "$xpath/bridge")
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/vif-ip
--- a/tools/hotplug/NetBSD/vif-ip Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/vif-ip Wed Dec 14 13:08:10 2011 +0100
@@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P
export PATH
xpath=$1
-xstatus=$2
+xaction=$2
-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
xenstore-rm $xpath
exit 0
;;
-2)
+1)
xip=$(xenstore-read "$xpath/ip")
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
diff -r 08a9f86b79df -r 7b68b9415745 tools/xenbackendd/xenbackendd.c
--- a/tools/xenbackendd/xenbackendd.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/xenbackendd/xenbackendd.c Wed Dec 14 13:08:10 2011 +0100
@@ -34,6 +34,9 @@
#define DEVTYPE_VIF 1
#define DEVTYPE_VBD 2
+#define CONNECT "1"
+#define DISCONNECT "2"
+
#define DOMAIN_PATH "/local/domain/0"
#ifndef XEN_SCRIPT_DIR
@@ -149,6 +152,7 @@ main(int argc, char * const argv[])
unsigned int num;
char *s;
int state;
+ char *action;
char *sstate;
char *p;
char buf[80];
@@ -297,11 +301,13 @@ main(int argc, char * const argv[])
strerror(errno));
goto next2;
}
- doexec(s, vec[XS_WATCH_PATH], sstate);
+ action = (state == 6 ? DISCONNECT : CONNECT);
+ doexec(s, vec[XS_WATCH_PATH], action);
break;
case DEVTYPE_VBD:
- doexec(vbd_script, vec[XS_WATCH_PATH], sstate);
+ action = (state == 6 ? DISCONNECT : CONNECT);
+ doexec(vbd_script, vec[XS_WATCH_PATH], action);
break;
default:
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 07 of 15 v5] libxl: execute hotplug scripts directly from libxl
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (5 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 06 of 15 v5] hotplug NetBSD: pass an action instead of a state to hotplug scripts Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 08 of 15 v5] hotplug: remove debug messages from NetBSD hotplug scripts Roger Pau Monne
` (8 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317386335 -7200
# Node ID 1cdbc9b053598abd01cdd039118c07609deeff1a
# Parent 7b68b9415745c8bff5d0148bbf3953f6f083e655
libxl: execute hotplug scripts directly from libxl.
Added the necessary handlers to execute hotplug scripts when necessary
from libxl. Split NetBSD and Linux hotplug calls into two separate
files, because parameters for hotplug scripts are different. Linux
has empty functions, since the calling of hotplug scripts is still
done using udev.
Hotplug scripts in NetBSD are in charge of adding the virtual DomU
network interface to the desired bridge and also mount the vnd device
to use virtual images as block devices. The following scripts are
currently implemented:
* block: executed when a vbd is used, is in charge mounting the
virtual image to the vnd device and setting the state of xenstore
to 4 (connected). When using a physical partition, the script only
sets the state to 4.
* vif-bridge: adds the virtual DomU interface to the desired bridge.
* vif-ip: configures the physical network interface assigned to the
DomU.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 7b68b9415745 -r 1cdbc9b05359 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl.c Fri Sep 30 14:38:55 2011 +0200
@@ -1023,6 +1023,11 @@ int libxl_device_disk_add(libxl_ctx *ctx
flexarray_append(back, "params");
flexarray_append(back, dev);
+ flexarray_append(back, "script");
+ flexarray_append(back, libxl__sprintf(gc, "%s/%s",
+ libxl_xen_script_dir_path(),
+ "block"));
+
assert(device.backend_kind == LIBXL__DEVICE_KIND_VBD);
break;
case LIBXL_DISK_BACKEND_TAP:
@@ -1099,6 +1104,16 @@ int libxl_device_disk_add(libxl_ctx *ctx
goto out_free;
}
}
+
+ /* Call hotplug scripts to attach device */
+ if (libxl__device_hotplug(gc, &device, CONNECT) < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "unable to execute hotplug script for disk: %s\n",
+ disk->pdev_path);
+ rc = -1;
+ goto out_free;
+ }
+
rc = 0;
out_free:
@@ -1561,6 +1576,16 @@ int libxl_device_nic_add(libxl_ctx *ctx,
goto out_free;
}
}
+
+ /* Call hotplug scripts to attach device */
+ if (libxl__device_hotplug(gc, &device, CONNECT) < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "unable to execute hotplug script for nic: %s\n",
+ nic->ifname);
+ rc = -1;
+ goto out_free;
+ }
+
rc = 0;
out_free:
diff -r 7b68b9415745 -r 1cdbc9b05359 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_device.c Fri Sep 30 14:38:55 2011 +0200
@@ -448,6 +448,7 @@ int libxl__device_remove(libxl__gc *gc,
if (!state)
goto out;
if (atoi(state) != 4) {
+ libxl__device_hotplug(gc, dev, DISCONNECT);
libxl__device_destroy_tapdisk(gc, be_path);
xs_rm(ctx->xsh, XBT_NULL, be_path);
goto out;
@@ -492,6 +493,12 @@ int libxl__device_destroy(libxl__gc *gc,
char *be_path = libxl__device_backend_path(gc, dev);
char *fe_path = libxl__device_frontend_path(gc, dev);
+ /*
+ * Run hotplug scripts, which will probably not be able to
+ * execute successfully since the device may still be plugged
+ */
+ libxl__device_hotplug(gc, dev, DISCONNECT);
+
xs_rm(ctx->xsh, XBT_NULL, be_path);
xs_rm(ctx->xsh, XBT_NULL, fe_path);
diff -r 7b68b9415745 -r 1cdbc9b05359 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_internal.h Fri Sep 30 14:38:55 2011 +0200
@@ -308,6 +308,25 @@ _hidden int libxl__wait_for_device_state
*/
_hidden int libxl__try_phy_backend(mode_t st_mode);
+/* hotplug functions */
+
+/* Action to pass to hotplug caller functions */
+typedef enum {
+ CONNECT = 1,
+ DISCONNECT = 2
+} libxl__hotplug_action;
+
+/*
+ * libxl__device_hotplug - generic function to execute hotplug scripts
+ * gc: allocation pool
+ * dev: reference to the device that executes the hotplug scripts
+ * action: action to execute
+ *
+ * Returns 0 on success, and < 0 on error.
+ */
+_hidden int libxl__device_hotplug(libxl__gc *gc, libxl__device *dev,
+ libxl__hotplug_action action);
+
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
diff -r 7b68b9415745 -r 1cdbc9b05359 tools/libxl/libxl_linux.c
--- a/tools/libxl/libxl_linux.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_linux.c Fri Sep 30 14:38:55 2011 +0200
@@ -25,3 +25,11 @@ int libxl__try_phy_backend(mode_t st_mod
return 1;
}
+
+/* Hotplug scripts caller functions */
+
+int libxl_device_hotplug(libxl__gc *gc, libxl__device *dev,
+ libxl__hotplug_action action)
+{
+ return 0;
+}
diff -r 7b68b9415745 -r 1cdbc9b05359 tools/libxl/libxl_netbsd.c
--- a/tools/libxl/libxl_netbsd.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/libxl/libxl_netbsd.c Fri Sep 30 14:38:55 2011 +0200
@@ -14,6 +14,7 @@
*/
#include <sys/stat.h>
+#include <sys/wait.h>
#include "libxl_internal.h"
@@ -24,3 +25,56 @@ int libxl__try_phy_backend(mode_t st_mod
return 0;
}
+
+/* Hotplug scripts call function */
+
+int libxl__device_hotplug(libxl__gc *gc, libxl__device *dev,
+ libxl__hotplug_action action)
+{
+ libxl_ctx *ctx = libxl__gc_owner(gc);
+ char *be_path = libxl__device_backend_path(gc, dev);
+ char *script, *what;
+ char **args;
+ int status, nr = 0;
+ int rc = -1;
+ flexarray_t *f_args;
+
+ if (dev->kind != LIBXL__DEVICE_KIND_VIF &&
+ dev->kind != LIBXL__DEVICE_KIND_VBD)
+ return 0;
+
+ script = libxl__xs_read(gc, XBT_NULL,
+ libxl__sprintf(gc, "%s/%s", be_path, "script"));
+ if (!script) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to read script from %s",
+ be_path);
+ return -1;
+ }
+
+ f_args = flexarray_make(4, 1);
+ if (!f_args)
+ return -1;
+
+ flexarray_set(f_args, nr++, script);
+ flexarray_set(f_args, nr++, be_path);
+ flexarray_set(f_args, nr++, libxl__sprintf(gc, "%d", action));
+ flexarray_set(f_args, nr++, NULL);
+
+ args = (char **) flexarray_contents(f_args);
+
+ what = libxl__sprintf(gc, "%s %s", args[0],
+ action == CONNECT ? "connect" : "disconnect");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
+ "Calling hotplug script: %s %s %s",
+ args[0], args[1], args[2]);
+ status = libxl__forkexec(gc, -1, -1, -1, args[0], args, what);
+ if (status) {
+ rc = -1;
+ goto out;
+ }
+ rc = 0;
+
+out:
+ free(args);
+ return rc;
+}
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 08 of 15 v5] hotplug: remove debug messages from NetBSD hotplug scripts
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (6 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 07 of 15 v5] libxl: execute hotplug scripts directly from libxl Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 09 of 15 v5] rc.d NetBSD: don't start xenbackendd by default, only when xend needs it Roger Pau Monne
` (7 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323865415 -3600
# Node ID a7e8713ee43f09b969e43fff0717c2e61e9c0213
# Parent 1cdbc9b053598abd01cdd039118c07609deeff1a
hotplug: remove debug messages from NetBSD hotplug scripts
Remove unecessary debug messages from NetBSD hotplug scripts, left
error messages only.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 1cdbc9b05359 -r a7e8713ee43f tools/hotplug/NetBSD/block
--- a/tools/hotplug/NetBSD/block Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/hotplug/NetBSD/block Wed Dec 14 13:23:35 2011 +0100
@@ -69,14 +69,12 @@ 1)
if [ "$status" = "free" ] && \
vnconfig /dev/${disk}d $xparams >/dev/null; then
device=/dev/${disk}d
- echo vnconfig /dev/${disk}d $xparams
break
fi
done
if [ x$device = x ] ; then
error "no available vnd device"
fi
- echo xenstore-write $xpath/vnd $device
xenstore-write $xpath/vnd $device
;;
phy)
@@ -84,9 +82,7 @@ 1)
;;
esac
physical_device=$(stat -f '%r' "$device")
- echo xenstore-write $xpath/physical-device $physical_device
xenstore-write $xpath/physical-device $physical_device
- echo xenstore-write $xpath/hotplug-status connected
xenstore-write $xpath/hotplug-status connected
exit 0
;;
diff -r 1cdbc9b05359 -r a7e8713ee43f tools/hotplug/NetBSD/vif-bridge
--- a/tools/hotplug/NetBSD/vif-bridge Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/hotplug/NetBSD/vif-bridge Wed Dec 14 13:23:35 2011 +0100
@@ -24,12 +24,9 @@ 1)
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
iface=$(xenstore-read "$xpath/vifname")
- echo ifconfig $iface up
ifconfig $iface up
brconfig $xbridge add $iface
- echo brconfig $xbridge add $iface
xenstore-write $xpath/hotplug-status connected
- echo xenstore-write $xpath/hotplug-status connected
exit 0
;;
*)
diff -r 1cdbc9b05359 -r a7e8713ee43f tools/hotplug/NetBSD/vif-ip
--- a/tools/hotplug/NetBSD/vif-ip Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/hotplug/NetBSD/vif-ip Wed Dec 14 13:23:35 2011 +0100
@@ -24,10 +24,8 @@ 1)
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
iface=$(xenstore-read "$xpath/vifname")
- echo ifconfig $iface $xip up
ifconfig $iface $xip up
xenstore-write $xpath/hotplug-status connected
- echo xenstore-write $xpath/hotplug-status connected
exit 0
;;
*)
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 09 of 15 v5] rc.d NetBSD: don't start xenbackendd by default, only when xend needs it
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (7 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 08 of 15 v5] hotplug: remove debug messages from NetBSD hotplug scripts Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 10 of 15 v5] NetBSD/xencommons: remove xend precmd folder creation Roger Pau Monne
` (6 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317386335 -7200
# Node ID 663e02a5360ce3d48ce732f9c40087e5ca4323d3
# Parent a7e8713ee43f09b969e43fff0717c2e61e9c0213
rc.d NetBSD: don't start xenbackendd by default, only when xend needs it.
With the move of hotplug scripts from xenbackendd to libxl
xenbackendd is no longer needed by libxl, only start it when xend is
started.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r a7e8713ee43f -r 663e02a5360c tools/hotplug/NetBSD/rc.d/xenbackendd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/hotplug/NetBSD/rc.d/xenbackendd Fri Sep 30 14:38:55 2011 +0200
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# PROVIDE: xenbackendd
+# REQUIRE: xencommons
+
+. /etc/rc.subr
+
+DIR=$(dirname "$0")
+. "${DIR}/xen-hotplugpath.sh"
+
+LD_LIBRARY_PATH="${LIBDIR}"
+export LD_LIBRARY_PATH PYTHONPATH
+PATH="${PATH}:${SBINDIR}"
+export PATH
+
+name="xenbackendd"
+rcvar=$name
+command="${SBINDIR}/xenbackendd"
+if [ -n "${XENBACKENDD_DEBUG}" ]; then
+ command_args="${XENBACKENDD_ARGS} -d"
+else
+ command_args="${XENBACKENDD_ARGS}"
+fi
+
+load_rc_config $name
+run_rc_command "$1"
+
diff -r a7e8713ee43f -r 663e02a5360c tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons Wed Dec 14 13:23:35 2011 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xencommons Fri Sep 30 14:38:55 2011 +0200
@@ -22,8 +22,6 @@ required_files="/kern/xen/privcmd"
XENSTORED_PIDFILE="/var/run/xenstored.pid"
XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
-XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
-#XENBACKENDD_DEBUG=1
#XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log"
#XENSTORED_TRACE="/var/log/xen/xenstore-trace.log"
@@ -46,7 +44,7 @@ xen_startcmd()
XENSTORED_ROOTDIR="/var/lib/xenstored"
fi
rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
- printf "Starting xenservices: xenstored, xenconsoled, xenbackendd."
+ printf "Starting xenservices: xenstored, xenconsoled."
XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
if [ -n "${XENSTORED_TRACE}" ]; then
XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log"
@@ -58,7 +56,7 @@ xen_startcmd()
sleep 1
done
else
- printf "Starting xenservices: xenconsoled, xenbackendd."
+ printf "Starting xenservices: xenconsoled."
fi
XENCONSOLED_ARGS=""
@@ -68,13 +66,6 @@ xen_startcmd()
${SBINDIR}/xenconsoled ${XENCONSOLED_ARGS}
- XENBACKENDD_ARGS=""
- if [ -n "${XENBACKENDD_DEBUG}" ]; then
- XENBACKENDD_ARGS="${XENBACKENDD_ARGS} -d"
- fi
-
- ${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
-
printf "\n"
printf "Setting domain 0 name.\n"
@@ -87,8 +78,6 @@ xen_stop()
printf "Stopping xencommons.\n"
printf "WARNING: Not stopping xenstored, as it cannot be restarted.\n"
- rc_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
- pids="$pids $rc_pid"
rc_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
pids="$pids $rc_pid"
@@ -108,17 +97,12 @@ xen_status()
pids="$pids $xenconsoled_pid"
fi
- xenbackend_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
- if test -n ${xenbackend_pid}; then
- pids="$pids $xenbackend_pid"
- fi
-
- if test -n "$xenbackend_pid" -a -n "$xenconsoled_pid" -a -n "$xenstored_pid";
+ if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
then
echo "xencommons are running as pids $pids."
return 0
fi
- if test -z "$xenbackend_pid" -a -z "$xenconsoled_pid" -a -z "$xenstored_pid";
+ if test -z "$xenconsoled_pid" -a -z "$xenstored_pid";
then
echo "xencommons are not running."
return 0
@@ -134,11 +118,6 @@ xen_status()
else
echo "xenconsoled is not running."
fi
- if test -n $xenbackend_pid; then
- echo "xenbackendd is running as pid $xenbackend_pid."
- else
- echo "xenbackendd is not running."
- fi
}
load_rc_config $name
diff -r a7e8713ee43f -r 663e02a5360c tools/hotplug/NetBSD/rc.d/xend
--- a/tools/hotplug/NetBSD/rc.d/xend Wed Dec 14 13:23:35 2011 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xend Fri Sep 30 14:38:55 2011 +0200
@@ -1,7 +1,7 @@
#!/bin/sh
#
# PROVIDE: xend
-# REQUIRE: xencommons
+# REQUIRE: xencommons xenbackendd
. /etc/rc.subr
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 10 of 15 v5] NetBSD/xencommons: remove xend precmd folder creation
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (8 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 09 of 15 v5] rc.d NetBSD: don't start xenbackendd by default, only when xend needs it Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 11 of 15 v5] libxl: fix incorrect log message in libxl_domain_destroy Roger Pau Monne
` (5 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939598 -3600
# Node ID 6a05eb37ecdd7122eb7ad7d0bea1879a7f1a3c6c
# Parent 663e02a5360ce3d48ce732f9c40087e5ca4323d3
NetBSD/xencommons: remove xend precmd folder creation
Since xend is not started by xencommons move the creation of the
necessary xend folders to xend init script.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 663e02a5360c -r 6a05eb37ecdd tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/hotplug/NetBSD/rc.d/xencommons Thu Dec 15 09:59:58 2011 +0100
@@ -27,8 +27,6 @@ XENCONSOLED_PIDFILE="/var/run/xenconsole
xen_precmd()
{
- mkdir -p /var/run/xend || exit 1
- mkdir -p /var/run/xend/boot || exit 1
mkdir -p /var/run/xenstored || exit 1
}
diff -r 663e02a5360c -r 6a05eb37ecdd tools/hotplug/NetBSD/rc.d/xend
--- a/tools/hotplug/NetBSD/rc.d/xend Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/hotplug/NetBSD/rc.d/xend Thu Dec 15 09:59:58 2011 +0100
@@ -15,10 +15,17 @@ export PATH
name="xend"
rcvar=$name
+start_precmd="xen_precmd"
command="${SBINDIR}/xend"
command_args="start"
command_interpreter=`head -n 1 ${command} | awk '{ print substr($0,3) }'`
sig_stop="SIGKILL"
+xen_precmd()
+{
+ mkdir -p /var/run/xend || exit 1
+ mkdir -p /var/run/xend/boot || exit 1
+}
+
load_rc_config $name
run_rc_command "$1"
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 11 of 15 v5] libxl: fix incorrect log message in libxl_domain_destroy
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (9 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 10 of 15 v5] NetBSD/xencommons: remove xend precmd folder creation Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 12 of 15 v5] libxl: remove frontend and execute hotplug scripts on domain destroy Roger Pau Monne
` (4 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939609 -3600
# Node ID f3d3a0a74f55f07616abc4bac95f82868b91fe9f
# Parent 6a05eb37ecdd7122eb7ad7d0bea1879a7f1a3c6c
libxl: fix incorrect log message in libxl_domain_destroy
Fix a log message that was referring to libxl_devices_dispose instead
of libxl__devices_destroy.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 6a05eb37ecdd -r f3d3a0a74f55 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Dec 15 09:59:58 2011 +0100
+++ b/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
@@ -773,7 +773,8 @@ int libxl_domain_destroy(libxl_ctx *ctx,
libxl__qmp_cleanup(gc, domid);
}
if (libxl__devices_destroy(gc, domid, force) < 0)
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_devices_dispose failed for %d", domid);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "libxl__devices_destroy failed for %d", domid);
vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/vm", dom_path));
if (vm_path)
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 12 of 15 v5] libxl: remove frontend and execute hotplug scripts on domain destroy
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (10 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 11 of 15 v5] libxl: fix incorrect log message in libxl_domain_destroy Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 13 of 15 v5] libxl: remove force parameter from libxl_domain_destroy Roger Pau Monne
` (3 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939609 -3600
# Node ID 7dbba8f9706d3a1ea777df23f1d40b2da951ef4a
# Parent f3d3a0a74f55f07616abc4bac95f82868b91fe9f
libxl: remove frontend and execute hotplug scripts on domain destroy
Removes frontend path on domain destruction and waits for devices to
be disconnected before executing hotplug scripts (call
libxl__device_remove to wait for detaching).
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r f3d3a0a74f55 -r 7dbba8f9706d tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl_device.c Thu Dec 15 10:00:09 2011 +0100
@@ -492,19 +492,17 @@ int libxl__device_destroy(libxl__gc *gc,
libxl_ctx *ctx = libxl__gc_owner(gc);
char *be_path = libxl__device_backend_path(gc, dev);
char *fe_path = libxl__device_frontend_path(gc, dev);
+ int rc;
- /*
- * Run hotplug scripts, which will probably not be able to
- * execute successfully since the device may still be plugged
- */
- libxl__device_hotplug(gc, dev, DISCONNECT);
+ xs_rm(ctx->xsh, XBT_NULL, fe_path);
+ /* Wait for backend status to disconnect */
+ rc = libxl__device_remove(gc, dev, 1);
xs_rm(ctx->xsh, XBT_NULL, be_path);
- xs_rm(ctx->xsh, XBT_NULL, fe_path);
libxl__device_destroy_tapdisk(gc, be_path);
- return 0;
+ return rc;
}
int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 13 of 15 v5] libxl: remove force parameter from libxl_domain_destroy
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (11 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 12 of 15 v5] libxl: remove frontend and execute hotplug scripts on domain destroy Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 14 of 15 v5] libxl: remove force parameter from libxl__devices_destroy Roger Pau Monne
` (2 subsequent siblings)
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939609 -3600
# Node ID 1beeb56e336aef8f95bd3dcead953feb6d383544
# Parent 7dbba8f9706d3a1ea777df23f1d40b2da951ef4a
libxl: remove force parameter from libxl_domain_destroy
Since a destroy is considered a forced shutdown, there's no point in
passing a force parameter. All the occurences of this function have
been replaced with the proper syntax.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 7dbba8f9706d -r 1beeb56e336a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
@@ -723,7 +723,7 @@ int libxl_event_get_disk_eject_info(libx
return 1;
}
-int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
+int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid)
{
GC_INIT(ctx);
libxl_dominfo dominfo;
@@ -772,7 +772,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
libxl__qmp_cleanup(gc, domid);
}
- if (libxl__devices_destroy(gc, domid, force) < 0)
+ if (libxl__devices_destroy(gc, domid, 1) < 0)
LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"libxl__devices_destroy failed for %d", domid);
diff -r 7dbba8f9706d -r 1beeb56e336a tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl.h Thu Dec 15 10:00:09 2011 +0100
@@ -269,7 +269,7 @@ int libxl_domain_suspend(libxl_ctx *ctx,
uint32_t domid, int fd);
int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid);
int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req);
-int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force);
+int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid);
int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, libxl_domain_create_info *info, const char *name_suffix, libxl_uuid new_uuid);
/* get max. number of cpus supported by hypervisor */
diff -r 7dbba8f9706d -r 1beeb56e336a tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl_create.c Thu Dec 15 10:00:09 2011 +0100
@@ -662,7 +662,7 @@ static int do_domain_create(libxl__gc *g
error_out:
if (domid)
- libxl_domain_destroy(ctx, domid, 0);
+ libxl_domain_destroy(ctx, domid);
return ret;
}
diff -r 7dbba8f9706d -r 1beeb56e336a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl_dm.c Thu Dec 15 10:00:09 2011 +0100
@@ -917,7 +917,7 @@ int libxl__destroy_device_model(libxl__g
goto out;
}
LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device model is a stubdom, domid=%d", stubdomid);
- ret = libxl_domain_destroy(ctx, stubdomid, 0);
+ ret = libxl_domain_destroy(ctx, stubdomid);
if (ret)
goto out;
} else {
diff -r 7dbba8f9706d -r 1beeb56e336a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Thu Dec 15 10:00:09 2011 +0100
@@ -1283,7 +1283,7 @@ static int handle_domain_death(libxl_ctx
/* fall-through */
case LIBXL_ACTION_ON_SHUTDOWN_DESTROY:
LOG("Domain %d needs to be cleaned up: destroying the domain", domid);
- libxl_domain_destroy(ctx, domid, 0);
+ libxl_domain_destroy(ctx, domid);
break;
case LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY:
@@ -1786,7 +1786,7 @@ start:
error_out:
release_lock();
if (libxl_domid_valid_guest(domid))
- libxl_domain_destroy(ctx, domid, 0);
+ libxl_domain_destroy(ctx, domid);
out:
if (logfile != 2)
@@ -2256,7 +2256,7 @@ static void destroy_domain(const char *p
fprintf(stderr, "Cannot destroy privileged domain 0.\n\n");
exit(-1);
}
- rc = libxl_domain_destroy(ctx, domid, 0);
+ rc = libxl_domain_destroy(ctx, domid);
if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
}
@@ -2502,7 +2502,7 @@ static int save_domain(const char *p, co
if (checkpoint)
libxl_domain_unpause(ctx, domid);
else
- libxl_domain_destroy(ctx, domid, 0);
+ libxl_domain_destroy(ctx, domid);
exit(0);
}
@@ -2735,7 +2735,7 @@ static void migrate_domain(const char *d
}
fprintf(stderr, "migration sender: Target reports successful startup.\n");
- libxl_domain_destroy(ctx, domid, 1); /* bang! */
+ libxl_domain_destroy(ctx, domid); /* bang! */
fprintf(stderr, "Migration successful.\n");
exit(0);
@@ -2852,7 +2852,7 @@ static void migrate_receive(int debug, i
if (rc) {
fprintf(stderr, "migration target: Failure, destroying our copy.\n");
- rc2 = libxl_domain_destroy(ctx, domid, 1);
+ rc2 = libxl_domain_destroy(ctx, domid);
if (rc2) {
fprintf(stderr, "migration target: Failed to destroy our copy"
" (code %d).\n", rc2);
diff -r 7dbba8f9706d -r 1beeb56e336a tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c Thu Dec 15 10:00:09 2011 +0100
@@ -437,10 +437,10 @@ static PyObject *pyxl_domain_shutdown(Xl
static PyObject *pyxl_domain_destroy(XlObject *self, PyObject *args)
{
- int domid, force = 1;
- if ( !PyArg_ParseTuple(args, "i|i", &domid, &force) )
+ int domid;
+ if ( !PyArg_ParseTuple(args, "i", &domid) )
return NULL;
- if ( libxl_domain_destroy(self->ctx, domid, force) ) {
+ if ( libxl_domain_destroy(self->ctx, domid) ) {
PyErr_SetString(xl_error_obj, "cannot destroy domain");
return NULL;
}
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 14 of 15 v5] libxl: remove force parameter from libxl__devices_destroy
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (12 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 13 of 15 v5] libxl: remove force parameter from libxl_domain_destroy Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 15:07 ` [PATCH 15 of 15 v5] libxl: fix mutex initialization Roger Pau Monne
2011-12-15 17:38 ` [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Ian Jackson
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939609 -3600
# Node ID 97d3104a544c067400c17e252641694790b6cf16
# Parent 1beeb56e336aef8f95bd3dcead953feb6d383544
libxl: remove force parameter from libxl__devices_destroy
Remove the force flag, and always use forced destruction.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 1beeb56e336a -r 97d3104a544c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
@@ -772,7 +772,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
libxl__qmp_cleanup(gc, domid);
}
- if (libxl__devices_destroy(gc, domid, 1) < 0)
+ if (libxl__devices_destroy(gc, domid) < 0)
LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"libxl__devices_destroy failed for %d", domid);
diff -r 1beeb56e336a -r 97d3104a544c tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl_device.c Thu Dec 15 10:00:09 2011 +0100
@@ -505,13 +505,13 @@ int libxl__device_destroy(libxl__gc *gc,
return rc;
}
-int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
+int libxl__devices_destroy(libxl__gc *gc, uint32_t domid)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
char *path;
unsigned int num_kinds, num_devs;
char **kinds = NULL, **devs = NULL;
- int i, j, n_watches = 0;
+ int i, j;
libxl__device dev;
libxl__device_kind kind;
@@ -542,16 +542,7 @@ int libxl__devices_destroy(libxl__gc *gc
dev.kind = kind;
dev.devid = atoi(devs[j]);
- if (force) {
- libxl__device_destroy(gc, &dev);
- } else {
- int rc = libxl__device_remove(gc, &dev, 0);
- if (rc < 0)
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
- "cannot remove device %s\n", path);
- else
- n_watches += rc;
- }
+ libxl__device_destroy(gc, &dev);
}
}
}
@@ -565,37 +556,9 @@ int libxl__devices_destroy(libxl__gc *gc
dev.kind = LIBXL__DEVICE_KIND_CONSOLE;
dev.devid = 0;
- if (force) {
- libxl__device_destroy(gc, &dev);
- } else {
- int rc = libxl__device_remove(gc, &dev, 0);
- if (rc < 0)
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
- "cannot remove device %s\n", path);
- else
- n_watches += rc;
- }
+ libxl__device_destroy(gc, &dev);
}
- if (!force) {
- /* Linux-ism. Most implementations leave the timeout
- * untouched after select. Linux, however, will chip
- * away the elapsed time from it, which is what we
- * need to enforce a single time span waiting for
- * device destruction. */
- struct timeval tv;
- tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
- tv.tv_usec = 0;
- while (n_watches > 0) {
- if (libxl__wait_for_device_state(gc, &tv, XenbusStateClosed,
- destroy_device) < 0) {
- /* function returned ERROR_* */
- break;
- } else {
- n_watches--;
- }
- }
- }
out:
return 0;
}
diff -r 1beeb56e336a -r 97d3104a544c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl_internal.h Thu Dec 15 10:00:09 2011 +0100
@@ -271,7 +271,7 @@ _hidden int libxl__parse_backend_path(li
libxl__device *dev);
_hidden int libxl__device_remove(libxl__gc *gc, libxl__device *dev, int wait);
_hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
-_hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
+_hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid);
_hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
/* Handler for the libxl__wait_for_device_state callback */
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 15 of 15 v5] libxl: fix mutex initialization
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (13 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 14 of 15 v5] libxl: remove force parameter from libxl__devices_destroy Roger Pau Monne
@ 2011-12-15 15:07 ` Roger Pau Monne
2011-12-15 17:38 ` [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Ian Jackson
15 siblings, 0 replies; 18+ messages in thread
From: Roger Pau Monne @ 2011-12-15 15:07 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323939609 -3600
# Node ID 759f27054f543cd57e008db4031fb7353c88fc20
# Parent 97d3104a544c067400c17e252641694790b6cf16
libxl: fix mutex initialization
The macro PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined on
NetBSD, so define mutex attributes manually.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
diff -r 97d3104a544c -r 759f27054f54 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
+++ b/tools/libxl/libxl.c Thu Dec 15 10:00:09 2011 +0100
@@ -41,7 +41,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
{
libxl_ctx *ctx;
struct stat stat_buf;
- const pthread_mutex_t mutex_value = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+ pthread_mutexattr_t attr;
if (version != LIBXL_VERSION)
return ERROR_VERSION;
@@ -55,10 +55,21 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
memset(ctx, 0, sizeof(libxl_ctx));
ctx->lg = lg;
- /* This somewhat convoluted approach is needed because
- * PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is defined to be valid
- * only as an initialiser, not as an expression. */
- memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
+ if (pthread_mutexattr_init(&attr) != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "Failed to init mutex attributes\n");
+ return ERROR_FAIL;
+ }
+ if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "Failed to set mutex attributes\n");
+ return ERROR_FAIL;
+ }
+ if (pthread_mutex_init(&ctx->lock, &attr) != 0) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+ "Failed to init mutex\n");
+ return ERROR_FAIL;
+ }
if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl
2011-12-15 15:07 [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Roger Pau Monne
` (14 preceding siblings ...)
2011-12-15 15:07 ` [PATCH 15 of 15 v5] libxl: fix mutex initialization Roger Pau Monne
@ 2011-12-15 17:38 ` Ian Jackson
2011-12-16 9:08 ` Ian Campbell
15 siblings, 1 reply; 18+ messages in thread
From: Ian Jackson @ 2011-12-15 17:38 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: xen-devel
Roger Pau Monne writes ("[Xen-devel] [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl"):
> This patch series adds support for hotplug script calling directly
> from libxl, instead of relying on xenbackendd. Also some patches
> contain general bug fixes.
Thanks for the resend. I think I have already acked a number of these
patches. But your resend has dropped (or, if you prefer to think of
it like that) not added my Acked-By lines.
Can you please try to keep track Acked-By in your series ? That will
make it easier for us to see what we need to re-review.
If you can repost a subseries which I have already acked, I would be
inclined to apply them right away.
Ian.
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl
2011-12-15 17:38 ` [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl Ian Jackson
@ 2011-12-16 9:08 ` Ian Campbell
0 siblings, 0 replies; 18+ messages in thread
From: Ian Campbell @ 2011-12-16 9:08 UTC (permalink / raw)
To: Ian Jackson; +Cc: Roger Pau Monne, xen-devel@lists.xensource.com
On Thu, 2011-12-15 at 17:38 +0000, Ian Jackson wrote:
> Roger Pau Monne writes ("[Xen-devel] [PATCH 00 of 15 v5] libxl: add support for hotplug script calling from libxl"):
> > This patch series adds support for hotplug script calling directly
> > from libxl, instead of relying on xenbackendd. Also some patches
> > contain general bug fixes.
>
> Thanks for the resend. I think I have already acked a number of these
> patches. But your resend has dropped (or, if you prefer to think of
> it like that) not added my Acked-By lines.
>
> Can you please try to keep track Acked-By in your series ? That will
> make it easier for us to see what we need to re-review.
This is a common omission. I've added a section to
http://wiki.xen.org/wiki/SubmittingXenPatches on resending and have
included this advice.
Ian.
>
> If you can repost a subseries which I have already acked, I would be
> inclined to apply them right away.
>
> Ian.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread