Skip to content

Commit

Permalink
Add support for Exadata Cluster VM Scaling
Browse files Browse the repository at this point in the history
Oracle have moved to a new resource model for Exadata at Oracle Cloud
instances, they're now split into Infrastructure and VM as opposed to the
all-encompassing DB Systems.

This update caters for scaling the new CloudVmCluster resource type.
  • Loading branch information
huggierich committed Apr 21, 2021
1 parent f404d31 commit 2382a35
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 5 deletions.
50 changes: 50 additions & 0 deletions AutoScaleALL.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ def findAllCompartments():
if resource.resource_type == "DbSystem":
resourceDetails = database.get_db_system(db_system_id=resource.identifier, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY).data
resourceOk = True
if resource.resource_type == "CloudVmCluster":
resourceDetails = database.get_cloud_vm_cluster(cloud_vm_cluster_id=resource.identifier, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY).data
resourceOk = True
if resource.resource_type == "VmCluster":
resourceDetails = database.get_vm_cluster(vm_cluster_id=resource.identifier, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY).data
resourceOk = True
Expand Down Expand Up @@ -611,6 +614,53 @@ def findAllCompartments():
MakeLog(" - Error ({}) Exadata DB Scale Up from {} to {} for {} - {}".format(response.status, resourceDetails.cpu_core_count,int(schedulehours[CurrentHour]), resource.display_name,response.message))
Retry = False

# Execute Scaling operations for Exadata@Oracle Cloud Cluster VM
if resource.resource_type == "CloudVmCluster":
if int(schedulehours[CurrentHour]) >= 0 and int(schedulehours[CurrentHour]) < 401:
# Cluster VM is running, request is amount of CPU core change is needed
if resourceDetails.lifecycle_state == "AVAILABLE":
if resourceDetails.cpu_core_count > int(schedulehours[CurrentHour]):
if Action == "All" or Action == "Down":
MakeLog(" - Initiate Exadata VM Cluster Scale Down from {} to {} for {}".format(resourceDetails.cpu_core_count, int(schedulehours[CurrentHour]),resource.display_name))
vmupdate = oci.database.models.UpdateCloudVmClusterDetails()
vmupdate.cpu_core_count = int(schedulehours[CurrentHour])
Retry = True
while Retry:
try:
response = database.update_cloud_vm_cluster(cloud_vm_cluster_id=resource.identifier, update_cloud_vm_cluster_details=vmupdate)
Retry = False
success.append(" - Initiate Exadata VM Cluster Scale Down to {} for {}".format(resourceDetails.cpu_core_count, int(schedulehours[CurrentHour]),resource.display_name))
except oci.exceptions.ServiceError as response:
if response.status == 429:
MakeLog("Rate limit kicking in.. waiting {} seconds...".format(RateLimitDelay))
time.sleep(RateLimitDelay)
else:
ErrorsFound = True
errors.append(" - Error ({}) Exadata VM Cluster Scale Down from {} to {} for {} - {}".format(response.status, resourceDetails.cpu_core_count, int(schedulehours[CurrentHour]),resource.display_name, response.message))
MakeLog(" - Error ({}) Exadata VM Cluster Scale Down from {} to {} for {} - {}".format(response.status, resourceDetails.cpu_core_count, int(schedulehours[CurrentHour]),resource.display_name, response.message))
Retry = False

if resourceDetails.cpu_core_count < int(schedulehours[CurrentHour]):
if Action == "All" or Action == "Up":
MakeLog(" - Initiate Exadata VM Cluster Scale UP from {} to {} for {}".format(resourceDetails.cpu_core_count,int(schedulehours[CurrentHour]),resource.display_name))
vmupdate = oci.database.models.UpdateCloudVmClusterDetails()
vmupdate.cpu_core_count = int(schedulehours[CurrentHour])
Retry = True
while Retry:
try:
response = database.update_cloud_vm_cluster(cloud_vm_cluster_id=resource.identifier, update_cloud_vm_cluster_details=vmupdate)
Retry = False
success.append(" - Initiate Exadata VM Cluster Scale UP from {} to {} for {}".format(resourceDetails.cpu_core_count,int(schedulehours[CurrentHour]),resource.display_name))
except oci.exceptions.ServiceError as response:
if response.status == 429:
MakeLog("Rate limit kicking in.. waiting {} seconds...".format(RateLimitDelay))
time.sleep(RateLimitDelay)
else:
ErrorsFound = True
errors.append(" - Error ({}) Exadata VM Cluster Scale Up from {} to {} for {} - {}".format(response.status, resourceDetails.cpu_core_count,int(schedulehours[CurrentHour]), resource.display_name,response.message))
MakeLog(" - Error ({}) Exadata VM Cluster Scale Up from {} to {} for {} - {}".format(response.status, resourceDetails.cpu_core_count,int(schedulehours[CurrentHour]), resource.display_name,response.message))
Retry = False

# Execute Scaling operations for Cloud@customer Exadata Cluster VM
if resource.resource_type == "VmCluster":
if int(schedulehours[CurrentHour]) >= 0 and int(schedulehours[CurrentHour]) < 401:
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ The **AutoScaleALL** script: A single Auto Scaling script for all OCI resources
- Instance Pools: On/Off and Scaling (# of instances)
- Database VMs: On/Off
- Database Baremetal Servers: Scaling (# of CPUs)
- Database Exadata CS: Scaling (# of CPUs)
- Database Exadata CS: Scaling (# of CPUs)*
- Autonomous Databases: On/Off and Scaling (# of CPUs)
- Oracle Digital Assistant: On/Off
- Oracle Analytics Cloud: On/Off and Scaling (between 2-8 oCPU and 10-12 oCPU)
- Oracle Integration Service: On/Off
- Load Balancer: Scaling (between 10, 100, 400, 8000 Mbps)*
- MySQL Service: On/Off**
- Load Balancer: Scaling (between 10, 100, 400, 8000 Mbps)**
- MySQL Service: On/Off***
- GoldenGate: On/Off

*For the loadbalancer service, specify the number 10,100,400 or 8000 for each hour to set the correct shape.
*Supports the original DB System resource model and the newer Cloud VM Cluster resource model (introduced in Nov 2020)

**For the loadbalancer service, specify the number 10,100,400 or 8000 for each hour to set the correct shape.
When changing shape, All existing connections to this load balancer will be reset during the update process and may take up to a minute, leading to potential connection loss. For non session persistent web based applications, I did not see any noticeable interruption or downtime in my own tests, but please test yourself!

**MySQL Instances are not found by the search function :-( So a special routine is run to query them.
***MySQL Instances are not found by the search function :-( So a special routine is run to query them.
Also MySQL instances that are not running (Active state)) do not allow their tags to be changed/added/removed.

# Features
Expand Down

0 comments on commit 2382a35

Please sign in to comment.