Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement list_volumes() API for VMAX driver #70

Merged
merged 3 commits into from
May 26, 2020

Conversation

joseph-v
Copy link
Collaborator

This PR implements list_volumes() API for the Dell EMC VMAX driver.

Functionality is verified using VMAX250F backed.

What this PR does / why we need it:

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

free_cap = total_cap - used_cap

# TODO: Update constants.VolumeStatus to make mapping more precise
switcher = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just optimization suggestion:
switcher can be out of foor loop or even top of try block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


try:
# List all volumes
volumes = self.conn.provisioning.get_volume_list(filters={'data_volume': 'false'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure, no. of chars in a line not >79

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if vol['num_of_storage_groups'] == 1:
sg = vol['storageGroupId'][0]
sg_info = self.conn.provisioning.get_storage_group(sg)
v['original_pool_id'] = sg_info['srp']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'original_pool_id' or 'original_id' ?? . Plz cross check models.

one Q:
incase 'num_of_storage_groups' !=1, there will be no 'original_id' of a pool??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is 'original_pool_id' (in class Volume(BASE, DolphinBase)). Currently we meed SG of the volume to get these info. Please see the TODO comment in the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. Thanks

dolphin/drivers/dell_emc/vmax/client.py Outdated Show resolved Hide resolved
dolphin/drivers/dell_emc/vmax/client.py Outdated Show resolved Hide resolved
dolphin/drivers/dell_emc/vmax/client.py Show resolved Hide resolved
dolphin/drivers/dell_emc/vmax/client.py Outdated Show resolved Hide resolved
dolphin/drivers/dell_emc/vmax/client.py Outdated Show resolved Hide resolved
def list_volumes(self, storage_id):

try:
# List all volumes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u update comment on what are type of volumes from backend will be listed for more clarity

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return volume_list

except Exception as err:
LOG.error("Failed to get list volumes from vmax: {}".format(err))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep as VMAX as maintained in other places

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sushanthakumar
Copy link
Collaborator

LGTM

used_cap = (total_cap * vol['allocated_percent']) / 100.0
free_cap = total_cap - used_cap

status = switcher.get(vol['status'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest , default to 'Unknown', what do you think?

Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

NajmudheenCT
NajmudheenCT previously approved these changes May 23, 2020
Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@codecov-commenter
Copy link

codecov-commenter commented May 23, 2020

Codecov Report

Merging #70 into master will decrease coverage by 0.17%.
The diff coverage is 3.57%.

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
- Coverage   29.37%   29.20%   -0.18%     
==========================================
  Files          59       59              
  Lines        3819     3845      +26     
  Branches      428      431       +3     
==========================================
+ Hits         1122     1123       +1     
- Misses       2680     2705      +25     
  Partials       17       17              
Impacted Files Coverage Δ
dolphin/drivers/api.py 37.25% <0.00%> (-0.75%) ⬇️
dolphin/drivers/dell_emc/vmax/vmax.py 47.05% <0.00%> (ø)
dolphin/drivers/dell_emc/vmax/client.py 18.60% <4.00%> (-5.99%) ⬇️

kumarashit
kumarashit previously approved these changes May 25, 2020
Copy link
Collaborator

@kumarashit kumarashit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@sfzeng sfzeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PravinRanjan10
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants