mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-02 19:43:00 +00:00
fix(vm): hostpci devices not showing up in refresh plan (#578)
* bug(vm): fix hostpci devices not showing up in refresh plan Signed-off-by: Michael Iseli <michael.iseli@bsi-software.com> * fix pci & usb devices set on read, fix test Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Michael Iseli <michael.iseli@bsi-software.com> Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
3e0ef1d08b
commit
aa939c731f
@ -134,11 +134,6 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
|||||||
line: `"0000:81:00.2"`,
|
line: `"0000:81:00.2"`,
|
||||||
want: &CustomPCIDevice{
|
want: &CustomPCIDevice{
|
||||||
DeviceIDs: &[]string{"0000:81:00.2"},
|
DeviceIDs: &[]string{"0000:81:00.2"},
|
||||||
MDev: nil,
|
|
||||||
PCIExpress: types.BoolPtr(false),
|
|
||||||
ROMBAR: types.BoolPtr(true),
|
|
||||||
ROMFile: nil,
|
|
||||||
XVGA: types.BoolPtr(false),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -176,6 +171,7 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
|||||||
if err := r.UnmarshalJSON([]byte(tt.line)); (err != nil) != tt.wantErr {
|
if err := r.UnmarshalJSON([]byte(tt.line)); (err != nil) != tt.wantErr {
|
||||||
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
}
|
}
|
||||||
|
require.Equal(t, tt.want, r)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4364,7 +4364,7 @@ func vmReadCustom(
|
|||||||
if pp.ROMBAR != nil {
|
if pp.ROMBAR != nil {
|
||||||
pci[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR] = *pp.ROMBAR
|
pci[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR] = *pp.ROMBAR
|
||||||
} else {
|
} else {
|
||||||
pci[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR] = false
|
pci[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if pp.ROMFile != nil {
|
if pp.ROMFile != nil {
|
||||||
@ -4388,7 +4388,7 @@ func vmReadCustom(
|
|||||||
pciMap[pi] = pci
|
pciMap[pi] = pci
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(currentPCIList) > 0 {
|
if len(clone) == 0 || len(currentPCIList) > 0 {
|
||||||
orderedPCIList := orderedListFromMap(pciMap)
|
orderedPCIList := orderedListFromMap(pciMap)
|
||||||
err := d.Set(mkResourceVirtualEnvironmentVMHostPCI, orderedPCIList)
|
err := d.Set(mkResourceVirtualEnvironmentVMHostPCI, orderedPCIList)
|
||||||
diags = append(diags, diag.FromErr(err)...)
|
diags = append(diags, diag.FromErr(err)...)
|
||||||
@ -4426,7 +4426,7 @@ func vmReadCustom(
|
|||||||
usbMap[pi] = usb
|
usbMap[pi] = usb
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(currentUSBList) > 0 {
|
if len(clone) == 0 || len(currentUSBList) > 0 {
|
||||||
// todo: reordering of devices by PVE may cause an issue here
|
// todo: reordering of devices by PVE may cause an issue here
|
||||||
orderedUSBList := orderedListFromMap(usbMap)
|
orderedUSBList := orderedListFromMap(usbMap)
|
||||||
err := d.Set(mkResourceVirtualEnvironmentVMHostUSB, orderedUSBList)
|
err := d.Set(mkResourceVirtualEnvironmentVMHostUSB, orderedUSBList)
|
||||||
|
Loading…
Reference in New Issue
Block a user