rubrik-sdk-for-python icon indicating copy to clipboard operation
rubrik-sdk-for-python copied to clipboard

on_demand_snapshot failing for Oracle DB where relics exist

Open SpikeyWeasel opened this issue 2 years ago • 0 comments

Hi,

We're doing a Rubrik POC and in the process of evaluating automation I was attempting to do an on demand snapshot of an Oracle database that had previously been deleted from the Rubrik cluster and was subsequently re-added. I'd expect that the snapshot would complete successfully.

Expected Behavior

A successful on demand snapshot of an Oracle DB

Current Behavior

The snapshot fails.

Failure Information (for bugs)

Snapshot fails with:

[2022-10-24 17:20:01,604] [INFO] -- Response: {"message":"Could not find OracleDatabase with id=df113dd1-723a-486f-9506-85398059ab59"}

import rubrik_cdm
import urllib3
import sys

urllib3.disable_warnings()
rubrik=rubrik_cdm.Connect(enable_logging=True, logging_level="info")

object_name = sys.argv[1]
object_type = "oracle_db"
host = sys.argv[2]

print ("DB: " + object_name)
print ("Host: " + host)
snapshot = rubrik.on_demand_snapshot(object_name, object_type, hostname=host, force_full=False )
print (snapshot)

Steps to Reproduce

  1. Create DB
  2. Register DB
  3. Delete environment
  4. Re-add environment
  5. Run snapshot script

Context

In terms of versions the API is invoked against the latest Rubrik version from a Python 3.6 virtual environment on RHEL7 OS.

Failure Logs

(ansible-venv) [ec2-user@ip-10-206-213-66 ansible]$ python ./python/on_demand_snapshot.py RBK01LB ip-10-227-97-215.ec2.internal [2022-10-24 17:19:59,691] [INFO] -- Node IP: use1l0rbk001-01.ireland.actifio.local [2022-10-24 17:19:59,691] [INFO] -- Username: peter.field [2022-10-24 17:19:59,691] [INFO] -- Password: ****** DB: RBK01LB Host: ip-10-227-97-215.ec2.internal [2022-10-24 17:19:59,691] [INFO] -- on_demand_snapshot: Searching the Rubrik cluster for the Oracle database 'RBK01LB' on the host 'ip-10-227-97-215.ec2.internal'. [2022-10-24 17:19:59,692] [INFO] -- object_id: Getting the object id for the oracle_db object 'RBK01LB'. [2022-10-24 17:19:59,692] [INFO] -- User Agent: RubrikPythonSDK--2.0.10--3.6.8 [2022-10-24 17:19:59,693] [INFO] -- GET https://use1l0rbk001-01.ireland.actifio.local/api/internal/oracle/db?name=RBK01LB [2022-10-24 17:20:00,408] [INFO] -- <Response [200]>

[2022-10-24 17:20:00,409] [INFO] -- on_demand_snapshot: Searching the Rubrik cluster for the SLA Domain assigned to the Oracle database 'RBK01LB'. [2022-10-24 17:20:00,409] [INFO] -- User Agent: RubrikPythonSDK--2.0.10--3.6.8 [2022-10-24 17:20:00,409] [INFO] -- GET https://use1l0rbk001-01.ireland.actifio.local/api/internal/oracle/db/OracleDatabase:::df113dd1-723a-486f-9506-85398059ab59 [2022-10-24 17:20:01,062] [INFO] -- <Response [200]>

[2022-10-24 17:20:01,063] [INFO] -- on_demand_snapshot: Initiating snapshot for the Oracle database 'RBK01LB'. [2022-10-24 17:20:01,063] [INFO] -- User Agent: RubrikPythonSDK--2.0.10--3.6.8 [2022-10-24 17:20:01,063] [INFO] -- POST https://use1l0rbk001-01.ireland.actifio.local/api/internal/oracle/db/OracleDatabase:::df113dd1-723a-486f-9506-85398059ab59/snapshot [2022-10-24 17:20:01,063] [INFO] -- Config: {"slaId": "UNPROTECTED", "forceFullSnapshot": false} [2022-10-24 17:20:01,604] [INFO] -- Response: {"message":"Could not find OracleDatabase with id=df113dd1-723a-486f-9506-85398059ab59"} [2022-10-24 17:20:01,605] [INFO] -- <Response [404]>

Analysis

I think that the issue is that having deleted the DB there are relic objects being returned when the DB object_id is being determined and it's picking up the relic first, trying to do a snapshot and stating that it could not find the Oracle database. In https://github.com/rubrikinc/rubrik-sdk-for-python/blob/6f31bf8008bbb0fb921942c55b5ff0a865677135/rubrik_cdm/data_management.py in the "object_id" function has a nested oracle_db dictionary in the api_call dictionary and that is missing "is_relic=false" in the api_endpoint. Other api_endpoints have it and I used the same API calls in the process flow directly from Ansible code and the addition of "is_relic=false" works.

Thanks

Peter

SpikeyWeasel avatar Oct 31 '22 09:10 SpikeyWeasel