qemu: Only set serial= if not already provided
Regression from which
broke `coreos.ignition.mount.disks` because we were overriding
the provided serial.
@@ -404,9 +404,17 @@ func (builder *QemuBuilder) addDiskImpl(disk *Disk, primary bool) error {
if primary {
diskOpts = append(diskOpts, "serial=primary-disk")
} else {
+ foundserial := false
+ for _, opt := range diskOpts {
+ if strings.HasPrefix(opt, "serial=") {
+ foundserial = true
+ }
+ }
+ if !foundserial {
// Note that diskId is incremented by addQcow2DiskFd
diskOpts = append(diskOpts, "serial="+fmt.Sprintf("disk%d", builder.diskId))
}
+ }
channel := disk.Channel
if channel == "" {
channel = "virtio"
