Code Monkey home page Code Monkey logo

pyu4v's Introduction

Welcome to PyU4V 10.1

Maintenance OpenSource Test Build Docs
Language Platform DTotal DMonth DWeek

Overview

PyU4V is a Python module that simplifies interaction with the Unisphere for PowerMax REST API. It wraps REST calls with simple APIs that abstract the HTTP request and response handling.

Full documentation and user guides can be found in PyU4V's ReadTheDocs.

Note

You can get the Unisphere for PowerMax REST documentation by navigating to a URL in your local instance of Unisphere for PowerMax. Navigate to https://{ip-address}:{port}/univmax/restapi/docs where {ip-address} is the IP address of your Unisphere server and {port} is the port it is listening on.

PyU4V Version 10.1

Author Dell EMC
PyU4V Version 10.1.0.2
Minimum Unisphere Version 10.1.0.0
Array Model VMAX-3, VMAX AFA, PowerMax
Array uCode HyperMax OS, PowerMax OS
Platforms Linux, Windows
Python 3.6, 3.7, 3.8, 3.9
Requires Requests, Six, urllib3
Note

If you want to continue to use Unisphere 8.4.x or 9.0.x with PyU4V you will need to remain on PyU4V 3.1.x. There is no support for PyU4V 9.x with any version of Unisphere older than 9.1.x

Note

PyU4V version 10.x is compatible with scripts written for PyU4V versions >= 9.2. Please ensure to check change log to ensure that you are not using functions that have been marked as depreciated.

Installation

Note

A full installation guide can be found in PyU4V's ReadTheDocs which includes additional configuration options around PyU4V logging.

PyU4V can be installed from source, via pip, or run directly from the source directory. To clone PyU4V from source use git:

$ git clone https://github.com/dell/PyU4V

To install from source navigate into the new PyU4V directory and use pip:

$ cd PyU4V/
$ pip install .

Installing via pip without cloning from source can be achieved by specifying PyU4V as the install package for pip:

$ pip install PyU4V
# Install a specific version
$ pip install PyU4V==10.1.0.0

Copy the sample PyU4V.conf provided with PyU4V to either your working directory or within a directory named .PyU4V in your current users home directory. The .sample suffix has to be removed for the configuration file to become valid for loading by PyU4V:

$ mkdir ~/.PyU4V
$ cp PyU4V/PyU4V.conf.sample ~/.PyU4V/PyU4V.conf
Note

If PyU4V.conf is present in both the current working directory and the current user's home directory, the version of PyU4V.conf in the current working directory will take precedence.

Edit PyU4V configuration settings in PyU4V.conf under the [setup] heading, these setting will need to reflect your environment configuration:

[setup]
username=pyu4v-user
password=secret-pass
server_ip=10.0.0.75
port=8443
array=00012345678
verify=/path-to-file/server_hostname.pem

Alternatively, you can pass some or all of these details on initialisation. Environment configuration values password, username, server_ip, port, and array must be set either in the config file or on initialisation. SSL verification as indicated by the verify key in PyU4V.conf is discussed in the next section.

SSL CONFIGURATION

In order to enable SSL enabled communication between your host and the Unisphere server there are some additional steps required. First you must extract the CA certificate from Unisphere then either add it to the system certificate bundle or specify the path to the cert in PyU4V.conf. We will demonstrate both approaches here.

Get the CA certificate of the Unisphere server:

$ openssl s_client -showcerts -connect {server_hostname}:8443 \
</dev/null 2>/dev/null|openssl x509 -outform PEM > {cert_name}.pem

# Example
$ openssl s_client -showcerts -connect 10.0.0.75:8443 \
</dev/null 2>/dev/null|openssl x509 -outform PEM > unisphere91.pem

Where {server_host_ip} is the hostname or IP address of your Unisphere server and {cert_name} is the name for your CA cert. This pulls the CA cert file from the instance of Unisphere at 10.0.0.75:8443 and saves it as a .pem file.

To add the cert to a CA certificate bundle, copy the .pem file to the system certificate directory and update the CA certificate database:

# cp {cert_name}.pem /usr/share/ca-certificates/{cert_name}.crt
# dpkg-reconfigure ca-certificates
# update-ca-certificates

Once the above steps are complete you will need to specify verify=True in PyU4V.conf for PyU4V to load the required Unisphere CA cert from the system certificate bundle:

[setup]
verify=True

Alternatively you can skip adding the certificate to a certificate bundle and pass it directly on PyU4V initialisation or specify the path to the certificate directly in PyU4V.conf:

[setup]
verify=/path/to/file/{cert_name}.pem

Initialise PyU4V Connection

Initialising PyU4V in your Python scripts is as simple as importing the library and initialising the connection (assuming you have PyU4V.conf configured as outlined in the previous section).

import PyU4V

conn = PyU4V.U4VConn()
conn.common.get_unisphere_version()
>> {'version': 'V10.1.0.0'}

If you wish to query another array without changing the configuration file, call the connection set_array_id() function:

conn.set_array_id('000197123456')

The various types of functionality provided by PyU4V is separated into logical sections such as replication, provisioning, and performance. For a full API breakdown by section and some usage example please refer to the PyU4V ReadTheDocs.

Support, Bugs, Issues

Please file support requests, bugs, and issues on the PyU4V GitHub-Issues page for this project. For further information on opening an issue and recommended issue templates please see the PyU4V ReadTheDocs.

For questions asked on StackOverFlow, please tag them with Dell, Dell EMC, PowerMax, and PyU4V to maximise the chances of the correct community members assisting.

Contributing

PyU4V is built to be used openly by everyone, and in doing so we encourage everyone to submit anything they may deem to be an improvement, addition, bug fix, or other change which may benefit other users of PyU4V.

There are some requirements when submitting for PyU4V, such as coding standards, building unit tests and continuous integration tests, and going through a formal code review process, however anyone familiar with open source development will be familiar with this process. There are a number of core PyU4V reviewers and once a submission has approvals from two or more core reviewers and all tests are running cleanly then the request will be merged with the upstream PyU4V repo.

For a full breakdown of contribution requirements, coding standards, submitting and everything else in between please refer to PyU4V ReadTheDocs.

Tools

Please refer to the Tools section of ReadTheDocs for OpenStack functionality to migrate volumes to the new REST masking view structure.

Disclaimer

Unless required by applicable law or agreed to in writing, software distributed under the Apache 2.0 License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

pyu4v's People

Contributors

ciarams87 avatar helenwalsh avatar jbrt avatar michaelmcaleer avatar nimeob avatar odonos12 avatar rawstorage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyu4v's Issues

Documentation and issue

Installing version 3 does not seem to be documented. I did a pull, but had to figure out how to install it. It would be useful to have this on the main project page.

On to my issue. I am running OL6. All RHEL6 flavors use python 2.6.6. You can enable software collections, but that has it's own set of unique obstacles. Anyway. I ran

python setup.py install

That installed PyU4V, but the sample code will not work properly. It still acts like version 2. I checked the version via help() and it is version 2.

Help on package PyU4V:

NAME
PyU4V - # -- coding: utf-8 --

FILE
/usr/lib/python2.6/site-packages/PyU4V-3.0.0-py2.6.egg/PyU4V/init.py

PACKAGE CONTENTS
common
performance
provisioning
replication
rest_requests
rest_univmax
rest_univmax2
univmax_conn
utils (package)

DATA
author = 'Dell EMC or its subsidieries'
copyright = 'Copyright 2017 Dell EMC Inc'
license = 'MIT'
title = 'pyu4v'
version = '2.0'

VERSION
2.0

AUTHOR
Dell EMC or its subsidieries

Is there something I need to add to the setup? Or is this related to my python version?

No array id specified. Please set array ID using the "set_array_id(array_id)" function.

Hi @rawstorage,

I've seen the issue #35, however I'm still experiencing the same problem.

$ pip show PyU4V
Name: PyU4V
Version: 3.1.3
Summary: A Python library for use with Dell EMC's Unisphere for VMAX RestAPI.
Home-page: https://github.com/MichaelMcAleer/PyU4V/
Author: Dell Inc. or its subsidiaries
Author-email: [email protected]
License: MIT
Location: /home/foo/bar/lib/python3.6/site-packages
Requires: six, requests, urllib3
Required-by:

$ python
Python 3.6.6 (default, Aug 13 2018, 18:24:23)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyU4V
>>> PyU4V.__version__
'3.1.3'
>>> conn = PyU4V.U4VConn(username='user', password='pass', server_ip='10.11.12.13', port='8443', verify=False)
No array id specified. Please set array ID using the "set_array_id(array_id)" function.

I can, however, bypass the error by simply providing a dummy value for array_id:

>>> conn = PyU4V.U4VConn(username='user', password='pass', server_ip='10.11.12.13', port='8443', verify=False, array_id='blah')
>>> conn.common.get_uni_version()
('V8.4.0.15', '84')
>>> conn.common.get_array_list()
['000297800XXX', '000297800YYY']

Even though the workaround is pretty simple, I tend to think I shouldn't have to have it, therefore wondering if there's a way to rid myself of the issue.

