Address review comments
This commit is contained in:
parent
cb359e8064
commit
b9b1cdf75f
|
@ -283,6 +283,18 @@ func (c *Config) Prepare(raws ...interface{}) error {
|
||||||
errs, errors.New("'shape' must be specified"))
|
errs, errors.New("'shape' must be specified"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasSuffix(c.Shape, "Flex") {
|
||||||
|
if c.ShapeConfig.Ocpus == nil {
|
||||||
|
errs = packersdk.MultiErrorAppend(
|
||||||
|
errs, errors.New("'Ocpus' must be specified when using flexible shapes"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.ShapeConfig.MemoryInGBs != nil && c.ShapeConfig.Ocpus == nil {
|
||||||
|
errs = packersdk.MultiErrorAppend(
|
||||||
|
errs, errors.New("'Ocpus' must be specified if memory_in_gbs is specified"))
|
||||||
|
}
|
||||||
|
|
||||||
if (c.SubnetID == "") && (c.CreateVnicDetails.SubnetId == nil) {
|
if (c.SubnetID == "") && (c.CreateVnicDetails.SubnetId == nil) {
|
||||||
errs = packersdk.MultiErrorAppend(
|
errs = packersdk.MultiErrorAppend(
|
||||||
errs, errors.New("'subnet_ocid' must be specified"))
|
errs, errors.New("'subnet_ocid' must be specified"))
|
||||||
|
|
|
@ -95,11 +95,6 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
|
||||||
FreeformTags: d.cfg.CreateVnicDetails.FreeformTags,
|
FreeformTags: d.cfg.CreateVnicDetails.FreeformTags,
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchInstanceShapeConfigDetails := core.LaunchInstanceShapeConfigDetails{
|
|
||||||
Ocpus: d.cfg.ShapeConfig.Ocpus,
|
|
||||||
MemoryInGBs: d.cfg.ShapeConfig.MemoryInGBs,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine base image ID
|
// Determine base image ID
|
||||||
var imageId *string
|
var imageId *string
|
||||||
if d.cfg.BaseImageID != "" {
|
if d.cfg.BaseImageID != "" {
|
||||||
|
@ -159,11 +154,18 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
|
||||||
DisplayName: d.cfg.InstanceName,
|
DisplayName: d.cfg.InstanceName,
|
||||||
FreeformTags: d.cfg.InstanceTags,
|
FreeformTags: d.cfg.InstanceTags,
|
||||||
Shape: &d.cfg.Shape,
|
Shape: &d.cfg.Shape,
|
||||||
ShapeConfig: &LaunchInstanceShapeConfigDetails,
|
|
||||||
SourceDetails: InstanceSourceDetails,
|
SourceDetails: InstanceSourceDetails,
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.cfg.ShapeConfig.Ocpus != nil {
|
||||||
|
LaunchInstanceShapeConfigDetails := core.LaunchInstanceShapeConfigDetails{
|
||||||
|
Ocpus: d.cfg.ShapeConfig.Ocpus,
|
||||||
|
MemoryInGBs: d.cfg.ShapeConfig.MemoryInGBs,
|
||||||
|
}
|
||||||
|
instanceDetails.ShapeConfig = &LaunchInstanceShapeConfigDetails
|
||||||
|
}
|
||||||
|
|
||||||
instance, err := d.computeClient.LaunchInstance(context.TODO(), core.LaunchInstanceRequest{
|
instance, err := d.computeClient.LaunchInstance(context.TODO(), core.LaunchInstanceRequest{
|
||||||
LaunchInstanceDetails: instanceDetails,
|
LaunchInstanceDetails: instanceDetails,
|
||||||
RequestMetadata: requestMetadata,
|
RequestMetadata: requestMetadata,
|
||||||
|
|
|
@ -100,10 +100,7 @@ can also be supplied to override the typical auto-generated key:
|
||||||
[ListShapes](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes)
|
[ListShapes](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes)
|
||||||
operation available in the Core Services API.
|
operation available in the Core Services API.
|
||||||
|
|
||||||
- `shape_config` (map of strings) - The shape configuration for an instance. The shape configuration determines the resources
|
When using flexible shapes, ocpus must be set.
|
||||||
allocated to an instance. Options:
|
|
||||||
- `ocpus` - The total number of OCPUs available to the instance.
|
|
||||||
- `memory_in_gbs` - The total amount of memory, in gigabytes, available to the instance.
|
|
||||||
|
|
||||||
- `subnet_ocid` (string) - The name of the subnet within which a new instance
|
- `subnet_ocid` (string) - The name of the subnet within which a new instance
|
||||||
is launched and provisioned.
|
is launched and provisioned.
|
||||||
|
@ -192,6 +189,11 @@ can also be supplied to override the typical auto-generated key:
|
||||||
- `use_private_ip` (boolean) - Use private ip addresses to connect to the
|
- `use_private_ip` (boolean) - Use private ip addresses to connect to the
|
||||||
instance via ssh.
|
instance via ssh.
|
||||||
|
|
||||||
|
- `shape_config` (object) - The shape configuration for an instance. The shape configuration determines the resources
|
||||||
|
allocated to an instance. Options:
|
||||||
|
- `ocpus` (required when using flexible shapes or memory_in_gbs is set) (float32) - The total number of OCPUs available to the instance.
|
||||||
|
- `memory_in_gbs` (optional) (float32) - The total amount of memory, in gigabytes, available to the instance.
|
||||||
|
|
||||||
<!-- markdown-link-check-disable -->
|
<!-- markdown-link-check-disable -->
|
||||||
- `metadata` (map of strings) - Metadata optionally contains custom metadata
|
- `metadata` (map of strings) - Metadata optionally contains custom metadata
|
||||||
key/value pairs provided in the configuration. While this can be used to
|
key/value pairs provided in the configuration. While this can be used to
|
||||||
|
|
Loading…
Reference in New Issue