[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/6] libxl: Remove linux udev rules
They are no longer needed, having been replaced by a daemon for driverdomains which will run scripts as necessary. Worse yet, they seem to be broken for script-based block devices, such as block-iscsi. This wouldn't matter so much if they were never run by default; but if you run block-attach without having created a domain, then the appropriate node to disable running udev scripts will not have been written yet, and the attach will silently fail. Rather than try to sort out that issue, just remove them entirely. Note: This changes tools/configure.ac, so autogen.sh may need to be re-run. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx> --- CC: Ian Campbell <ian.campbell@xxxxxxxxxx> CC: Ian Jackson <ian.jackson@xxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> CC: Roger Pau Monne <roger.pau@xxxxxxxxxx> There was some concern that old udev scripts may end up lying around in /etc which will still trigger and run unless libxl/disable_udev exists. If that's a concern, then for one release we might consider writing libxl/disable_udev manually in xencommons or something to make sure that they don't trigger. --- tools/configure | 13 ++++++------- tools/configure.ac | 1 - tools/examples/README | 1 - tools/hotplug/Linux/Makefile | 14 +------------- tools/hotplug/Linux/xen-backend.rules.in | 13 ------------- tools/hotplug/Linux/xen-hotplug-common.sh.in | 7 ------- tools/libxl/libxl.c | 13 ------------- tools/libxl/libxl_create.c | 27 --------------------------- tools/libxl/libxl_internal.c | 19 ------------------- tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_linux.c | 7 ------- tools/libxl/libxl_netbsd.c | 7 ------- 12 files changed, 7 insertions(+), 116 deletions(-) diff --git a/tools/configure b/tools/configure index c940dd1..5138f3d 100755 --- a/tools/configure +++ b/tools/configure @@ -2403,7 +2403,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/vif-setup hotplug/Linux/xen-backend.rules hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons libxl/xenlight.pc.in libxl/xlutil.pc.in" +ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons libxl/xenlight.pc.in libxl/xlutil.pc.in" ac_config_headers="$ac_config_headers config.h" @@ -3343,7 +3343,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -3389,7 +3389,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -3413,7 +3413,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -3458,7 +3458,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -3482,7 +3482,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -10050,7 +10050,6 @@ do "hotplug/Linux/init.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xencommons" ;; "hotplug/Linux/init.d/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendomains" ;; "hotplug/Linux/vif-setup") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/vif-setup" ;; - "hotplug/Linux/xen-backend.rules") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-backend.rules" ;; "hotplug/Linux/xen-hotplug-common.sh") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-hotplug-common.sh" ;; "hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;; "hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;; diff --git a/tools/configure.ac b/tools/configure.ac index 2d371f4..8bfdfcb 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -13,7 +13,6 @@ hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/vif-setup -hotplug/Linux/xen-backend.rules hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons diff --git a/tools/examples/README b/tools/examples/README index 115ca02..13380a4 100644 --- a/tools/examples/README +++ b/tools/examples/README @@ -24,7 +24,6 @@ vif-nat - xen virtual network start/stop script in NAT mode vif-route - xen virtual network start/stop script in routed mode xen-backend.agent - calls block, vif-* scripts to add, remove, hotplug devices -xen-backend.rules - hotplug script rules xen-hotplug-common.sh - sourced by vif-common.sh xen-network-common.sh - sourced by vif-common.sh xen-script-common.sh - sourced by xen-hotplug-common.sh diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile index d94a9cb..8bb2316 100644 --- a/tools/hotplug/Linux/Makefile +++ b/tools/hotplug/Linux/Makefile @@ -32,9 +32,6 @@ XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh -UDEV_RULES_DIR = $(CONFIG_DIR)/udev -UDEV_RULES = xen-backend.rules $(UDEV_RULES-y) - .PHONY: all all: subdirs-all @@ -42,7 +39,7 @@ all: subdirs-all build: .PHONY: install -install: install-initd install-scripts install-udev subdirs-install +install: install-initd install-scripts subdirs-install # See docs/misc/distro_mapping.txt for INITD_DIR location .PHONY: install-initd @@ -70,15 +67,6 @@ install-scripts: $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ done -.PHONY: install-udev -install-udev: - [ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \ - $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)/rules.d - set -e; for i in $(UDEV_RULES); \ - do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(UDEV_RULES_DIR)/rules.d; \ - done - .PHONY: clean clean: subdirs-clean diff --git a/tools/hotplug/Linux/xen-backend.rules.in b/tools/hotplug/Linux/xen-backend.rules.in deleted file mode 100644 index ee107af..0000000 --- a/tools/hotplug/Linux/xen-backend.rules.in +++ /dev/null @@ -1,13 +0,0 @@ -SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/block $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="@XEN_SCRIPT_DIR@/vif2 $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="@XEN_SCRIPT_DIR@/vif-setup online type_if=vif" -SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="@XEN_SCRIPT_DIR@/vif-setup offline type_if=vif" -SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="@XEN_SCRIPT_DIR@/vscsi $env{ACTION}" -SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/xen-hotplug-cleanup" -KERNEL=="evtchn", NAME="xen/%k" -SUBSYSTEM=="blktap2", KERNEL=="blktap[0-9]*", NAME="xen/blktap-2/%k", MODE="0600" -KERNEL=="blktap-control", NAME="xen/blktap-2/control", MODE="0600" -KERNEL=="gntdev", NAME="xen/%k", MODE="0600" -KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600" -KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600" -SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/vif-setup $env{ACTION} type_if=tap" diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh.in b/tools/hotplug/Linux/xen-hotplug-common.sh.in index 40b933e..afb240f 100644 --- a/tools/hotplug/Linux/xen-hotplug-common.sh.in +++ b/tools/hotplug/Linux/xen-hotplug-common.sh.in @@ -15,13 +15,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Hack to prevent the execution of hotplug scripts from udev if the domain -# has been launched from libxl -if [ -n "${UDEV_CALL}" ] && \ - xenstore-read "libxl/disable_udev" >/dev/null 2>&1; then - exit 0 -fi - dir=$(dirname "$0") . "$dir/hotplugpath.sh" . "$dir/logging.sh" diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 92563db..3a83903 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3211,7 +3211,6 @@ out: int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic, uint32_t domid) { - int run_hotplug_scripts; int rc; if (!nic->mtu) @@ -3242,12 +3241,6 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic, libxl__xen_script_dir_path()) < 0 ) return ERROR_FAIL; - run_hotplug_scripts = libxl__hotplug_settings(gc, XBT_NULL); - if (run_hotplug_scripts < 0) { - LOG(ERROR, "unable to get current hotplug scripts execution setting"); - return run_hotplug_scripts; - } - rc = libxl__resolve_domid(gc, nic->backend_domname, &nic->backend_domid); if (rc < 0) return rc; @@ -4550,12 +4543,6 @@ int libxl_device_events_handler(libxl_ctx *ctx, goto out; } - rc = libxl__xs_write_checked(gc, XBT_NULL, DISABLE_UDEV_PATH, "1"); - if (rc) { - LOGE(ERROR, "unable to write %s = 1", DISABLE_UDEV_PATH); - goto out; - } - /* * We use absolute paths because we want xswatch to also return * absolute paths that can be parsed by libxl__parse_backend_path. diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f799081..9c2303c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -682,33 +682,6 @@ retry_transaction: goto out; } libxl_vminfo_list_free(vm_list, nb_vm); - int hotplug_setting = libxl__hotplug_settings(gc, t); - if (hotplug_setting < 0) { - LOG(ERROR, "unable to get current hotplug scripts execution setting"); - rc = ERROR_FAIL; - goto out; - } - if (libxl_defbool_val(info->run_hotplug_scripts) != hotplug_setting && - (nb_vm - 1)) { - LOG(ERROR, "cannot change hotplug execution option once set, " - "please shutdown all guests before changing it"); - rc = ERROR_FAIL; - goto out; - } - - if (libxl_defbool_val(info->run_hotplug_scripts)) { - rc = libxl__xs_write_checked(gc, t, DISABLE_UDEV_PATH, "1"); - if (rc) { - LOGE(ERROR, "unable to write %s = 1", DISABLE_UDEV_PATH); - goto out; - } - } else { - rc = libxl__xs_rm_checked(gc, t, DISABLE_UDEV_PATH); - if (rc) { - LOGE(ERROR, "unable to delete %s", DISABLE_UDEV_PATH); - goto out; - } - } xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string)); xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/name", vm_path), info->name, strlen(info->name)); diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index c2c67bd..42d548e 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -376,25 +376,6 @@ int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid) return value; } -int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t t) -{ - int rc = 0; - char *val; - - val = libxl__xs_read(gc, t, DISABLE_UDEV_PATH); - if (!val && errno != ENOENT) { - LOGE(ERROR, "cannot read %s from xenstore", DISABLE_UDEV_PATH); - rc = ERROR_FAIL; - goto out; - } - if (!val) val = "0"; - - rc = !!atoi(val); - -out: - return rc; -} - /* Portability note: this lock utilises flock(2) so a proper implementation of * flock(2) is required. */ diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index d52589e..7129aee 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -104,7 +104,6 @@ #define STUBDOM_CONSOLE_SERIAL 3 #define STUBDOM_SPECIAL_CONSOLES 3 #define TAP_DEVICE_SUFFIX "-emu" -#define DISABLE_UDEV_PATH "libxl/disable_udev" #define DOMID_XS_PATH "domid" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c index f42a89a..512d2c9 100644 --- a/tools/libxl/libxl_linux.c +++ b/tools/libxl/libxl_linux.c @@ -236,15 +236,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev, libxl__device_action action, int num_exec) { - char *disable_udev = libxl__xs_read(gc, XBT_NULL, DISABLE_UDEV_PATH); int rc; - /* Check if we have to run hotplug scripts */ - if (!disable_udev) { - rc = 0; - goto out; - } - switch (dev->backend_kind) { case LIBXL__DEVICE_KIND_VBD: if (num_exec != 0) { diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c index a2a962e..096c057 100644 --- a/tools/libxl/libxl_netbsd.c +++ b/tools/libxl/libxl_netbsd.c @@ -64,15 +64,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev, libxl__device_action action, int num_exec) { - char *disable_udev = libxl__xs_read(gc, XBT_NULL, DISABLE_UDEV_PATH); int rc; - /* Check if we have to run hotplug scripts */ - if (!disable_udev || num_exec > 0) { - rc = 0; - goto out; - } - switch (dev->backend_kind) { case LIBXL__DEVICE_KIND_VBD: case LIBXL__DEVICE_KIND_VIF: -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |