gluster / python-gluster-mgmt-client

Python bindings for gluster
GNU General Public License v3.0
5 stars 3 forks source link

Unable to add peers to the cluster #16

Open sac opened 6 years ago

sac commented 6 years ago

Unable to add peers to the cluster. When I follow the documenation, I see the below traceback:

>>> from glusterapi import Client
>>> client = Client("10.70.41.250")
>>> client.peer_add("10.70.43.250")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "glusterapi/peer.py", line 28, in peer_add
    json.dumps(req))
  File "glusterapi/common.py", line 87, in _handle_request
    resp = func(*args, **kwargs)
  File "glusterapi/common.py", line 73, in _post
    verify=self.verify)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 494, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 437, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 305, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 379, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '10.70.41.250/v1/peers': No schema supplied. Perhaps you meant http://10.70.41.250/v1/peers?
Madhu-1 commented 6 years ago

@sac, Client should be created as below

client=Client("http://127.0.0.1:24007")

we need to update documentation. and add validation of endpoint in common.py

sac commented 6 years ago

@Madhu-1 even with that I see:

>>> from glusterapi import Client
>>> client = Client("http://10.70.41.250:24007")
>>> client.peer_add("10.70.43.250")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "glusterapi/peer.py", line 28, in peer_add
    json.dumps(req))
  File "glusterapi/common.py", line 90, in _handle_request
    raise GlusterApiError()
glusterapi.exceptions.GlusterApiError
>>> 
Madhu-1 commented 6 years ago

@sac host should be of the form ip:port client.peer_add("10.70.43.250:24007")

sac commented 6 years ago

@Madhu-1 client.peer_add("10.70.43.250) worked, the failure was because one of the nodes was running a different version of glusterd. Thanks for your help.

devyanikota commented 6 years ago

@sac @Madhu-1 should we keep the issue open? I think we can add the ip validations before executing, to avoid similar issues?

Madhu-1 commented 6 years ago

@devyanikota we need to validate endpoint while creating Client.