@@ -120,11 +120,19 @@ def test_install_uefi(self, request, iso_remaster, create_vms, iso_version):
120
120
@pytest .mark .usefixtures ("xcpng_chained" )
121
121
@pytest .mark .parametrize ("mode" , (
122
122
"83b2" ,
123
+ #"83b2-83b2", # 8.3b2 disabled the upgrade from 8.3
124
+ "821.1-83b2" ,
123
125
"821.1" ,
126
+ "821.1-821.1" ,
124
127
))
125
128
@pytest .mark .continuation_of (
126
129
lambda params : [dict (vm = "vm1" ,
127
- image_test = f"TestNested::test_install_uefi[{ params } ]" )],
130
+ image_test = (f"TestNested::{{}}[{ params } ]" .format (
131
+ {
132
+ 1 : "test_install_uefi" ,
133
+ 2 : "test_upgrade_uefi" ,
134
+ }[len (params .split ("-" ))]
135
+ )))],
128
136
param_mapping = {"params" : "mode" })
129
137
def test_firstboot_uefi (self , request , create_vms , mode ):
130
138
host_vm = create_vms [0 ]
@@ -222,3 +230,102 @@ def test_firstboot_uefi(self, request, create_vms, mode):
222
230
# wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
223
231
host_vm .shutdown (force = True )
224
232
raise
233
+
234
+ @pytest .mark .usefixtures ("xcpng_chained" )
235
+ @pytest .mark .parametrize (("orig_version" , "iso_version" ), [
236
+ ("821.1" , "821.1" ),
237
+ ("821.1" , "83b2" ),
238
+ #("83b2", "83b2"), # 8.3b2 disabled the upgrade from 8.3
239
+ ])
240
+ @pytest .mark .continuation_of (
241
+ lambda params : [dict (vm = "vm1" ,
242
+ image_test = f"TestNested::test_firstboot_uefi[{ params } ]" )],
243
+ param_mapping = {"params" : "orig_version" })
244
+ @pytest .mark .installer_iso (
245
+ lambda version : {
246
+ "821.1" : "xcpng-8.2.1-2023" ,
247
+ "83b2" : "xcpng-8.3-beta2" ,
248
+ }[version ],
249
+ param_mapping = {"version" : "iso_version" })
250
+ @pytest .mark .answerfile (
251
+ {
252
+ "base" : "UPGRADE" ,
253
+ "source" : {"type" : "local" },
254
+ "existing-installation" : {"text" : "nvme0n1" },
255
+ })
256
+ def test_upgrade_uefi (self , iso_remaster , create_vms , orig_version , iso_version ):
257
+ host_vm = create_vms [0 ]
258
+ vif = host_vm .vifs ()[0 ]
259
+ mac_address = vif .param_get ('MAC' )
260
+ logging .info ("Host VM has MAC %s" , mac_address )
261
+
262
+ host_vm .insert_cd (iso_remaster )
263
+
264
+ try :
265
+ host_vm .start ()
266
+ wait_for (host_vm .is_running , "Wait for host VM running" )
267
+
268
+ # catch host-vm IP address
269
+ wait_for (lambda : pxe .arp_addresses_for (mac_address ),
270
+ "Wait for DHCP server to see Host VM in ARP tables" ,
271
+ timeout_secs = 10 * 60 )
272
+ ips = pxe .arp_addresses_for (mac_address )
273
+ logging .info ("Host VM has IPs %s" , ips )
274
+ assert len (ips ) == 1
275
+ host_vm .ip = ips [0 ]
276
+
277
+ # wait for "yum install" phase to start
278
+ wait_for (lambda : host_vm .ssh (["grep" ,
279
+ "'DISPATCH: NEW PHASE: Reading package information'" ,
280
+ "/tmp/install-log" ],
281
+ check = False , simple_output = False ,
282
+ ).returncode == 0 ,
283
+ "Wait for upgrade preparations to finish" ,
284
+ timeout_secs = 40 * 60 ) # FIXME too big
285
+
286
+ # wait for "yum install" phase to finish
287
+ wait_for (lambda : host_vm .ssh (["grep" ,
288
+ "'DISPATCH: NEW PHASE: Completing installation'" ,
289
+ "/tmp/install-log" ],
290
+ check = False , simple_output = False ,
291
+ ).returncode == 0 ,
292
+ "Wait for rpm installation to succeed" ,
293
+ timeout_secs = 40 * 60 ) # FIXME too big
294
+
295
+ # wait for install to finish
296
+ wait_for (lambda : host_vm .ssh (["grep" ,
297
+ "'The installation completed successfully'" ,
298
+ "/tmp/install-log" ],
299
+ check = False , simple_output = False ,
300
+ ).returncode == 0 ,
301
+ "Wait for system installation to succeed" ,
302
+ timeout_secs = 40 * 60 ) # FIXME too big
303
+
304
+ wait_for (lambda : host_vm .ssh (["ps a|grep '[0-9]. python /opt/xensource/installer/init'" ],
305
+ check = False , simple_output = False ,
306
+ ).returncode == 1 ,
307
+ "Wait for installer to terminate" )
308
+
309
+ logging .info ("Shutting down Host VM after successful upgrade" )
310
+ try :
311
+ host_vm .ssh (["poweroff" ])
312
+ except commands .SSHCommandFailed as e :
313
+ # ignore connection closed by reboot
314
+ if e .returncode == 255 and "closed by remote host" in e .stdout :
315
+ logging .info ("sshd closed the connection" )
316
+ pass
317
+ else :
318
+ raise
319
+ wait_for (host_vm .is_halted , "Wait for host VM halted" )
320
+ host_vm .eject_cd ()
321
+
322
+ except Exception as e :
323
+ logging .critical ("caught exception %s" , e )
324
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
325
+ host_vm .shutdown (force = True )
326
+ raise
327
+ except KeyboardInterrupt :
328
+ logging .warning ("keyboard interrupt" )
329
+ # wait_for(lambda: False, 'Wait "forever"', timeout_secs=100*60)
330
+ host_vm .shutdown (force = True )
331
+ raise
0 commit comments