Comment 4 for bug 1779654

Revision history for this message
Vivek Soni (viveksoni) wrote :

This 'SERVER_ALREADY_EXISTS' error occurs only if we tries to create a server which is already exists: I am able to get this error using standalone script

# creating NEW server
server_info = cl.createServer("cld6b2", "iqn.1993-08.org.debian:01:686b42f5dcc8")
>>> server_info
{u'inServerCluster': False, u'chapTargetSecret': u'', u'iscsiEnabled': True, u'modified': u'', u'iscsiIQN': u'iqn.1993-08.org.debian:01:686b42f5dcc8', u'id': 5904, u'wwnnList': [], u'wwpnList': [], u'chapInitiatorSecret': u'', u'type': u'server', u'bootVolumeID': 0, u'iscsiLoadBalancingEnabled': True, u'description': u'', u'chapName': u'', u'chapAuthenticationRequired': False, u'bootVolumeLun': 0, u'controllingServerName': u'', u'fibreChannelEnabled': False, u'name': u'cld6b2', u'created': u'', u'uri': u'/lhos/servers/5904', u'fibreChannelPaths': None}

# creating a server which is already EXISTS -- ERROR
>>> server_info = cl.createServer("cld6b2", "iqn.1993-08.org.debian:01:686b42f5dcc8")
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/hpelefthandclient/client.py", line 263, in createServer
    response, body = self.http.post('/servers', body=info)
  File "/usr/local/lib/python2.7/dist-packages/hpelefthandclient/http.py", line 343, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/hpelefthandclient/http.py", line 291, in _cs_request
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/hpelefthandclient/http.py", line 267, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/hpelefthandclient/http.py", line 261, in request
    raise exceptions.from_response(resp, body)
hpelefthandclient.exceptions.HTTPServerError: Error (HTTP 500) SERVER_ALREADY_EXISTS - The server with the name "$1" already exists. Use a unique name and try again.

--------------------------------

This will not occurs via VSA driver path flow as it first check the existence of server:
if server exists:
    # it returns and uses that server
    # code reference - https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py#L964
else:
    # it creates a new server
    # code reference - https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py#L985