Best regards,
Albert.

get_volume_list

for vol in vol_page['result']:
vol_id_list.append(vol['volumeId'])

is incorrect: it should be:

for vol in vol_page:
vol_id_list.append(vol['volumeId'])

Expand Volume Fails with Python 3.x

Issue raised by customer attempting to run Anisble Modules with Python version 3.x

2019-11-14 01:54:35,114 main.py ERROR : Expand volume 000EA failed with error Bad or unexpected response from the storage volume backend API: The PUT request to URLhttps://myunipsherehost:8443/univmax/restapi/90/sloprovisioning/symmetrix/000197600156/volume/000EA failed with exception Object of type 'Decimal' is not JSON serializable.

Works fine with 2.7.

extend_volume to include capacity unit variable

Hi,

In the extend_volume function, could you please make the capacity unit a variable? At current, it's hard-coded to be 'GB'.

What I've done locally and what I'm suggesting here is:

def extend_volume(self, device_id, new_size, cap_unit='GB', _async=False):
    """Extend a VMAX volume.

    :param device_id: volume device id
    :param new_size: the new required size for the device
    :param _async: flag to indicate if call should be async
    """
    extend_vol_payload = {'editVolumeActionParam': {
        'expandVolumeParam': {
            'volumeAttribute': {
                'volume_size': new_size,
                'capacityUnit': cap_unit}}}}
    if _async:
        extend_vol_payload.update(ASYNC_UPDATE)
    return self._modify_volume(device_id, extend_vol_payload)

Thanks!

Best regards,
Albert.

unisphere out of sync issue?

Hi,

have you ever noticed unisphere DB going to out-of-sync? If answer is yes should i run any other API or CLI to make sure unisphere DB & symapi DB is 100% sync?

In our cause, we'll create devices using POST, and then query using GET unisphere for the device ids we just created, and unisphere will say the device id doesn't exist, even though it was just created. Currently we use unisphere version 8.3 and provisioning tool written in JAVA. I wish tool would have been in Python so can simply used PyU4V which could have taken care out-of-sync issue under the wood.

get_fe_port_metrics parameter [metriclist]

Thanks for provide this valuable library.

Tried to fetch performance metrics of PowerMax port and hit one issue with method get_fe_port_metrics.

Based on parameter description, metriclist is one list.
:param metriclist: list of one or more metrics
If input list like following.
['HostIOs','HostMBs','PercentBusy','ReadResponseTime','WriteResponseTime']
It will report error.
({'message': 'Can not deserialize instance of com.emc.em.restapi.performance.dto.FePortMetric out of START_ARRAY token\n at [Source: com.emc.em.deployer.sharding.ReusableRequest$ReusableInputStream@53463775; line: 6, column: 9] (through reference chain: com.emc.em.restapi.performance.dto.FePortParam["metrics"]->java.util.ArrayList[0])'}, 400)

After remove "[]" from line 177 of file PyU4V/performance.py like following.
"metrics": metriclist,

It works.

Is it one code issue or need change input ?

Br,
Colin

target_uri can't handle the new URL without version number.

https://github.com/ciarams87/PyU4V/blob/39ea3c7e5f1f5f1635a1d92cadeb60cef786c803/PyU4V/common.py#L511

Thanks Ciara for your useful lib. I just found some issues that may need to improve.

The URL format here means that we can't use this kind URL /sloprovisioning/symmetrix/xxx.
Even we define U4V_VERSION = None, the URL //sloprovisioning/symmetrix/xxx can't be accepted by VMAX.

So, build URL base on U4V_VERSION input is necessary here I think.
Thanks a lot.

Cannot delete storage group

Unisphere version is 90. Getting this error on trying to delete an SG.

PyU4V.utils.exception.VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: Error Delete storagegroup resource. The status code received is 500 and the message is {u'message': u'The server encountered an unexpected condition which prevented it from fulfilling the request'}.

May be possible that 84 rest calls are not working against 90. Need to do more digging.

Make Request Timeout user parameter and remove log init in libraries.

Improvement #1.

Make logging centrally configurable by main program? Such away user application will have logging control to tune log levels. Also user does not need make code changes.

Can you replace :

CONF_FILE = "PyU4V.conf"
LOG = logging.getLogger("PyU4V")
logging.config.fileConfig(CONF_FILE)

with

LOG = logging.getLogger(name)

Improvement #2 .

Introduce method in rest_univmax to override time out. So that user can choose different timeout values per operation.

Improvement #3.

Please get rid of dependency of PyU4V.conf as this can be optional for enterprise provisioning. When user deletes the file PyU4V.conf and passes required params to rest_univmax. Call fails with file config dependency.

