提交 4746c2f9 编写于 作者: Y Yang Feng

Merge pull request #694 from FengYang/sr-iov

sr-iov:  Update PciAssignable class to support more feature.
......@@ -21,7 +21,7 @@
pci_assignable_nic2 = vf
- vf_boot_vms:
type = boot
vms = 'vm1 vm2'
vms += ' vm2'
nics = 'nic1 nic2'
pci_assignable = vf
image_snapshot = yes
......
import re
import logging
from autotest.client.shared import error
from virttest import utils_misc, aexpect, utils_test
from virttest import utils_misc, aexpect, utils_test, utils_net
@error.context_aware
......@@ -180,8 +180,18 @@ def run_sr_iov_hotplug(test, params, env):
pci_model = params.get("pci_model", "pci-assign")
# Need udpate match_string if you use a card other than 82576
match_string = params.get("match_string", "82576")
devices = []
device_type = params.get("hotplug_device_type", "vf")
for i in xrange(pci_num_range):
device = {}
device["type"] = device_type
device['mac'] = utils_net.generate_mac_address_simple()
if params.get("device_name"):
device["name"] = params.get("device_name")
devices.append(device)
if vm.pci_assignable is not None:
pa_pci_ids = vm.pci_assignable.request_devs(pci_num_range)
pa_pci_ids = vm.pci_assignable.request_devs(devices)
# Modprobe the module if specified in config file
module = params.get("modprobe_module")
......
......@@ -2,7 +2,7 @@ import logging
import os
from autotest.client.shared import error
from autotest.client import utils
from virttest import utils_test, utils_misc
from virttest import utils_test, utils_misc, utils_net
@error.context_aware
......@@ -58,8 +58,15 @@ def run_sr_iov_hotplug_negative(test, params, env):
msg = "Try to remove sr-iov module in host."
error.context(msg, logging.info)
utils.system(modprobe_cmd)
device = {}
device["type"] = params.get("hotplug_device_type", "vf")
device['mac'] = utils_net.generate_mac_address_simple()
if params.get("device_name"):
device["name"] = params.get("device_name")
if vm.pci_assignable is not None:
pa_pci_ids = vm.pci_assignable.request_devs(1)
pa_pci_ids = vm.pci_assignable.request_devs(device)
# Probe qemu to verify what is the supported syntax for PCI hotplug
if vm.monitor.protocol == 'qmp':
cmd_output = vm.monitor.info("commands")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册