Skip to content

feat:Block volume with autotune config#501

Open
vladcristi wants to merge 10 commits intooracle:mainfrom
vladcristi:block_volume_with_autotune_config
Open

feat:Block volume with autotune config#501
vladcristi wants to merge 10 commits intooracle:mainfrom
vladcristi:block_volume_with_autotune_config

Conversation

@vladcristi
Copy link
Member

@vladcristi vladcristi commented Feb 20, 2026

What this PR does:

  1. adds the possibility to specify block volume configuration with autotune enabled for cluster nodes.
  2. Fixes also an issue regarding bringing up cluster nodes with block volume attachments using launchVolumeAttachments with volumeId instead of launchParavirtualizedVolumeAttachment/launchIscsiVolumeAttachment block to be able to use previously created block volumes outside CAPOCI
  3. add the possibility to specify both block volume attachments to a cluster node with both autotune enabled configuration using blockVolumeSpec or using launchVolumeAttachments at the same time

Why we need it:
At instance creation you cannot specify autotune enabled configuration for your attached block volume: https://github.com/oracle/oci-go-sdk/blob/master/core/launch_instance_details.go -> https://github.com/oracle/oci-go-sdk/blob/master/core/launch_create_volume_from_attributes.go
In order to do that you should create a block volume with that configuration and after that at instance creation specify that block volume for attachments.

The changes from this PR give the capability to run that logic behind the scenes just by specifying in OCIMachineTemplate the blockvolumeSpec block with its fields. There is an example under templates/cluster-template-with-bv-autotuned.yaml

Which issue(s) this PR fixes :
Fixes #462

Checklist

  • All unit tests are passing
  • All PRBlocking tests are passing
  • Code builds successfully

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 20, 2026
@vladcristi
Copy link
Member Author

vladcristi commented Feb 20, 2026

Unit tests output:

        github.com/oracle/cluster-api-provider-oci              coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta1  19.231s coverage: 23.7% of statements
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta2  0.051s  coverage: 17.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/config 0.009s  coverage: 86.1% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/hash   0.015s  coverage: 97.8% of statements
       github.com/oracle/cluster-api-provider-oci/cloud/metrics                coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/ociutil        0.008s  coverage: 23.2% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/ociutil/ptr    0.029s  coverage: 100.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/scope  22.389s coverage: 74.4% of statements
       github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks            coverage: 0.0% of statements
       github.com/oracle/cluster-api-provider-oci/cloud/services/base          coverage: 0.0% of statements
       github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base                coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/compute       [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/compute/mock_compute          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement     [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement/mock_computemanagement              coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine       [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/identity      [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/identity/mock_identity                coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer  [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer/mock_lb          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer   [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer/mock_nlb          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/vcn   [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/vcn/mock_vcn          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/volume        [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/volume/mock_volume            coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/workrequests  [no test files]
       github.com/oracle/cluster-api-provider-oci/cloud/services/workrequests/mock_workrequests                coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/util   0.152s  coverage: 60.4% of statements
ok      github.com/oracle/cluster-api-provider-oci/controllers  7.136s  coverage: 59.7% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1      5.487s  coverage: 15.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2      0.025s  coverage: 5.8% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/controllers      0.713s  coverage: 56.0% of statements
       github.com/oracle/cluster-api-provider-oci/feature              coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/version      [no test files]
grep -v 'zz_generated' coverage.out > coverage_filtered.out
go tool cover -func=coverage_filtered.out -o coverage.txt
go tool cover -html=coverage_filtered.out -o coverage.html

E2e tests output:

Ran 9 of 31 Specs in 3921.596 seconds
SUCCESS! -- 9 Passed | 0 Failed | 0 Pending | 22 Skipped

@vladcristi vladcristi requested a review from joekr February 20, 2026 12:42
// * `20`: Represents Higher Performance option.
// * `30`-`120`: Represents the Ultra High Performance option.
// For performance autotune enabled volumes, it would be the Default(Minimum) VPUs/GB.
VpusPerGB *int64 `json:"vpusPerGB,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure I'll find out later in the code, but do we validate these values?

RPCConnectionId *string `json:"rpcConnectionId,omitempty"`
}

type BlockVolumeSpec struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we aren't perfect with this, but should we add // +optional for any param that is optional?
or call out defaults we set on behalf of the user


// The type of volume attachment used to attach this block volume to the instance
VolumeType string `json:"volumeType,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of new values here that can be set. Have we tested them all? should we make a new e2e test?


// The availability domain of the block volume replica.
// Example: `Uocm:PHX-AD-1`
AvailabilityDomain *string `json:"availabilityDomain,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about this. I see there is a cross region and cross AD replication support. Does this support both of those? Have we tested this works? Is there a way we can e2e test this works? or something?


type AutotunePolicy struct {
// This field can be of type DETACHED_VOLUME or PERFORMANCE_BASED
AutotuneType string `json:"autotuneType,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure I'll find out later in the code, but do we validate these values?

},
}...)
} else {
m.Logger.Info("Unknown attachment type not supported")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log this as error?

}

m.Logger.Info("Instance state, waiting...", "state", getInstanceResp.Instance.LifecycleState)
time.Sleep(5 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably also want to need some exit here as well. I'm not sure what that might be though 🤔

getInstanceResp, err := m.ComputeClient.GetInstance(ctx, getInstanceReq)
if err != nil {
if serviceErr, ok := err.(common.ServiceError); ok {
if serviceErr.GetHTTPStatusCode() == 404 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use ociutil.IsNotFound here

break
}
}
m.Logger.Info("Error checking instance state", "error", err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets log this as an error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if there is an error here we will still try to delete the DeleteBlockVolume below? Will that work?

if instance != nil {
m.Logger.Info("Found an existing instance")
m.Logger.Info("Reconcile block volume")
m.ReconcileBlockVolume(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this return an error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what will happen here if the instance already exists, will a new blockvolume be created? will that leak resources?

it looks like ReconcileBlockVolume gets the BV by name, if found it doesn't do anything what happens if the user wants to update the display name? Do we handle that case? Reading the code it seems it might create a new BV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support to define auto-tune parameters on launch volumes

2 participants