Many Thanks.

rest_univmax2.py

Line 636 and 637 need to be

return self.create_resource(self.array_id, SLOPROVISIONING,
                                    'hostgroup', new_ig_data)

instead of

return self.create_resource(self.array_id, SLOPROVISIONING,
                                    'host', new_ig_data)

You don't create a host. You create a hostgroup.

Get volume properties

Hi,

Is there a way to check the "Dynamic RDF Capability" attribute set for a device using api call.

get_volume('dev_name') ; lists few properties but not the Dynamic RDF Capability.
Please suggest if you have any details on this.

Unable to import PyU4V

Hello,

I am a novice and hence the question. I am trying to import the PyU4V library and it errors out with a syntax error at the location with the statement

def create_host(self, host_name, initiator_list=None,
                    host_flags=None, init_file=None, async=False):

The error that I see is

host_flags=None, init_file=None, async=False):
                                      ^
SyntaxError: invalid syntax

Is there a trick that I missing here?, I generally have been working on other API's and haven't seen such problems there.

I would appreciate any help with respect to this error.

Regards,
KayK

Delete SG snapshot is not working in latest PyU4V version

This is the old PyU4V code which works (v2.0):

def delete_storagegroup_snapshot(self, storagegroup, snap_name, gen_num=0):
    """Delete the snapshot of a storagegroup.

    :param storagegroup: the storage group name
    :param snap_name: the name of the snapshot
    :param gen_num: the generation number
    """
    resource_name = ('storagegroup/{}/snapshot/{}/generation/{}'.format(
        storagegroup, snap_name, gen_num))
    return self.delete_resource(
        self.array_id, REPLICATION, resource_name)

This makes a call to the following URL ->

DELETE
https://IP:8443/univmax/restapi/90/replication/symmetrix/000197900237/storagegroup/ansible_SG_2635/snapshot/prashant/generation/0

This is the latest PyU4V code which doesn’t work (v 3.1.2):

def delete_storagegroup_snapshot(self, storagegroup, snap_name, gen_num=0):
    """Delete the snapshot of a storagegroup.

    :param storagegroup: the storage group name
    :param snap_name: the name of the snapshot
    :param gen_num: the generation number
    """
    resource_name = (
        '{storagegroup}/snapshot/{snap_name}/generation/{gen_num}'.format(     ISSUE is on THIS LINE
            storagegroup=storagegroup,
            snap_name=snap_name,
            gen_num=gen_num))
    return self.delete_resource(
       self.array_id, REPLICATION, resource_name)

It makes a call to the following URL:
https://IP:8443/univmax/restapi/90/replication/symmetrix/000197900237/ansible_SG_2635/snapshot/prashant/generation/0

^^^
Please compare this URL to the one above, notice how the keyword “storagegroup” is missing

Error - Compression is not supported on Symmetrix

I'm testing PyU4V with a newly deployed VMAX 950F AFA. I'm able to query the UNI version and SRP, and a few other items from this array. As it's new, it doesn't have any SGs, PGs, IGs, MVs, etc. Using the same PyU4V version with another array I have confirmed that I'm successful at querying those things from the array including SGs, IGs, MVs, Devices, PGs, etc. But when I try to provision a SG with a few devices, I'm getting the error shown below. I've tried toggling 'do_disable_compression' from True to False, but I get the same error either way.

Here is my environment.

Python - 2.7.16
PyU4V - 3.1.5
Unisphere Version: V8.4.0.29

Here is the code block.

srp = u'SRP_1'
sg = u'sg_test'
slo = u'Diamond'
num_vols = 4
vol_size = u'72'
vol_name = u'vol_test'

res = conn.provisioning.create_storage_group(srp, sg, slo, workload=None, do_disable_comp
ression=True, num_vols=num_vols, vol_size=vol_size, cap_unit='GB', allocate_full=True, _
async=False, vol_name=vol_name)
  File "./adddevice.py", line 165, in <module>
    res = conn.provisioning.create_storage_group(srp, sg, slo, workload=None, do_disable_compression=False, num_vols=num_vols, vol_size=vol_size, cap_unit='GB', allocate_full=True, _async=False, vol_name=vol_name)
  File "/opt/path/python/lib/python2.7/site-packages/PyU4V/provisioning.py", line 1036, in create_storage_group
    self.array_id, SLOPROVISIONING, 'storagegroup', payload=payload)
  File "/opt/path/python/lib/python2.7/site-packages/PyU4V/common.py", line 387, in create_resource
    operation, status_code, message)
  File "/opt/path/python/lib/python2.7/site-packages/PyU4V/common.py", line 172, in check_status_code_success
    data=exception_message)
