Skip to content

Commit

Permalink
SDK-352 : Add storage config params - block_volume_count and block_vo…
Browse files Browse the repository at this point in the history
…lume_size (#274)

* SDK-352 : Add storage config params - block_volume_count and block_volume_size
  • Loading branch information
thispc authored and chattarajoy committed May 21, 2019
1 parent ce8fb38 commit 9148fba
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
34 changes: 29 additions & 5 deletions qds_sdk/cloud/oracle_bmc_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def set_cloud_config(self,
storage_tenant_id=None,
storage_user_id=None,
storage_key_finger_print=None,
storage_api_private_rsa_key=None):
storage_api_private_rsa_key=None,
block_volume_count=None,
block_volume_size=None):
'''
Args:
Expand Down Expand Up @@ -66,6 +68,10 @@ def set_cloud_config(self,
storage_api_private_rsa_key: storage api private rsa key for oracle cluster
block_volume_count: count of block volumes to be mounted to an instance as reserved disks
block_volume_size: It is the size (in GB) of each block volume to be mounted to an instance as reserved disk
'''

self.set_compute_config(use_account_compute_creds, compute_tenant_id,
Expand All @@ -75,7 +81,8 @@ def set_cloud_config(self,
self.set_network_config(vcn_id, subnet_id,
compartment_id, image_id, availability_domain_info_map)
self.set_storage_config(storage_tenant_id, storage_user_id,
storage_key_finger_print, storage_api_private_rsa_key)
storage_key_finger_print, storage_api_private_rsa_key, block_volume_count,
block_volume_size)

def set_compute_config(self,
use_account_compute_creds=None,
Expand Down Expand Up @@ -115,11 +122,15 @@ def set_storage_config(self,
storage_tenant_id=None,
storage_user_id=None,
storage_key_finger_print=None,
storage_api_private_rsa_key=None):
storage_api_private_rsa_key=None,
block_volume_count=None,
block_volume_size=None):
self.storage_config['storage_tenant_id'] = storage_tenant_id
self.storage_config['storage_user_id'] = storage_user_id
self.storage_config['storage_key_finger_print'] = storage_key_finger_print
self.storage_config['storage_api_private_rsa_key'] = storage_api_private_rsa_key
self.storage_config['block_volume_count'] = block_volume_count
self.storage_config['block_volume_size'] = block_volume_size

def set_cloud_config_from_arguments(self, arguments):
self.set_cloud_config(compute_tenant_id=arguments.compute_tenant_id,
Expand All @@ -137,7 +148,10 @@ def set_cloud_config_from_arguments(self, arguments):
storage_tenant_id=arguments.storage_tenant_id,
storage_user_id=arguments.storage_user_id,
storage_key_finger_print=arguments.storage_key_finger_print,
storage_api_private_rsa_key=arguments.storage_api_private_rsa_key)
storage_api_private_rsa_key=arguments.storage_api_private_rsa_key,
block_volume_count=arguments.block_volume_count,
block_volume_size=arguments.block_volume_size
)

def create_parser(self, argparser):
# compute settings parser
Expand Down Expand Up @@ -215,4 +229,14 @@ def create_parser(self, argparser):
storage_config.add_argument("--storage-api-private-rsa-key",
dest="storage_api_private_rsa_key",
default=None,
help="storage api private rsa key for oracle cluster")
help="storage api private rsa key for oracle cluster")
storage_config.add_argument("--block-volume-count",
dest="block_volume_count",
default=None,
help="count of block volumes to be mounted to an instance as reserved disks",
type=int)
storage_config.add_argument("--block-volume-size",
dest="block_volume_size",
default=None,
help="size (in GB) of each block volume to be mounted to an instance",
type=int)
7 changes: 5 additions & 2 deletions tests/test_clusterv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def test_oracle_bmc_compute_config(self):
def test_oracle_bmc_storage_config(self):
sys.argv = ['qds.py', '--version', 'v2', '--cloud', 'ORACLE_BMC', 'cluster', 'create', '--label', 'test_label',
'--storage-tenant-id', 'xxx11', '--storage-user-id', 'yyyy11', '--storage-key-finger-print',
'zzz22', '--storage-api-private-rsa-key', 'aaa']
'zzz22', '--storage-api-private-rsa-key', 'aaa', '--block-volume-count', '1',
'--block-volume-size', '100']
Qubole.cloud = None
print_command()
Connection._api_call = Mock(return_value={})
Expand All @@ -124,7 +125,9 @@ def test_oracle_bmc_storage_config(self):
{'storage_key_finger_print': 'zzz22',
'storage_api_private_rsa_key': 'aaa',
'storage_user_id': 'yyyy11',
'storage_tenant_id': 'xxx11'}},
'storage_tenant_id': 'xxx11',
'block_volume_count': 1,
'block_volume_size': 100}},
'cluster_info': {'label': ['test_label']}})

def test_oracle_bmc_network_config(self):
Expand Down

0 comments on commit 9148fba

Please sign in to comment.