From 2fce7a3d0ca264e012d0fb5cf128a74dd9a07fb0 Mon Sep 17 00:00:00 2001 From: Vipin Balachandran Date: Tue, 23 Aug 2016 14:05:44 +0530 Subject: [PATCH] VMware:Config option for http connection pool size Adding config option 'vmware_connection_pool_size' to specify the maximum number of connections in the http connection pool. Change-Id: I4bc2ac61d95c9fc8894503dade6b215c394f0733 --- .../volume/drivers/vmware/test_vmware_vmdk.py | 22 +++++++++++-------- cinder/volume/drivers/vmware/vmdk.py | 12 +++++++--- ...onfig_conn_pool_size-0658c497e118533f.yaml | 5 +++++ 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/vmdk_config_conn_pool_size-0658c497e118533f.yaml diff --git a/cinder/tests/unit/volume/drivers/vmware/test_vmware_vmdk.py b/cinder/tests/unit/volume/drivers/vmware/test_vmware_vmdk.py index fdf51560ca9..85f03de9491 100644 --- a/cinder/tests/unit/volume/drivers/vmware/test_vmware_vmdk.py +++ b/cinder/tests/unit/volume/drivers/vmware/test_vmware_vmdk.py @@ -58,6 +58,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase): VMDK_DRIVER = vmdk.VMwareVcVmdkDriver CLUSTERS = ["cls-1", "cls-2"] DEFAULT_VC_VERSION = '5.5' + POOL_SIZE = 20 VOL_ID = 'abcdefab-cdef-abcd-efab-cdefabcdefab' DISPLAY_NAME = 'foo' @@ -89,6 +90,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase): self._config.vmware_insecure = False self._config.vmware_cluster_name = self.CLUSTERS self._config.vmware_host_version = self.DEFAULT_VC_VERSION + self._config.vmware_connection_pool_size = self.POOL_SIZE self._db = mock.Mock() self._driver = vmdk.VMwareVcVmdkDriver(configuration=self._config, @@ -2687,17 +2689,19 @@ class VMwareVcVmdkDriverTestCase(test.TestCase): self._driver.session() + config = self._driver.configuration apiSession.assert_called_once_with( - self._config.vmware_host_ip, - self._config.vmware_host_username, - self._config.vmware_host_password, - self._config.vmware_api_retry_count, - self._config.vmware_task_poll_interval, - wsdl_loc=self._config.safe_get('vmware_wsdl_location'), + config.vmware_host_ip, + config.vmware_host_username, + config.vmware_host_password, + config.vmware_api_retry_count, + config.vmware_task_poll_interval, + wsdl_loc=config.safe_get('vmware_wsdl_location'), pbm_wsdl_loc=None, - port=self._config.vmware_host_port, - cacert=self._config.vmware_ca_file, - insecure=self._config.vmware_insecure) + port=config.vmware_host_port, + cacert=config.vmware_ca_file, + insecure=config.vmware_insecure, + pool_size=config.vmware_connection_pool_size) @mock.patch.object(VMDK_DRIVER, 'volumeops') @mock.patch.object(VMDK_DRIVER, '_extend_backing') diff --git a/cinder/volume/drivers/vmware/vmdk.py b/cinder/volume/drivers/vmware/vmdk.py index 7ab47aa6d62..099f0413b0d 100644 --- a/cinder/volume/drivers/vmware/vmdk.py +++ b/cinder/volume/drivers/vmware/vmdk.py @@ -128,6 +128,9 @@ vmdk_opts = [ cfg.MultiStrOpt('vmware_cluster_name', help='Name of a vCenter compute cluster where volumes ' 'should be created.'), + cfg.IntOpt('vmware_connection_pool_size', + default=10, + help='Maximum number of connections in http connection pool.'), ] CONF = cfg.CONF @@ -219,9 +222,10 @@ class VMwareVcVmdkDriver(driver.VolumeDriver): # 1.4.0 - support for volume retype # 1.5.0 - restrict volume placement to specific vCenter clusters # 1.6.0 - support for manage existing - VERSION = '1.6.0' + # 1.7.0 - new config option 'vmware_connection_pool_size' + VERSION = '1.7.0' - # ThirdaPartySystems wiki page + # ThirdPartySystems wiki page CI_WIKI_NAME = "VMware_CI" # Minimum supported vCenter version. @@ -1814,6 +1818,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver): pbm_wsdl = self.pbm_wsdl if hasattr(self, 'pbm_wsdl') else None ca_file = self.configuration.vmware_ca_file insecure = self.configuration.vmware_insecure + pool_size = self.configuration.vmware_connection_pool_size self._session = api.VMwareAPISession(ip, username, password, api_retry_count, task_poll_interval, @@ -1821,7 +1826,8 @@ class VMwareVcVmdkDriver(driver.VolumeDriver): pbm_wsdl_loc=pbm_wsdl, port=port, cacert=ca_file, - insecure=insecure) + insecure=insecure, + pool_size=pool_size) return self._session def _get_vc_version(self): diff --git a/releasenotes/notes/vmdk_config_conn_pool_size-0658c497e118533f.yaml b/releasenotes/notes/vmdk_config_conn_pool_size-0658c497e118533f.yaml new file mode 100644 index 00000000000..4a6fafce759 --- /dev/null +++ b/releasenotes/notes/vmdk_config_conn_pool_size-0658c497e118533f.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - Added config option ``vmware_connection_pool_size`` in the + VMware VMDK driver to specify the maximum number of connections + (to vCenter) in the http connection pool.