mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-04 04:22:59 +00:00
fix(vm): do not reboot at disk resize (#1580)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
51d0338bba
commit
90c50fcb47
@ -19,3 +19,16 @@ func Or[T any](p *T, or T) T {
|
||||
|
||||
return or
|
||||
}
|
||||
|
||||
// Eq compares two pointers and returns true if they are equal.
|
||||
func Eq[T comparable](a, b *T) bool {
|
||||
if a == nil && b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if a == nil || b == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return *a == *b
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
|
||||
"github.com/bpg/terraform-provider-proxmox/proxmox"
|
||||
"github.com/bpg/terraform-provider-proxmox/proxmox/helpers/ptr"
|
||||
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms"
|
||||
"github.com/bpg/terraform-provider-proxmox/proxmox/ssh"
|
||||
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||
@ -602,7 +603,7 @@ func Update(
|
||||
continue
|
||||
}
|
||||
|
||||
if tmp.AIO != disk.AIO {
|
||||
if !ptr.Eq(tmp.AIO, disk.AIO) {
|
||||
rebootRequired = true
|
||||
tmp.AIO = disk.AIO
|
||||
}
|
||||
|
@ -5523,12 +5523,19 @@ func vmUpdateDiskLocationAndSize(
|
||||
)
|
||||
} else {
|
||||
return diag.Errorf(
|
||||
"Cannot resize %s:%s in VM %d configuration, it is not owned by this VM!",
|
||||
"Cannot resize %s:%s in VM %d, it is not owned by this VM!",
|
||||
*oldDisk.DatastoreID,
|
||||
*oldDisk.PathInDatastore(),
|
||||
vmID,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
return diag.Errorf(
|
||||
"Cannot shrink %s:%s in VM %d, it is not supported!",
|
||||
*oldDisk.DatastoreID,
|
||||
*oldDisk.PathInDatastore(),
|
||||
vmID,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user