@@ -43,6 +43,7 @@ def helper_vm_with_plugged_disk(running_vm, create_vms):
43
43
class TestNested :
44
44
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
45
45
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
46
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
46
47
@pytest .mark .parametrize ("iso_version" , (
47
48
"83nightly" , "830net" ,
48
49
"830" ,
@@ -54,7 +55,7 @@ class TestNested:
54
55
))
55
56
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
56
57
@pytest .mark .vm_definitions (
57
- lambda firmware : dict (
58
+ lambda firmware , system_disk_config : dict (
58
59
name = "vm1" ,
59
60
template = "Other install media" ,
60
61
params = (
@@ -74,31 +75,46 @@ class TestNested:
74
75
),
75
76
"bios" : (),
76
77
}[firmware ],
77
- vdis = [dict (name = "vm1 system disk" , size = "100GiB" , device = "xvda" , userdevice = "0" )],
78
+ vdis = ([dict (name = "vm1 system disk" , size = "100GiB" , device = "xvda" , userdevice = "0" )]
79
+ + ([dict (name = "vm1 system disk mirror" , size = "100GiB" , device = "xvdb" , userdevice = "1" )]
80
+ if system_disk_config == "raid1" else [])
81
+ ),
78
82
cd_vbd = dict (device = "xvdd" , userdevice = "3" ),
79
83
vifs = [dict (index = 0 , network_name = NETWORKS ["MGMT" ])],
80
84
))
81
85
@pytest .mark .answerfile (
82
- lambda system_disks_names , local_sr , package_source , iso_version : AnswerFile ("INSTALL" )
86
+ lambda system_disks_names , local_sr , package_source , system_disk_config , iso_version : AnswerFile ("INSTALL" )
83
87
.top_setattr ({} if local_sr == "nosr" else {"sr-type" : local_sr })
84
88
.top_append (
85
89
{"iso" : {"TAG" : "source" , "type" : "local" },
86
90
"net" : {"TAG" : "source" , "type" : "url" ,
87
91
"CONTENTS" : ISO_IMAGES [iso_version ]['net-url' ]},
88
92
}[package_source ],
93
+
94
+ {"raid1" : {"TAG" : "raid" , "device" : "md127" ,
95
+ "CONTENTS" : [
96
+ {"TAG" : "disk" , "CONTENTS" : diskname } for diskname in system_disks_names
97
+ ]},
98
+ "disk" : None ,
99
+ }[system_disk_config ],
100
+
89
101
{"TAG" : "admin-interface" , "name" : "eth0" , "proto" : "dhcp" },
90
102
{"TAG" : "primary-disk" ,
91
103
"guest-storage" : "no" if local_sr == "nosr" else "yes" ,
92
- "CONTENTS" : system_disks_names [0 ]},
104
+ "CONTENTS" : {"disk" : system_disks_names [0 ],
105
+ "raid1" : "md127" ,
106
+ }[system_disk_config ],
107
+ },
93
108
))
94
109
def test_install (self , vm_booted_with_installer , system_disks_names ,
95
- firmware , iso_version , package_source , local_sr ):
110
+ firmware , iso_version , package_source , system_disk_config , local_sr ):
96
111
host_vm = vm_booted_with_installer
97
112
installer .monitor_install (ip = host_vm .ip )
98
113
99
114
@pytest .mark .usefixtures ("xcpng_chained" )
100
115
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
101
116
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
117
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
102
118
@pytest .mark .parametrize ("machine" , ("host1" , "host2" ))
103
119
@pytest .mark .parametrize ("version" , (
104
120
"83nightly" , "830net" ,
@@ -112,15 +128,24 @@ def test_install(self, vm_booted_with_installer, system_disks_names,
112
128
))
113
129
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
114
130
@pytest .mark .continuation_of (
115
- lambda version , firmware , local_sr , package_source : [dict (
131
+ lambda version , firmware , local_sr , package_source , system_disk_config : [dict (
116
132
vm = "vm1" ,
117
- image_test = f"TestNested::test_install[{ firmware } -{ version } -{ package_source } - { local_sr } ]" )])
118
- @ pytest . mark . small_vm
133
+ image_test = ( f"TestNested::test_install[{ firmware } -{ version } -{ system_disk_config } "
134
+ f"- { package_source } - { local_sr } ]" ))])
119
135
def test_tune_firstboot (self , create_vms , helper_vm_with_plugged_disk ,
120
- firmware , version , machine , local_sr , package_source ):
136
+ firmware , version , machine , local_sr , package_source , system_disk_config ):
121
137
helper_vm = helper_vm_with_plugged_disk
122
138
123
- helper_vm .ssh (["mount /dev/xvdb1 /mnt" ])
139
+ if system_disk_config == "disk" :
140
+ helper_vm .ssh (["mount /dev/xvdb1 /mnt" ])
141
+ elif system_disk_config == "raid1" :
142
+ # FIXME helper VM has to be an Alpine, that should not be a random vm_ref
143
+ helper_vm .ssh (["apk add mdadm" ])
144
+ helper_vm .ssh (["mdadm -A /dev/md/127 -N localhost:127" ])
145
+ helper_vm .ssh (["mount /dev/md127p1 /mnt" ])
146
+ else :
147
+ raise ValueError (f"unhandled system_disk_config { system_disk_config !r} " )
148
+
124
149
try :
125
150
# hostname
126
151
logging .info ("Setting hostname to %r" , machine )
@@ -134,7 +159,7 @@ def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
134
159
'/mnt/etc/xensource-inventory' ])
135
160
helper_vm .ssh (["grep UUID /mnt/etc/xensource-inventory" ])
136
161
finally :
137
- helper_vm .ssh (["umount /dev/xvdb1 " ])
162
+ helper_vm .ssh (["umount /mnt " ])
138
163
139
164
def _test_firstboot (self , create_vms , mode , * , machine = 'DEFAULT' , is_restore = False ):
140
165
host_vm = create_vms [0 ]
@@ -290,6 +315,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
290
315
@pytest .mark .usefixtures ("xcpng_chained" )
291
316
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
292
317
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
318
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
293
319
@pytest .mark .parametrize ("machine" , ("host1" , "host2" ))
294
320
@pytest .mark .parametrize ("version" , (
295
321
"83nightly" , "830net" ,
@@ -303,17 +329,19 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
303
329
))
304
330
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
305
331
@pytest .mark .continuation_of (
306
- lambda firmware , version , machine , local_sr , package_source : [
332
+ lambda firmware , version , machine , local_sr , package_source , system_disk_config : [
307
333
dict (vm = "vm1" ,
308
334
image_test = ("TestNested::test_tune_firstboot"
309
- f"[None-{ firmware } -{ version } -{ machine } -{ package_source } -{ local_sr } ]" ))])
335
+ f"[None-{ firmware } -{ version } -{ machine } -{ system_disk_config } "
336
+ f"-{ package_source } -{ local_sr } ]" ))])
310
337
def test_boot_inst (self , create_vms ,
311
- firmware , version , machine , package_source , local_sr ):
338
+ firmware , version , machine , package_source , system_disk_config , local_sr ):
312
339
self ._test_firstboot (create_vms , version , machine = machine )
313
340
314
341
@pytest .mark .usefixtures ("xcpng_chained" )
315
342
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
316
343
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
344
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
317
345
@pytest .mark .parametrize ("machine" , ("host1" , "host2" ))
318
346
@pytest .mark .parametrize (("orig_version" , "iso_version" ), [
319
347
("83nightly" , "83nightly" ),
@@ -330,26 +358,32 @@ def test_boot_inst(self, create_vms,
330
358
])
331
359
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
332
360
@pytest .mark .continuation_of (
333
- lambda firmware , orig_version , machine , package_source , local_sr : [dict (
361
+ lambda firmware , orig_version , machine , system_disk_config , package_source , local_sr : [dict (
334
362
vm = "vm1" ,
335
- image_test = f"TestNested::test_boot_inst[{ firmware } -{ orig_version } -{ machine } -{ package_source } -{ local_sr } ]" )])
363
+ image_test = (f"TestNested::test_boot_inst[{ firmware } -{ orig_version } -{ machine } -{ system_disk_config } "
364
+ f"-{ package_source } -{ local_sr } ]" ))])
336
365
@pytest .mark .answerfile (
337
- lambda system_disks_names , package_source , iso_version : AnswerFile ("UPGRADE" ).top_append (
366
+ lambda system_disks_names , package_source , system_disk_config , iso_version :
367
+ AnswerFile ("UPGRADE" ).top_append (
338
368
{"iso" : {"TAG" : "source" , "type" : "local" },
339
369
"net" : {"TAG" : "source" , "type" : "url" ,
340
370
"CONTENTS" : ISO_IMAGES [iso_version ]['net-url' ]},
341
371
}[package_source ],
342
372
{"TAG" : "existing-installation" ,
343
- "CONTENTS" : system_disks_names [0 ]},
373
+ "CONTENTS" : {"disk" : system_disks_names [0 ],
374
+ "raid1" : "md127" ,
375
+ }[system_disk_config ]},
344
376
))
345
377
def test_upgrade (self , vm_booted_with_installer , system_disks_names ,
346
- firmware , orig_version , iso_version , machine , package_source , local_sr ):
378
+ firmware , orig_version , iso_version , machine , package_source ,
379
+ system_disk_config , local_sr ):
347
380
host_vm = vm_booted_with_installer
348
381
installer .monitor_upgrade (ip = host_vm .ip )
349
382
350
383
@pytest .mark .usefixtures ("xcpng_chained" )
351
384
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
352
385
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
386
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
353
387
@pytest .mark .parametrize ("machine" , ("host1" , "host2" ))
354
388
@pytest .mark .parametrize ("mode" , (
355
389
"83nightly-83nightly" ,
@@ -366,16 +400,18 @@ def test_upgrade(self, vm_booted_with_installer, system_disks_names,
366
400
))
367
401
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
368
402
@pytest .mark .continuation_of (
369
- lambda firmware , mode , machine , package_source , local_sr : [dict (
403
+ lambda firmware , mode , machine , system_disk_config , package_source , local_sr : [dict (
370
404
vm = "vm1" ,
371
- image_test = (f"TestNested::test_upgrade[{ firmware } -{ mode } -{ machine } -{ package_source } -{ local_sr } ]" ))])
405
+ image_test = (f"TestNested::test_upgrade[{ firmware } -{ mode } -{ machine } -{ system_disk_config } "
406
+ f"-{ package_source } -{ local_sr } ]" ))])
372
407
def test_boot_upg (self , create_vms ,
373
- firmware , mode , machine , package_source , local_sr ):
408
+ firmware , mode , machine , package_source , system_disk_config , local_sr ):
374
409
self ._test_firstboot (create_vms , mode , machine = machine )
375
410
376
411
@pytest .mark .usefixtures ("xcpng_chained" )
377
412
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
378
413
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
414
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
379
415
@pytest .mark .parametrize (("orig_version" , "iso_version" ), [
380
416
("83nightly-83nightly" , "83nightly" ),
381
417
("830-83nightly" , "83nightly" ),
@@ -391,22 +427,27 @@ def test_boot_upg(self, create_vms,
391
427
])
392
428
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
393
429
@pytest .mark .continuation_of (
394
- lambda firmware , orig_version , local_sr , package_source : [dict (
430
+ lambda firmware , orig_version , local_sr , system_disk_config , package_source : [dict (
395
431
vm = "vm1" ,
396
- image_test = f"TestNested::test_boot_upg[{ firmware } -{ orig_version } -host1-{ package_source } -{ local_sr } ]" )])
432
+ image_test = (f"TestNested::test_boot_upg[{ firmware } -{ orig_version } -host1-{ system_disk_config } "
433
+ f"-{ package_source } -{ local_sr } ]" ))])
397
434
@pytest .mark .answerfile (
398
- lambda system_disks_names : AnswerFile ("RESTORE" ).top_append (
435
+ lambda system_disks_names , system_disk_config : AnswerFile ("RESTORE" ).top_append (
399
436
{"TAG" : "backup-disk" ,
400
- "CONTENTS" : system_disks_names [0 ]},
437
+ "CONTENTS" : {"disk" : system_disks_names [0 ],
438
+ "raid1" : "md127" ,
439
+ }[system_disk_config ]},
401
440
))
402
441
def test_restore (self , vm_booted_with_installer , system_disks_names ,
403
- firmware , orig_version , iso_version , package_source , local_sr ):
442
+ firmware , orig_version , iso_version , package_source ,
443
+ system_disk_config , local_sr ):
404
444
host_vm = vm_booted_with_installer
405
445
installer .monitor_restore (ip = host_vm .ip )
406
446
407
447
@pytest .mark .usefixtures ("xcpng_chained" )
408
448
@pytest .mark .parametrize ("local_sr" , ("nosr" , "ext" , "lvm" ))
409
449
@pytest .mark .parametrize ("package_source" , ("iso" , "net" ))
450
+ @pytest .mark .parametrize ("system_disk_config" , ("disk" , "raid1" ))
410
451
@pytest .mark .parametrize ("mode" , (
411
452
"83nightly-83nightly-83nightly" ,
412
453
"830-83nightly-83nightly" ,
@@ -422,9 +463,10 @@ def test_restore(self, vm_booted_with_installer, system_disks_names,
422
463
))
423
464
@pytest .mark .parametrize ("firmware" , ("uefi" , "bios" ))
424
465
@pytest .mark .continuation_of (
425
- lambda firmware , mode , package_source , local_sr : [dict (
466
+ lambda firmware , mode , system_disk_config , package_source , local_sr : [dict (
426
467
vm = "vm1" ,
427
- image_test = (f"TestNested::test_restore[{ firmware } -{ mode } -{ package_source } -{ local_sr } ]" ))])
468
+ image_test = (f"TestNested::test_restore[{ firmware } -{ mode } -{ system_disk_config } "
469
+ f"-{ package_source } -{ local_sr } ]" ))])
428
470
def test_boot_rst (self , create_vms ,
429
- firmware , mode , package_source , local_sr ):
471
+ firmware , mode , package_source , system_disk_config , local_sr ):
430
472
self ._test_firstboot (create_vms , mode , is_restore = True )
0 commit comments