Call hotplug scripts from libxl
PATCH 1/1 Call hotplug scripts from libxl
This patch adds support for NetBSD to call hotplugs scripts directly from libxl, instead of relying on xenbackendd. Also some patches contain general bug fixes that apply to both NetBSD and Linux. Currently Linux hotplug script call functions are empty, so Linux continues to use udev rules to call hotplug scripts.
If possible, all this changes should be backported to xen-4.1 also.
Regards, Roger.
PATCH 1/1 xenbackendd: fix incorrect usage of pidfile
# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317300282 -7200
# Node ID 47005b3da245e2be052b614c02ed212d3d2cecbd # Parent a422e2a4451e16dc791b293f41966b842fa4781d
xenbackendd: fix incorrect usage of pidfile
Fix xenbackendd ignoring the pidfile passed through the command line.
tools/xenbackendd/xenbackendd.c +1 -1
@@ -169,7 +169,7 @@ main(int argc, char * const argv[]) log_file = optarg;break ;case 'p' : - pidfile = pidfile; + pidfile = optarg;case 's' : vbd_script = optarg;break ;
PATCH 1/1 xenbackendd: pass type of block device to hotplug script
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID d10abc15d963b00658405be71981f5726e24c0aa # Parent 47005b3da245e2be052b614c02ed212d3d2cecbd
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.
tools/hotplug/NetBSD/block +1 -1
@@ -19,7 +19,7 @@ error() { xpath=$1 xstatus=$2 -xtype=$(xenstore-read "$xpath/type") +xtype=$3 xparams=$(xenstore-read "$xpath/params") case $xstatus in
tools/xenbackendd/xenbackendd.c +35 -5
@@ -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 :
PATCH 1/1 libxl: fix for libxl not waiting for devices to disconnect
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID 31b3caad18ac904a242c5bd1ea2bb0e574cd0453 # Parent d10abc15d963b00658405be71981f5726e24c0aa
libxl: fix for libxl not waiting for devices to disconnect
libxl was ignoring the timeout and the number of devices to wait before destroying them.
tools/libxl/libxl_device.c +4 -1
@@ -422,6 +422,9 @@ static int wait_for_dev_destroy(libxl__g }free (l1); } + }else { +/* timeout reached */ + rc =0 ; }return rc; }
@@ -482,7 +485,7 @@ int libxl__devices_destroy(libxl__gc *gc tv.tv_usec =0 ;while (n_watches >0 ) {if (wait_for_dev_destroy (gc, &tv)) { -break ; +continue ; }else { n_watches--; }
PATCH 1/1 libxl: create pci backend only when there are pci devices
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID 156626fef95b36184ad44dfcb049bae2545435f0 # Parent 31b3caad18ac904a242c5bd1ea2bb0e574cd0453
libxl: create pci backend only when there are pci devices.
Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.
tools/libxl/libxl_create.c +8 -6
@@ -584,12 +584,14 @@ static int do_domain_create(libxl__gc *gfor (i =0 ; i < d_config->num_pcidevs; i++)libxl__device_pci_add (gc, domid, &d_config->pcidevs[i],1 ); - ret =libxl__create_pci_backend (gc, domid, d_config->pcidevs, - d_config->num_pcidevs); -if (ret <0 ) { -LIBXL__LOG (ctx,LIBXL__LOG_ERROR , -"libxl_create_pci_backend failed: %d" , ret); - goto error_out; +if (d_config->num_pcidevs >0 ) { + ret =libxl__create_pci_backend (gc, domid, d_config->pcidevs, + d_config->num_pcidevs); +if (ret <0 ) { +LIBXL__LOG (ctx,LIBXL__LOG_ERROR , +"libxl_create_pci_backend failed: %d" , ret); + goto error_out; + } } if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&
PATCH 1/1 libxl: only use interactive PyGrub mode when a console is attached
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1317386335 -7200
# Node ID 84a27a9f39f29194a7344e842b2055f592a42250
# Parent 156626fef95b36184ad44dfcb049bae2545435f0
libxl: only use interactive PyGrub mode when a console is attached
Sometimes PyGrub freezed when trying to create a domain without the console attached (without "-c"). This patch adds the "-q" option to PyGrub when "-c" is not specified at creation time. PyGrub freezed trying to set terminal attributes (like reset_prog_mode or nocbreak).
tools/libxl/libxl.h +2 -1
@@ -287,7 +287,8 @@ int libxl_get_max_cpus(libxl_ctx *ctx);int libxl_run_bootloader (libxl_ctx *ctx,libxl_domain_build_info *info,libxl_device_disk *disk, -uint32_t domid); +uint32_t domid, +libxl_console_ready cb);/* 0 means ERROR_ENOMEM, which we have logged */
tools/libxl/libxl_bootloader.c +7 -3
@@ -33,7 +33,8 @@static char **make_bootloader_args (libxl__gc *gc,libxl_domain_build_info *info,uint32_t domid, -const char *fifo,char *disk) +const char *fifo,char *disk, +libxl_console_ready cb) {flexarray_t *args;int nr =0 ;
@@ -55,6 +56,8 @@ static char **make_bootloader_args(libxlflexarray_set (args, nr++,libxl__sprintf (gc,"--output=%s" , fifo));flexarray_set (args, nr++,"--output-format=simple0" );flexarray_set (args, nr++,libxl__sprintf (gc,"--output-directory=%s" ,"/var/run/libxl/" )); +if (!cb) +flexarray_set (args, nr++,"-q" );if (info->u.pv.bootloader_args) {char *saveptr;
@@ -300,7 +303,8 @@ static void parse_bootloader_result(libxint libxl_run_bootloader (libxl_ctx *ctx,libxl_domain_build_info *info,libxl_device_disk *disk, -uint32_t domid) +uint32_t domid, +libxl_console_ready cb) {libxl__gc gc =LIBXL_INIT_GC (ctx);int ret, rc =0 ;
@@ -362,7 +366,7 @@ int libxl_run_bootloader(libxl_ctx *ctx, goto out_close; } - args =make_bootloader_args (&gc, info, domid, fifo, diskpath); + args =make_bootloader_args (&gc, info, domid, fifo, diskpath, cb);if (args ==NULL ) { rc =ERROR_NOMEM ; goto out_close;
tools/libxl/libxl_create.c +1 -1
@@ -461,7 +461,7 @@ static int do_domain_create(libxl__gc *g }if ( restore_fd <0 ) { - ret =libxl_run_bootloader (ctx, &d_config->b_info, d_config->num_disks >0 ? &d_config->disks[0 ] :NULL , domid); + ret =libxl_run_bootloader (ctx, &d_config->b_info, d_config->num_disks >0 ? &d_config->disks[0 ] :NULL , domid, cb);if (ret) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"failed to run bootloader: %d" , ret);
PATCH 1/1 libxl: add support for image files for NetBSD
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID ce4b969a938afa40edb6858629b6eb2905a29f04 # Parent 84a27a9f39f29194a7344e842b2055f592a42250
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.
tools/libxl/Makefile +2 -0
@@ -31,6 +31,8 @@ LIBXL_OBJS-y += libxl_noblktap2.o endif LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o +LIBXL_OBJS-$(CONFIG_NetBSD) += libxl_phybackend.o +LIBXL_OBJS-$(CONFIG_Linux) += libxl_nophybackend.o LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
tools/libxl/libxl_device.c +7 -8
@@ -136,15 +136,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 (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)) {
tools/libxl/libxl_internal.h +3 -0
@@ -227,6 +227,9 @@ _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); +/* OS dependant helper function */ +_hidden int 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);
tools/libxl/libxl_nophybackend.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2011 +* Author Roger Pau Monne <[email protected]> +* +* 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 try_phy_backend (mode_t st_mode) +{ +if (!S_ISBLK (st_mode)) { +return 0 ; + } + +return 1 ; +}
tools/libxl/libxl_phybackend.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2011 +* Author Roger Pau Monne <[email protected]> +* +* 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 try_phy_backend (mode_t st_mode) +{ +if (S_ISREG (st_mode) ||S_ISBLK (st_mode)) +return 1 ; + +return 0 ; +}
PATCH 1/1 libxl: execute hotplug scripts directly from libxl
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID a767b85f9c3410c4cbe5cca7b12bd0900415040e # Parent ce4b969a938afa40edb6858629b6eb2905a29f04
libxl: execute hotplug scripts directly from libxl.
Added the necessary handlers to execute hotplug scripts when necessary from libxl. Split NetBSD from 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.
tools/libxl/Makefile +4 -1
@@ -33,10 +33,13 @@ LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid. LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o LIBXL_OBJS-$(CONFIG_NetBSD) += libxl_phybackend.o LIBXL_OBJS-$(CONFIG_Linux) += libxl_nophybackend.o +LIBXL_OBJS-$(CONFIG_NetBSD) += hotplug_netbsd.o +LIBXL_OBJS-$(CONFIG_Linux) += hotplug_linux.o LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \ - libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y) + libxl_internal.o libxl_utils.o libxl_uuid.o libxl_hotplug.o \ + $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o libxl_flask.o $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
tools/libxl/hotplug_linux.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2011 +* Author Roger Pau Monne <[email protected]> +* +* 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 "libxl_internal.h" + +int libxl_disk_hotplug (libxl__gc *gc,char *be_path) +{ +return 0 ; +} + +int libxl_nic_hotplug_connect (libxl__gc *gc,char *be_path) +{ +return 0 ; +}
tools/libxl/hotplug_netbsd.c new file +121 -0
121 lines not on this page · raw message
tools/libxl/libxl.c +22 -0
@@ -1009,6 +1009,11 @@ int libxl_device_disk_add(libxl_ctx *ctxflexarray_append (back,libxl__device_disk_string_of_backend (disk->backend));flexarray_append (back,"mode" );flexarray_append (back, disk->readwrite ?"w" :"r" ); +/* TODO: add Linux scripts, NetBSD only has block */ +flexarray_append (back,"script" ); +flexarray_append (back,libxl__sprintf (&gc,"%s/%s" , +libxl_xen_script_dir_path (), +"block" ));flexarray_append (front,"backend-id" );flexarray_append (front,libxl__sprintf (&gc,"%d" , disk->backend_domid));
@@ -1023,6 +1028,14 @@ int libxl_device_disk_add(libxl_ctx *ctxlibxl__xs_kvs_of_flexarray (&gc, back, back->count), libxl__xs_kvs_of_flexarray(&gc, front, front->count)); +/* Call hotplug scripts to attach device */ +if (libxl_disk_hotplug (&gc,libxl__device_backend_path (&gc, &device)) <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:
@@ -1252,6 +1265,15 @@ int libxl_device_nic_add(libxl_ctx *ctx, libxl__xs_kvs_of_flexarray(&gc, front, front->count));/* FIXME: wait for plug */ + +/* Call hotplug scripts to attach device */ +if (libxl_nic_hotplug (&gc,libxl__device_backend_path (&gc, &device)) <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:flexarray_free (back);
tools/libxl/libxl_device.c +42 -0
77 lines not on this page · raw message
tools/libxl/libxl_hotplug.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2011 +* Author Roger Pau Monne <[email protected]> +* +* 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 <unistd.h> + +#include "libxl_internal.h" + +int libxl_exec (libxl__gc *gc,char **cmd) +{ +libxl_ctx *ctx =libxl__gc_owner (gc); + +LIBXL__LOG (ctx,LIBXL__LOG_DEBUG ,"Executing: %s" , cmd[0 ]); +switch (vfork ()) { +case -1 : +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to vfork\n" ); +return -1 ; +case 0 : +execv (cmd[0 ], cmd); +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to execute %s\n" , + cmd[0 ]); +exit (EXIT_FAILURE ); +break ; +default : +wait (NULL ); +break ; + } +return 0 ; +}
tools/libxl/libxl_internal.h +7 -1
@@ -95,7 +95,8 @@ struct libxl__ctx { }; typedef enum { - DEVICE_VIF = 1, + DEVICE_UNKNOWN = 0, + DEVICE_VIF, DEVICE_VBD, DEVICE_QDISK, DEVICE_PCI,
@@ -230,6 +231,11 @@ _hidden int libxl__wait_for_backend(libx/* OS dependant helper function */ _hidden int try_phy_backend(mode_t st_mode); +/* hotplug functions */ +_hidden int libxl_exec(libxl__gc *gc, char **cmd); +_hidden int libxl_disk_hotplug(libxl__gc *gc, char *be_path); +_hidden int libxl_nic_hotplug(libxl__gc *gc, char *be_path); +/* from libxl_pci */ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
PATCH 1/1 hotplug NetBSD: detach devices when state is 5 or 6
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID 7e44ba113546e4c2db56ebf9b0b251dcd9a1948a # Parent a767b85f9c3410c4cbe5cca7b12bd0900415040e hotplug NetBSD: detach devices when state is 5 or 6
With the move of hotplug calls from xenbackendd to libxl, we can detach devices when the state is 5 or 6.
tools/hotplug/NetBSD/block +1 -1
@@ -23,7 +23,7 @@ xtype=$3 xparams=$(xenstore-read "$xpath/params") case $xstatus in -6) +5|6) # device removed case $xtype in file)
tools/hotplug/NetBSD/vif-bridge +1 -1
@@ -14,7 +14,7 @@ xpath=$1 xstatus=$2 case $xstatus in -6) +5|6) # device removed xenstore-rm $xpath exit 0
tools/hotplug/NetBSD/vif-ip +1 -1
@@ -14,7 +14,7 @@ xpath=$1 xstatus=$2 case $xstatus in -6) +5|6) # device removed xenstore-rm $xpath exit 0
PATCH 1/1 rc.d NetBSD: don't start xenbackendd by default, only when xend needs it
In reply to Roger Pau Monne# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1317386335 -7200
# Node ID 3009fd6e30ea90b5a55dc97fd953e0b5ab188276
# Parent 7e44ba113546e4c2db56ebf9b0b251dcd9a1948a
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.
tools/hotplug/NetBSD/rc.d/xenbackendd new file +27 -0
@@ -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" +
tools/hotplug/NetBSD/rc.d/xencommons +1 -8
@@ -46,7 +46,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"
@@ -68,13 +68,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"
tools/hotplug/NetBSD/rc.d/xend +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # # PROVIDE: xend -# REQUIRE: xencommons +# REQUIRE: xencommons xenbackendd . /etc/rc.subr
Re: [PATCH 1 of 9] xenbackendd: fix incorrect usage of pidfile
In reply to Roger Pau MonneQuoted 10 lines · Roger Pau Monne
# HG changeset patch
# User Roger Pau Monne<[email protected]> # Date 1317300282 -7200
# Node ID47005b3da245e2be052b614c02ed212d3d2cecbd# Parenta422e2a4451e16dc791b293f41966b842fa4781d
xenbackendd: fix incorrect usage of pidfileFix xenbackendd ignoring the pidfile passed through the command line.
Signed-off-by Roger Pau Monne<[email protected]>
Quoted 14 lines
diff -r
a422e2a4451e-r47005b3da245tools/xenbackendd/xenbackendd.ctools/xenbackendd/xenbackendd.c +1
-1@@ -169,7 +169,7 @@ main(int argc, char * const argv[]) log_file = optarg;break ;case 'p' : - pidfile = pidfile; + pidfile = optarg;case 's' : vbd_script = optarg;break ;
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
I've just realized that there's a drawback with this implementation, domains that are closed from inside the VM (a typical "shutdown -h now") do not trigger the launch of hotplug scripts, since libxl is not running and is not aware that the domain has powered off. Don't know the best way to solve this issue, that doesn't take us back to having a separate daemon that monitors xenstore states (or udev on Linux).
Regards, Roger.
Quoted 4 lines · Roger Pau Monné
I've just realized that there's a drawback with this implementation, domains that are closed from inside the VM (a typical "shutdown -h now") do not trigger the launch of hotplug scripts, since libxl is not running and is not aware that the domain has powered off.
By default xl daemonises itself and monitors the domain waiting for it to exit, at which point it should perform the necessary cleanup (this is the call to libxl_domain_destroy in handle_domain_death).
If you ask xl to not do this (using the -e or -F options) then you are expected to call xl destroy yourself.
The call to libxl_domain_destroy calls libxl__devices_destroy which tears down the backends. Unfortunately this is done in a slightly generic way but my recent series should have laid the ground work for doing this in a more device-specific way.
I have a feeling that libxl__device_destroy should really consist of a sequence of libxl_device_FOO_list+foreach(thing) libxl_device_FOO_remove calls rather than the current mechanism. i.e. be really explicit about what it is tearing down.
Ian.
Quoted 10 lines
Don't know
the best way to solve this issue, that doesn't take us back to having a separate daemon that monitors xenstore states (or udev on Linux).Regards, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
2011/10/4 Ian Campbell <[email protected]>:
Quoted 3 lines
By default xl daemonises itself and monitors the domain waiting for it to exit, at which point it should perform the necessary cleanup (this is the call to
libxl_domain_destroyinhandle_domain_death).
libxl daemonises itself if you call "xl shutdown <domain>", but if the domain shuts down from inside (doing a "halt"), xl is never called, and therefore hotplug scripts are not executed.
Quoted 14 lines
If you ask xl to not do this (using the -e or -F options) then you are expected to call xl destroy yourself.
The call to
libxl_domain_destroycallslibxl__devices_destroywhich tears down the backends. Unfortunately this is done in a slightly generic way but my recent series should have laid the ground work for doing this in a more device-specific way.I have a feeling that
libxl__device_destroyshould really consist of a sequence of libxl_device_FOO_list+foreach(thing)libxl_device_FOO_removecalls rather than the current mechanism. i.e. be really explicit about what it is tearing down.Ian.
Quoted 8 lines · Roger Pau Monné
2011/10/4 Ian Campbell <[email protected]>:
Quoted 3 lines
By default xl daemonises itself and monitors the domain waiting for it to exit, at which point it should perform the necessary cleanup (this is the call to
libxl_domain_destroyinhandle_domain_death).libxl daemonises itself if you call "xl shutdown <domain>", but if the domain shuts down from inside (doing a "halt"), xl is never called, and therefore hotplug scripts are not executed.
I don't think "xl shutdown" daemonises ever.
"xl create" daemonises itself and waits for the guest to die. It should be detecting the guest shutdown no matter if it is triggered internally or externally. That's not to say it's not buggy though...
Quoted 15 lines
Quoted 15 lines
If you ask xl to not do this (using the -e or -F options) then you are expected to call xl destroy yourself.
The call to
libxl_domain_destroycallslibxl__devices_destroywhich tears down the backends. Unfortunately this is done in a slightly generic way but my recent series should have laid the ground work for doing this in a more device-specific way.I have a feeling that
libxl__device_destroyshould really consist of a sequence of libxl_device_FOO_list+foreach(thing)libxl_device_FOO_removecalls rather than the current mechanism. i.e. be really explicit about what it is tearing down.Ian.
Quoted 5 lines
I don't think "xl shutdown" daemonises ever.
"xl create" daemonises itself and waits for the guest to die. It should be detecting the guest shutdown no matter if it is triggered internally or externally. That's not to say it's not buggy though...
Sorry for the stupid question, this seems to not be working ok on NetBSD, I will check it and post a patch.
Regards, Roger.
Re: [PATCH 1 of 9] xenbackendd: fix incorrect usage of pidfile [and 1 more messages]
In reply to Roger Pau MonneRoger Pau Monne writes ("[Xen-devel] [PATCH 1 of 9] xenbackendd: fix incorrect usage of pidfile"):
Quoted 5 lines
xenbackendd: fix incorrect usage of pidfile
Fix xenbackendd ignoring the pidfile passed through the command line.
Signed-off-by Roger Pau Monne <[email protected]>
Re: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
In reply to Roger Pau MonneRoger Pau Monne writes ("[Xen-devel] [PATCH 4 of 9] libxl: create pci backend on> libxl: create pci backend only when there are pci devices.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
In reply to Roger Pau MonneRoger Pau Monne writes ("[Xen-devel] [PATCH 5 of 9] libxl: only use interactive > libxl: only use interactive PyGrub mode when a console is attached
I don't think this is correct.
Quoted 5 lines
Sometimes PyGrub freezed when trying to create a domain without the console attached (without "-c"). This patch adds the "-q" option to PyGrub when "-c" is not specified at creation time. PyGrub freezed trying to set terminal attributes (like
reset_prog_modeor nocbreak).
I think "-c" shouldn't affect the functionality of the domain, just whether the console is initially connected. Perhaps the console will be connected somewhere else.
OTOH I think it would be fine to have an option (libxl config parameter, I guess) to make pygrub run noninteractively.
Ian.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 6 lines
I think "-c" shouldn't affect the functionality of the domain, just whether the console is initially connected. Perhaps the console will be connected somewhere else.
OTOH I think it would be fine to have an option (libxl config parameter, I guess) to make pygrub run noninteractively.
I've digged a little more into this issue, and found out that NetBSD ptys have a 1024 buffer limit, and when this limit is hit, the select from libxl_bootloader:211 blocks and no more data is writen to xenconsole_fd and no more data is read from bootloader_fd (because bootloader_buf contains data), which of course blocks the execution of pygrub. Since the xenconsoled_fd pty is not monitored by xenconsole, nobody is draining data from it. I don't know the best way to solve this, but it seems like somebody should read the data from xenconsoled_fd and dispose it if there is no console attached.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 9 lines · Roger Pau Monné
Quoted 6 lines
I think "-c" shouldn't affect the functionality of the domain, just whether the console is initially connected. Perhaps the console will be connected somewhere else.
OTOH I think it would be fine to have an option (libxl config parameter, I guess) to make pygrub run noninteractively.
I've digged a little more into this issue, and found out that NetBSD ptys have a 1024 buffer limit, and when this limit is hit, the select
^byte ?
Quoted 3 lines
from libxl_bootloader:211 blocks and no more data is writen to
xenconsole_fdand no more data is read frombootloader_fd(becausebootloader_bufcontains data),
IIRC I made that last condition like that because it simplified things because I could avoid worrying about wrapping the consumer round in the buffer, or something. However if that scheme doesn't work for BSD we could go the more complex route, assuming it would help.
This could well be a problem on Linux too but we are just avoiding it due to the larger buffers. I wonder if I can artificially reduce the buffer size on Linux...
Quoted 5 lines
which of course blocks the execution of
pygrub. Since thexenconsoled_fdpty is not monitored by xenconsole, nobody is draining data from it. I don't know the best way to solve this, but it seems like somebody should read the data fromxenconsoled_fdand dispose it if there is no console attached.
Yes. One option could be to add a timeout to the select and throwaway data if necessary. I think xenconsoled does this for real guest consoles too if no one is connected so that behaviour would at least be consistent. Or maybe xenconsoled should be doing this for this pty like it does for guests?
Might another option be to increase the size of the buffer in libxl to
Quoted 1 line
1K? More of a workaround than a solution I suppose.
Ian.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 31 lines · Ian Campbell
Quoted 9 lines · Roger Pau Monné
Quoted 6 lines
I think "-c" shouldn't affect the functionality of the domain, just whether the console is initially connected. Perhaps the console will be connected somewhere else.
OTOH I think it would be fine to have an option (libxl config parameter, I guess) to make pygrub run noninteractively.
I've digged a little more into this issue, and found out that NetBSD ptys have a 1024 buffer limit, and when this limit is hit, the select
^byte ?Quoted 3 lines
from libxl_bootloader:211 blocks and no more data is writen to
xenconsole_fdand no more data is read frombootloader_fd(becausebootloader_bufcontains data),IIRC I made that last condition like that because it simplified things because I could avoid worrying about wrapping the consumer round in the buffer, or something. However if that scheme doesn't work for BSD we could go the more complex route, assuming it would help.
This could well be a problem on Linux too but we are just avoiding it due to the larger buffers. I wonder if I can artificially reduce the buffer size on Linux...
Quoted 5 lines
which of course blocks the execution of
pygrub. Since thexenconsoled_fdpty is not monitored by xenconsole, nobody is draining data from it. I don't know the best way to solve this, but it seems like somebody should read the data fromxenconsoled_fdand dispose it if there is no console attached.
Quoted 5 lines
Yes. One option could be to add a timeout to the select and throwaway data if necessary. I think xenconsoled does this for real guest consoles too if no one is connected so that behaviour would at least be consistent. Or maybe xenconsoled should be doing this for this pty like it does for guests?
Wait, that last suggestion doesn't work because this pty goes direct to the xencosole client not via the server and the issue is that there is no client connected.
Ian.
Quoted 11 lines
Might another option be to increase the size of the buffer in libxl to
Quoted 1 line
1K? More of a workaround than a solution I suppose.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
In reply to Roger Pau MonnéRoger Pau Monné writes ("Re: [Xen-devel] [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached"):
Quoted 9 lines
I've digged a little more into this issue, and found out that NetBSD ptys have a 1024 buffer limit, and when this limit is hit, the select from libxl_bootloader:211 blocks and no more data is writen to
xenconsole_fdand no more data is read frombootloader_fd(becausebootloader_bufcontains data), which of course blocks the execution of pygrub. Since thexenconsoled_fdpty is not monitored by xenconsole, nobody is draining data from it. I don't know the best way to solve this, but it seems like somebody should read the data fromxenconsoled_fdand dispose it if there is no console attached.
That sounds unfortunate. I agree with you.
Ian.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 1 line
That sounds unfortunate. I agree with you.
Well Ian Campbell proposed to use a timeout in select and drop data when the timeout is hit, that what I've implemented in
libxl: drop bootloader output if xenconsole file descriptor is not available for writing
The patch is quite simple and solves the problem, I don't think it interferes with normal boot process, since a 1s timeout is quite high for data to be delivered from xenconsoled_fd to the user if the console is attached. The other option would be to modify xenconsole daemon, but I think that's far too complicated for a problem that can be solved easily.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 5 lines · Roger Pau Monné
Quoted 1 line
That sounds unfortunate. I agree with you.
Well Ian Campbell proposed to use a timeout in select and drop data when the timeout is hit, that what I've implemented in
Quoted 7 lines
libxl: drop bootloader output if xenconsole file descriptor is not available for writing
The patch is quite simple and solves the problem, I don't think it interferes with normal boot process, since a 1s timeout is quite high for data to be delivered from
xenconsoled_fdto the user if the console is attached.
The case where a user types
xl create /a/domain
xl console adomain
might have a reasonably long delay in it before the console is connected. Increasing the libxl buffer size would mitigate that but you'd still have the problem of not reading from an fd if the cons is != 0.
Can you print out the actual values of the various producers and consumers at the point of the hang? (maybe track total bytes too for debug?)
Perhaps where we have:
if (xenconsoled_prod == xenconsoled_cons)
xenconsoled_prod = xenconsoled_cons = 0;
if (bootloader_prod == bootloader_cons)
bootloader_prod = bootloader_cons = 0;We could also add some suitable memmoves and associated prod/cons manipulation, such that the unconsumed data is always pulled to the head of the buffer. That might be a reasonably simple way to improve things and allow larger buffers to be used? More often than not the memmove won't be getting called since either XXX_prod == XXX_cons or XXX_cons is already 0, IOW having a partially consumed buffer would be unusual?
Once we have a larger buffer which we always try to fill discarding data after a timeout when the buffer is full won't be so critical.
Quoted 8 lines
The other option would be to modify xenconsole
daemon, but I think that's far too complicated for a problem that can be solved easily._______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
2011/10/11 Ian Campbell <[email protected]>:
Quoted 18 lines · Roger Pau Monné
Quoted 5 lines
Quoted 1 line
That sounds unfortunate. I agree with you.
Well Ian Campbell proposed to use a timeout in select and drop data when the timeout is hit, that what I've implemented in
Quoted 7 lines
libxl: drop bootloader output if xenconsole file descriptor is not available for writing
The patch is quite simple and solves the problem, I don't think it interferes with normal boot process, since a 1s timeout is quite high for data to be delivered from
xenconsoled_fdto the user if the console is attached.The case where a user types
xl create /a/domain
xl console adomain
Quoted 8 lines
might have a reasonably long delay in it before the console is connected. Increasing the libxl buffer size would mitigate that but you'd still have the problem of not reading from an fd if the cons is != 0.
Can you print out the actual values of the various producers and consumers at the point of the hang? (maybe track total bytes too for debug?)
The process gets stuck after writing 1022 bytes to xenconsole_fd, and the buffer is 24 consumed 48 produced (although that varies, sometimes I get ~700 produced and ~20 consumed, but the total written bits is 1022 always).
Quoted 11 lines
Perhaps where we have:
if (xenconsoled_prod==xenconsoled_cons)xenconsoled_prod=xenconsoled_cons= 0;
if (bootloader_prod==bootloader_cons)bootloader_prod=bootloader_cons= 0;
We could also add some suitable memmoves and associated prod/cons manipulation, such that the unconsumed data is always pulled to the head of the buffer. That might be a reasonably simple way to improve things and allow larger buffers to be used? More often than not the memmove won't be getting called since eitherXXX_prod==XXX_consorXXX_consis already 0, IOW having a partially consumed buffer would be unusual?
I don't really like moving memory around, since it's slow, but I think implementing a circular buffer would really complicate things. I will post a new patch that implements the following:
1. Increase buffer.
2. Use memmove to move memory to the head of the buffer and fill it until the buffer is full.
3. On timeout and full buffer, drop data from the head of the buffer (older data) and fill it with new data (move the buffer and append new data at the end).
Do you thing this should be applied to both xenconsoled and bootloader? since the only one giving problems is xenconsoled.
Quoted 2 lines
Once we have a larger buffer which we always try to fill discarding data after a timeout when the buffer is full won't be so critical.
Re: [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached
Quoted 29 lines · Roger Pau Monné
2011/10/11 Ian Campbell <[email protected]>:
Quoted 18 lines · Roger Pau Monné
Quoted 5 lines
Quoted 1 line
That sounds unfortunate. I agree with you.
Well Ian Campbell proposed to use a timeout in select and drop data when the timeout is hit, that what I've implemented in
Quoted 7 lines
libxl: drop bootloader output if xenconsole file descriptor is not available for writing
The patch is quite simple and solves the problem, I don't think it interferes with normal boot process, since a 1s timeout is quite high for data to be delivered from
xenconsoled_fdto the user if the console is attached.The case where a user types
xl create /a/domain
xl console adomainQuoted 8 lines
might have a reasonably long delay in it before the console is connected. Increasing the libxl buffer size would mitigate that but you'd still have the problem of not reading from an fd if the cons is != 0.
Can you print out the actual values of the various producers and consumers at the point of the hang? (maybe track total bytes too for debug?)
Quoted 4 lines
The process gets stuck after writing 1022 bytes to
xenconsole_fd, and the buffer is 24 consumed 48 produced (although that varies, sometimes I get ~700 produced and ~20 consumed, but the total written bits is 1022 always).
Thanks.
Quoted 13 lines
Quoted 6 lines
Perhaps where we have:
if (xenconsoled_prod == xenconsoled_cons) xenconsoled_prod = xenconsoled_cons = 0; if (bootloader_prod == bootloader_cons) bootloader_prod = bootloader_cons = 0;Quoted 6 lines
We could also add some suitable memmoves and associated prod/cons manipulation, such that the unconsumed data is always pulled to the head of the buffer. That might be a reasonably simple way to improve things and allow larger buffers to be used? More often than not the memmove won't be getting called since either
XXX_prod==XXX_consorXXX_consis already 0, IOW having a partially consumed buffer would be unusual?
Quoted 2 lines
I don't really like moving memory around, since it's slow, but I think implementing a circular buffer would really complicate things.
I suspect that under normal use the move will never happen because we will always have either written the entire buffer (so cons==prod, cheaply reset both to zero) or none of it (so cons==0 and there is nothing to do).
In the case you are suffering from I expect it will happen exactly once and then we will be in the cons==0 state from then on unless we become able to write something.
If that is correct then I don't think the move will be a problem in practice. Also the buffers aren't all that big so moving them cant bee all that expensive in the grand scheme of things.
libxl configures xenconsoled to have a limit of 1048576 (LIBXL_XENCONSOLE_LIMIT) by default. Hopefully we can get away with something smaller for the bootloader interactions.
Quoted 9 lines
I will
post a new patch that implements the following:1. Increase buffer.
2. Use memmove to move memory to the head of the buffer and fill it until the buffer is full.
3. On timeout and full buffer, drop data from the head of the buffer (older data) and fill it with new data (move the buffer and append new data at the end).
This sounds good.
When xenconsoled drops guest console data it seems to drop data from the middle. I'm not sure why though. The checkin comment of 2b8efe11096b8 doesn't really go into detail on that aspect.
Quoted 2 lines
Do you thing this should be applied to both xenconsoled and bootloader? since the only one giving problems is xenconsoled.
The bootloader buffer is currently larger so we probably don't see any problems but in theory it's just as vulnerable? We probably don't need to increase the buffer any further but the other changes probably make sense.
Quoted 2 lines
Quoted 2 lines
Once we have a larger buffer which we always try to fill discarding data after a timeout when the buffer is full won't be so critical.
Re: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
In reply to Roger Pau MonneQuoted 9 lines · Roger Pau Monne
# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID156626fef95b36184ad44dfcb049bae2545435f0# Parent31b3caad18ac904a242c5bd1ea2bb0e574cd0453
libxl: create pci backend only when there are pci devices.Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.
I think since this change we need the following. This applies after my big libxl API series:
Ian.
8<------------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1318943709 -3600
# Node ID e6af32ecb4483457d5ad9a7b674c18aaf20cc085
# Parent 12ac478d1b56f0ff4d3242138b780c551a69f107
libxl: libxl__device_pci_destroy_all should succeed if there is no PCI bus on the domain
Since 23915:4c4b72c94bac "" it is possible that no bus exists and this is not an error. Removes the following spurious warning when destroying a PV domain with no PCI devices:
libxl: error: libxl.c:759:libxl_domain_destroy: pci shutdown failed for domid 1005
tools/libxl/libxl_pci.c +1 -1
@@ -1098,7 +1098,7 @@ int libxl__device_pci_destroy_all(libxl_ pcidevs =libxl_device_pci_list (ctx, domid, &num);if ( pcidevs ==NULL ) -return ERROR_FAIL ; +return 0 ;for (i =0 ; i < num; i++) {/* Force remove on shutdown since, on HVM, qemu will not always
Roger Pau Monné
Acked-byRe: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
2011/10/18 Ian Campbell <[email protected]>:
Quoted 8 lines · Roger Pau Monne
Quoted 7 lines
# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID156626fef95b36184ad44dfcb049bae2545435f0# Parent 31b3caad18ac904a242c5bd1ea2bb0e574cd0453
libxl: create pci backend only when there are pci devices.
Quoted 5 lines
Quoted 2 lines
Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.
I think since this change we need the following. This applies after my big libxl API series:
Yes, this fixes the issue related to the error message "libxl: error:
libxl.c:759:libxl_domain_destroy: pci shutdown failed for domid". I don't know if I can do this, but anyway:
Quoted 34 lines
Ian.
8<------------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1318943709 -3600
# Node IDe6af32ecb4483457d5ad9a7b674c18aaf20cc085
# Parent 12ac478d1b56f0ff4d3242138b780c551a69f107
libxl:libxl__device_pci_destroy_allshould succeed if there is no PCI bus on the domainSince 23915:4c4b72c94bac "" it is possible that no bus exists and this is not an error. Removes the following spurious warning when destroying a PV domain with no PCI devices:
libxl: error: libxl.c:759:libxl_domain_destroy: pci shutdown failed for domid 1005Signed-off-by Ian Campbell <[email protected]>diff -r
12ac478d1b56-re6af32ecb448tools/libxl/libxl_pci.ctools/libxl/libxl_pci.c Tue Oct 18 14:15:09 2011 +0100 renamed from tools/libxl/libxl_pci.c Tue Oct 18 13:36:43 2011 +0100 +1
-1@@ -1098,7 +1098,7 @@ int libxl__device_pci_destroy_all(libxl_ pcidevs = libxl_device_pci_list(ctx, domid, &num); if ( pcidevs == NULL ) - return ERROR_FAIL; + return 0; for (i = 0; i < num; i++) { /* Force remove on shutdown since, on HVM, qemu will not always
Re: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
Quoted 12 lines · Roger Pau Monné
2011/10/18 Ian Campbell <[email protected]>:
Quoted 11 lines · Roger Pau Monne
Quoted 9 lines
# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1317386335 -7200
# Node ID156626fef95b36184ad44dfcb049bae2545435f0# Parent31b3caad18ac904a242c5bd1ea2bb0e574cd0453
libxl: create pci backend only when there are pci devices.Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.
Quoted 8 lines
Quoted 2 lines
I think since this change we need the following. This applies after my big libxl API series:
Yes, this fixes the issue related to the error message "libxl: error:
libxl.c:759:libxl_domain_destroy: pci shutdown failed for domid". I don't know if I can do this, but anyway:Acked-by Roger Pau Monne <[email protected]>
Thanks. FWIW I would encourage anyone who wants and feels qualified to do so to review any patch and Ack it if they think it is sensible. More eyes doing review is always a good thing IMHO.
Quoted 35 lines
Quoted 35 lines
Ian.
8<------------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1318943709 -3600
# Node IDe6af32ecb4483457d5ad9a7b674c18aaf20cc085
# Parent12ac478d1b56f0ff4d3242138b780c551a69f107
libxl:libxl__device_pci_destroy_allshould succeed if there is no PCI bus on the domainSince 23915:4c4b72c94bac "" it is possible that no bus exists and this is not an error. Removes the following spurious warning when destroying a PV domain with no PCI devices:
libxl: error: libxl.c:759:libxl_domain_destroy: pci shutdown failed for domid 1005Signed-off-by Ian Campbell <[email protected]>diff -r
12ac478d1b56-re6af32ecb448tools/libxl/libxl_pci.ctools/libxl/libxl_pci.c Tue Oct 18 14:15:09 2011 +0100 renamed from tools/libxl/libxl_pci.c Tue Oct 18 13:36:43 2011 +0100 +1
-1@@ -1098,7 +1098,7 @@ int libxl__device_pci_destroy_all(libxl_ pcidevs = libxl_device_pci_list(ctx, domid, &num); if ( pcidevs == NULL ) - return ERROR_FAIL; + return 0; for (i = 0; i < num; i++) { /* Force remove on shutdown since, on HVM, qemu will not always
Re: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
Please remember that this patch fixing the removal of PCI entries has not been applied along with the "libxl: rationalise libxl_device_* APIs" series.
Re: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 4 of 9] libxl: create pci backend only when there are pci devices"):
Quoted 3 lines
Please remember that this patch fixing the removal of PCI entries has not been applied along with the "libxl: rationalise libxl_device_* APIs" series.
Thanks for the reminder. (I did have to dig a bit to find which patch you meant.)
Ian.
Ian Jackson
AppliedRe: [PATCH 4 of 9] libxl: create pci backend only when there are pci devices [and 1 more messages]
In reply to Ian CampbellIan Campbell writes ("Re: [Xen-devel] [PATCH 4 of 9] libxl: create pci backend only when there are pci devices"):
Quoted 1 line
libxl:
libxl__device_pci_destroy_allshould succeed if there is no PCI bus on the domain
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH 4 of 9] libxl: create pci backend only when there are pci devices"):
Quoted 1 line
Acked-by Roger Pau Monne <[email protected]>
Applied, thanks.
Ian.