[dts] [PATCH v1 2/3] framework/virt_base: add default kernel driver option

Marvin Liu yong.liu at intel.com
Wed Mar 7 18:06:07 CET 2018


If default driver is configured for VM, it will be setup when
initializing VM. Default kernel driver is DPDK igb_uio, suite owner can
change the default setting in VM local configuration file.

Signed-off-by: Marvin Liu <yong.liu at intel.com>

diff --git a/conf/virt_global.cfg b/conf/virt_global.cfg
index 58ca061..e47c6f3 100644
--- a/conf/virt_global.cfg
+++ b/conf/virt_global.cfg
@@ -24,6 +24,8 @@ cpu =
     number=4,cpupin=3 4 5 6;
 mem =
     size=2048;
+def_driver =
+    driver_name=igb_uio;
 [KVM]
 cpu = 
     model=host,number=4,cpupin=3 4 5 6;
@@ -35,6 +37,8 @@ control =
     type=qga;
 vnc =
     disable=False;
+def_driver =
+    driver_name=igb_uio;
 [XEN]
 cpu = 
     number=4,cpupin=3 4 5 6;
@@ -42,3 +46,5 @@ mem =
     size=2048;
 vif =
     mac=random,bridge=br0
+def_driver =
+    driver_name=igb_uio;
diff --git a/framework/virt_base.py b/framework/virt_base.py
index b26a25a..fd2faeb 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -92,6 +92,10 @@ class VirtBase(object):
         # vm status is running by default, only be changed in internal module
         self.vm_status = ST_RUNNING
 
+        # by default no special kernel module is required
+        self.def_driver = ''
+        self.driver_mode = ''
+
     def get_virt_type(self):
         """
         Get the virtual type, such as KVM, XEN or LIBVIRT.
@@ -184,6 +188,15 @@ class VirtBase(object):
                 self.host_logger.error(traceback.print_exception(*sys.exc_info()))
                 raise exception.VirtConfigParamException(key)
 
+    def add_vm_def_driver(self, **options):
+        """
+        Set default driver which may required when setup VM
+        """
+        if 'driver_name' in options.keys():
+            self.def_driver = options['driver_name']
+        if 'driver_mode' in options.keys():
+            self.driver_mode = options['driver_mode']
+
     def find_option_index(self, option):
         """
         Find the boot option in the params which is generated from
@@ -423,7 +436,7 @@ class VirtBase(object):
             vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches, autodetect_topo)
             if set_target:
                 target = self.host_dut.target
-                vm_dut.set_target(target, bind_dev)
+                vm_dut.set_target(target, bind_dev, self.def_driver, self.driver_mode)
         except:
             raise exception.VirtDutInitException(vm_dut)
             return None
-- 
1.9.3



More information about the dts mailing list