Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions libvirt/tests/cfg/virtual_network/iface_network.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
start_vm = "no"
status_error = "no"
start_error = "no"
preferred_iface_state = "UP"
variants:
- rom_test:
variants:
Expand Down
1 change: 1 addition & 0 deletions libvirt/tests/cfg/virtual_network/iface_options.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
start_vm = "no"
status_error = "no"
start_error = "no"
preferred_iface_state = "UP"
variants:
- iface_source_default:
test_iface_option_cmd = "yes"
Expand Down
7 changes: 6 additions & 1 deletion libvirt/tests/src/virtual_network/iface_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ def modify_iface_xml(sync=True):
source = ast.literal_eval(iface_source)
if not source:
source = {"network": "default"}
net_ifs = utils_net.get_net_if(state="UP")
preferred_state = params.get("preferred_iface_state", "UP")
net_ifs = utils_net.get_net_if(state=preferred_state)
# if no interfaces are available in preferred state,
# cancel the test
if len(net_ifs) == 0:
test.cancel("No active network interface available on host")
# Check source device is valid or not,
# if it's not in host interface list, try to set
# source device to first active interface of host
Expand Down
7 changes: 6 additions & 1 deletion libvirt/tests/src/virtual_network/iface_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ def modify_iface_xml(update, status_error=False):
del iface.source
source = iface_source
if source:
net_ifs = utils_net.get_net_if(state="UP")
preferred_state = params.get("preferred_iface_state", "UP")
net_ifs = utils_net.get_net_if(state=preferred_state)
# if no interfaces are available in preferred state,
# cancel the test
if len(net_ifs) == 0:
test.cancel("No active network interface available on host")
# Check source device is valid or not,
# if it's not in host interface list, try to set
# source device to first active interface of host
Expand Down