diff --git a/CHANGELOG.md b/CHANGELOG.md index 54d33ef4..56da4821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,8 @@ -## Version 4.8.4 +## Version 4.8.5 ### Исправлено #### kvmvm | Идентификатор
задачи | Описание | | --- | --- | -| BATF-1015 | Ошибка при изменении полей `ram` и `cpu`, приводящая к невозможности измения параметров виртуальной машины в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm | -| BATF-1017 | Ошибка при изменении поля `started`, приводящая к невозможности запуска виртуальной машины в resources `decort_kvmvm` в cloudapi/kvmvm | \ No newline at end of file +| BATF-1053 | Перезагрузка виртуальной машины при изменении полей `ram` и `cpu` в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm | \ No newline at end of file diff --git a/Makefile b/Makefile index d2d201b2..e25187aa 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ZIPDIR = ./zip BINARY=${NAME} WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH} MAINPATH = ./cmd/decort/ -VERSION=4.8.4 +VERSION=4.8.5 OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH) FILES = ${BINARY}_${VERSION}_darwin_amd64\ diff --git a/internal/service/cloudapi/kvmvm/resource_compute.go b/internal/service/cloudapi/kvmvm/resource_compute.go index 1d269273..c82b301a 100644 --- a/internal/service/cloudapi/kvmvm/resource_compute.go +++ b/internal/service/cloudapi/kvmvm/resource_compute.go @@ -866,10 +866,14 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf } } - // Note bene: numa_affinity, cpu_pin and hp_backed, cpu, ram are not allowed to be changed for compute in STARTED tech status. + // Note bene: numa_affinity, cpu_pin, old_cpu > new_cpu and hp_backed are not allowed to be changed for compute in STARTED tech status. // If STARTED, we need to stop it before update var isStopRequired bool - if d.HasChanges("numa_affinity", "cpu_pin", "hp_backed", "chipset", "preferred_cpu", "ram", "cpu") && d.Get("started").(bool) { + if d.HasChanges("numa_affinity", "cpu_pin", "hp_backed", "chipset", "preferred_cpu") && d.Get("started").(bool) { + isStopRequired = true + } + old, new := d.GetChange("cpu") + if old.(int) > new.(int) && d.Get("started").(bool) { isStopRequired = true } if isStopRequired { diff --git a/internal/service/cloudbroker/kvmvm/utility_compute.go b/internal/service/cloudbroker/kvmvm/utility_compute.go index bc343b85..0fed6716 100644 --- a/internal/service/cloudbroker/kvmvm/utility_compute.go +++ b/internal/service/cloudbroker/kvmvm/utility_compute.go @@ -114,7 +114,13 @@ func utilityComputeResize(ctx context.Context, d *schema.ResourceData, m interfa c := m.(*controller.ControllerCfg) computeId, _ := strconv.ParseUint(d.Id(), 10, 64) - if d.Get("started").(bool) { + var isStopRequired bool + old, new := d.GetChange("cpu") + if d.Get("started").(bool) && (old.(int) > new.(int)) { + isStopRequired = true + } + + if isStopRequired { stopReq := compute.StopRequest{ ComputeID: computeId, Force: false, @@ -179,7 +185,7 @@ func utilityComputeResize(ctx context.Context, d *schema.ResourceData, m interfa } } - if d.Get("started").(bool) { + if isStopRequired { if _, err := c.CloudBroker().Compute().Start(ctx, compute.StartRequest{ComputeID: computeId}); err != nil { return err }