Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Check whether peer has devices before removing peer #1421

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rishubhjain
Copy link
Contributor

No description provided.

@ghost ghost assigned rishubhjain Dec 18, 2018
@ghost ghost added the in progress label Dec 18, 2018
@rishubhjain
Copy link
Contributor Author

Fixes : #1422

@rishubhjain
Copy link
Contributor Author

Please review, but this should be merged after #1120

dev, err := client.DeviceList(g2.PeerID(), "/dev/gluster_loop1")
r.Nil(err)
r.Equal(dev[0].Device, "/dev/gluster_loop1")

err = client.PeerRemove(g2.PeerID())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the peer remove failed, please remove the device and then try removing the peer again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the device once the delete device PR is in. Let's wait for the PR(#1120) to get merged.

@@ -43,3 +43,11 @@ func (c *Client) DeviceEdit(peerid, device, state string) error {
err := c.post(url, req, http.StatusOK, nil)
return err
}

// DevicesInPeer lists devices in peer
func (c *Client) DevicesInPeer(peerid string) (deviceapi.ListDeviceResp, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is needed?
we already have an API to do this functionality. https://github.com/gluster/glusterd2/blob/master/pkg/restclient/device.go#L26

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants