HPE Storage Users Group

A Storage Administrator Community




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: WSAPI python script to create VLUN errors
PostPosted: Mon Nov 25, 2019 5:55 am 

Joined: Thu Nov 21, 2019 6:23 am
Posts: 1
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


Top
 Profile  
Reply with quote  
 Post subject: Re: WSAPI python script to create VLUN errors
PostPosted: Wed Dec 18, 2019 9:12 am 

Joined: Sat Nov 24, 2018 4:18 pm
Posts: 14
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group | DVGFX2 by: Matt