Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu: scsi id conflict when both disk_interface and cdrom_interface are set to virtio-scsi #35

Closed
hc-github-team-packer opened this issue Aug 17, 2021 · 0 comments · Fixed by #40

Comments

@hc-github-team-packer
Copy link

This issue was originally opened by @AmedeeBulle in hashicorp/packer#11211 and has been migrated to this repository. The original issue description is below.


Overview of the Issue

When setting both disk_interface and cdrom_interface to virtio-scsi, they will use the same target and qemu will error out with:

qemu-kvm: -drive file=<iso file path>,if=none,index=0,id=cdrom0,media=cdrom: drive with bus=0, unit=0 (index=0) exists

As workaround, we can list the drives in qemuargs and use index=1 for the cdrom, but this is not very practical...

The use case for having both set to virtio-scsi is:

  • I want/need to have my image based on scsi / sda (target / portability reason)
  • aarch64 requires virtio-scsi for the cdrom (on x86_64 I use the default -- virtio -- so I don't have this issue)

Reproduction Steps

With the Buildfile hereunder:

PACKER_LOG=1 packer build virtio-scsi.json

Packer version

Packer v1.7.4

Simplified Packer Buildfile

{
  "builders":
    [
      {
      "type": "qemu",
      "iso_url": "http://yum.oracle.com/ISOS/OracleLinux/OL8/u4/aarch64/aarch64-boot-uek.iso",
      "iso_checksum": "e15006202045c2cb287d72e5c4e490d59698d7ef247ba5280bce09e886a4841c",
      "ssh_username": "root",
      "ssh_password": "root",
      "output_directory": "/data/packer/virtio-scsi",
      "disk_size": "1024",
      "format": "qcow2",
      "disk_interface": "virtio-scsi",
      "cdrom_interface": "virtio-scsi",
      "cpus": 2,
      "headless": "true",
      "memory": 1024,
      "vm_name": "system.qcow",
      "qemu_binary": "/usr/libexec/qemu-kvm",
      "qemuargs": [
        [ "-machine", "gic-version=3,accel=kvm" ]
      ]
      }
    ]
}

(any iso file will do)

Operating system and Environment details

Oracle Linux 8.4 on aarch64.
Kernel: 5.4.17-2102.204.4.2.el8uek.aarch64
qemu-kvm: 4.2.0

Log Fragments and crash.log files

==> qemu: Overriding default Qemu arguments with qemuargs template option...
2021/08/17 08:24:38 packer-builder-qemu plugin: Executing /usr/libexec/qemu-kvm: []string{"-smp", "cpus=2,sockets=2", "-drive", "if=none,file=/data/packer/virtio-scsi/system.qcow,id=drive0,cache=writeback,discard=ignore,format=qcow2", "-drive", "file=/home/opc/packer/packer_cache/ac5f4ad7b472d5c56ae4e15ce40b2c8c068280ee.iso,if=none,index=0,id=cdrom0,media=cdrom", "-boot", "once=d", "-machine", "gic-version=3,accel=kvm", "-vnc", "127.0.0.1:12", "-device", "virtio-scsi-pci,id=scsi0", "-device", "scsi-hd,bus=scsi0.0,drive=drive0", "-device", "virtio-net,netdev=user.0", "-device", "virtio-scsi-device", "-device", "scsi-cd,drive=cdrom0", "-netdev", "user,id=user.0,hostfwd=tcp::3291-:22", "-m", "1024M", "-name", "system.qcow"}
2021/08/17 08:24:38 packer-builder-qemu plugin: Started Qemu. Pid: 10303
2021/08/17 08:24:38 packer-builder-qemu plugin: Qemu stderr: qemu-kvm: -drive file=/home/opc/packer/packer_cache/ac5f4ad7b472d5c56ae4e15ce40b2c8c068280ee.iso,if=none,index=0,id=cdrom0,media=cdrom: drive with bus=0, unit=0 (index=0) exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants