@@ -83,12 +83,8 @@ def test_install_821_uefi(self, iso_remaster, create_vms):
83
83
).returncode == 1 ,
84
84
"Wait for installer to terminate" )
85
85
86
- # powercycle, catch any change of IP
87
86
logging .info ("Shutting down Host VM after successful installation" )
88
87
try :
89
- # use "poweroff" because "reboot" would cause ARP and
90
- # SSH to be checked before host is down, and require
91
- # ssh retries
92
88
host_vm .ssh (["poweroff" ])
93
89
except commands .SSHCommandFailed as e :
94
90
# ignore connection closed by reboot
@@ -100,12 +96,42 @@ def test_install_821_uefi(self, iso_remaster, create_vms):
100
96
wait_for (host_vm .is_halted , "Wait for host VM halted" )
101
97
host_vm .eject_cd ()
102
98
103
- # FIXME: make a snapshot here
99
+ except Exception as e :
100
+ logging .critical ("caught exception %s" , e )
101
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
102
+ host_vm .shutdown (force = True )
103
+ raise
104
+ except KeyboardInterrupt :
105
+ logging .warning ("keyboard interrupt" )
106
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
107
+ host_vm .shutdown (force = True )
108
+ raise
109
+
110
+ # record this state
111
+ # FIXME move to fixture
112
+ # FIXME where to store?
113
+ host_vm .host .ssh (["rm -f test_install_821_uefi-vm1.xva" ])
114
+ host_vm .export ("test_install_821_uefi-vm1.xva" , "zstd" )
104
115
116
+ @pytest .mark .vm_definitions (
117
+ dict (name = "vm 1" ,
118
+ image = "test_install_821_uefi-vm1.xva"
119
+ ))
120
+ def test_firstboot_821_uefi (self , create_vms ):
121
+ host_vm = create_vms [0 ]
122
+ vif = host_vm .vifs ()[0 ]
123
+ mac_address = vif .param_get ('MAC' )
124
+ logging .info ("Host VM has MAC %s" , mac_address )
125
+
126
+ try :
105
127
# FIXME: evict MAC from ARP cache first?
106
128
host_vm .start ()
107
129
wait_for (host_vm .is_running , "Wait for host VM running" )
108
130
131
+ # catch host-vm IP address
132
+ wait_for (lambda : pxe .arp_addresses_for (mac_address ),
133
+ "Wait for DHCP server to see Host VM in ARP tables" ,
134
+ timeout_secs = 10 * 60 )
109
135
ips = pxe .arp_addresses_for (mac_address )
110
136
logging .info ("Host VM has IPs %s" , ips )
111
137
assert len (ips ) == 1
@@ -187,3 +213,9 @@ def test_install_821_uefi(self, iso_remaster, create_vms):
187
213
# wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
188
214
host_vm .shutdown (force = True )
189
215
raise
216
+
217
+ # record this state
218
+ # FIXME move to fixture
219
+ # FIXME where to store?
220
+ host_vm .host .ssh (["rm -f test_firstboot_821_uefi-vm1.xva" ])
221
+ host_vm .export ("test_firstboot_821_uefi-vm1.xva" , "zstd" )
0 commit comments