OCI Block Volume Backup scenarios with Invalid State scenarios on Snapshot Creation
I'm reviewing some code and I'm building a feature where I need help solving I'm stuck on something that should probably be simple... I am trying to create a backup of an existing block volume in Oracle Cloud Infrastructure (OCI) using the Go SDK. However, every time I attempt to create a snapshot, I receive an behavior indicating that the volume is in an invalid state. The behavior message I receive is: `"behavior creating snapshot: The specified block volume is in an invalid state"`. I've verified that the volume is not attached to any instance, and I can see the volume status as `Available` in the OCI console. Hereβs a snippet of my code: ```go package main import ( "context" "fmt" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/identity" "github.com/oracle/oci-go-sdk/v65/volumes" ) func main() { client, err := volumes.NewBlockstorageClientWithConfigurationProvider(common.DefaultConfigProvider()) if err != nil { fmt.Println("behavior creating block storage client:", err) return } ctx := context.Background() snapshotRequest := volumes.CreateVolumeBackupRequest{ VolumeBackupDetail: volumes.CreateVolumeBackupDetails{ VolumeId: common.String("<your-volume-id>"), DisplayName: common.String("MySnapshot"), }, } snapshotResponse, err := client.CreateVolumeBackup(ctx, snapshotRequest) if err != nil { fmt.Println("Failed to create snapshot:", err) return } fmt.Println("Snapshot created successfully:", snapshotResponse.Id) } ``` Iβve also confirmed that the block volume is indeed available using the OCI CLI with the command `oci bv volume get --volume-id <your-volume-id>`. The console says it's not attached to any instance, and I have the necessary permissions set up for the IAM policy. Is there something I might be missing in my code or configuration? Any insights would be appreciated! This is part of a larger CLI tool I'm building. I'm using Go latest in this project. Any suggestions would be helpful. Thanks for any help you can provide! This is part of a larger application I'm building. What's the best practice here?