PyU4V.utils.exception.VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: Error Create storagegroup resource. The status code received is 500 and the message is {u'message': u'A problem occurred creating the storage group resource: Compression is not supported on Symmetrix [00019xxxxxxx]'}.

I've tried to use this call below, but am getting the same error about "Compression is not supported..."

    res = conn.provisioning.create_non_empty_storagegroup(srp, sg, slo, workload=None, disable_compression=True, num_vols=num_vols, vol_size=vol_size, cap_unit='GB', _async=False)

It is true that the array is set for no compression, but these seems to be a bug.

support 8.2 version?

ru=PyU4V.RestFunctions(username="smc",password="smc",server_ip="xxxx",verify=False,port=8443,array_id="xxxxx",u4v_version='82')
print ru.get_symmetrix_array()
2018-01-17 16:11:00,879 - PyU4V.rest_requests - INFO - GET request to https://xxxx:8443/univmax/restapi/82/system/symmetrix has returned with a status code of: 500

tried this way as well..

ru = PyU4V.rest_functions()
ru.get_symmetrix_array()
2018-01-17 17:29:26,453 - PyU4V.rest_requests - INFO - No response received from API. Status code received is: 401
2018-01-17 17:29:26,453 - PyU4V.rest_requests - INFO - GET request to https://xxx:8443/univmax/restapi/system/symmetrix has returned with a status code of: 401

split leading to SRDF failover when using modify_storagegroup_srdf

Hi ,

In recent times i started using and i am new to PyU4V module , when i tried to send
split command using this line - conn.replication.modify_storagegroup_srdf('autodr_test_r1_SG','split','9')
but its making the SG to go failed over not the split .

can you help and let me know what am i missing ?

Post request error:

Hi,
I am having issue running any of the example scripts. I have updated PYU4V.conf file with appropriate information (username, password, server_ip, port, array). I have also added SSL certification.

Initially, I got an error relating to cert variable listed below. I believe, we need to add "cert=/path-to-file/uni_server.pem" in "PYU4V.conf" file instead of "verify=/path-to-file/uni_server.pem" since verify is boolean. I overcame below error by adding "cert=/path-to-file/uni_server.pem" in PYU4V.conf file.

#########################################################################
Cert Error:
$python ./Get_FE_Stats_LastHour.py
Traceback (most recent call last):
File "./Get_FE_Stats_LastHour.py", line 38, in
ru = rest_functions()
File "/testing/PyU4V/rest_univmax.py", line 62, in __init__
cert = CFG.get('setup', 'cert')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 618, in get
raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'cert' in section: 'setup'
#########################################################################

After adding "cert=/path-to-file/uni_server.pem" in PYU4V.conf, I am receiving following error. I have performed some debugging on my own and it seems like PYU4U/rest_requests.py (rest_request) function is not returning anything. I very much appreciated any help.

I am using python 2.7.10.
P.S.: following error is coming rite away after I run the script.

#########################################################################
$python ./Get_FE_Stats_LastHour.py
2017-03-23 21:00:22,300 - PyU4V - ERROR - The POST request to URL https://testing.example.com:8443/univmax/restapi/performance/FEDirector/keys timed-out, but may have been successful.Please check the array.
Traceback (most recent call last):
File "./Get_FE_Stats_LastHour.py", line 51, in
dir_list = ru.get_fe_director_list()
File "/testing/PyU4V/rest_univmax.py", line 1448, in get_fe_director_list
for director in dir_response[0]['feDirectorInfo']:
TypeError: 'NoneType' object has no attribute '__getitem__'

PyU4V install from PyPi not functioning as expected

When installing PyU4V from PyPi using command:
pip install PyU4V==3.0.0.14
The core functional files are still on version 2.0 whilst all the rest of the versioning points towards 3.0.0.14 being the installed version.

As a workaround, uninstall PyU4V using pip, clone PyU4V from the source GitHub repo and install using pip but with local files instead of remote.

$ pip uninstall PyU4V
$ git clone https://github.com/MichaelMcAleer/PyU4V.git
$ cd PyU4V
$ pip install .

You can confirm the correct version has been installed by checking the version in the init.py file in our site packages. Get the install location from pip and check the contents of init.py:

$ pip show PyU4V
$ cat /usr/local/lib/python3.6/dist-packages/PyU4V/__init__.py
#   __
#  /__)      /  /   / | \   /
# /    ( /  / _/  / _ |  \ /
#       /             |
"""__init__.py."""

