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