4.8.5
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user