Skip to content

Commit

Permalink
Merge pull request #13 from dell/release_1.10.0
Browse files Browse the repository at this point in the history
Release 1.10.0 for PyPowerStore Python Library
  • Loading branch information
Jennifer-John committed Mar 28, 2023
2 parents 10df2a5 + 42fd568 commit 90268ab
Show file tree
Hide file tree
Showing 24 changed files with 543 additions and 110 deletions.
11 changes: 9 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# PyPowerStore Change Log

## Version 1.9.0 - released on 20/12/22
## Version 1.10.0 - released on 31/03/23
- Added configuration operations for vCenter.
- Added support for app_type and app_type_other to volume.
- Added support for config_type, is_async_MTime_enabled,
file_events_publishing_mode, flr_attributes and host_io_size
while creating and modifying a filesystem.

## Version 1.9.0 - released on 21/12/22
- Added support for clone, restore, and refresh a volume.
- Added support for metro sync to volume, host, host group and replication session.

Expand Down Expand Up @@ -29,4 +36,4 @@
- Added file provisioning operations includes managing filesystem, filesystem snapshot, SMB shares, NFS exports, quotas and getting high level facts about all these entities.

## Version 1.1.0 - released on 06/05/20
- Added block provisioning operations includes managing volume, volume group, host, host group, snapshot rule, protection policy, snapshots and getting high level facts about all these entities.
- Added block provisioning operations includes managing volume, volume group, host, host group, snapshot rule, protection policy, snapshots and getting high level facts about all these entities.
5 changes: 5 additions & 0 deletions ProgrammersGuideExamples/info_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@
# Get certificate list
RESP = CONN.config_mgmt.get_certificates()
print(RESP)

# Get virtual volume list
RESP = CONN.config_mgmt.get_virtual_volume_list()
print(RESP)

19 changes: 19 additions & 0 deletions ProgrammersGuideExamples/vcenter_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@

vcenter_details = CONN.config_mgmt.modify_vcenter(vcenter_id=vcenters_list[0]['id'], modify_param_dict=param_dict)
print(vcenter_details)

# Add vCenter
add_dict = {
'address': 'vcenter IP/hostname',
'username': 'vcenter username',
'password': 'vcenter password',
'vasa_provider_credentials': {
'username': "<<admin_user>>",
'password': "<<admin_password>>"
}
}

vcenter_id = CONN.config_mgmt.add_vcenter(add_params=add_dict)
print(vcenter_id)

# Remove a vCenter
remove_vasa = True
print(CONN.config_mgmt.remove_vcenter(vcenter_id=vcenters_list[0]['id'],
delete_vasa_provider=remove_vasa))
2 changes: 1 addition & 1 deletion PyPowerStore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"""__init__.py."""

__title__ = 'PyPowerStore'
__version__ = '1.9.0.0'
__version__ = '1.10.0.0'
__author__ = 'Dell Technologies or its subsidiaries'
__copyright__ = 'Copyright 2019 Dell Technologies'
114 changes: 98 additions & 16 deletions PyPowerStore/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,6 @@ def get_ip_port_details(self, ip_port_id):
# IP ports operations end

# vCenter operations start

