From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 1/5] Add virttype parameter into virtual machine instantiation.
Date: Thu, 4 Jun 2015 14:28:35 +0800 [thread overview]
Message-ID: <1433399319-2314-2-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1433399319-2314-1-git-send-email-yong.liu@intel.com>
From: Marvin Liu <yong.liu@intel.com>
When virtype is XEN, request addtional host port operation.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
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
next prev parent reply other threads:[~2015-06-04 6:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 6:28 [dts] [PATCH 0/5] Optimize virtualization automation framework Yong Liu
2015-06-04 6:28 ` Yong Liu [this message]
2015-06-04 6:28 ` [dts] [PATCH 2/5] Change virtual machine default directory to host base_dir Yong Liu
2015-06-04 6:28 ` [dts] [PATCH 3/5] Optimize qemu kvm module functions and code style Yong Liu
2015-06-04 6:28 ` [dts] [PATCH 4/5] Add session close function in virt_dut module Yong Liu
2015-06-04 6:28 ` [dts] [PATCH 5/5] Support dynamic load test case in debug mode. Use can use "rerun" command to re-run the interrupted case 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=1433399319-2314-2-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).