test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [dts 7/9] Optimize VF devices creation and network devices pass-through function
Date: Thu, 18 Jun 2015 11:06:42 +0800	[thread overview]
Message-ID: <1434596804-16846-8-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1434596804-16846-1-git-send-email-yong.liu@intel.com>

From: Marvin Liu <yong.liu@intel.com>

Add pt devices list in qemu_kvm module which can support devices free in
virtual scenario module.
Support netdevie object get by pci address.

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

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index 8e0582a..6320a43 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -88,6 +88,9 @@ class QEMUKvm(VirtBase):
         self.char_idx = 0
         self.netdev_idx = 0
 
+        # devices pass-through into vm
+        self.pt_devices = []
+
     def set_vm_default(self):
         self.set_vm_name(self.vm_name)
         self.set_vm_enable_kvm()
@@ -534,6 +537,7 @@ class QEMUKvm(VirtBase):
         if 'opt_host' in options.keys() and \
                 options['opt_host']:
             dev_boot_line += separator + 'host=%s' % options['opt_host']
+            self.pt_devices.append(options['opt_host'])
         if 'opt_addr' in options.keys() and \
                 options['opt_addr']:
             dev_boot_line += separator + 'addr=%s' % options['opt_addr']
@@ -773,7 +777,7 @@ class QEMUKvm(VirtBase):
         cpus = self.virt_pool.alloc_cpu(vm=self.vm_name, corelist=req_cpus)
 
         if len(req_cpus) != len(cpus):
-            self.host_logger.warn("VCPUs not enough, required [ %s ], just [ %s ]" %
+            self.host_logger.warning("VCPUs not enough, required [ %s ], just [ %s ]" %
                                   (req_cpus, cpus))
             raise Exception("No enough required vcpus!!!")
 
@@ -904,6 +908,9 @@ class QEMUKvm(VirtBase):
                     return ip
         return ''
 
+    def get_vm_pt_devices(self):
+        return self.pt_devices
+
     def __control_session(self, command, *args):
         """
         Use the qemu guest agent service to control VM.
@@ -935,10 +942,9 @@ class QEMUKvm(VirtBase):
 
         return out
 
-    def stop(self):
+    def _stop_vm(self):
         """
         Stop VM.
         """
         self.__control_session('powerdown')
         time.sleep(5)
-        self.virt_pool.free_all_resource(self.vm_name)
diff --git a/framework/settings.py b/framework/settings.py
index 19ebe6b..d3cdf80 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -189,3 +189,14 @@ def accepted_nic(pci_id):
             return True
 
     return False
+
+def get_netdev(crb, pci):
+    for port in crb.ports_info:
+        if pci == port['pci']:
+            return port['port']
+        if 'vfs_port' in port.keys():
+            for vf in port['vfs_port']:
+                if pci == vf.pci:
+                    return vf
+
+    return None
diff --git a/framework/test_case.py b/framework/test_case.py
index a519691..5013123 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -49,7 +49,10 @@ class TestCase(object):
         for portid in range(len(self.dut.ports_info)):
             nic_type = self.dut.ports_info[portid]['type']
             self.nics.append(nic_name_from_type(nic_type))
-        self.nic = self.nics[0]
+        if len(self.nics):
+            self.nic = self.nics[0]
+        else:
+            self.nic = ''
 
     def set_up_all(self):
         pass
-- 
1.9.3

  parent reply	other threads:[~2015-06-18  3:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18  3:06 [dts] [dts 0/9] Support virtual scenarios Yong Liu
2015-06-18  3:06 ` [dts] [dts 1/9] Optimize config load module with proper execption raised Yong Liu
2015-06-18  3:06 ` [dts] [dts 2/9] Implement virtual scenario module Yong Liu
2015-06-18  3:06 ` [dts] [dts 3/9] Support virtual scenario in dts main process Yong Liu
2015-06-18  3:06 ` [dts] [dts 4/9] Optimize network topology discovery routine in virtual scenario Yong Liu
2015-06-18  3:06 ` [dts] [dts 5/9] Optimize set_target function for " Yong Liu
2015-06-18  3:06 ` [dts] [dts 6/9] Support auto_map and set_target flag in vm initialization Yong Liu
2015-06-18  3:06 ` Yong Liu [this message]
2015-06-18  3:06 ` [dts] [dts 8/9] Optimize ssh_pexpect and virt_resource module Yong Liu
2015-06-18  3:06 ` [dts] [dts 9/9] Add three typical virtual scenario configuration files Yong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434596804-16846-8-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).