__title__ = 'pyu4v'
__version__ = '3.0.0.15'
__author__ = 'Dell EMC or its subsidieries'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 Dell EMC Inc'

The root cause of the issue is incorrect files associated with the .whl file hosted on PyPi, we are currently investigating the issue and will have a fix submitted in due course.

--Michael

get_volume_list fails after 1000 volumes

As the max_page_size=1000, code retrieves from below code.
vol_page = self.common.get_iterator_page_list( iterator_id, start, end)
The problem seems to be at the iterator id, as no contents are available at retrieved id uri.

Logging setup

do we have document to setup log file?
this is not a issue just need information only

i see options in config file but not able to make it work.

PyU4V Exception Handling Suggestions

This not an actual issue, just more of an observation with hope for suggestions. I started using the PyU4V module a while back and quickly found it very difficult to debug my foolish mistakes.

For example:
rjson = conn.performance.get_port_group_metrics(pg_id, start_date, end_date)

If all goes well, I get back a simple json payload which is easy to parse. However, if I mess something up (like start/end times not in miliseconds), I get:

File "./vmax_get_port_group_metrics.py", line 102, in
rjson = conn.performance.get_port_group_metrics(pg_id, start_date, end_date)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/PyU4V/performance.py", line 513, in get_port_group_metrics
pg_perf_data[0]['resultList']['result'])
KeyError: 'resultList'

I can't even tell what the problem is, just that something deep below isn't happy. What about a status_code and some response_content where I could do some real exception handling and pass along the status code and error information to the end user. Any suggestions greatly appreciated.

Regards,
Brent

PyU4V.conf not read in home directory

Running Python 2.7.13 on Linux, the file ~/.PyU4V/PyU4V.conf isn't parsed when initializing a new U4VConnection. It appears tilde expansion isn't happening on line 20 of utils/config_handler.py. It works when I change the line from global_path = os.path.normpath('~/.PyU4V/PyU4V.conf') to global_path = os.path.expanduser('~/.PyU4V/PyU4V.conf').

snap_data definition in rest_univmax.link_gen_snapshot redundant braces

The snap_data definition in rest_univmax.link_gen_snapshot appears to be syntactically incorrect; it generates a syntax error in Python 2.6 and a type error in Python 2.7.5. The specific code is:

snap_data = ({{"action": "Link",
               "link": {"linkStorageGroupName": link_sg_name},
               }})

It appears there is an extra set of braces surrounding the dictionary definition. Using this definition in Python 2.6.6 generates a syntax error:

$ python
Python 2.6.6 (r266:84292, Aug  9 2016, 06:11:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> snap_data = ({{"action": "Link",
...                "link": {"linkStorageGroupName": link_sg_name},
...                }})
  File "<stdin>", line 3
	}})
	 ^
SyntaxError: invalid syntax
>>>

And using this definition in 2.7.5 generates a TypeError:

