@@ -691,6 +691,11 @@ class HPE3PARBaseDriver(test.TestCase):
691691 'minor' : 10 ,
692692 'revision' : 0 }
693693
694+ wsapi_version_2025 = {'major' : 1 ,
695+ 'build' : 100500031 ,
696+ 'minor' : 15 ,
697+ 'revision' : 0 }
698+
694699 # Use this to point to latest version of wsapi
695700 wsapi_version_latest = wsapi_version_for_compression
696701
@@ -1519,12 +1524,18 @@ def test_create_volume_replicated_peer_persistence(
15191524 mock_client .assert_has_calls (expected )
15201525 self .assertEqual (return_model ['replication_status' ], 'enabled' )
15211526
1527+ # (i) wsapi version is old/default
1528+ # (ii) wsapi version is 2025, then all licenses are enabled
1529+ @ddt .data ({'wsapi_version' : None },
1530+ {'wsapi_version' : HPE3PARBaseDriver .wsapi_version_2025 })
1531+ @ddt .unpack
15221532 @mock .patch .object (volume_types , 'get_volume_type' )
1523- def test_create_volume_dedup_compression (self , _mock_volume_types ):
1533+ def test_create_volume_dedup_compression (self , _mock_volume_types ,
1534+ wsapi_version ):
15241535 # setup_mock_client drive with default configuration
15251536 # and return the mock HTTP 3PAR client
15261537
1527- mock_client = self .setup_driver ()
1538+ mock_client = self .setup_driver (wsapi_version = wsapi_version )
15281539
15291540 _mock_volume_types .return_value = {
15301541 'name' : 'dedup_compression' ,
@@ -1536,21 +1547,41 @@ def test_create_volume_dedup_compression(self, _mock_volume_types):
15361547 'hpe3par:provisioning' : 'dedup' ,
15371548 'hpe3par:compression' : 'True' ,
15381549 'volume_type' : self .volume_type_dedup_compression }}
1539- mock_client .getStorageSystemInfo .return_value = {
1540- 'id' : self .CLIENT_ID ,
1541- 'serialNumber' : '1234' ,
1542- 'licenseInfo' : {
1543- 'licenses' : [{'name' : 'Compression' },
1544- {'name' : 'Thin Provisioning (102400G)' },
1545- {'name' : 'System Reporter' }]
1550+ if not wsapi_version :
1551+ mock_client .getStorageSystemInfo .return_value = {
1552+ 'id' : self .CLIENT_ID ,
1553+ 'serialNumber' : '1234' ,
1554+ 'licenseInfo' : {
1555+ 'licenses' : [{'name' : 'Compression' },
1556+ {'name' : 'Thin Provisioning (102400G)' },
1557+ {'name' : 'System Reporter' }]
1558+ }
1559+ }
1560+ else :
1561+ mock_client .getStorageSystemInfo .return_value = {
1562+ 'id' : self .CLIENT_ID ,
1563+ 'serialNumber' : '1234' ,
1564+ 'licenseInfo' : {
1565+ # all licenses are enabled
1566+ 'licenses' : [{'name' : 'FIPS Encryption' },
1567+ {'name' : 'Owned' },
1568+ {'name' : 'Software and Support SaaS' }]
1569+ }
15461570 }
1547- }
15481571 with mock .patch .object (hpecommon .HPE3PARCommon ,
15491572 '_create_client' ) as mock_create_client :
15501573 mock_create_client .return_value = mock_client
15511574
1552- return_model = self .driver .create_volume (
1553- self .volume_dedup_compression )
1575+ if not wsapi_version :
1576+ # (i) old/default
1577+ return_model = self .driver .create_volume (
1578+ self .volume_dedup_compression )
1579+ else :
1580+ # (ii) wsapi version 2025
1581+ common = self .driver ._login ()
1582+ return_model = common .create_volume (
1583+ self .volume_dedup_compression )
1584+
15541585 comment = Comment ({
15551586 "volume_type_name" : "dedup_compression" ,
15561587 "display_name" : "Foo Volume" ,
@@ -1559,18 +1590,24 @@ def test_create_volume_dedup_compression(self, _mock_volume_types):
15591590 "volume_id" : "d03338a9-9115-48a3-8dfc-35cdfcdc15a7" ,
15601591 "qos" : {},
15611592 "type" : "OpenStack" })
1593+ optional = {'comment' : comment ,
1594+ 'tpvv' : False ,
1595+ 'tdvv' : True ,
1596+ 'compression' : True }
1597+ if not wsapi_version :
1598+ optional ['snapCPG' ] = HPE3PAR_CPG_SNAP
15621599 expected = [
15631600 mock .call .getCPG (HPE3PAR_CPG ),
15641601 mock .call .getStorageSystemInfo (),
15651602 mock .call .createVolume (
15661603 self .VOLUME_3PAR_NAME ,
15671604 HPE3PAR_CPG ,
1568- 16384 , {
1569- 'comment' : comment ,
1570- 'tpvv' : False ,
1571- 'tdvv' : True ,
1572- 'compression' : True ,
1573- 'snapCPG' : HPE3PAR_CPG_SNAP })]
1605+ 16384 , optional )]
1606+ if wsapi_version == HPE3PARBaseDriver . wsapi_version_2025 :
1607+ extras = ( self . get_id_login +
1608+ self . standard_logout +
1609+ self . standard_login )
1610+ expected = extras + expected
15741611 mock_client .assert_has_calls (expected )
15751612 self .assertIsNone (return_model )
15761613
@@ -8133,25 +8170,43 @@ def test_get_3par_host_from_wwn_iqn(self):
81338170 iqns = None )
81348171 self .assertIsNotNone (hostname )
81358172
8136- def test_get_volume_stats1 (self ):
8173+ # (i) wsapi version is old/default
8174+ # (ii) wsapi version is 2025, then all licenses are enabled
8175+ @ddt .data ({'wsapi_version' : None },
8176+ {'wsapi_version' : HPE3PARBaseDriver .wsapi_version_2025 })
8177+ @ddt .unpack
8178+ def test_get_volume_stats1 (self , wsapi_version ):
81378179 # setup_mock_client drive with the configuration
81388180 # and return the mock HTTP 3PAR client
81398181 config = self .setup_configuration ()
81408182 config .filter_function = FILTER_FUNCTION
81418183 config .goodness_function = GOODNESS_FUNCTION
8142- mock_client = self .setup_driver (config = config )
8184+ mock_client = self .setup_driver (config = config ,
8185+ wsapi_version = wsapi_version )
81438186 mock_client .getCPG .return_value = self .cpgs [0 ]
8144- # Purposely left out the Priority Optimization license in
8145- # getStorageSystemInfo to test that QoS_support returns False.
8146- mock_client .getStorageSystemInfo .return_value = {
8147- 'id' : self .CLIENT_ID ,
8148- 'serialNumber' : '1234' ,
8149- 'licenseInfo' : {
8150- 'licenses' : [{'name' : 'Remote Copy' },
8151- {'name' : 'Thin Provisioning (102400G)' },
8152- {'name' : 'System Reporter' }]
8187+ if not wsapi_version :
8188+ # Purposely left out the Priority Optimization license in
8189+ # getStorageSystemInfo to test that QoS_support returns False.
8190+ mock_client .getStorageSystemInfo .return_value = {
8191+ 'id' : self .CLIENT_ID ,
8192+ 'serialNumber' : '1234' ,
8193+ 'licenseInfo' : {
8194+ 'licenses' : [{'name' : 'Remote Copy' },
8195+ {'name' : 'Thin Provisioning (102400G)' },
8196+ {'name' : 'System Reporter' }]
8197+ }
8198+ }
8199+ else :
8200+ mock_client .getStorageSystemInfo .return_value = {
8201+ 'id' : self .CLIENT_ID ,
8202+ 'serialNumber' : '1234' ,
8203+ 'licenseInfo' : {
8204+ # all licenses are enabled
8205+ 'licenses' : [{'name' : 'FIPS Encryption' },
8206+ {'name' : 'Owned' },
8207+ {'name' : 'Software and Support SaaS' }]
8208+ }
81538209 }
8154- }
81558210
81568211 # cpg has no limit
81578212 mock_client .getCPGAvailableSpace .return_value = {
@@ -8181,7 +8236,12 @@ def test_get_volume_stats1(self):
81818236 self .assertEqual ('12345' , stats ['array_id' ])
81828237 self .assertTrue (stats ['pools' ][0 ]['thin_provisioning_support' ])
81838238 self .assertTrue (stats ['pools' ][0 ]['thick_provisioning_support' ])
8184- self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8239+ if not wsapi_version :
8240+ # (i) old/default
8241+ self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8242+ else :
8243+ # (ii) wsapi version 2025
8244+ self .assertTrue (stats ['pools' ][0 ]['QoS_support' ])
81858245 self .assertEqual (86.0 ,
81868246 stats ['pools' ][0 ]['provisioned_capacity_gb' ])
81878247 self .assertEqual (24.0 , stats ['pools' ][0 ]['total_capacity_gb' ])
@@ -8221,7 +8281,12 @@ def test_get_volume_stats1(self):
82218281 self .assertEqual ('12345' , stats ['array_id' ])
82228282 self .assertTrue (stats ['pools' ][0 ]['thin_provisioning_support' ])
82238283 self .assertTrue (stats ['pools' ][0 ]['thick_provisioning_support' ])
8224- self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8284+ if not wsapi_version :
8285+ # (i) old/default
8286+ self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8287+ else :
8288+ # (ii) wsapi version 2025
8289+ self .assertTrue (stats ['pools' ][0 ]['QoS_support' ])
82258290 self .assertEqual (86.0 ,
82268291 stats ['pools' ][0 ]['provisioned_capacity_gb' ])
82278292 self .assertEqual (24.0 , stats ['pools' ][0 ]['total_capacity_gb' ])
@@ -8254,7 +8319,12 @@ def test_get_volume_stats1(self):
82548319 self .assertEqual ('12345' , stats ['array_id' ])
82558320 self .assertTrue (stats ['pools' ][0 ]['thin_provisioning_support' ])
82568321 self .assertTrue (stats ['pools' ][0 ]['thick_provisioning_support' ])
8257- self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8322+ if not wsapi_version :
8323+ # (i) old/default
8324+ self .assertFalse (stats ['pools' ][0 ]['QoS_support' ])
8325+ else :
8326+ # (ii) wsapi version 2025
8327+ self .assertTrue (stats ['pools' ][0 ]['QoS_support' ])
82588328 total_capacity_gb = 8192 * const
82598329 self .assertEqual (total_capacity_gb ,
82608330 stats ['pools' ][0 ]['total_capacity_gb' ])
0 commit comments