platform/qemu: don't add -fw_cfg if injecting config
If we've injected the config, don't also add `-fw_cfg` even if the
platform supports it. This otherwise muddles what we're testing and
makes it less obvious that the config must be coming from the injected
one.
@@ -148,6 +148,7 @@ type QemuBuilder struct {
ConfigFile string
// ForceConfigInjection is useful for booting `metal` images directly
ForceConfigInjection bool
+ configInjected bool
// Memory defaults to 1024 on most architectures, others it may be 2048
Memory int
@@ -530,6 +531,7 @@ func (builder *QemuBuilder) addDiskImpl(disk *Disk, primary bool) error {
dstFileName, disk.SectorSize); err != nil {
return errors.Wrapf(err, "ignition injection with guestfs failed")
}
+ builder.configInjected = true
}
}
fd, err := os.OpenFile(dstFileName, os.O_RDWR, 0)
@@ -721,7 +723,7 @@ func (builder *QemuBuilder) Exec() (*QemuInstance, error) {
argv = append(argv, "-nographic")
// Handle Ignition
- if builder.ConfigFile != "" {
+ if builder.ConfigFile != "" && !builder.configInjected {
if builder.supportsFwCfg() {
builder.Append("-fw_cfg", "name=opt/com.coreos/config,file="+builder.ConfigFile)
} else if !builder.primaryDiskAdded {
