Skip to content

Commit 90268ab

Browse files
Merge pull request #13 from dell/release_1.10.0
Release 1.10.0 for PyPowerStore Python Library
2 parents 10df2a5 + 42fd568 commit 90268ab

24 files changed

+543
-110
lines changed

ChangeLog.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# PyPowerStore Change Log
22

3-
## Version 1.9.0 - released on 20/12/22
3+
## Version 1.10.0 - released on 31/03/23
4+
- Added configuration operations for vCenter.
5+
- Added support for app_type and app_type_other to volume.
6+
- Added support for config_type, is_async_MTime_enabled,
7+
file_events_publishing_mode, flr_attributes and host_io_size
8+
while creating and modifying a filesystem.
9+
10+
## Version 1.9.0 - released on 21/12/22
411
- Added support for clone, restore, and refresh a volume.
512
- Added support for metro sync to volume, host, host group and replication session.
613

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

3138
## Version 1.1.0 - released on 06/05/20
32-
- 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.
39+
- 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.

ProgrammersGuideExamples/info_examples.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@
136136
# Get certificate list
137137
RESP = CONN.config_mgmt.get_certificates()
138138
print(RESP)
139+
140+
# Get virtual volume list
141+
RESP = CONN.config_mgmt.get_virtual_volume_list()
142+
print(RESP)
143+

ProgrammersGuideExamples/vcenter_examples.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,22 @@
3030

3131
vcenter_details = CONN.config_mgmt.modify_vcenter(vcenter_id=vcenters_list[0]['id'], modify_param_dict=param_dict)
3232
print(vcenter_details)
33+
34+
# Add vCenter
35+
add_dict = {
36+
'address': 'vcenter IP/hostname',
37+
'username': 'vcenter username',
38+
'password': 'vcenter password',
39+
'vasa_provider_credentials': {
40+
'username': "<<admin_user>>",
41+
'password': "<<admin_password>>"
42+
}
43+
}
44+
45+
vcenter_id = CONN.config_mgmt.add_vcenter(add_params=add_dict)
46+
print(vcenter_id)
47+
48+
# Remove a vCenter
49+
remove_vasa = True
50+
print(CONN.config_mgmt.remove_vcenter(vcenter_id=vcenters_list[0]['id'],
51+
delete_vasa_provider=remove_vasa))

PyPowerStore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"""__init__.py."""
33

44
__title__ = 'PyPowerStore'
5-
__version__ = '1.9.0.0'
5+
__version__ = '1.10.0.0'
66
__author__ = 'Dell Technologies or its subsidiaries'
77
__copyright__ = 'Copyright 2019 Dell Technologies'

PyPowerStore/configuration.py

Lines changed: 98 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ def get_ip_port_details(self, ip_port_id):
901901
# IP ports operations end
902902

