4.11.0
This commit is contained in:
@@ -256,6 +256,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_partition": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -264,6 +268,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1035,6 +1043,11 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"userdata": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1128,14 +1141,6 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"virtual_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"virtual_image_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"stateless_sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -76,6 +76,10 @@ func computeDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
@@ -226,10 +230,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"interfaces": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -409,6 +409,11 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -420,10 +425,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"virtual_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -128,7 +128,7 @@ func dataSourceComputePCIDeviceListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -50,6 +50,7 @@ func flattenDisks(disks []compute.InfoDisk) []map[string]interface{} {
|
||||
// "bus_number": disk.BusNumber,
|
||||
"disk_id": disk.ID,
|
||||
// "pci_slot": disk.PCISlot,
|
||||
"sep_id": disk.SepID,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -179,76 +180,73 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{}
|
||||
customFields, _ := json.Marshal(compute.CustomFields)
|
||||
devices, _ := json.Marshal(compute.Devices)
|
||||
temp := map[string]interface{}{
|
||||
"acl": flattenListACL(compute.ACL),
|
||||
"account_id": compute.AccountID,
|
||||
"account_name": compute.AccountName,
|
||||
"affinity_label": compute.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(compute.AffinityRules),
|
||||
"affinity_weight": compute.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(compute.AntiAffinityRules),
|
||||
"arch": compute.Architecture,
|
||||
"auto_start_w_node": compute.AutoStart,
|
||||
"boot_order": compute.BootOrder,
|
||||
"bootdisk_size": compute.BootDiskSize,
|
||||
"boot_image_id": compute.BootImageID,
|
||||
"chipset": compute.Chipset,
|
||||
"cd_image_id": compute.CdImageId,
|
||||
"clone_reference": compute.CloneReference,
|
||||
"clones": compute.Clones,
|
||||
"computeci_id": compute.ComputeCIID,
|
||||
"cpu_pin": compute.CPUPin,
|
||||
"cpus": compute.CPU,
|
||||
"created_by": compute.CreatedBy,
|
||||
"created_time": compute.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": compute.DeletedBy,
|
||||
"deleted_time": compute.DeletedTime,
|
||||
"desc": compute.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(compute.Disks),
|
||||
"driver": compute.Driver,
|
||||
"gid": compute.GID,
|
||||
"guid": compute.GUID,
|
||||
"hp_backed": compute.HPBacked,
|
||||
"compute_id": compute.ID,
|
||||
//TODO
|
||||
// "image_id": compute.ImageID,
|
||||
"interfaces": flattenInterfaces(compute.Interfaces),
|
||||
"live_migration_job_id": compute.LiveMigrationJobID,
|
||||
"lock_status": compute.LockStatus,
|
||||
"manager_id": compute.ManagerID,
|
||||
"manager_type": compute.ManagerType,
|
||||
"migrationjob": compute.MigrationJob,
|
||||
"milestones": compute.Milestones,
|
||||
"name": compute.Name,
|
||||
"need_reboot": compute.NeedReboot,
|
||||
"numa_affinity": compute.NumaAffinity,
|
||||
"numa_node_id": compute.NumaNodeId,
|
||||
"os_version": compute.OSVersion,
|
||||
"pinned": compute.PinnedToStack,
|
||||
"preferred_cpu": compute.PreferredCPU,
|
||||
"qemu_guest": flattenQemuQuest(compute.QemuQuest),
|
||||
"ram": compute.RAM,
|
||||
"reference_id": compute.ReferenceID,
|
||||
"registered": compute.Registered,
|
||||
"res_name": compute.ResName,
|
||||
"reserved_node_cpus": compute.ReservedNodeCpus,
|
||||
"rg_id": compute.RGID,
|
||||
"rg_name": compute.RGName,
|
||||
"snap_sets": flattenSnapSets(compute.SnapSets),
|
||||
"stateless_sep_id": compute.StatelessSepID,
|
||||
"stateless_sep_type": compute.StatelessSepType,
|
||||
"status": compute.Status,
|
||||
"tags": flattenTags(compute.Tags),
|
||||
"tech_status": compute.TechStatus,
|
||||
"total_disk_size": compute.TotalDiskSize,
|
||||
"updated_by": compute.UpdatedBy,
|
||||
"updated_time": compute.UpdatedTime,
|
||||
"user_managed": compute.UserManaged,
|
||||
"vgpus": compute.VGPUs,
|
||||
"vins_connected": compute.VINSConnected,
|
||||
//TODO
|
||||
// "virtual_image_id": compute.VirtualImageID,
|
||||
"acl": flattenListACL(compute.ACL),
|
||||
"account_id": compute.AccountID,
|
||||
"account_name": compute.AccountName,
|
||||
"affinity_label": compute.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(compute.AffinityRules),
|
||||
"affinity_weight": compute.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(compute.AntiAffinityRules),
|
||||
"arch": compute.Architecture,
|
||||
"auto_start_w_node": compute.AutoStart,
|
||||
"boot_order": compute.BootOrder,
|
||||
"bootdisk_size": compute.BootDiskSize,
|
||||
"boot_image_id": compute.BootImageID,
|
||||
"chipset": compute.Chipset,
|
||||
"cd_image_id": compute.CdImageId,
|
||||
"clone_reference": compute.CloneReference,
|
||||
"clones": compute.Clones,
|
||||
"computeci_id": compute.ComputeCIID,
|
||||
"cpu_pin": compute.CPUPin,
|
||||
"cpus": compute.CPU,
|
||||
"created_by": compute.CreatedBy,
|
||||
"created_time": compute.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": compute.DeletedBy,
|
||||
"deleted_time": compute.DeletedTime,
|
||||
"desc": compute.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(compute.Disks),
|
||||
"driver": compute.Driver,
|
||||
"gid": compute.GID,
|
||||
"guid": compute.GUID,
|
||||
"hp_backed": compute.HPBacked,
|
||||
"compute_id": compute.ID,
|
||||
"interfaces": flattenInterfaces(compute.Interfaces),
|
||||
"live_migration_job_id": compute.LiveMigrationJobID,
|
||||
"lock_status": compute.LockStatus,
|
||||
"manager_id": compute.ManagerID,
|
||||
"manager_type": compute.ManagerType,
|
||||
"migrationjob": compute.MigrationJob,
|
||||
"milestones": compute.Milestones,
|
||||
"name": compute.Name,
|
||||
"need_reboot": compute.NeedReboot,
|
||||
"numa_affinity": compute.NumaAffinity,
|
||||
"numa_node_id": compute.NumaNodeId,
|
||||
"os_version": compute.OSVersion,
|
||||
"pinned": compute.PinnedToNode,
|
||||
"preferred_cpu": compute.PreferredCPU,
|
||||
"qemu_guest": flattenQemuQuest(compute.QemuQuest),
|
||||
"ram": compute.RAM,
|
||||
"reference_id": compute.ReferenceID,
|
||||
"registered": compute.Registered,
|
||||
"res_name": compute.ResName,
|
||||
"reserved_node_cpus": compute.ReservedNodeCpus,
|
||||
"rg_id": compute.RGID,
|
||||
"rg_name": compute.RGName,
|
||||
"snap_sets": flattenSnapSets(compute.SnapSets),
|
||||
"stateless_sep_id": compute.StatelessSepID,
|
||||
"stateless_sep_type": compute.StatelessSepType,
|
||||
"status": compute.Status,
|
||||
"tags": flattenTags(compute.Tags),
|
||||
"tech_status": compute.TechStatus,
|
||||
"total_disk_size": compute.TotalDiskSize,
|
||||
"updated_by": compute.UpdatedBy,
|
||||
"updated_time": compute.UpdatedTime,
|
||||
"user_managed": compute.UserManaged,
|
||||
"read_only": compute.ReadOnly,
|
||||
"vgpus": compute.VGPUs,
|
||||
"vins_connected": compute.VINSConnected,
|
||||
"loader_type": compute.LoaderType,
|
||||
"boot_type": compute.BootType,
|
||||
"hot_resize": compute.HotResize,
|
||||
@@ -279,6 +277,8 @@ func flattenBootDisk(bootDisk *compute.ItemComputeDisk) []map[string]interface{}
|
||||
"present_to": bootDisk.PresentTo,
|
||||
"storage_policy_id": bootDisk.StoragePolicyID,
|
||||
"to_clean": bootDisk.ToClean,
|
||||
"cache": bootDisk.Cache,
|
||||
"blk_discard": bootDisk.BLKDiscard,
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
@@ -333,6 +333,8 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, disksBlocks, ex
|
||||
"deleted_time": disk.DeletedTime,
|
||||
"updated_time": disk.UpdatedTime,
|
||||
"permanently": pernamentlyValue,
|
||||
"cache": disk.Cache,
|
||||
"blk_discard": disk.BLKDiscard,
|
||||
}
|
||||
res = append(res, temp)
|
||||
indexDataDisks++
|
||||
@@ -351,6 +353,7 @@ func flattenNetwork(networks []interface{}, interfaces compute.ListInterfaces) [
|
||||
"ip_address": network.IPAddress,
|
||||
"mac": network.MAC,
|
||||
"mtu": network.MTU,
|
||||
"net_mask": network.NetMask,
|
||||
"sdn_interface_id": network.SDNInterfaceID,
|
||||
"weight": flattenNetworkWeight(networks, network.NetID, network.NetType),
|
||||
"enabled": network.Enabled,
|
||||
@@ -428,12 +431,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
d.Set("gid", computeRec.GID)
|
||||
d.Set("guid", computeRec.GUID)
|
||||
d.Set("compute_id", computeRec.ID)
|
||||
//TODO
|
||||
// if computeRec.VirtualImageID != 0 {
|
||||
// d.Set("image_id", computeRec.VirtualImageID)
|
||||
// } else {
|
||||
// d.Set("image_id", computeRec.ImageID)
|
||||
// }
|
||||
d.Set("image_id", computeRec.ImageID)
|
||||
d.Set("interfaces", flattenInterfaces(computeRec.Interfaces))
|
||||
d.Set("lock_status", computeRec.LockStatus)
|
||||
d.Set("manager_id", computeRec.ManagerID)
|
||||
@@ -451,7 +449,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
if err := d.Set("os_users", parseOsUsers(computeRec.OSUsers)); err != nil {
|
||||
return err
|
||||
}
|
||||
d.Set("pinned", computeRec.PinnedToStack)
|
||||
d.Set("pinned", computeRec.PinnedToNode)
|
||||
d.Set("preferred_cpu", computeRec.PreferredCPU)
|
||||
d.Set("ram", computeRec.RAM)
|
||||
d.Set("reference_id", computeRec.ReferenceID)
|
||||
@@ -469,11 +467,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
d.Set("updated_by", computeRec.UpdatedBy)
|
||||
d.Set("updated_time", computeRec.UpdatedTime)
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("read_only", computeRec.ReadOnly)
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", flattenVGPUs(computeRec.VGPUs))
|
||||
//TODO
|
||||
// d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
// d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("loader_type", computeRec.LoaderType)
|
||||
d.Set("boot_type", computeRec.BootType)
|
||||
d.Set("hot_resize", computeRec.HotResize)
|
||||
@@ -585,9 +581,11 @@ func flattenListComputeDisks(disks compute.ListComputeDisks) []map[string]interf
|
||||
"_ckey": disk.CKey,
|
||||
"acl": string(acl),
|
||||
"account_id": disk.AccountID,
|
||||
"blk_discard": disk.BLKDiscard,
|
||||
"boot_partition": disk.BootPartition,
|
||||
"bus_number": disk.BusNumber,
|
||||
"created_time": disk.CreatedTime,
|
||||
"cache": disk.Cache,
|
||||
"created_by": disk.CreatedBy,
|
||||
"deleted_time": disk.DeletedTime,
|
||||
"deleted_by": disk.DeletedBy,
|
||||
@@ -722,7 +720,7 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute
|
||||
d.Set("natable_vins_network", computeRec.NatableVINSNetwork)
|
||||
d.Set("natable_vins_network_name", computeRec.NatableVINSNetworkName)
|
||||
d.Set("os_users", flattenOsUsers(computeRec.OSUsers))
|
||||
d.Set("pinned", computeRec.PinnedToStack)
|
||||
d.Set("pinned", computeRec.PinnedToNode)
|
||||
d.Set("preferred_CPU", computeRec.PreferredCPU)
|
||||
d.Set("qemu_guest", flattenQemuQuest(computeRec.QemuQuest))
|
||||
d.Set("ram", computeRec.RAM)
|
||||
@@ -741,12 +739,10 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute
|
||||
d.Set("updated_by", computeRec.UpdatedBy)
|
||||
d.Set("updated_time", computeRec.UpdatedTime)
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("read_only", computeRec.ReadOnly)
|
||||
d.Set("userdata", string(userdata))
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", flattenVGPUs(computeRec.VGPUs))
|
||||
//TODO
|
||||
// d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
// d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
d.Set("loader_type", computeRec.LoaderType)
|
||||
d.Set("boot_type", computeRec.BootType)
|
||||
@@ -884,7 +880,7 @@ func flattenPCIDevice(deviceList []compute.ItemPCIDevice) []map[string]interface
|
||||
"device_id": dev.ID,
|
||||
"name": dev.Name,
|
||||
"rg_id": dev.RGID,
|
||||
"stack_id": dev.StackID,
|
||||
"node_id": dev.NodeID,
|
||||
"status": dev.Status,
|
||||
"system_name": dev.SystemName,
|
||||
}
|
||||
|
||||
@@ -184,6 +184,13 @@ func networkSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "network enable flag",
|
||||
},
|
||||
|
||||
"net_mask": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "Subnet mask, used only for DPDK and VFNIC network types",
|
||||
},
|
||||
}
|
||||
return rets
|
||||
}
|
||||
|
||||
@@ -182,6 +182,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
reqInterface.MTU = uint64(netInterfaceVal["mtu"].(int))
|
||||
}
|
||||
|
||||
if reqInterface.NetType == "DPDK" || reqInterface.NetType == "VFNIC" {
|
||||
if netMask, netMaskSet := netInterfaceVal["net_mask"]; netMaskSet {
|
||||
reqInterface.NetMask = uint64(netMask.(int))
|
||||
}
|
||||
}
|
||||
|
||||
ipaddr, ipSet := netInterfaceVal["ip_address"]
|
||||
if ipSet {
|
||||
reqInterface.IPAddr = ipaddr.(string)
|
||||
@@ -460,16 +466,16 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.Get("pin_to_stack").(bool) {
|
||||
if d.Get("pin_to_node").(bool) {
|
||||
if !d.Get("started").(bool) {
|
||||
warnings.Add(errors.New("cannot pin to stack a VM, VM should be started"))
|
||||
warnings.Add(errors.New("cannot pin to node a VM, VM should be started"))
|
||||
}
|
||||
if d.Get("started").(bool) {
|
||||
req := compute.PinToStackRequest{
|
||||
req := compute.PinToNodeRequest{
|
||||
ComputeID: computeId,
|
||||
}
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
_, err = c.CloudAPI().Compute().PinToStack(ctx, req)
|
||||
_, err = c.CloudAPI().Compute().PinToNode(ctx, req)
|
||||
if err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
@@ -637,7 +643,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if !d.Get("pin_to_stack").(bool) && d.Get("auto_start_w_node").(bool) {
|
||||
if !d.Get("pin_to_node").(bool) && d.Get("auto_start_w_node").(bool) {
|
||||
req := compute.UpdateRequest{
|
||||
ComputeID: computeId,
|
||||
AutoStart: d.Get("auto_start_w_node").(bool),
|
||||
@@ -1775,6 +1781,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
req := compute.StopRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
@@ -1785,28 +1792,28 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChange("pin_to_stack") || d.HasChange("started") {
|
||||
newPin := d.Get("pin_to_stack")
|
||||
if !newPin.(bool) && d.HasChange("pin_to_stack") {
|
||||
req := compute.UnpinFromStackRequest{
|
||||
if d.HasChange("pin_to_node") || d.HasChange("started") {
|
||||
newPin := d.Get("pin_to_node")
|
||||
if !newPin.(bool) && d.HasChange("pin_to_node") {
|
||||
req := compute.UnpinFromNodeRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().Compute().UnpinFromStack(ctx, req)
|
||||
_, err := c.CloudAPI().Compute().UnpinFromNode(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
if newPin.(bool) {
|
||||
if !d.Get("started").(bool) {
|
||||
return diag.Errorf("Cannot pin to stack a VM, that is not started")
|
||||
return diag.Errorf("Cannot pin to node a VM, that is not started")
|
||||
}
|
||||
|
||||
req := compute.PinToStackRequest{
|
||||
req := compute.PinToNodeRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
}
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
_, err = c.CloudAPI().Compute().PinToStack(ctx, req)
|
||||
_, err = c.CloudAPI().Compute().PinToNode(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
@@ -1992,6 +1999,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2012,6 +2023,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return rets
|
||||
}
|
||||
@@ -2199,7 +2214,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"value": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Required: true,
|
||||
Description: "value that must match the key to be taken into account when analyzing this rule",
|
||||
},
|
||||
},
|
||||
@@ -2235,7 +2250,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"value": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Required: true,
|
||||
Description: "value that must match the key to be taken into account when analyzing this rule",
|
||||
},
|
||||
},
|
||||
@@ -2345,7 +2360,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Schema: cdSubresourceSchemaMake(),
|
||||
},
|
||||
},
|
||||
"pin_to_stack": {
|
||||
"pin_to_node": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
@@ -2735,6 +2750,11 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"vnc_password": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2866,12 +2886,12 @@ func ResourceCompute() *schema.Resource {
|
||||
},
|
||||
|
||||
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error {
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules",
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_node", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules",
|
||||
"extra_disks", "tags", "port_forwarding", "user_access", "snapshot", "pci_devices", "preferred_cpu", "security_groups") {
|
||||
diff.SetNewComputed("updated_time")
|
||||
diff.SetNewComputed("updated_by")
|
||||
}
|
||||
if diff.HasChanges("pin_to_stack") {
|
||||
if diff.HasChanges("pin_to_node") {
|
||||
diff.SetNewComputed("pinned")
|
||||
}
|
||||
if diff.HasChanges("image_id") {
|
||||
|
||||
@@ -281,6 +281,12 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
req.MTU = uint64(netData["mtu"].(int))
|
||||
}
|
||||
|
||||
if req.NetType == "DPDK" || req.NetType == "VFNIC" {
|
||||
if netMask, ok := netData["net_mask"].(int); ok && netMask > 0 {
|
||||
req.NetMask = uint64(netMask)
|
||||
}
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().Compute().NetAttach(ctx, req)
|
||||
if err != nil {
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to attach net ID %d of type %s to Compute ID %s: %s",
|
||||
|
||||
Reference in New Issue
Block a user