HPE Storage Users Group
https://3parug.com/

WSAPI python script to create VLUN errors
https://3parug.com/viewtopic.php?f=18&t=3329
Page 1 of 1

Author:  em110905 [ Mon Nov 25, 2019 5:55 am ]
Post subject:  WSAPI python script to create VLUN errors

Hi, I hope someone can help...
I am running on solaris and access the 3par via wsapi only.
I have a python script to automate the process of creating oracle databases on Solaris, however the createVLUN doesn't work.
The script map.py is:

import sys, requests, json
headers = { 'Content-Type': 'application/json', }
data = '{"user":"XXXXX", "password":"YYYYY"}'
response = requests.post('https://10.13.9.154:8080/api/v1/credentials', headers=headers, data=data, verify=False)
key = json.loads(response.text)['key']

vset = sys.argv[1]
host = sys.argv[2]
headers = {'X-HP3PAR-WSAPI-SessionKey':key, 'Content-Type':'application/json' }
pydata = {
"volumeName":"set:" + vset,
"hostname":host,
"autoLun":True,
}
data = json.dumps(pydata)
r = requests.post('https://10.13.9.154:8080/api/v1/vluns', headers=headers, data=data, verify=False)
result = r.status_code
print(result)

j = json.loads(r.text)
print(j)

When run with:
python -W ignore map.py <vset name> <host_name>

returns:
400
{u'code': 40, u'ref': u'lun', u'desc': u'invalid input: some or all required parameters are missing'}

Anyone with an idea?
By using autoLun, I shouldn't need to supply a Lunid.

/Richard

Author:  feldsam [ Wed Dec 18, 2019 9:12 am ]
Post subject:  Re: WSAPI python script to create VLUN errors

Hi Richard,

when using autoLun = True, then you have to supply also lun = 0 and maxAutoLun = 0.

btw, why you don't use official python hpe3parclient lib?

https://github.com/hpe-storage/python-3parclient

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/