$ python
Python 2.7.5 (default, Aug  2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> link_sg_name = 'test'
>>>
>>> snap_data = ({{"action": "Link",
...                "link": {"linkStorageGroupName": link_sg_name},
...                }})
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: unhashable type: 'dict'

Removing the extra braces results in the creation of a dictionary as I would expect.

snap_data = ({"action": "Link",
			   "link": {"linkStorageGroupName": link_sg_name},
			   })

get_iterator_page_list

latest version has a bug in target_uri = 'common/Iterator/{}/page'.format(iterator_id)

it should be

target_uri = '/common/Iterator/{}/page'.format(iterator_id)

No handlers could be found for logger "PyU4V.rest_requests"

Hi

I am facing the following issue when I use this module in playbook and run the playbook in AWX. I am able to run same via commad line like ansible-playbook plyabook.yml but when i run through awx I face this issue.

Error:
"module_stderr": "No handlers could be found for logger "PyU4V.rest_requests"\nTraceback (most recent call last):\n File "/root/.ansible/tmp/ansible-tmp-1558363142.15-275430186386678/AnsiballZ_dellpmax_createhost.py", line 113, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-tmp-1558363142.15-275430186386678/AnsiballZ_dellpmax_createhost.py", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-tmp-1558363142.15-275430186386678/AnsiballZ_dellpmax_createhost.py", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File "/tmp/ansible_dellpmax_createhost_payload_8zBOaH/main.py", line 168, in \n File "/tmp/ansible_dellpmax_createhost_payload_8zBOaH/main.py", line 150, in main\n File "/usr/lib/python2.7/site-packages/PyU4V/provisioning.py", line 148, in get_host_list\n self.array_id, SLOPROVISIONING, 'host', params=filters)\n File "/usr/lib/python2.7/site-packages/PyU4V/common.py", line 321, in get_resource\n return self.get_request(target_uri, resource_type, kwargs.get('params'))\n File "/usr/lib/python2.7/site-packages/PyU4V/common.py", line 277, in get_request\n self.check_status_code_success(operation, sc, message)\n File "/usr/lib/python2.7/site-packages/PyU4V/common.py", line 167, in check_status_code_success\n data=exception_message)\nPyU4V.utils.exception.VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: Error get host. The status code received is None and the message is None.\n",

SSL issue

Hi expert,

I followed guide to setup PyU4V. then get below issue. Can you help to give some advices? many Thanks.
Used the latest Powermax Unisphere Demo V9.1.0.1 and the latest PyY4V code.

[root@gerry-centos77 ~]# python
Python 3.7.5 (default, Apr 4 2020, 15:08:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import PyU4V
conn=PyU4V.U4VConn()
/usr/local/python3/lib/python3.7/site-packages/urllib3/connection.py:384: SubjectAltNameWarning: Certificate for 192.168.78.1 has no subjectAltName, falling back to check for a commonName for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See urllib3/urllib3#497 for details.)
SubjectAltNameWarning,
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
conn.connect()
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connection.py", line 386, in connect
_match_hostname(cert, self.assert_hostname or server_hostname)
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connection.py", line 396, in _match_hostname
match_hostname(cert, asserted_hostname)
File "/usr/local/python3/lib/python3.7/ssl.py", line 340, in match_hostname
raise CertificateError("no appropriate commonName or "
ssl.SSLCertVerificationError: ('no appropriate commonName or subjectAltName fields were found',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/python3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/python3/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.78.1', port=8444): Max retries exceeded with url: /univmax/restapi/version (Caused by SSLError(SSLCertVerificationError('no appropriate commonName or subjectAltName fields were found')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/rest_requests.py", line 104, in rest_request
timeout=timeout_val)
File "/usr/local/python3/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/python3/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/python3/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.78.1', port=8444): Max retries exceeded with url: /univmax/restapi/version (Caused by SSLError(SSLCertVerificationError('no appropriate commonName or subjectAltName fields were found')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/univmax_conn.py", line 115, in init
self.validate_unisphere()
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/univmax_conn.py", line 149, in validate_unisphere
uni_ver, major_ver = self.common.get_uni_version()
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/common.py", line 488, in get_uni_version
response = self.get_resource(category=VERSION, no_version=True)
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/common.py", line 346, in get_resource
target_uri, resource_type, kwargs.get('params'))
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/common.py", line 315, in get_request
message, sc = self.request(target_uri, GET, params=params)
File "/usr/local/python3/lib/python3.7/site-packages/PyU4V/rest_requests.py", line 133, in rest_request
raise r_exc.SSLError(msg)
requests.exceptions.SSLError: The connection to https://192.168.78.1:8444/univmax/restapi has encountered an SSL error. Please check your SSL config or supplied SSL cert in Cinder configuration. SSL Exception message: HTTPSConnectionPool(host='192.168.78.1', port=8444): Max retries exceeded with url: /univmax/restapi/version (Caused by SSLError(SSLCertVerificationError('no appropriate commonName or subjectAltName fields were found')))

failed to get the IG from initiator

conn.provisioning.get_initiator_group_from_initiator('21000024ff34cefd')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/PyU4V/provisioning.py", line 403, in get_initiator_group_from_initiator
init_details = self.get_initiator(initiator)
File "/usr/local/lib/python3.4/dist-packages/PyU4V/provisioning.py", line 319, in get_initiator
resource_name=initiator_id)
File "/usr/local/lib/python3.4/dist-packages/PyU4V/common.py", line 321, in get_resource
return self.get_request(target_uri, resource_type, kwargs.get('params'))
File "/usr/local/lib/python3.4/dist-packages/PyU4V/common.py", line 277, in get_request
self.check_status_code_success(operation, sc, message)
File "/usr/local/lib/python3.4/dist-packages/PyU4V/common.py", line 167, in check_status_code_success
data=exception_message)
PyU4V.utils.exception.VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: Error get initiator. The status code received is 500 and the message is {'message': "A problem occurred retrieving the initiator resource: ID 000297800192:21000024ff34cefd does not contain 4 tokens separated by ':'"}.

setup.py with error

Line 11 needs to be
packages=['PyU4V', 'PyU4V.utils'],
to include utils aswell.

3.0.0.14 modify_storagegroup_srdf regression

Hi,

Function modify_storagegroup_srdf from replication.py is not working anymore with pyU4V 3.0.0.14

When you try to suspend a replication you get this exception :

