Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QEMU_VM: Add nic_extra_param_types support #4045

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion virttest/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,24 @@ def add_nic(
dev.parent_bus = pci_bus
dev.set_param("addr", pci_addr)
if nic_extra_params:
nic_extra_params_type = dict(
eval(self.params.get("nic_extra_params_type", {}))
vivianQizhu marked this conversation as resolved.
Show resolved Hide resolved
)
nic_extra_params = (
_.split("=", 1) for _ in nic_extra_params.split(",") if _
)
for key, val in nic_extra_params:
dev.set_param(key, val)
value_type = nic_extra_params_type.get(key)
if value_type:
try:
converted_val = eval(value_type)(val)
dev.set_param(key, converted_val)
except ValueError as e:
raise ValueError(
f"Failed to convert {key}: {val} to {value_type}: {e}"
)
else:
dev.set_param(key, val)
dev.set_param("bootindex", bootindex)
if "aarch64" in params.get("vm_arch_name", arch.ARCH):
if "rombar" in devices.execute_qemu("-device %s,?" % model):
Expand Down