4.8.0
This commit is contained in:
@@ -34,6 +34,7 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
|
||||
d.Set("affinity_rules", flattenAffinityRules(computeRec.AffinityRules))
|
||||
d.Set("anti_affinity_rules", flattenAffinityRules(computeRec.AntiAffinityRules))
|
||||
d.Set("arch", computeRec.Arch)
|
||||
d.Set("auto_start_w_node", computeRec.AutoStart)
|
||||
d.Set("boot_order", computeRec.BootOrder)
|
||||
d.Set("boot_disk_id", bootDisk.ID)
|
||||
// we intentionally use the SizeMax field, do not change it until the BootDiskSize field is fixed on the platform
|
||||
@@ -92,6 +93,7 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
|
||||
d.Set("updated_time", computeRec.UpdatedTime)
|
||||
d.Set("user_data", string(userData))
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", computeRec.VGPUs)
|
||||
d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
@@ -294,6 +296,7 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{}
|
||||
"affinity_weight": computeItem.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules),
|
||||
"arch": computeItem.Arch,
|
||||
"auto_start_w_node": computeItem.AutoStart,
|
||||
"chipset": computeItem.Chipset,
|
||||
"cd_image_id": computeItem.CdImageId,
|
||||
"boot_order": computeItem.BootOrder,
|
||||
@@ -613,6 +616,7 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute
|
||||
d.Set("affinity_weight", compFacts.AffinityWeight)
|
||||
d.Set("anti_affinity_rules", flattenAffinityRules(compFacts.AntiAffinityRules))
|
||||
d.Set("arch", compFacts.Arch)
|
||||
d.Set("auto_start_w_node", compFacts.AutoStart)
|
||||
d.Set("boot_order", compFacts.BootOrder)
|
||||
d.Set("chipset", compFacts.Chipset)
|
||||
d.Set("cd_image_id", compFacts.CdImageId)
|
||||
@@ -671,6 +675,7 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute
|
||||
d.Set("updated_time", compFacts.UpdatedTime)
|
||||
d.Set("user_data", string(userData))
|
||||
d.Set("user_managed", compFacts.UserManaged)
|
||||
d.Set("vnc_password", compFacts.VNCPassword)
|
||||
d.Set("vgpus", compFacts.VGPUs)
|
||||
d.Set("virtual_image_id", compFacts.VirtualImageID)
|
||||
d.Set("virtual_image_name", compFacts.VirtualImageName)
|
||||
|
||||
@@ -484,12 +484,29 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
req.Force = force
|
||||
}
|
||||
|
||||
if autoStart, ok := d.Get("auto_start_w_node").(bool); ok {
|
||||
req.AutoStart = autoStart
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().PinToStack(ctx, req)
|
||||
if err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
|
||||
if !d.Get("pin_to_stack").(bool) && d.Get("auto_start_w_node").(bool) {
|
||||
req := compute.UpdateRequest{
|
||||
ComputeID: computeId,
|
||||
AutoStart: d.Get("auto_start_w_node").(bool),
|
||||
CPUPin: d.Get("cpu_pin").(bool),
|
||||
HPBacked: d.Get("hp_backed").(bool),
|
||||
}
|
||||
_, err := c.CloudBroker().Compute().Update(ctx, req)
|
||||
if err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
|
||||
if d.Get("pause").(bool) {
|
||||
req := compute.PauseRequest{
|
||||
ComputeID: computeId,
|
||||
@@ -686,7 +703,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChanges("description", "name", "numa_affinity", "cpu_pin", "hp_backed") {
|
||||
if d.HasChanges("description", "name", "numa_affinity", "cpu_pin", "hp_backed", "chipset", "auto_start_w_node") {
|
||||
if err := utilityComputeUpdate(ctx, d, m); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
@@ -839,11 +856,14 @@ func ResourceCompute() *schema.Resource {
|
||||
SchemaVersion: 1,
|
||||
|
||||
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error {
|
||||
if diff.HasChanges() || diff.HasChanges("libvirt_settings", "network", "affinity_rules", "anti_affinity_rules",
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "libvirt_settings", "network", "affinity_rules", "anti_affinity_rules",
|
||||
"disks", "extra_disks", "tags", "port_forwarding", "user_access", "snapshot", "pci_devices") {
|
||||
diff.SetNewComputed("updated_time")
|
||||
diff.SetNewComputed("updated_by")
|
||||
}
|
||||
if diff.HasChanges("pin_to_stack") {
|
||||
diff.SetNewComputed("pinned")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
|
||||
@@ -134,6 +134,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"auto_start_w_node": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -902,6 +906,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"vnc_password": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -990,6 +998,11 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "Find by image ID",
|
||||
},
|
||||
"cd_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by CD image ID",
|
||||
},
|
||||
"extnet_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -1145,6 +1158,10 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"auto_start_w_node": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -1802,6 +1819,10 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"auto_start_w_node": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -3375,6 +3396,11 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
"auto_start_w_node": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
"target_stack_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
@@ -3906,6 +3932,10 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"vnc_password": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
|
||||
@@ -852,21 +852,17 @@ func utilityComputeUpdate(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
if d.HasChange("numa_affinity") {
|
||||
req.NumaAffinity = d.Get("numa_affinity").(string)
|
||||
}
|
||||
if d.HasChange("cpu_pin") {
|
||||
req.CPUPin = d.Get("cpu_pin").(bool)
|
||||
}
|
||||
if d.HasChange("hp_backed") {
|
||||
req.HPBacked = d.Get("hp_backed").(bool)
|
||||
}
|
||||
|
||||
if d.HasChange("chipset") {
|
||||
req.Chipset = d.Get("chipset").(string)
|
||||
}
|
||||
req.CPUPin = d.Get("cpu_pin").(bool)
|
||||
req.HPBacked = d.Get("hp_backed").(bool)
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
|
||||
// Note bene: numa_affinity, cpu_pin 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") && d.Get("started").(bool) {
|
||||
if d.HasChanges("numa_affinity", "cpu_pin", "hp_backed", "chipset") && d.Get("started").(bool) {
|
||||
isStopRequired = true
|
||||
}
|
||||
if isStopRequired {
|
||||
@@ -1434,6 +1430,11 @@ func utilityComputePinToStack(ctx context.Context, d *schema.ResourceData, m int
|
||||
if force, ok := d.Get("force_pin").(bool); ok {
|
||||
req.Force = force
|
||||
}
|
||||
|
||||
if autoStart, ok := d.Get("auto_start_w_node").(bool); ok {
|
||||
req.AutoStart = autoStart
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().PinToStack(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -75,6 +75,9 @@ func utilityDataComputeListCheckPresence(ctx context.Context, d *schema.Resource
|
||||
if imageID, ok := d.GetOk("image_id"); ok {
|
||||
req.ImageID = imageID.(uint64)
|
||||
}
|
||||
if cdImageID, ok := d.GetOk("cd_image_id"); ok {
|
||||
req.CDImageID = cdImageID.(uint64)
|
||||
}
|
||||
if extNetName, ok := d.GetOk("extnet_name"); ok {
|
||||
req.ExtNetName = extNetName.(string)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user