0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-05 13:33:58 +00:00

fix(vm): do not reboot VM on config change if it is not running (#430)

This commit is contained in:
Pavel Boldyrev 2023-07-16 14:12:17 -04:00 committed by GitHub
parent a1d76441d5
commit 0281bc83e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5035,6 +5035,12 @@ func vmUpdateDiskLocationAndSize(
// Perform a regular reboot in case it's necessary and haven't already been done.
if reboot {
vmStatus, err := vmAPI.GetVMStatus(ctx)
if err != nil {
return diag.FromErr(err)
}
if vmStatus.Status != "stopped" {
rebootTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutReboot).(int)
err := vmAPI.RebootVM(
@ -5048,6 +5054,7 @@ func vmUpdateDiskLocationAndSize(
return diag.FromErr(err)
}
}
}
return vmRead(ctx, d, m)
}