diff --git a/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go b/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go index bfc8eeb330d7..976f6a0ce828 100644 --- a/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go +++ b/pkg/virt-launcher/virtwrap/api/deepcopy_generated.go @@ -736,10 +736,12 @@ func (in *Devices) DeepCopyInto(out *Devices) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Watchdog != nil { - in, out := &in.Watchdog, &out.Watchdog - *out = new(Watchdog) - (*in).DeepCopyInto(*out) + if in.Watchdogs != nil { + in, out := &in.Watchdogs, &out.Watchdogs + *out = make([]Watchdog, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Rng != nil { in, out := &in.Rng, &out.Rng diff --git a/pkg/virt-launcher/virtwrap/api/schema.go b/pkg/virt-launcher/virtwrap/api/schema.go index 0b4ab1fc379d..6a588aea6c45 100644 --- a/pkg/virt-launcher/virtwrap/api/schema.go +++ b/pkg/virt-launcher/virtwrap/api/schema.go @@ -478,7 +478,7 @@ type Devices struct { Inputs []Input `xml:"input"` Serials []Serial `xml:"serial"` Consoles []Console `xml:"console"` - Watchdog *Watchdog `xml:"watchdog,omitempty"` + Watchdogs []Watchdog `xml:"watchdog,omitempty"` Rng *Rng `xml:"rng,omitempty"` Filesystems []FilesystemDevice `xml:"filesystem,omitempty"` Redirs []RedirectedDevice `xml:"redirdev,omitempty"` diff --git a/pkg/virt-launcher/virtwrap/api/schema_test.go b/pkg/virt-launcher/virtwrap/api/schema_test.go index 8150ea8fdc18..c315cf13fe59 100644 --- a/pkg/virt-launcher/virtwrap/api/schema_test.go +++ b/pkg/virt-launcher/virtwrap/api/schema_test.go @@ -348,10 +348,12 @@ var _ = ginkgo.Describe("Schema", func() { exampleDomain.Spec.Devices.Consoles = []Console{ {Type: "pty"}, } - exampleDomain.Spec.Devices.Watchdog = &Watchdog{ - Model: "i6300esb", - Action: "poweroff", - Alias: NewUserDefinedAlias("mywatchdog"), + exampleDomain.Spec.Devices.Watchdogs = []Watchdog{ + { + Model: "i6300esb", + Action: "poweroff", + Alias: NewUserDefinedAlias("mywatchdog"), + }, } exampleDomain.Spec.Devices.Rng = &Rng{ Model: v1.VirtIO, diff --git a/pkg/virt-launcher/virtwrap/converter/converter.go b/pkg/virt-launcher/virtwrap/converter/converter.go index 835710669fc1..04b36ab52146 100644 --- a/pkg/virt-launcher/virtwrap/converter/converter.go +++ b/pkg/virt-launcher/virtwrap/converter/converter.go @@ -1604,7 +1604,7 @@ func Convert_v1_VirtualMachineInstance_To_api_Domain(vmi *v1.VirtualMachineInsta if err != nil { return err } - domain.Spec.Devices.Watchdog = newWatchdog + domain.Spec.Devices.Watchdogs = append(domain.Spec.Devices.Watchdogs, *newWatchdog) } if vmi.Spec.Domain.Devices.Rng != nil { diff --git a/pkg/virt-launcher/virtwrap/converter/pci-placement.go b/pkg/virt-launcher/virtwrap/converter/pci-placement.go index 38ca8354e3ee..fbe17ba6ef19 100644 --- a/pkg/virt-launcher/virtwrap/converter/pci-placement.go +++ b/pkg/virt-launcher/virtwrap/converter/pci-placement.go @@ -53,8 +53,8 @@ func PlacePCIDevicesOnRootComplex(spec *api.DomainSpec) (err error) { return err } } - if spec.Devices.Watchdog != nil { - spec.Devices.Watchdog.Address, err = assigner.PlacePCIDeviceAtNextSlot(spec.Devices.Watchdog.Address) + for i, watchdog := range spec.Devices.Watchdogs { + spec.Devices.Watchdogs[i].Address, err = assigner.PlacePCIDeviceAtNextSlot(watchdog.Address) if err != nil { return err }