1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 09:18:08 +00:00

Add nvme disk interface and fix scsi disk interface for Qemu VMs.

This commit is contained in:
grossmj 2020-01-25 16:22:34 +08:00
parent 667d50aa4a
commit 92ac250bc7
2 changed files with 15 additions and 6 deletions

View File

@ -1645,9 +1645,18 @@ class QemuVM(BaseNode):
if interface == "sata":
# special case, sata controller doesn't exist in Qemu
options.extend(["-device", 'ahci,id=ahci{}'.format(disk_index)])
options.extend(["-drive", 'file={},if=none,id=drive{},index={},media=disk'.format(disk, disk_index, disk_index)])
options.extend(["-drive", 'file={},if=none,id=drive{},index={},media=disk,format=raw'.format(disk, disk_index, disk_index)])
options.extend(["-device", 'ide-drive,drive=drive{},bus=ahci{}.0,id=drive{}'.format(disk_index, disk_index, disk_index)])
elif interface == "nvme":
options.extend(["-drive", 'file={},if=none,id=drive{},index={},media=disk,format=raw'.format(disk, disk_index, disk_index)])
options.extend(["-device", 'nvme,drive=drive{},serial={}'.format(disk_index, disk_index)])
elif interface == "scsi":
options.extend(["-device", 'virtio-scsi-pci,id=scsi{}'.format(disk_index)])
options.extend(["-drive", 'file={},if=none,id=drive{},index={},media=disk,format=raw'.format(disk, disk_index, disk_index)])
options.extend(["-device", 'scsi-hd,drive=drive{}'.format(disk_index)])
#elif interface == "sd":
# options.extend(["-drive", 'file={},id=drive{},index={},format=raw'.format(disk, disk_index, disk_index)])
# options.extend(["-device", 'sd-card,drive=drive{},id=drive{}'.format(disk_index, disk_index, disk_index)])
else:
options.extend(["-drive", 'file={},if={},index={},media=disk,id=drive{}'.format(disk, interface, disk_index, disk_index)])

View File

@ -115,7 +115,7 @@ QEMU_TEMPLATE_PROPERTIES = {
},
"hda_disk_interface": {
"description": "QEMU hda interface",
"enum": ["ide", "sata", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"enum": ["ide", "sata", "nvme", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"default": "ide"
},
"hdb_disk_image": {
@ -125,7 +125,7 @@ QEMU_TEMPLATE_PROPERTIES = {
},
"hdb_disk_interface": {
"description": "QEMU hdb interface",
"enum": ["ide", "sata", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"enum": ["ide", "sata", "nvme", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"default": "ide"
},
"hdc_disk_image": {
@ -135,7 +135,7 @@ QEMU_TEMPLATE_PROPERTIES = {
},
"hdc_disk_interface": {
"description": "QEMU hdc interface",
"enum": ["ide", "sata", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"enum": ["ide", "sata", "nvme", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"default": "ide"
},
"hdd_disk_image": {
@ -145,7 +145,7 @@ QEMU_TEMPLATE_PROPERTIES = {
},
"hdd_disk_interface": {
"description": "QEMU hdd interface",
"enum": ["ide", "sata", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"enum": ["ide", "sata", "nvme", "scsi", "sd", "mtd", "floppy", "pflash", "virtio", "none"],
"default": "ide"
},
"cdrom_image": {