File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 40
40
hook_script = ' #! /bin/bash;echo "$0" "$@" >> %s;exit 1;'
41
41
- network_t:
42
42
test_network = " yes"
43
+ net_name = " default"
43
44
hook_file = " /etc/libvirt/hooks/network"
44
45
hook_log = " /tmp/network.log"
45
46
- error_test:
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ def start_stop_hook():
73
73
prepare_hook_file (hook_script %
74
74
(vm_name , hook_log ))
75
75
vm .start ()
76
+ vm .wait_for_login ().close ()
76
77
try :
77
78
hook_str = hook_para + " prepare begin -"
78
79
assert check_hooks (hook_str )
@@ -255,11 +256,26 @@ def attach_hook():
255
256
raise error .TestFail ("Failed to check"
256
257
" attach hooks" )
257
258
259
+ def edit_iface (net_name ):
260
+ """
261
+ Edit interface options for vm.
262
+ """
263
+ vmxml = vm_xml .VMXML .new_from_dumpxml (vm .name )
264
+ iface_xml = vmxml .get_devices (device_type = "interface" )[0 ]
265
+ vmxml .del_device (iface_xml )
266
+ iface_xml .type_name = "network"
267
+ iface_xml .source = {"network" : net_name }
268
+ del iface_xml .address
269
+ vmxml .add_device (iface_xml )
270
+ vmxml .sync ()
271
+
258
272
def network_hook ():
259
273
"""
260
274
Check network hooks.
261
275
"""
262
- net_name = "default"
276
+ # Set interface to use default network
277
+ net_name = params .get ("net_name" , "default" )
278
+ edit_iface (net_name )
263
279
prepare_hook_file (hook_script %
264
280
(net_name , hook_log ))
265
281
try :
You can’t perform that action at this time.
0 commit comments