From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 8469DB3D6 for ; Thu, 4 Jun 2015 08:28:52 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 03 Jun 2015 23:28:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,551,1427785200"; d="scan'208";a="581850486" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 03 Jun 2015 23:28:50 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t546SnZO018311; Thu, 4 Jun 2015 14:28:49 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t546Skrb002357; Thu, 4 Jun 2015 14:28:48 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t546Sko1002353; Thu, 4 Jun 2015 14:28:46 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 4 Jun 2015 14:28:35 +0800 Message-Id: <1433399319-2314-2-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433399319-2314-1-git-send-email-yong.liu@intel.com> References: <1433399319-2314-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 1/5] Add virttype parameter into virtual machine instantiation. X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2015 06:28:53 -0000 From: Marvin Liu When virtype is XEN, request addtional host port operation. Signed-off-by: Marvin Liu diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index e762695..707dd7b 100644 --- a/framework/qemu_kvm.py +++ b/framework/qemu_kvm.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/framework/virt_base.py b/framework/virt_base.py index 285c1d6..12aa318 100644 --- a/framework/virt_base.py +++ b/framework/virt_base.py @@ -241,13 +241,13 @@ class VirtBase(object): return True elif type(vm_except) is exception.VirtDutConnectException: # need stop vm - self.virt_obj.stop() + self.stop() return True elif type(vm_except) is exception.VirtDutInitException: # need close session vm_except.vm_dut.close_sessions() # need stop vm - self.virt_obj.stop() + self.stop() return True else: return False @@ -276,6 +276,7 @@ class VirtBase(object): vm_dut = VirtDut( crb, serializer, + self.virt_type, self.vm_name, self.suite) except: diff --git a/framework/virt_dut.py b/framework/virt_dut.py index 273b29e..b087220 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -54,7 +54,7 @@ class VirtDut(DPDKdut): or CRBBareMetal. """ - def __init__(self, crb, serializer, vm_name, suite): + def __init__(self, crb, serializer, virttype, vm_name, suite): super(Dut, self).__init__(crb, serializer) self.vm_ip = self.get_ip_address() self.NAME = 'virtdut' + LOG_NAME_SEP + '%s' % self.vm_ip @@ -77,6 +77,7 @@ class VirtDut(DPDKdut): self.architecture = None self.ports_info = None self.ports_map = [] + self.virttype = virttype def set_nic_type(self, nic_type): """ @@ -133,7 +134,10 @@ class VirtDut(DPDKdut): # scan ports before restore interface self.scan_ports() # restore dut ports to kernel - self.restore_interfaces() + if self.virttype != 'XEN': + self.restore_interfaces() + else: + self.restore_interfaces_domu() # rescan ports after interface up self.rescan_ports() @@ -153,6 +157,27 @@ class VirtDut(DPDKdut): for port_info in self.ports_info: self.logger.info(port_info) + def restore_interfaces_domu(self): + """ + Restore Linux interfaces. + """ + for port in self.ports_info: + pci_bus = port['pci'] + pci_id = port['type'] + driver = settings.get_nic_driver(pci_id) + if driver is not None: + addr_array = pci_bus.split(':') + bus_id = addr_array[0] + devfun_id = addr_array[1] + port = NetDevice(self, bus_id, devfun_id) + itf = port.get_interface_name() + self.send_expect("ifconfig %s up" % itf, "# ") + time.sleep(30) + print self.send_expect("ip link ls %s" % itf, "# ") + else: + self.logger.info( + "NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id)) + def pci_devices_information(self): self.pci_devices_information_uncached() @@ -170,6 +195,8 @@ class VirtDut(DPDKdut): if pci_id == "8086:100e": return False return True + # load vm port conf need another function + # need add vitrual function device into NICS def scan_ports(self): """ -- 1.9.3