#391 new scsi, nvme support for VM
Merged 4 years ago by astepano. Opened 4 years ago by japokorn.
japokorn/standard-test-roles master-qcow_scsi_nvme_support  into  master

@@ -99,17 +99,33 @@ 

          """

          result = []

          drives = fmf_get(['qemu', 'drive'], list())

+         dev_id = 0

+         scsi_device_exists = False

          for drive in drives:

              # create temporary sparse file

              size = int(drive.get('size', 2 * 1024 ** 3))  # default size: 2G

              path = drive.get('path', None)

              path = str(path) if path is not None else None

+             interface = drive.get('interface', None)

              drive_file = tempfile.NamedTemporaryFile(dir=path, delete=False)

              drive_file.truncate(size)

              cls._tempfiles.append(drive_file)

              logger.info("Created temporary sparse file '%s'.", drive_file.name)

              # translate data into qemu command options

-             result += ["-drive", "file=%s,media=disk,if=virtio" % drive_file.name]

+ 

+             if interface is None or interface.lower() == 'virtio':

+                 result += ["-drive", "file=%s,media=disk,if=virtio" % drive_file.name]

+             elif interface.lower() == 'nvme':

+                 result += ["-device", "nvme,drive=nvme%s,serial=def%s" % (dev_id, dev_id)]

+                 result += ["-drive", "file=%s,media=disk,if=none,id=nvme%s" % (drive_file.name, dev_id)]

+                 dev_id += 1

+             elif interface.lower() == 'scsi':

+                 if not scsi_device_exists:

+                     result += ["-device", "virtio-scsi-pci,id=scsi0"]

+                     scsi_device_exists = True

+                 result += ["-device", "scsi-hd,drive=drive%s,bus=scsi0.0" % dev_id]

+                 result += ["-drive", "if=none,file=%s,id=drive%s" % (drive_file.name, dev_id)]

+                 dev_id += 1

  

          usb_drives = fmf_get(['qemu', 'usb_drive'], list())

          if usb_drives:
@@ -398,9 +414,9 @@ 

          "-smp", get_qemu_smp_arg(),

          # Set startup RAM size

          "-m", param_m,

-         # Add image with RHEL as drive (if=virtio is important for newer

-         # RHEL 8 images)

-         "-drive", "file={0},if=virtio".format(image),

+         # Add image with RHEL as drive

+         "-drive", "if=none,file=%s,id=virtio-disk0" % image,

+         "-device", "virtio-blk-pci,drive=virtio-disk0,bootindex=1",

          # Write to temporary files instead of disk image files

          "-snapshot",

          # Use `cloudinit` as CD-ROM image

  • added support for SCSI and NVME into VM creation script

Looks good, I would ask to add a comment into git commit where do you plan to use it (package name), or why it is is required, maybe add some contacts.

rebased onto 2c6c82f

4 years ago

@japokorn hi, I am ok to merge it . Please let me know when PR is ready for merge.
It would be good to get +1 from someone else. @msrb, @bgoncalv , @jimbair ?

@astepano Ready. Thanks for the comments and review.

rebased onto 23a4217

4 years ago

pretty please pagure-ci rebuild

@japokorn CI passed. Should I merge this PR? Is it ready?

@astepano Yes, you can merge it. Thanks.

Commit ce0ce5e fixes this pull-request

Pull-Request has been merged by astepano

4 years ago

Pull-Request has been merged by astepano

4 years ago