def get_vcenters(self, filter_dict=None, all_pages=False):
"""Get all vcenters.
:param filter_dict: (optional) Filter details
Expand All @@ -916,11 +915,18 @@ def get_vcenters(self, filter_dict=None, all_pages=False):
querystring = helpers.prepare_querystring(
constants.SELECT_ID, filter_dict)
LOG.info("Querystring: '%s'" % querystring)
return self.config_client.request(
constants.GET,
constants.GET_VCENTER_LIST_URL.format(self.server_ip),
querystring=querystring, all_pages=all_pages
)
vcenter_list = self.config_client.\
request(constants.GET,
constants.GET_VCENTER_LIST_URL.format(self.server_ip),
querystring=querystring, all_pages=all_pages)

if vcenter_list:
resp_list = []
for vcenter in vcenter_list:
resp_dict = self.get_vcenter_details(vcenter['id'])
resp_list.append(resp_dict)
return resp_list
return vcenter_list

def get_vcenter_details(self, vcenter_id):
"""Get vcenter details.
Expand All @@ -931,12 +937,11 @@ def get_vcenter_details(self, vcenter_id):
"""
LOG.info("Getting vcenter details by ID: '%s'" % vcenter_id)
querystring = constants.VCENTER_DETAILS_QUERY
if helpers.is_foot_hill_or_higher():
querystring = {
'select': 'id,instance_uuid,address,username,'
'vendor_provider_status,'
'vendor_provider_status_l10n'
}
if helpers.is_foot_hill_prime_or_higher():
querystring = constants.FHP_VCENTER_QUERY
elif helpers.is_foot_hill_or_higher():
querystring = constants.FHC_MALKA_VCENTER_QUERY

return self.config_client.request(
constants.GET,
constants.GET_VCENTER_DETAILS_URL.format(self.server_ip,
Expand All @@ -945,20 +950,66 @@ def get_vcenter_details(self, vcenter_id):
)

def modify_vcenter(self, vcenter_id, modify_param_dict):
"""Register VASA provider.
"""Modify vcenter attributes.
:param vcenter_id: ID of the vcenter
:type vcenter_id: str
:param modify_param_dict: Dict containing VASA provider credentials
:param modify_param_dict: Dict containing parameters for modification
:type modify_param_dict: dict
:return: Details of vcenter
:rtype: dict
"""
LOG.info("Registering VASA provider: '%s'" % vcenter_id)
LOG.info("Modifying vCenter attributes: '%s'" % vcenter_id)
self.config_client.request(constants.PATCH,
constants.MODIFY_VCENTER_URL.format(
self.server_ip, vcenter_id),
payload=modify_param_dict)
return self.get_vcenter_details(vcenter_id)

def add_vcenter(self, add_params):
"""
Add a vcenter to the unified PowerStore model.
vcenter can not be added to unified+ deployment
:param add_params: the parameters to add vcenter
:type add_params:dict
:return: ID of the vcenter if addition is successful
:rtype: dict
"""
LOG.info("Adding a vcenter.")

payload = dict()
if add_params:
for key, values in add_params.items():
payload[key] = values

return self.config_client.\
request(constants.POST,
constants.ADD_VCENTER_URL.format(self.server_ip),
payload=payload)

def remove_vcenter(self, vcenter_id, delete_vasa_provider=None):
"""
Remove vcenter from Unified PowerStore model.
vcenter can not be removed from unified+ deployment
:param vcenter_id: ID of the vcenter
:type vcenter_id: str
:param delete_vasa_provider: whether to remove a VASA provider.
Removal will only happen if the provider
is not connected to any other PowerStore
system
:type delete_vasa_provider: bool
:return: None if success
:rtype: None
"""
LOG.info("Removing vcenter: {0}.".format(vcenter_id))
payload = dict()
if delete_vasa_provider is not None:
payload['delete_vendor_provider'] = delete_vasa_provider

return self.config_client.\
request(constants.DELETE,
constants.REMOVE_VCENTER_URL.format(self.server_ip,
vcenter_id),
payload=payload)
# vCenter operations end

# Appliance operations start
Expand Down Expand Up @@ -2044,7 +2095,38 @@ def delete_ldap_account(self, ldap_account_id):
self.server_ip, ldap_account_id))


# LDAP Account operations end
# LDAP Account operations end

# Virtual volume operations begin

def get_virtual_volume_list(self, filter_dict=None, all_pages=None):
"""Get all virtual volumes available on array.
:param filter_dict: (optional) Filter details
:type filter_dict: dict
:param all_pages: (optional) Indicates whether to return all
virtual volumes or not
:type all_pages: bool
:return: List of virtual volumes on array
:rtype: list[dict]
"""
LOG.info("Getting volumes with filter: '%s' and all_pages: %s"
% (filter_dict, all_pages))
querystring = helpers.prepare_querystring(
constants.VIRTUAL_VOLUME_DETAILS_QUERY,
filter_dict)
if helpers.is_foot_hill_prime_or_higher():
querystring = helpers.prepare_querystring(
constants.VIRTUAL_VOLUME_FHP_DETAILS_QUERY,
filter_dict)
LOG.info("Querystring: '%s'" % querystring)
return self.config_client.request(constants.GET,
constants.GET_VIRTUAL_VOLUME_LIST_URL.format
(self.server_ip), payload=None,
querystring=querystring,
all_pages=all_pages)

# Virtual volume operations end


@staticmethod
def _prepare_local_user_payload(**kwargs):
Expand Down
Loading

0 comments on commit 90268ab

Please sign in to comment.