message': 'Parameter of type [SgRdfAction] value not one of declared Enum instance values: [Establish, Split, Suspend, Restore, Resume, Failover, Failback, Swap, SetBias, SetMode]

Previous version use to capitalize action to fit VMAX rest-api.

Tag 3.0.0 line 508 payload = {"action": action.capitalize()}
Tag 3.0.0.14 : line 513 payload = {"action": action}

Is PyU4V v 9.1.0.3 supported for Ansible Modules for Powermax v1.1

I am getting the below error while trying to run a sample playbook.

TASK [Get names of all the Storage Group] ***************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "PyU4V 9.1.3.0 is not supported by this module.Minimum supported version is : 3.1.5 and less than 4.0.0 "}

failed to delete masking view

conn.provisioning.delete_masking_view('tony_mv')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/PyU4V/provisioning.py", line 540, in delete_masking_view
self.array_id, SLOPROVISIONING, 'maskingview', maskingview_name)
File "/usr/local/lib/python3.4/dist-packages/PyU4V/common.py", line 464, in delete_resource
self.check_status_code_success(operation, status_code, message)
File "/usr/local/lib/python3.4/dist-packages/PyU4V/common.py", line 167, in check_status_code_success
data=exception_message)
PyU4V.utils.exception.VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: Error Delete maskingview resource. The status code received is 500 and the message is {'message': 'The server encountered an unexpected condition which prevented it from fulfilling the request'}.

Providing a symid for initial connection

Creating a connection requires specifying a symid known to the Unisphere host I'm trying to connect to. This is an issue for me because I've written a script to iterate over 4 Unisphere servers and collect performance data from 12 VMAX arrays. It would be nicer if I didn't need to know which arrays were on each unisphere server in advance. If I could connect without the symid, I could then use get_array_list to iterate over the arrays and set the array for each iteration. It seems like all I should need to connect is the ip address, port and credentials. I should be able to dynamically discover the arrays. I'm working around this by just adding configuration to the script so that for each unisphere IP I have a known symid on that unisphere instance. It would be better if I could connect without the symid because in the future the arrays in the unisphere server may change.

Env Check for VMAX arrays using PyU4V module.

Hello,

Could you please inform if there is any PyU4V function to get the env failed or Failed disks from Vmax arrays.

eg: Looking for PyU4V options equivalent to symcfg -sid XXXX list -env_data -service_state failed" or symdisk -sid XXX list -failed":

Thanks in advance.

a bug?

when i use api " conn.provisionging.get_director_list" to get all director-ids , but error below:

The server encountered an unexpected condition which prevented it from fulfilling the request.
image

ps: my version is v9.0.2.5 / 90

provisioning with cyliners

can this module support capacity provisioning using cylinders? if not can this be functionality added into this module?

Unable to install PyU4V

Hi Team,

I am unable to install PyU4V. Getting the below error. Please assist.

Sun 09/23/2018 19:35:25.26 C:\mydata >>>pip install PyU4V
Collecting PyU4V
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Veri
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Veri
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Veri
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Veri
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Veri
Could not find a version that satisfies the requirement PyU4V (from versions: )
No matching distribution found for PyU4V

Regards,
PR

Error while creating the storage group.

Issue : Below error while creating the storage group.

Bad or unexpected response from the storage volume backend API: Error Create storagegroup resource. The status code received is 500 and the message is {'message': 'A problem occurred creating the storage group resource: java.lang.NullPointerException'}.

Command Issued : rf.provisioning.create_storage_group(srp, 'restapi_SG', 'Diamond')

Note : Earlier we were using PyU4V version: 3.0.0.1. Got the same error and updated to 3.1.5.

PyU4V version: 3.1.5
Unisphere version : 8.4

provisioning.create_volume_from_sg_return_dev_id returns a different volume_id from name just being created

provisioning.create_volume_from_sg_return_dev_id(volume_name, storagegroup_name, vol_size, cap_unit)

Hello, I am filing something I noticed while using this module.

Same volume names can be set to different volumes, e.g., 00075:volume1108 and 00077:volume1108. Is it as expected? I an confused due to the following lab results.

Volume_name is a required parameter, and when volume_name='' (volume_name=None worked in the same way) is specified, no volume_name is assigned. After creation, this function returns a result of provisioning.find_volume_device_id(volume_name) for which empty volume_name is used to look for created device_id. The very first device_id matched with this device_name is returned e.g., in my lab 00001 which is actually not the volume just created.

For that reason it looks to me that device_name needs to be unique or cannot be used an identifier of a volume. Or it could make sense if find_volume_device_id returns not only a device_id but a list of devices.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.