mock.call.getCluster(1),
mock.call.getVolumes(
cluster='CloudCluster1',
- fields=['members[id]', 'members[clusterName]']),
+ fields=['members[id]', 'members[clusterName]', 'members[size]']),
]
def default_mock_conf(self):
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
existing_ref = {'source-name': self.volume_name}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
existing_ref = {'source-name': self.volume_name}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
existing_ref = {'source-name': self.volume_name}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
existing_ref = {'source-name': self.volume_name}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
volume = {}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
volume = {}
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": self.volume_id,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1
+ }]
}
self.driver.proxy.api_version = "1.1"
mock_client.getVolumes.return_value = {
"type": "volume",
"total": 1,
- "members": {
+ "members": [{
"id": 12345,
- "clusterName": self.cluster_name
- }
+ "clusterName": self.cluster_name,
+ "size": 1 * units.Gi
+ }]
}
with mock.patch.object(hp_lefthand_rest_proxy.HPLeftHandRESTProxy,
self.assertEqual(GOODNESS_FUNCTION, stats['goodness_function'])
self.assertEqual(FILTER_FUNCTION, stats['filter_function'])
self.assertEqual(1, int(stats['total_volumes']))
+ self.assertEqual(True, stats['thin_provisioning_support'])
+ self.assertEqual(True, stats['thick_provisioning_support'])
+ self.assertEqual(1, int(stats['provisioned_capacity_gb']))
cap_util = (
float(units.Gi * 500 - units.Gi * 250) / float(units.Gi * 500)
expected = self.driver_startup_call_stack + [
mock.call.getCluster(1),
mock.call.getVolumes(fields=['members[id]',
- 'members[clusterName]'],
+ 'members[clusterName]',
+ 'members[size]'],
cluster=self.cluster_name),
mock.call.logout()]
-# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
1.0.8 - Fixed bug #1418201, A cloned volume fails to attach.
1.0.9 - Adding support for manage/unmanage.
1.0.10 - Add stats for goodness_function and filter_function
+ 1.0.11 - Add over subscription support
"""
- VERSION = "1.0.10"
+ VERSION = "1.0.11"
device_stats = {}
data['location_info'] = (self.DRIVER_LOCATION % {
'cluster': self.configuration.hplefthand_clustername,
'vip': self.cluster_vip})
+ data['thin_provisioning_support'] = True
+ data['thick_provisioning_support'] = True
+ data['max_over_subscription_ratio'] = (
+ self.configuration.safe_get('max_over_subscription_ratio'))
cluster_info = client.getCluster(self.cluster_id)
# so try to limit the size of data for now. Once new lefthand API is
# available, replace this call.
total_volumes = 0
+ provisioned_size = 0
volumes = client.getVolumes(
cluster=self.configuration.hplefthand_clustername,
- fields=['members[id]', 'members[clusterName]'])
+ fields=['members[id]', 'members[clusterName]', 'members[size]'])
if volumes:
total_volumes = volumes['total']
+ provisioned_size = sum(
+ members['size'] for members in volumes['members'])
+ data['provisioned_capacity_gb'] = int(provisioned_size) / units.Gi
data['capacity_utilization'] = capacity_utilization
data['total_volumes'] = total_volumes
data['filter_function'] = self.get_filter_function()