oracle / oracle/oci-cli

OCI CLI ignores shape-config memory_in_gbs parameter for Flex shapes, always uses default memory allocation

Open
#986 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
669
Forks
236
Avg merge
1m
Merged PRs (30d)
4

Description

Bug Description:

Summary

The OCI CLI compute instance launch command completely ignores the memory_in_gbs parameter in --shape-config for Flex shapes (VM.Standard.E4.Flex,
VM.Standard3.Flex, VM.Standard.A1.Flex), always defaulting to the shape's default memory allocation regardless of the specified value.

Environment

  • OCI CLI Version: 3.64.1 (Oracle-PythonCLI/3.64.1)
  • Platform: Linux 6.12.0-102.36.5.2.el9uek.x86_64
  • Region: us-ashburn-1 (iad)
  • Shapes Tested: VM.Standard.E4.Flex, VM.Standard3.Flex, VM.Standard.A1.Flex

Expected Behavior

When launching an instance with --shape-config '{"ocpus": 2, "memory_in_gbs": 4}', the instance should be created with exactly 4 GB of memory.

Actual Behavior

The instance is created with the shape's default memory allocation:

  • VM.Standard.E4.Flex: Always gets 32 GB (16 GB per OCPU default)
  • VM.Standard3.Flex: Always gets 32 GB (16 GB per OCPU default)
  • VM.Standard.A1.Flex: Always gets 12 GB (6 GB per OCPU default)

Steps to Reproduce

  1. Launch instance with JSON inline:
    oci compute instance launch
    --compartment-id [COMPARTMENT_ID]
    --availability-domain [AD]
    --display-name "test-memory-4gb"
    --image-id [COMPATIBLE_IMAGE_ID]
    --subnet-id [SUBNET_ID]
    --shape VM.Standard.E4.Flex
    --shape-config '{"ocpus": 2, "memory_in_gbs": 4}'

  2. Launch instance with JSON file:
    echo '{"ocpus": 2, "memory_in_gbs": 4}' > shape-config.json
    oci compute instance launch
    --shape VM.Standard.E4.Flex
    --shape-config file://shape-config.json
    [other parameters...]

  3. Attempt resize on stopped instance:
    oci compute instance update
    --instance-id [INSTANCE_ID]
    --shape-config file://shape-config.json --force

  4. Verify memory allocation:
    oci compute instance get
    --instance-id [INSTANCE_ID]
    --query 'data.shape_config.memory_in_gbs'

Result: All methods return default memory (32.0 GB for E4.Flex) instead of requested 4 GB.

Workaround

Using Terraform with the OCI provider correctly allocates the specified memory:
resource "oci_core_instance" "test" {
shape = "VM.Standard.E4.Flex"
shape_config {
ocpus = 2
memory_in_gbs = 4 # This works correctly
}
}

Impact

  • High: Prevents accurate resource provisioning for migration and automation scenarios
  • Cost: Forces over-allocation of memory resources leading to unnecessary costs
  • Automation: Breaks infrastructure-as-code deployments that require specific memory configurations

Additional Evidence

  • Shape constraints confirm memory_in_gbs range is valid (min: 1.0, max: 64.0 per OCPU for E4.Flex)
  • Work requests complete successfully but memory allocation remains unchanged
  • Issue persists across multiple regions and image types
  • Same JSON configuration works correctly with Terraform OCI provider

This appears to be a CLI-specific issue where the shape-config memory parameter is not being properly passed to the underlying API, while the
Terraform provider correctly implements the same functionality.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OCI CLI compute instance launch and update entry points and reproduce the issue using --shape-config with memory_in_gbs on the listed Flex shapes. Trace the request data and verify with oci compute instance get that the requested memory value is sent and retained instead of the shape default.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.