From c852c40d0467b60d3dd2e82326b46ca6a434546b Mon Sep 17 00:00:00 2001 From: Pulkit Chawla Date: Mon, 20 May 2019 16:20:27 +0530 Subject: [PATCH 1/4] SDK-352 : Add storage config params - block_volume_count and block_volume_size --- qds_sdk/cloud/oracle_bmc_cloud.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/qds_sdk/cloud/oracle_bmc_cloud.py b/qds_sdk/cloud/oracle_bmc_cloud.py index f71c9445..ccaa9479 100755 --- a/qds_sdk/cloud/oracle_bmc_cloud.py +++ b/qds_sdk/cloud/oracle_bmc_cloud.py @@ -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: @@ -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, @@ -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, @@ -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, From 73aa86c67e2b48c53cccda3316a7dea35f8709bd Mon Sep 17 00:00:00 2001 From: Pulkit Chawla Date: Mon, 20 May 2019 18:17:24 +0530 Subject: [PATCH 2/4] added unit tests --- tests/test_clusterv2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_clusterv2.py b/tests/test_clusterv2.py index dadd5817..6683678b 100644 --- a/tests/test_clusterv2.py +++ b/tests/test_clusterv2.py @@ -124,7 +124,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): From 82acf6e8545016c963b2bebf80f9d0beb20ad2d0 Mon Sep 17 00:00:00 2001 From: Pulkit Chawla Date: Mon, 20 May 2019 18:32:26 +0530 Subject: [PATCH 3/4] added cli options --- qds_sdk/cloud/oracle_bmc_cloud.py | 12 +++++++++++- tests/test_clusterv2.py | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qds_sdk/cloud/oracle_bmc_cloud.py b/qds_sdk/cloud/oracle_bmc_cloud.py index ccaa9479..a7a9bd74 100755 --- a/qds_sdk/cloud/oracle_bmc_cloud.py +++ b/qds_sdk/cloud/oracle_bmc_cloud.py @@ -226,4 +226,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") \ No newline at end of file + 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) \ No newline at end of file diff --git a/tests/test_clusterv2.py b/tests/test_clusterv2.py index 6683678b..c1e0b413 100644 --- a/tests/test_clusterv2.py +++ b/tests/test_clusterv2.py @@ -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={}) From 9326fd59e31d03e5fe7b79fa5c6e2728b0c6c379 Mon Sep 17 00:00:00 2001 From: Pulkit Chawla Date: Mon, 20 May 2019 18:39:58 +0530 Subject: [PATCH 4/4] added cli options --- qds_sdk/cloud/oracle_bmc_cloud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qds_sdk/cloud/oracle_bmc_cloud.py b/qds_sdk/cloud/oracle_bmc_cloud.py index a7a9bd74..edefe0a4 100755 --- a/qds_sdk/cloud/oracle_bmc_cloud.py +++ b/qds_sdk/cloud/oracle_bmc_cloud.py @@ -148,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