From d574ac6e14d3136ef1473e6afd901fca0c97d762 Mon Sep 17 00:00:00 2001 From: mleone87 <807457+mleone87@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:32:58 +0100 Subject: [PATCH 1/2] [fix] Fix Pool setting results in error 400 --- proxmox/config_guest.go | 3 --- proxmox/config_lxc.go | 4 ---- proxmox/config_qemu.go | 7 ------- 3 files changed, 14 deletions(-) diff --git a/proxmox/config_guest.go b/proxmox/config_guest.go index ad4e7cc5..ac7c4e89 100644 --- a/proxmox/config_guest.go +++ b/proxmox/config_guest.go @@ -81,9 +81,6 @@ func (GuestResource) mapToStruct(params []interface{}) []GuestResource { if _, isSet := tmpParams["node"]; isSet { resources[i].Node = tmpParams["node"].(string) } - if _, isSet := tmpParams["pool"]; isSet { - resources[i].Pool = tmpParams["pool"].(string) - } if _, isSet := tmpParams["status"]; isSet { resources[i].Status = tmpParams["status"].(string) } diff --git a/proxmox/config_lxc.go b/proxmox/config_lxc.go index c91d6f87..40f0ccca 100644 --- a/proxmox/config_lxc.go +++ b/proxmox/config_lxc.go @@ -380,10 +380,6 @@ func (config ConfigLxc) CloneLxc(vmr *VmRef, client *Client) (err error) { paramMap["hostname"] = config.Hostname } - if config.Pool != "" { - paramMap["pool"] = config.Pool - } - if config.Snapname != "" { paramMap["snapname"] = config.Snapname } diff --git a/proxmox/config_qemu.go b/proxmox/config_qemu.go index ce33235c..c6f447c6 100644 --- a/proxmox/config_qemu.go +++ b/proxmox/config_qemu.go @@ -158,10 +158,6 @@ func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error) { if config.QemuVcpus >= 1 { params["vcpus"] = config.QemuVcpus } - - if vmr.pool != "" { - params["pool"] = vmr.pool - } if config.Boot != "" { params["boot"] = config.Boot } @@ -366,9 +362,6 @@ func (config ConfigQemu) mapToApiValues(currentConfig ConfigQemu) (rebootRequire if config.QemuOs != "" { params["ostype"] = config.QemuOs } - if config.Pool != "" { - params["pool"] = config.Pool - } if config.Scsihw != "" { params["scsihw"] = config.Scsihw } From ff9f0c4da436440d19f0043feb8fe5fe47efa8d9 Mon Sep 17 00:00:00 2001 From: mleone87 <807457+mleone87@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:11:21 +0100 Subject: [PATCH 2/2] fix broken tests --- proxmox/config_guest_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/proxmox/config_guest_test.go b/proxmox/config_guest_test.go index d22f5eec..c05d06aa 100644 --- a/proxmox/config_guest_test.go +++ b/proxmox/config_guest_test.go @@ -68,10 +68,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { input: []interface{}{map[string]interface{}{"node": "pve1"}}, output: []GuestResource{{Node: "pve1"}}, }, - {name: "Pool", - input: []interface{}{map[string]interface{}{"pool": "Production"}}, - output: []GuestResource{{Pool: "Production"}}, - }, {name: "Status", input: []interface{}{map[string]interface{}{"status": "running"}}, output: []GuestResource{{Status: "running"}}, @@ -109,7 +105,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { "netin": float64(23884639), "netout": float64(1000123465987), "node": "pve1", - "pool": "Production", "status": "running", "tags": "tag1;tag2;tag3", "template": float64(0), @@ -131,7 +126,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { "netin": float64(2331323424), "netout": float64(88775378423476), "node": "pve2", - "pool": "Development", "status": "running", "tags": "dev", "template": float64(0), @@ -153,7 +147,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { "netin": float64(23884639), "netout": float64(1000123465987), "node": "node3", - "pool": "Templates", "status": "stopped", "tags": "template", "template": float64(1), @@ -177,7 +170,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { NetworkIn: 23884639, NetworkOut: 1000123465987, Node: "pve1", - Pool: "Production", Status: "running", Tags: []string{"tag1", "tag2", "tag3"}, Template: false, @@ -199,7 +191,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { NetworkIn: 2331323424, NetworkOut: 88775378423476, Node: "pve2", - Pool: "Development", Status: "running", Tags: []string{"dev"}, Template: false, @@ -221,7 +212,6 @@ func Test_GuestResource_mapToStruct(t *testing.T) { NetworkIn: 23884639, NetworkOut: 1000123465987, Node: "node3", - Pool: "Templates", Status: "stopped", Tags: []string{"template"}, Template: true,