Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 00 of 11 v3] 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. Currently Linux hotplug script call functions are empty, so Linux continues to use udev rules to call hotplug scripts. Patches 1, 7, 8, 9, 10 are NetBSD specific, and basicaly pave the way for the application of the bigger changes present in this series. Patch 11 is a trivial update for an error message. Patch 2 adds support for mounting raw image files using the vnd device. Since NetBSD doesn''t have qdisk or blktap support, the only way to use raw images with guests is to mount the image and pass the block device as a "PHY" backend. To check wheter an OS supports raw images as "PHY" backends two new files are added to the project, to avoid using #ifdefs, that contain a helper function. The file to be included is decided during the compilation process. Patch 3 adds a generic function to fork the current process and execute a given file, which will be later used to execute hotplug scripts synchronously. Patches 4 and 5 add a new function to wait for a device to reach a certain state, and replace wait_for_dev_destroy with this more generic implementation. This function is also used to wait for device initialization before calling hotplug scripts. The added function will benefit from a rework after event support is added to libxl. Finally patch 6 adds the calling of hotplug scripts when devices are initializated and removed. Two new files are also added to support hotplug scripts, since Linux and NetBSD hotplug scripts have different call parameters. The path of the script to execute is retrieved from xenstore. The file to include is also decided at compile time. Changes since v2: * Use libxl_linux.c and libxl_netbsd.c to place OS specific functions. * Fixed libxl__forkexec comment, adding the need to pass NULL as the last array member. * Use XenbusState instead of state numbers. * Use libxl_report_child_exit and return the exit status of the process in libxl__forkexec. * Pass action to execute to hotplug scripts, either CONNECT or DISCONNECT. Please review, Roger.
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 01 of 11 v3] xenbackendd: pass type of block device to hotplug script
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1317386335 -7200 # Node ID 23578c9942bcc8767adc4e435bb1fd1cd89f5e18 # Parent fd3567cafe1c7ccd0ddba0ad7fb067d435e13529 xenbackendd: pass type of block device to hotplug script Pass the type of block device to attach to the block script instead of reading it from 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 fd3567cafe1c -r 23578c9942bc tools/hotplug/NetBSD/block --- a/tools/hotplug/NetBSD/block Tue Nov 15 14:50:18 2011 +0100 +++ b/tools/hotplug/NetBSD/block Fri Sep 30 14:38:55 2011 +0200 @@ -19,7 +19,7 @@ error() { xpath=$1 xstatus=$2 -xtype=$(xenstore-read "$xpath/type") +xtype=$3 xparams=$(xenstore-read "$xpath/params") case $xstatus in diff -r fd3567cafe1c -r 23578c9942bc tools/xenbackendd/xenbackendd.c --- a/tools/xenbackendd/xenbackendd.c Tue Nov 15 14:50:18 2011 +0100 +++ b/tools/xenbackendd/xenbackendd.c Fri Sep 30 14:38:55 2011 +0200 @@ -89,15 +89,15 @@ dodebug(const char *fmt, ...) } static void -doexec(const char *cmd, const char *arg1, const char *arg2) +doexec(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { - dodebug("exec %s %s %s", cmd, arg1, arg2); + dodebug("exec %s %s %s %s", cmd, arg1, arg2, arg3); switch(vfork()) { case -1: dolog(LOG_ERR, "can''t vfork: %s", strerror(errno)); break; case 0: - execl(cmd, cmd, arg1, arg2, NULL); + execl(cmd, cmd, arg1, arg2, arg3, NULL); dolog(LOG_ERR, "can''t exec %s: %s", cmd, strerror(errno)); exit(EXIT_FAILURE); /* NOTREACHED */ @@ -145,11 +145,14 @@ xen_setup(void) int main(int argc, char * const argv[]) { + struct stat stab; char **vec; unsigned int num; char *s; int state; char *sstate; + char *stype; + char *params; char *p; char buf[80]; int type; @@ -297,11 +300,38 @@ main(int argc, char * const argv[]) strerror(errno)); goto next2; } - doexec(s, vec[XS_WATCH_PATH], sstate); + doexec(s, vec[XS_WATCH_PATH], sstate, NULL); break; case DEVTYPE_VBD: - doexec(vbd_script, vec[XS_WATCH_PATH], sstate); + /* check if given file is a block device or a raw image */ + snprintf(buf, sizeof(buf), "%s/params", vec[XS_WATCH_PATH]); + params = xs_read(xs, XBT_NULL, buf, 0); + if(params == NULL) { + dolog(LOG_ERR, + "Failed to read %s (%s)", buf, strerror(errno)); + goto next2; + } + if (stat(params, &stab) < 0) { + dolog(LOG_ERR, + "Failed to get info about %s (%s)", params, + strerror(errno)); + goto next3; + } + stype = NULL; + if (S_ISBLK(stab.st_mode)) + stype = "phy"; + if (S_ISREG(stab.st_mode)) + stype = "file"; + if (stype == NULL) { + dolog(LOG_ERR, + "Failed to attach %s (not a block device or raw image)", + params, strerror(errno)); + goto next3; + } + doexec(vbd_script, vec[XS_WATCH_PATH], sstate, stype); +next3: + free(params); break; default:
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 02 of 11 v3] libxl: add support for image files for NetBSD
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1317386335 -7200 # Node ID 097287f09ef3fba4f1d61d7073a77a122f3c597a # Parent 23578c9942bcc8767adc4e435bb1fd1cd89f5e18 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 23578c9942bc -r 097287f09ef3 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 @@ -32,6 +32,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 23578c9942bc -r 097287f09ef3 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 @@ -138,15 +138,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 23578c9942bc -r 097287f09ef3 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 @@ -252,6 +252,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 23578c9942bc -r 097287f09ef3 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 23578c9942bc -r 097287f09ef3 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; +}
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 03 of 11 v3] libxl: add libxl__forkexec function to libxl_exec
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751677 -3600 # Node ID 0abd9540788822b58585c8f2d29571e63fb68865 # Parent 097287f09ef3fba4f1d61d7073a77a122f3c597a 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 097287f09ef3 -r 0abd95407888 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 Thu Dec 01 16:01:17 2011 +0100 @@ -450,6 +450,39 @@ int libxl__spawn_check(libxl__gc *gc, li return ERROR_FAIL; } +int libxl__forkexec(libxl__gc *gc, int stdinfd, int stdoutfd, + int stderrfd, char **args) +{ + 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, args[0], args); + /* libxl__exec never returns */ + default: + while (waitpid(pid, &status, 0) < 0) { + if (errno != EINTR) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "waitpid failed\n"); + rc = -1; + break; + } + } + if (status) + libxl_report_child_exitstatus(ctx, LIBXL__LOG_ERROR, + args[0], pid, status); + rc = status; + break; + } + return rc; +} + /* * Local variables: * mode: C diff -r 097287f09ef3 -r 0abd95407888 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 Thu Dec 01 16:01:17 2011 +0100 @@ -400,6 +400,22 @@ _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 + * gc: allocation pool + * stdinfd, stdoutfd, stderrfd: fds to pass to libxl__exec + * args: file to execute and arguments to pass in the following format + * args[0]: file to execute + * args[1]: first argument to pass to the called program + * ... + * args[n-1]: (n-1)th argument to pass to the called program + * args[n]: NULL + * + * Returns the exit status, as reported by waitpid. + */ +_hidden int libxl__forkexec(libxl__gc *gc, int stdinfd, int stdoutfd, + int stderrfd, char **args); + /* 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,
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 04 of 11 v3] libxl: introduce libxl__wait_for_device_state
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID 3b5b14fcd208e7c5cb1840ea76eb11a63958a030 # Parent 0abd9540788822b58585c8f2d29571e63fb68865 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 0abd95407888 -r 3b5b14fcd208 tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Dec 01 16:01:17 2011 +0100 +++ b/tools/libxl/libxl_device.c Thu Dec 01 16:01:31 2011 +0100 @@ -370,7 +370,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; @@ -395,17 +397,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); @@ -418,6 +417,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. */ @@ -458,7 +474,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)); @@ -566,7 +583,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 0abd95407888 -r 3b5b14fcd208 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Thu Dec 01 16:01:17 2011 +0100 +++ b/tools/libxl/libxl_internal.h Thu Dec 01 16:01:31 2011 +0100 @@ -20,11 +20,14 @@ #include <stdint.h> #include <stdarg.h> #include <stdlib.h> +#include <sys/time.h> #include <xs.h> #include <xenctrl.h> #include "xentoollog.h" +#include <xen/io/xenbus.h> + #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) #define _hidden __attribute__((visibility("hidden"))) #define _protected __attribute__((visibility("protected"))) @@ -252,6 +255,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
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 05 of 11 v3] libxl: wait for devices to initialize upon addition to the domain
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID e5128830bc1e13adbf0b07962821fe8b13ba93b8 # Parent 3b5b14fcd208e7c5cb1840ea76eb11a63958a030 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 3b5b14fcd208 -r e5128830bc1e tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/libxl/libxl.c Thu Dec 01 16:01:31 2011 +0100 @@ -971,6 +971,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; @@ -1075,6 +1077,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: @@ -1450,6 +1469,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); @@ -1518,8 +1539,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);
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 06 of 11 v3] libxl: execute hotplug scripts directly from libxl
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1317386335 -7200 # Node ID 5e9c1fc4869fa14c2b54b33866a3784db94da852 # Parent e5128830bc1e13adbf0b07962821fe8b13ba93b8 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. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> diff -r e5128830bc1e -r 5e9c1fc4869f tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/libxl/libxl.c Fri Sep 30 14:38:55 2011 +0200 @@ -1018,6 +1018,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: @@ -1094,6 +1099,15 @@ int libxl_device_disk_add(libxl_ctx *ctx goto out_free; } } + + /* Call hotplug scripts to attach device */ + if (libxl__device_execute_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: @@ -1556,6 +1570,15 @@ int libxl_device_nic_add(libxl_ctx *ctx, goto out_free; } } + + /* Call hotplug scripts to attach device */ + if (libxl__device_execute_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 e5128830bc1e -r 5e9c1fc4869f tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/libxl/libxl_device.c Fri Sep 30 14:38:55 2011 +0200 @@ -68,6 +68,25 @@ int libxl__parse_backend_path(libxl__gc return libxl__device_kind_from_string(strkind, &dev->backend_kind); } +int libxl__device_execute_hotplug(libxl__gc *gc, libxl__device *dev, + libxl__hotplug_action action) +{ + int rc = 0; + + switch(dev->kind) { + case LIBXL__DEVICE_KIND_VIF: + rc = libxl__nic_hotplug(gc, dev, action); + break; + case LIBXL__DEVICE_KIND_VBD: + rc = libxl__disk_hotplug(gc, dev, action); + break; + default: + break; + } + + return rc; +} + int libxl__device_generic_add(libxl__gc *gc, libxl__device *device, char **bents, char **fents) { @@ -449,6 +468,7 @@ int libxl__device_remove(libxl__gc *gc, if (!state) goto out; if (atoi(state) != 4) { + libxl__device_execute_hotplug(gc, dev, DISCONNECT); libxl__device_destroy_tapdisk(gc, be_path); xs_rm(ctx->xsh, XBT_NULL, be_path); goto out; @@ -493,6 +513,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_execute_hotplug(gc, dev, DISCONNECT); + xs_rm(ctx->xsh, XBT_NULL, be_path); xs_rm(ctx->xsh, XBT_NULL, fe_path); diff -r e5128830bc1e -r 5e9c1fc4869f tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/libxl/libxl_internal.h Fri Sep 30 14:38:55 2011 +0200 @@ -289,6 +289,46 @@ _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_execute_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_execute_hotplug(libxl__gc *gc, libxl__device *dev, + libxl__hotplug_action action); + +/* + * libxl__disk_hotplug - execute hotplug script for a disk type device + * gc: allocation pool + * dev: reference to the disk device + * action: action to execute + * + * Returns 0 on success, and < 0 on error. + */ +_hidden int libxl__disk_hotplug(libxl__gc *gc, libxl__device *dev, + libxl__hotplug_action action); + +/* + * libxl__nic_hotplug - execute hotplug script for a nic type device + * gc: allocation pool + * dev: reference to the nic device + * + * Returns 0 on success, and < 0 on error. + */ +_hidden int libxl__nic_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 e5128830bc1e -r 5e9c1fc4869f tools/libxl/libxl_linux.c --- a/tools/libxl/libxl_linux.c Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/libxl/libxl_linux.c Fri Sep 30 14:38:55 2011 +0200 @@ -25,3 +25,17 @@ int libxl__try_phy_backend(mode_t st_mod return 1; } + +/* Hotplug scripts caller functions */ + +int libxl_disk_hotplug(libxl__gc *gc, libxl__device *dev, + libxl__hotplug_action action) +{ + return 0; +} + +int libxl_nic_hotplug_connect(libxl__gc *gc, libxl__device *dev, + libxl__hotplug_action action) +{ + return 0; +} diff -r e5128830bc1e -r 5e9c1fc4869f tools/libxl/libxl_netbsd.c --- a/tools/libxl/libxl_netbsd.c Thu Dec 01 16:01:31 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,130 @@ int libxl__try_phy_backend(mode_t st_mod return 0; } + +/* Hotplug scripts caller functions */ + +int libxl__disk_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); + struct stat stab; + char *stype, *sstate, *script, *params; + char **args; + int status, nr = 0; + int rc = -1; + flexarray_t *f_args; + + 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; + } + + params = libxl__xs_read(gc, XBT_NULL, + libxl__sprintf(gc, "%s/%s", be_path, "params")); + if (!params) + return -1; + + sstate = libxl__xs_read(gc, XBT_NULL, + libxl__sprintf(gc, "%s/%s", be_path, "state")); + if (!sstate) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to read state from %s", + be_path); + return -1; + } + + if (stat(params, &stab) < 0) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to get stat info\n"); + return -1; + } + if (S_ISBLK(stab.st_mode)) + stype = "phy"; + if (S_ISREG(stab.st_mode)) + stype = "file"; + if (stype == NULL) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Not block or regular file"); + return -1; + } + + f_args = flexarray_make(5, 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++, stype); + flexarray_set(f_args, nr++, NULL); + + args = (char **) flexarray_contents(f_args); + + LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, + "Calling disk hotplug script: %s %s %s %s", + args[0], args[1], args[2], args[3]); + status = libxl__forkexec(gc, -1, -1, -1, args); + if (!WIFEXITED(status) || WEXITSTATUS(status) == EXIT_FAILURE) { + rc = -1; + goto out; + } + rc = 0; + +out: + free(args); + return rc; +} + +int libxl__nic_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 *sstate, *script; + char **args; + int status, nr = 0; + int rc = -1; + flexarray_t *f_args; + + 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; + } + + sstate = libxl__xs_read(gc, XBT_NULL, + libxl__sprintf(gc, "%s/%s", be_path, "state")); + if (!sstate) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to read state 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); + + LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Calling nic hotplug script: %s %s %s", + args[0], args[1], args[2]); + status = libxl__forkexec(gc, -1, -1, -1, args); + if (!WIFEXITED(status) || WEXITSTATUS(status) == EXIT_FAILURE) { + rc = -1; + goto out; + } + rc = 0; + +out: + free(args); + return rc; +}
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 07 of 11 v3] hotplug NetBSD: pass an action instead of a state to hotplug scripts
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID 8ff55cfa427f123982884436f8b80614fb0ce50f # Parent 5e9c1fc4869fa14c2b54b33866a3784db94da852 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. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> diff -r 5e9c1fc4869f -r 8ff55cfa427f tools/hotplug/NetBSD/block --- a/tools/hotplug/NetBSD/block Fri Sep 30 14:38:55 2011 +0200 +++ b/tools/hotplug/NetBSD/block Thu Dec 01 16:01:31 2011 +0100 @@ -18,12 +18,12 @@ error() { xpath=$1 -xstatus=$2 +xaction=$2 xtype=$3 xparams=$(xenstore-read "$xpath/params") -case $xstatus in -6) +case $xaction in +2) # device removed case $xtype in file) @@ -41,7 +41,7 @@ 6) xenstore-rm $xpath exit 0 ;; -2) +1) case $xtype in file) # Store the list of available vnd(4) devices in diff -r 5e9c1fc4869f -r 8ff55cfa427f 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 Thu Dec 01 16:01:31 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 5e9c1fc4869f -r 8ff55cfa427f 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 Thu Dec 01 16:01:31 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")
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 08 of 11 v3] xenbackendd: pass action to hotplug script
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID 698834eeca6709c5569ac5c091b1dfaa17146b7f # Parent 8ff55cfa427f123982884436f8b80614fb0ce50f xenbackendd: pass action to hotplug script Pass an action to hotplug scripts instead of a xenbus state. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> diff -r 8ff55cfa427f -r 698834eeca67 tools/xenbackendd/xenbackendd.c --- a/tools/xenbackendd/xenbackendd.c Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/xenbackendd/xenbackendd.c Thu Dec 01 16:01:31 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 @@ -150,6 +153,7 @@ main(int argc, char * const argv[]) unsigned int num; char *s; int state; + char *action; char *sstate; char *stype; char *params; @@ -300,7 +304,8 @@ main(int argc, char * const argv[]) strerror(errno)); goto next2; } - doexec(s, vec[XS_WATCH_PATH], sstate, NULL); + action = (state == 6 ? DISCONNECT : CONNECT); + doexec(s, vec[XS_WATCH_PATH], action, NULL); break; case DEVTYPE_VBD: @@ -329,7 +334,8 @@ main(int argc, char * const argv[]) params, strerror(errno)); goto next3; } - doexec(vbd_script, vec[XS_WATCH_PATH], sstate, stype); + action = (state == 6 ? DISCONNECT : CONNECT); + doexec(vbd_script, vec[XS_WATCH_PATH], action, stype); next3: free(params); break;
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 09 of 11 v3] hotplug: remove debug messages from NetBSD hotplug scripts
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID 3e1212856bca08fda162eb27d6b9702d3f973f21 # Parent 698834eeca6709c5569ac5c091b1dfaa17146b7f 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 698834eeca67 -r 3e1212856bca tools/hotplug/NetBSD/block --- a/tools/hotplug/NetBSD/block Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/hotplug/NetBSD/block Thu Dec 01 16:01:31 2011 +0100 @@ -64,14 +64,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) @@ -79,9 +77,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 698834eeca67 -r 3e1212856bca tools/hotplug/NetBSD/vif-bridge --- a/tools/hotplug/NetBSD/vif-bridge Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/hotplug/NetBSD/vif-bridge Thu Dec 01 16:01:31 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 698834eeca67 -r 3e1212856bca tools/hotplug/NetBSD/vif-ip --- a/tools/hotplug/NetBSD/vif-ip Thu Dec 01 16:01:31 2011 +0100 +++ b/tools/hotplug/NetBSD/vif-ip Thu Dec 01 16:01:31 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 ;; *)
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 10 of 11 v3] rc.d NetBSD: don''t start xenbackendd by default, only when xend needs it
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1317386335 -7200 # Node ID ef23e64c6b8b6c6a3c75e48f20d05e9a0aa15b8c # Parent 3e1212856bca08fda162eb27d6b9702d3f973f21 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 3e1212856bca -r ef23e64c6b8b 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 3e1212856bca -r ef23e64c6b8b tools/hotplug/NetBSD/rc.d/xencommons --- a/tools/hotplug/NetBSD/rc.d/xencommons Thu Dec 01 16:01:31 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 3e1212856bca -r ef23e64c6b8b tools/hotplug/NetBSD/rc.d/xend --- a/tools/hotplug/NetBSD/rc.d/xend Thu Dec 01 16:01:31 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
Roger Pau Monne
2011-Dec-01 15:08 UTC
[PATCH 11 of 11 v3] libxl: fix incorrect log message in libxl_domain_destroy
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1322751691 -3600 # Node ID 274fa4aea2a30fb82228513f969d7cb807813bb8 # Parent ef23e64c6b8b6c6a3c75e48f20d05e9a0aa15b8c 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 ef23e64c6b8b -r 274fa4aea2a3 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Sep 30 14:38:55 2011 +0200 +++ b/tools/libxl/libxl.c Thu Dec 01 16:01:31 2011 +0100 @@ -768,7 +768,7 @@ 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)
Ian Jackson
2011-Dec-12 18:03 UTC
Re: [PATCH 00 of 11 v3] libxl: add support for hotplug script calling from libxl
Roger Pau Monne writes ("[Xen-devel] [PATCH 00 of 11 v3] 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.FYI this has now got to the top of my list. I hope to give it some serious review time tomorrow. In the meantime, if you have any final tweaks, feel free to send an updated version. Thanks, Ian.
Roger Pau Monné
2011-Dec-12 19:31 UTC
Re: [PATCH 00 of 11 v3] libxl: add support for hotplug script calling from libxl
2011/12/12 Ian Jackson <Ian.Jackson@eu.citrix.com>:> FYI this has now got to the top of my list. I hope to give it some > serious review time tomorrow. In the meantime, if you have any final > tweaks, feel free to send an updated version.I will try to post an updated version tomorrow morning, that applies to tip without rejections. I also have another smaller series pending, the one about libxl not being able to destroy a domain correctly under NetBSD. I think it will be good to merge the two series, since they are quite related (the destroy issue is related to libxl not removing frontend entries before attempting to destroy the devices). _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Dec-13 11:24 UTC
Re: [PATCH 00 of 11 v3] libxl: add support for hotplug script calling from libxl
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 00 of 11 v3] libxl: add support for hotplug script calling from libxl"):> 2011/12/12 Ian Jackson <Ian.Jackson@eu.citrix.com>: > > FYI this has now got to the top of my list. I hope to give it some > > serious review time tomorrow. In the meantime, if you have any final > > tweaks, feel free to send an updated version. > > I will try to post an updated version tomorrow morning, that applies > to tip without rejections. I also have another smaller series pending, > the one about libxl not being able to destroy a domain correctly under > NetBSD. I think it will be good to merge the two series, since they > are quite related (the destroy issue is related to libxl not removing > frontend entries before attempting to destroy the devices).Sure, thanks. And sorry about the huge conflicts you''re probably seeing... Ian.
Roger Pau Monné
2011-Dec-13 13:26 UTC
Re: [PATCH 00 of 11 v3] libxl: add support for hotplug script calling from libxl
2011/12/13 Ian Jackson <Ian.Jackson@eu.citrix.com>:> Sure, thanks. And sorry about the huge conflicts you're probably > seeing...I will have to send the series again, since the push of the new code was after I've submitted the patches, sorry for the fuss, let's see if I can finish this today... _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel