mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-03 20:12:59 +00:00
fix(vm): regressions: provider always tries to update cpu.affinity
even if it is not specified (#1182)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
39e67da544
commit
82d435f575
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -1,4 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
"editor.bracketPairColorization.enabled": true,
|
||||||
|
"editor.guides.bracketPairs": true,
|
||||||
|
"editor.guides.bracketPairsHorizontal": true,
|
||||||
|
"editor.guides.highlightActiveBracketPair": true,
|
||||||
|
"editor.rulers": [
|
||||||
|
100
|
||||||
|
],
|
||||||
"git.alwaysSignOff": true,
|
"git.alwaysSignOff": true,
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"aarch",
|
"aarch",
|
||||||
|
@ -87,6 +87,35 @@ func TestAccResourceVM(t *testing.T) {
|
|||||||
),
|
),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"update CPU block", []resource.TestStep{{
|
||||||
|
Config: `
|
||||||
|
resource "proxmox_virtual_environment_vm" "test_vm5" {
|
||||||
|
node_name = "pve"
|
||||||
|
started = false
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
cores = 2
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
resource.TestCheckResourceAttr("proxmox_virtual_environment_vm.test_vm5", "cpu.0.cores", "2"),
|
||||||
|
),
|
||||||
|
}, {
|
||||||
|
Config: `
|
||||||
|
resource "proxmox_virtual_environment_vm" "test_vm5" {
|
||||||
|
node_name = "pve"
|
||||||
|
started = false
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
cores = 1
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
resource.TestCheckResourceAttr("proxmox_virtual_environment_vm.test_vm5", "cpu.0.cores", "1"),
|
||||||
|
),
|
||||||
|
}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
accProviders := testAccMuxProviders(context.Background(), t)
|
accProviders := testAccMuxProviders(context.Background(), t)
|
||||||
|
@ -4823,10 +4823,15 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
updateBody.CPUUnits = &cpuUnits
|
updateBody.CPUUnits = &cpuUnits
|
||||||
updateBody.NUMAEnabled = &cpuNUMA
|
updateBody.NUMAEnabled = &cpuNUMA
|
||||||
|
|
||||||
if cpuAffinity != "" {
|
// CPU affinity is a special case, only root can change it.
|
||||||
updateBody.CPUAffinity = &cpuAffinity
|
// we can't even have it in the delete list, as PVE will return an error for non-root.
|
||||||
} else {
|
// Hence, checking explicitly if it has changed.
|
||||||
del = append(del, "affinity")
|
if d.HasChange(mkCPU + ".0." + mkCPUAffinity) {
|
||||||
|
if cpuAffinity != "" {
|
||||||
|
updateBody.CPUAffinity = &cpuAffinity
|
||||||
|
} else {
|
||||||
|
del = append(del, "affinity")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cpuHotplugged > 0 {
|
if cpuHotplugged > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user