@@ -353,16 +353,23 @@ async def test_set_platform(compute_project, manager):
353
353
async def test_disk_options (vm , tmpdir , fake_qemu_img_binary ):
354
354
355
355
vm ._hda_disk_image = str (tmpdir / "test.qcow2" )
356
+ vm ._hda_disk_interface = "ide"
357
+ vm ._hdb_disk_image = str (tmpdir / "test2.qcow2" )
356
358
open (vm ._hda_disk_image , "w+" ).close ()
359
+ open (vm ._hdb_disk_image , "w+" ).close ()
357
360
358
- with asyncio_patch ("gns3server.compute.qemu.qemu_vm.QemuVM._find_disk_file_format" , return_value = "qcow2" ):
361
+ with ( asyncio_patch ("gns3server.compute.qemu.qemu_vm.QemuVM._find_disk_file_format" , return_value = "qcow2" ) ):
359
362
with asyncio_patch ("asyncio.create_subprocess_exec" , return_value = MagicMock ()) as process :
360
363
options = await vm ._disk_options ()
361
364
assert process .called
362
365
args , kwargs = process .call_args
363
- assert args == (fake_qemu_img_binary , "create" , "-o" , "backing_file={}" .format (vm ._hda_disk_image ), "-F" , "qcow2" , "-f" , "qcow2" , os .path .join (vm .working_dir , "hda_disk.qcow2" ))
366
+ assert args == (fake_qemu_img_binary , "create" , "-o" , "backing_file={}" .format (vm ._hda_disk_image ), "-F" , "qcow2" , "-f" , "qcow2" , os .path .join (vm .working_dir , "hda_disk.qcow2" )) or \
367
+ args == (fake_qemu_img_binary , "create" , "-o" , "backing_file={}" .format (vm ._hdb_disk_image ), "-F" , "qcow2" , "-f" , "qcow2" , os .path .join (vm .working_dir , "hdb_disk.qcow2" ))
364
368
365
- assert options == ['-drive' , 'file=' + os .path .join (vm .working_dir , "hda_disk.qcow2" ) + ',if=ide,index=0,media=disk,id=drive0' ]
369
+ assert options == [
370
+ '-drive' , 'file=' + os .path .join (vm .working_dir , "hda_disk.qcow2" ) + ',if=ide,index=0,media=disk,id=drive0' ,
371
+ '-drive' , 'file=' + os .path .join (vm .working_dir , "hdb_disk.qcow2" ) + ',if=none,index=1,media=disk,id=drive1' ,
372
+ ]
366
373
367
374
368
375
async def test_cdrom_option (vm , tmpdir , fake_qemu_img_binary ):
@@ -440,9 +447,13 @@ async def test_tpm_option(vm, tmpdir, fake_qemu_img_binary):
440
447
async def test_disk_options_multiple_disk (vm , tmpdir , fake_qemu_img_binary ):
441
448
442
449
vm ._hda_disk_image = str (tmpdir / "test0.qcow2" )
450
+ vm ._hda_disk_interface = "ide"
443
451
vm ._hdb_disk_image = str (tmpdir / "test1.qcow2" )
452
+ vm ._hdb_disk_interface = "ide"
444
453
vm ._hdc_disk_image = str (tmpdir / "test2.qcow2" )
454
+ vm ._hdc_disk_interface = "ide"
445
455
vm ._hdd_disk_image = str (tmpdir / "test3.qcow2" )
456
+ vm ._hdd_disk_interface = "ide"
446
457
open (vm ._hda_disk_image , "w+" ).close ()
447
458
open (vm ._hdb_disk_image , "w+" ).close ()
448
459
open (vm ._hdc_disk_image , "w+" ).close ()
0 commit comments