[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v6 11/13] xencommons: move module list into a generic place



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

This will allows us to share the same module list with
sysemd, and lets us upkeep it in one place. Document this
while at it on the top level README and expand on the wiki:

http://wiki.xen.org/wiki/Category:Host_Configuration#Linux_kernel_modules

In order to upkeep parallelism builds be explicit about the
requirement to complete all actions before any installation
targets.

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 README                                             | 18 +++++++++++
 config/modules                                     | 16 ++++++++++
 tools/hotplug/Linux/Makefile                       | 36 +++++++++++++++++++---
 .../Linux/init.d/{xencommons => xencommons.in}     | 16 +---------
 4 files changed, 67 insertions(+), 19 deletions(-)
 create mode 100644 config/modules
 rename tools/hotplug/Linux/init.d/{xencommons => xencommons.in} (89%)

diff --git a/README b/README
index 9bbe734..34d7c0b 100644
--- a/README
+++ b/README
@@ -129,6 +129,24 @@ performed with root privileges.]
    versions of those scripts, so that you can copy the dist directory
    to another machine and install from that distribution.
 
+Required Linux modules
+======================
+
+Xen has a set of Linux modules which the init scripts ensure to load before
+enablement of xen guests. The list of modules are upkept in one place:
+
+  * config/modules
+
+The file supports a simple language, comments are ignored, and if you there
+are module replacements this can be listed by using a pipe to show preference
+for the first module, followed by the older module.
+
+We should strive to not require statically loading modules but it seems some
+systems have had issues with automatically loading some Linux kernel modules.
+For more details refer to:
+
+http://wiki.xen.org/wiki/Category:Host_Configuration#Linux_kernel_modules
+
 Python Runtime Libraries
 ========================
 
diff --git a/config/modules b/config/modules
new file mode 100644
index 0000000..525c60e
--- /dev/null
+++ b/config/modules
@@ -0,0 +1,16 @@
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+# Prefer to load blktap2 if found, otherwise load blktap
+blktap2|blktap
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index d5de9e6..90b0b0c 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -33,17 +33,45 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all:
+all: $(XENCOMMONS_INITD)
+
+$(XENCOMMONS_INITD): $(XEN_ROOT)/config/modules $(XENCOMMONS_INITD).in
+       @set -e ;                                                       \
+       IFS=''                                                          ;\
+       cat  $(XEN_ROOT)/config/modules | (                             \
+               while read l ; do                                       \
+                       if echo $${l} | egrep -q "^#" ; then            \
+                               continue                                ;\
+                       fi                                              ;\
+                       if echo "$${l}" | egrep -q "\|" ; then          \
+                               m1=$${l%%|*}                            ;\
+                               m2=$${l#*|}                             ;\
+                               echo "        modprobe $$m1 2>/dev/null || 
modprobe $$m2 2>/dev/null" ;\
+                       else                                            \
+                               echo "        modprobe $$l 2>/dev/null"         
;\
+                       fi                                              ;\
+               done                                                    \
+       ) > $(XENCOMMONS_INITD).modules                                 ;\
+       cat  $(XENCOMMONS_INITD).in     | (                             \
+               while read l ; do                                       \
+                       if echo "$${l}" | egrep -q "@LOAD_MODULES@" ; then \
+                               cat $(XENCOMMONS_INITD).modules         ;\
+                       else                                            \
+                               echo $$l                                ;\
+                       fi                                              ;\
+               done                                                    \
+       ) > $@
+       @rm -f $(XENCOMMONS_INITD).modules
 
 .PHONY: build
-build:
+build: all
 
 .PHONY: install
 install: all install-initd install-scripts install-udev
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
-install-initd:
+install-initd: all
        [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
        [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) 
$(DESTDIR)$(SYSCONFIG_DIR)
        [ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
@@ -55,7 +83,7 @@ install-initd:
        $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
 
 .PHONY: install-scripts
-install-scripts:
+install-scripts: all
        [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
                $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
        set -e; for i in $(XEN_SCRIPTS); \
diff --git a/tools/hotplug/Linux/init.d/xencommons 
b/tools/hotplug/Linux/init.d/xencommons.in
similarity index 89%
rename from tools/hotplug/Linux/init.d/xencommons
rename to tools/hotplug/Linux/init.d/xencommons.in
index 4ebd636..3939bcc 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons.in
@@ -57,21 +57,7 @@ do_start () {
         local time=0
        local timeout=30
 
-       modprobe xen-evtchn 2>/dev/null
-       modprobe xen-gntdev 2>/dev/null
-       modprobe xen-gntalloc 2>/dev/null
-       modprobe xen-blkback 2>/dev/null
-       modprobe xen-netback 2>/dev/null
-       modprobe xen-pciback 2>/dev/null
-       modprobe evtchn 2>/dev/null
-       modprobe gntdev 2>/dev/null
-       modprobe netbk 2>/dev/null
-       modprobe blkbk 2>/dev/null
-       modprobe xen-scsibk 2>/dev/null
-       modprobe usbbk 2>/dev/null
-       modprobe pciback 2>/dev/null
-       modprobe xen-acpi-processor 2>/dev/null
-       modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null
+       @LOAD_MODULES@
        mkdir -p /var/run/xen
 
        if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
-- 
2.0.0.rc3.18.g00a5b79


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.