Skip to contentSkip to conversation

Add ability to install custom kernel modules

PATCH In review Mike Burns 2 participants 3 messages May 20, 2009 KVM

lore
Share & tools
lore

Mike Burns

author
#0 lore raw

PATCH 1/1 Add ability to install custom kernel modules

See comments and example in control file for details.

---
 client/tests/kvm_runtest_2/control        |    6 ++++++
 client/tests/kvm_runtest_2/kvm_install.py |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
client/tests/kvm_runtest_2/control +6 -0
index d6e26bc..02b1d22 100644
@@ -74,6 +74,12 @@ params = {
     
     ## Custom install
     "install_script": 'custom_kvm_install.sh param1'
+
+    ## Additional kernel modules to install
+    ## Must be a comma separated list of values
+    ## Installed in the order they are listed.
+    ## to install mod1.ko, mod2.ko, mod3.ko, you would set like this:
+    #"additional_modules": 'mod1,mod2,mod3'
 }
 
 # Comment the job.run_test line if you do not want to install kvm on the host.
client/tests/kvm_runtest_2/kvm_install.py +7 -0
index 392ef0c..4b703f6 100755
@@ -237,6 +237,13 @@ def __load_kvm_modules():
         os.chdir("x86")
     utils.system("/sbin/insmod ./kvm.ko && sleep 1 && /sbin/insmod ./kvm-%s.ko" % vendor)
 
+    #Add additional modules specified in params by "additional_modules"
+    #Modules must be named <value>.ko and be located in the 
+    #same location as kvm and kvm-vendor modules
+    for module in params.get("additional_modules").split(","):
+      kvm_log.info("Installing module \"%s\"" % module)
+      utils.system("/sbin/insmod ./%s.ko" % module )
+
     #elif self.config.load_modules == "no":
         #kvm_log.info("user requested not to load kvm modules")
 
Signature · 1 line
1.5.5.6
author
#1 lore raw

Just found out this is really not going to work like I thought it would. I'll rework and repost later.

Quoted 44 lines · Mike Burns

See comments and example in control file for details.

---
 client/tests/kvm_runtest_2/control        |    6 ++++++
 client/tests/kvm_runtest_2/kvm_install.py |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
client/tests/kvm_runtest_2/control +6 -0
index d6e26bc..02b1d22 100644
@@ -74,6 +74,12 @@ params = {
 
     ## Custom install
     "install_script": 'custom_kvm_install.sh param1'
+
+    ## Additional kernel modules to install
+    ## Must be a comma separated list of values
+    ## Installed in the order they are listed.
+    ## to install mod1.ko, mod2.ko, mod3.ko, you would set like this:
+    #"additional_modules": 'mod1,mod2,mod3'
 }
 
 # Comment the job.run_test line if you do not want to install kvm on the host.
client/tests/kvm_runtest_2/kvm_install.py +7 -0
index 392ef0c..4b703f6 100755
@@ -237,6 +237,13 @@ def __load_kvm_modules():
         os.chdir("x86")
     utils.system("/sbin/insmod ./kvm.ko && sleep 1 && /sbin/insmod ./kvm-%s.ko" % vendor)
 
+    #Add additional modules specified in params by "additional_modules"
+    #Modules must be named <value>.ko and be located in the 
+    #same location as kvm and kvm-vendor modules
+    for module in params.get("additional_modules").split(","):
+      kvm_log.info("Installing module \"%s\"" % module)
+      utils.system("/sbin/insmod ./%s.ko" % module )
+
     #elif self.config.load_modules == "no":
         #kvm_log.info("user requested not to load kvm modules")
 
#2 lore raw
In reply to Mike Burns
Quoted 22 lines · ----- "Mike Burns

See comments and example in control file for details.

---
 client/tests/kvm_runtest_2/control        |    6 ++++++
 client/tests/kvm_runtest_2/kvm_install.py |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
client/tests/kvm_runtest_2/control +5 -0
index d6e26bc..02b1d22 100644
@@ -74,6 +74,12 @@ params = {
 
     ## Custom install
     "install_script": 'custom_kvm_install.sh param1'
+
+    ## Additional kernel modules to install
+    ## Must be a comma separated list of values
+    ## Installed in the order they are listed.
+    ## to install mod1.ko, mod2.ko, mod3.ko, you would set like
Quoted 3 lines

this:
+ #"additional_modules": 'mod1,mod2,mod3'
}

Just for consistency, maybe we should make it a space separated list? Every other list is separated by spaces, like 'vms = vm1 dst'.

Quoted 14 lines

# Comment the job.run_test line if you do not want to install kvm on
the host.

client/tests/kvm_runtest_2/kvm_install.py +1 -0
index 392ef0c..4b703f6 100755
@@ -237,6 +237,13 @@ def __load_kvm_modules():
         os.chdir("x86")
     utils.system("/sbin/insmod ./kvm.ko && sleep 1 && /sbin/insmod
 ./kvm-%s.ko" % vendor)
 
+    #Add additional modules specified in params by

"additional_modules"

client/tests/kvm_runtest_2/kvm_install.py def __load_kvm_modules(): · line 243

Quoted 3 lines
client/tests/kvm_runtest_2/kvm_install.py +3 -0
+    #Modules must be named <value>.ko and be located in the 
+    #same location as kvm and kvm-vendor modules
+    for module in params.get("additional_modules").split(","):

It should probably be a good idea to provide a default value here, because "additional_modules" isn't necessarily defined, in which case split() will throw an exception. Something like:
params.get("additional_modules", "")
which returns "" in case "additional_modules" is undefined.

Quoted 13 lines
client/tests/kvm_runtest_2/kvm_install.py +3 -0
+      kvm_log.info("Installing module \"%s\"" % module)
+      utils.system("/sbin/insmod ./%s.ko" % module )
+
     #elif self.config.load_modules == "no":
         #kvm_log.info("user requested not to load kvm modules")
Signature · 7 lines
-- 
1.5.5.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html