903903
# vCenter operations start
904-
905904
def get_vcenters(self, filter_dict=None, all_pages=False):
906905
"""Get all vcenters.
907906
:param filter_dict: (optional) Filter details
@@ -916,11 +915,18 @@ def get_vcenters(self, filter_dict=None, all_pages=False):
916915
querystring = helpers.prepare_querystring(
917916
constants.SELECT_ID, filter_dict)
918917
LOG.info("Querystring: '%s'" % querystring)
919-
return self.config_client.request(
920-
constants.GET,
921-
constants.GET_VCENTER_LIST_URL.format(self.server_ip),
922-
querystring=querystring, all_pages=all_pages
923-
)
918+
vcenter_list = self.config_client.\
919+
request(constants.GET,
920+
constants.GET_VCENTER_LIST_URL.format(self.server_ip),
921+
querystring=querystring, all_pages=all_pages)
922+
923+
if vcenter_list:
924+
resp_list = []
925+
for vcenter in vcenter_list:
926+
resp_dict = self.get_vcenter_details(vcenter['id'])
927+
resp_list.append(resp_dict)
928+
return resp_list
929+
return vcenter_list
924930

925931
def get_vcenter_details(self, vcenter_id):
926932
"""Get vcenter details.
@@ -931,12 +937,11 @@ def get_vcenter_details(self, vcenter_id):
931937
"""
932938
LOG.info("Getting vcenter details by ID: '%s'" % vcenter_id)
933939
querystring = constants.VCENTER_DETAILS_QUERY
934-
if helpers.is_foot_hill_or_higher():
935-
querystring = {
936-
'select': 'id,instance_uuid,address,username,'
937-
'vendor_provider_status,'
938-
'vendor_provider_status_l10n'
939-
}
940+
if helpers.is_foot_hill_prime_or_higher():
941+
querystring = constants.FHP_VCENTER_QUERY
942+
elif helpers.is_foot_hill_or_higher():
943+
querystring = constants.FHC_MALKA_VCENTER_QUERY
944+
940945
return self.config_client.request(
941946
constants.GET,
942947
constants.GET_VCENTER_DETAILS_URL.format(self.server_ip,
@@ -945,20 +950,66 @@ def get_vcenter_details(self, vcenter_id):
945950
)
946951

947952
def modify_vcenter(self, vcenter_id, modify_param_dict):
948-
"""Register VASA provider.
953+
"""Modify vcenter attributes.
949954
:param vcenter_id: ID of the vcenter
950955
:type vcenter_id: str
951-
:param modify_param_dict: Dict containing VASA provider credentials
956+
:param modify_param_dict: Dict containing parameters for modification
952957
:type modify_param_dict: dict
953958
:return: Details of vcenter
954959
:rtype: dict
955960
"""
956-
LOG.info("Registering VASA provider: '%s'" % vcenter_id)
961+
LOG.info("Modifying vCenter attributes: '%s'" % vcenter_id)
957962
self.config_client.request(constants.PATCH,
958963
constants.MODIFY_VCENTER_URL.format(
959964
self.server_ip, vcenter_id),
960965
payload=modify_param_dict)
961966
return self.get_vcenter_details(vcenter_id)
967+
968+
def add_vcenter(self, add_params):
969+
"""
970+
Add a vcenter to the unified PowerStore model.
971+
vcenter can not be added to unified+ deployment
972+
:param add_params: the parameters to add vcenter
973+
:type add_params:dict
974+
:return: ID of the vcenter if addition is successful
975+
:rtype: dict
976+
"""
977+
LOG.info("Adding a vcenter.")
978+
979+
payload = dict()
980+
if add_params:
981+
for key, values in add_params.items():
982+
payload[key] = values
983+
984+
return self.config_client.\
985+
request(constants.POST,
986+
constants.ADD_VCENTER_URL.format(self.server_ip),
987+
payload=payload)
988+
989+
def remove_vcenter(self, vcenter_id, delete_vasa_provider=None):
990+
"""
991+
Remove vcenter from Unified PowerStore model.
992+
vcenter can not be removed from unified+ deployment
993+
:param vcenter_id: ID of the vcenter
994+
:type vcenter_id: str
995+
:param delete_vasa_provider: whether to remove a VASA provider.
996+
Removal will only happen if the provider
997+
is not connected to any other PowerStore
998+
system
999+
:type delete_vasa_provider: bool
1000+
:return: None if success
1001+
:rtype: None
1002+
"""
1003+
LOG.info("Removing vcenter: {0}.".format(vcenter_id))
1004+
payload = dict()
1005+
if delete_vasa_provider is not None:
1006+
payload['delete_vendor_provider'] = delete_vasa_provider
1007+
1008+
return self.config_client.\
1009+
request(constants.DELETE,
1010+
constants.REMOVE_VCENTER_URL.format(self.server_ip,
1011+
vcenter_id),
1012+
payload=payload)
9621013
# vCenter operations end
9631014

9641015
# Appliance operations start
@@ -2044,7 +2095,38 @@ def delete_ldap_account(self, ldap_account_id):
20442095
self.server_ip, ldap_account_id))
20452096

20462097

2047-
# LDAP Account operations end
2098+
# LDAP Account operations end
2099+
2100+
# Virtual volume operations begin
2101+
2102+
def get_virtual_volume_list(self, filter_dict=None, all_pages=None):
2103+
"""Get all virtual volumes available on array.
2104+
:param filter_dict: (optional) Filter details
2105+
:type filter_dict: dict
2106+
:param all_pages: (optional) Indicates whether to return all
2107+
virtual volumes or not
2108+
:type all_pages: bool
2109+
:return: List of virtual volumes on array
2110+
:rtype: list[dict]
2111+
"""
2112+
LOG.info("Getting volumes with filter: '%s' and all_pages: %s"
2113+
% (filter_dict, all_pages))
2114+
querystring = helpers.prepare_querystring(
2115+
constants.VIRTUAL_VOLUME_DETAILS_QUERY,
2116+
filter_dict)
2117+
if helpers.is_foot_hill_prime_or_higher():
2118+
querystring = helpers.prepare_querystring(
2119+
constants.VIRTUAL_VOLUME_FHP_DETAILS_QUERY,
2120+
filter_dict)
2121+
LOG.info("Querystring: '%s'" % querystring)
2122+
return self.config_client.request(constants.GET,
2123+
constants.GET_VIRTUAL_VOLUME_LIST_URL.format
2124+
(self.server_ip), payload=None,
2125+
querystring=querystring,
2126+
all_pages=all_pages)
2127+
2128+
# Virtual volume operations end
2129+
20482130

20492131
@staticmethod
20502132
def _prepare_local_user_payload(**kwargs):

0 commit comments

Comments
 (0)