@@ -227,3 +227,98 @@ def test_firstboot_821_uefi(self, create_vms):
227
227
host_vm .host .ssh (["rm -f test_firstboot_821_uefi-vm1.xva" ])
228
228
host_vm .export ("test_firstboot_821_uefi-vm1.xva" , "zstd" ,
229
229
use_cache = CACHE_IMPORTED_VM )
230
+
231
+ @pytest .mark .vm_definitions (
232
+ dict (name = "vm 1" ,
233
+ image = "test_firstboot_821_uefi-vm1.xva"
234
+ ))
235
+ @pytest .mark .answerfile (
236
+ {
237
+ "base" : "UPGRADE" ,
238
+ "source" : {"type" : "local" },
239
+ "existing-installation" : {"text" : "nvme0n1" },
240
+ })
241
+ @pytest .mark .installer_iso ("xcpng-8.2.1-2023" )
242
+ def test_upgrade_821_uefi (self , iso_remaster , create_vms ):
243
+ host_vm = create_vms [0 ]
244
+ vif = host_vm .vifs ()[0 ]
245
+ mac_address = vif .param_get ('MAC' )
246
+ logging .info ("Host VM has MAC %s" , mac_address )
247
+
248
+ host_vm .insert_cd (iso_remaster )
249
+
250
+ try :
251
+ host_vm .start ()
252
+ wait_for (host_vm .is_running , "Wait for host VM running" )
253
+
254
+ # catch host-vm IP address
255
+ wait_for (lambda : pxe .arp_addresses_for (mac_address ),
256
+ "Wait for DHCP server to see Host VM in ARP tables" ,
257
+ timeout_secs = 10 * 60 )
258
+ ips = pxe .arp_addresses_for (mac_address )
259
+ logging .info ("Host VM has IPs %s" , ips )
260
+ assert len (ips ) == 1
261
+ host_vm .ip = ips [0 ]
262
+
263
+ # wait for "yum install" phase to start
264
+ wait_for (lambda : host_vm .ssh (["grep" ,
265
+ "'DISPATCH: NEW PHASE: Reading package information'" ,
266
+ "/tmp/install-log" ],
267
+ check = False , simple_output = False ,
268
+ ).returncode == 0 ,
269
+ "Wait for upgrade preparations to finish" ,
270
+ timeout_secs = 40 * 60 ) # FIXME too big
271
+
272
+ # wait for "yum install" phase to finish
273
+ wait_for (lambda : host_vm .ssh (["grep" ,
274
+ "'DISPATCH: NEW PHASE: Completing installation'" ,
275
+ "/tmp/install-log" ],
276
+ check = False , simple_output = False ,
277
+ ).returncode == 0 ,
278
+ "Wait for rpm installation to succeed" ,
279
+ timeout_secs = 40 * 60 ) # FIXME too big
280
+
281
+ # wait for install to finish
282
+ wait_for (lambda : host_vm .ssh (["grep" ,
283
+ "'The installation completed successfully'" ,
284
+ "/tmp/install-log" ],
285
+ check = False , simple_output = False ,
286
+ ).returncode == 0 ,
287
+ "Wait for system installation to succeed" ,
288
+ timeout_secs = 40 * 60 ) # FIXME too big
289
+
290
+ wait_for (lambda : host_vm .ssh (["ps a|grep '[0-9]. python /opt/xensource/installer/init'" ],
291
+ check = False , simple_output = False ,
292
+ ).returncode == 1 ,
293
+ "Wait for installer to terminate" )
294
+
295
+ logging .info ("Shutting down Host VM after successful upgrade" )
296
+ try :
297
+ host_vm .ssh (["poweroff" ])
298
+ except commands .SSHCommandFailed as e :
299
+ # ignore connection closed by reboot
300
+ if e .returncode == 255 and "closed by remote host" in e .stdout :
301
+ logging .info ("sshd closed the connection" )
302
+ pass
303
+ else :
304
+ raise
305
+ wait_for (host_vm .is_halted , "Wait for host VM halted" )
306
+ host_vm .eject_cd ()
307
+
308
+ except Exception as e :
309
+ logging .critical ("caught exception %s" , e )
310
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
311
+ host_vm .shutdown (force = True )
312
+ raise
313
+ except KeyboardInterrupt :
314
+ logging .warning ("keyboard interrupt" )
315
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
316
+ host_vm .shutdown (force = True )
317
+ raise
318
+
319
+ # record this state
320
+ # FIXME move to fixture
321
+ # FIXME where to store?
322
+ host_vm .host .ssh (["rm -f test_upgrade_821_uefi-vm1.xva" ])
323
+ host_vm .export ("test_upgrade_821_uefi-vm1.xva" , "zstd" ,
324
+ use_cache = CACHE_IMPORTED_VM )
0 commit comments