mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
Using peerid instead of nodeid
This commit is contained in:
@@ -22,7 +22,7 @@ volume.auth.password
|
||||
```
|
||||
brick.id
|
||||
brick.hostname
|
||||
brick.nodeid
|
||||
brick.peerid
|
||||
brick.path
|
||||
brick.volumename
|
||||
brick.volumeid
|
||||
|
||||
@@ -117,7 +117,7 @@ func handleMessage(inMessage string, addr *net.UDPAddr) {
|
||||
|
||||
message := make(map[string]interface{})
|
||||
message["ts"] = time.Now().Unix()
|
||||
message["nodeid"] = gdctx.MyUUID.String()
|
||||
message["peerid"] = gdctx.MyUUID.String()
|
||||
message["message"] = msgDict
|
||||
|
||||
marshalledMsg, err := json.Marshal(message)
|
||||
|
||||
@@ -20,15 +20,15 @@ const (
|
||||
)
|
||||
|
||||
// IsNodeAlive returns true and pid if the node specified is alive as seen by the store
|
||||
func (s *GDStore) IsNodeAlive(nodeID interface{}) (int, bool) {
|
||||
func (s *GDStore) IsNodeAlive(peerID interface{}) (int, bool) {
|
||||
|
||||
var keySuffix string
|
||||
|
||||
switch nodeID.(type) {
|
||||
switch peerID.(type) {
|
||||
case uuid.UUID:
|
||||
keySuffix = nodeID.(uuid.UUID).String()
|
||||
keySuffix = peerID.(uuid.UUID).String()
|
||||
case string:
|
||||
keySuffix = nodeID.(string)
|
||||
keySuffix = peerID.(string)
|
||||
if uuid.Parse(keySuffix) == nil {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ type TxnCtx interface {
|
||||
// Set attaches the given key with value to the context. It updates value if key exists already.
|
||||
Set(key string, value interface{}) error
|
||||
// SetNodeResult is similar to Set but prefixes the key with node UUID specified.
|
||||
SetNodeResult(nodeID uuid.UUID, key string, value interface{}) error
|
||||
SetNodeResult(peerID uuid.UUID, key string, value interface{}) error
|
||||
// Get gets the value for the given key. Returns an error if the key is not present
|
||||
Get(key string, value interface{}) error
|
||||
// GetNodeResult is similar to Get but prefixes the key with node UUID specified.
|
||||
GetNodeResult(nodeID uuid.UUID, key string, value interface{}) error
|
||||
GetNodeResult(peerID uuid.UUID, key string, value interface{}) error
|
||||
// Delete deletes the key and value
|
||||
Delete(key string) error
|
||||
// Logger returns the Logrus logger associated with the context
|
||||
@@ -121,8 +121,8 @@ func (c *Tctx) commit() error {
|
||||
// SetNodeResult is similar to Set but prefixes the key with the node UUID
|
||||
// specified. This function can be used by nodes to store results of
|
||||
// transaction steps.
|
||||
func (c *Tctx) SetNodeResult(nodeID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := nodeID.String() + "/" + key
|
||||
func (c *Tctx) SetNodeResult(peerID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := peerID.String() + "/" + key
|
||||
return c.Set(storeKey, value)
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ func (c *Tctx) Get(key string, value interface{}) error {
|
||||
// GetNodeResult is similar to Get but prefixes the key with node UUID
|
||||
// specified. This function can be used by the transaction initiator node to
|
||||
// fetch results of transaction step run on remote nodes.
|
||||
func (c *Tctx) GetNodeResult(nodeID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := nodeID.String() + "/" + key
|
||||
func (c *Tctx) GetNodeResult(peerID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := peerID.String() + "/" + key
|
||||
return c.Get(storeKey, value)
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ func (m *MockTctx) Set(key string, value interface{}) error {
|
||||
}
|
||||
|
||||
// SetNodeResult is similar to Set but prefixes the key with the node UUID specified.
|
||||
func (m *MockTctx) SetNodeResult(nodeID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := nodeID.String() + "/" + key
|
||||
func (m *MockTctx) SetNodeResult(peerID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := peerID.String() + "/" + key
|
||||
return m.Set(storeKey, value)
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ func (m *MockTctx) Get(key string, value interface{}) error {
|
||||
}
|
||||
|
||||
// GetNodeResult is similar to Get but prefixes the key with node UUID specified.
|
||||
func (m *MockTctx) GetNodeResult(nodeID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := nodeID.String() + "/" + key
|
||||
func (m *MockTctx) GetNodeResult(peerID uuid.UUID, key string, value interface{}) error {
|
||||
storeKey := peerID.String() + "/" + key
|
||||
return m.Get(storeKey, value)
|
||||
}
|
||||
|
||||
|
||||
@@ -123,11 +123,11 @@ func getClientVolFilePath(volname string) string {
|
||||
return path.Join(dir, file)
|
||||
}
|
||||
|
||||
func getBrickVolFilePath(volname string, brickNodeID string, brickPath string) string {
|
||||
func getBrickVolFilePath(volname string, brickPeerID string, brickPath string) string {
|
||||
dir := utils.GetVolumeDir(volname)
|
||||
|
||||
brickPathWithoutSlashes := strings.Trim(strings.Replace(brickPath, "/", "-", -1), "-")
|
||||
file := fmt.Sprintf("%s.%s.%s.vol", volname, brickNodeID, brickPathWithoutSlashes)
|
||||
file := fmt.Sprintf("%s.%s.%s.vol", volname, brickPeerID, brickPathWithoutSlashes)
|
||||
|
||||
return path.Join(dir, file)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func typeInSubvolType(ele volume.SubvolType, list []volume.SubvolType) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func clusterGraph(volfile *Volfile, dht *Entry, vol *volume.Volinfo, nodeid uuid.UUID, filters *clusterGraphFilters) {
|
||||
func clusterGraph(volfile *Volfile, dht *Entry, vol *volume.Volinfo, peerid uuid.UUID, filters *clusterGraphFilters) {
|
||||
numSubvols := len(vol.Subvols)
|
||||
decommissionedBricks := []string{}
|
||||
clientIdx := 0
|
||||
@@ -79,7 +79,7 @@ func clusterGraph(volfile *Volfile, dht *Entry, vol *volume.Volinfo, nodeid uuid
|
||||
clientIdx++
|
||||
|
||||
// If local bricks only
|
||||
if filters != nil && filters.onlyLocalBricks && !uuid.Equal(b.PeerID, nodeid) {
|
||||
if filters != nil && filters.onlyLocalBricks && !uuid.Equal(b.PeerID, peerid) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ type extrainfo struct {
|
||||
func generateClusterLevelVolfiles(clusterinfo []*volume.Volinfo, xopts *map[string]extrainfo) error {
|
||||
for _, cvf := range clusterVolfiles {
|
||||
if cvf.nodeLevel {
|
||||
for _, nodeid := range nodesFromClusterInfo(clusterinfo) {
|
||||
for _, peerid := range nodesFromClusterInfo(clusterinfo) {
|
||||
volfile := New(cvf.name)
|
||||
cvf.fn.(clusterVolfileFunc)(volfile, clusterinfo, nodeid)
|
||||
cvf.fn.(clusterVolfileFunc)(volfile, clusterinfo, peerid)
|
||||
volfiledata, err := volfile.Generate("", xopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = save(nodeid.String()+"-"+volfile.FileName, volfiledata)
|
||||
err = save(peerid.String()+"-"+volfile.FileName, volfiledata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -63,14 +63,14 @@ func generateVolumeLevelVolfiles(clusterinfo []*volume.Volinfo, xopts *map[strin
|
||||
for _, volinfo := range clusterinfo {
|
||||
for _, vvf := range volumeVolfiles {
|
||||
if vvf.nodeLevel {
|
||||
for _, nodeid := range volinfo.Nodes() {
|
||||
for _, peerid := range volinfo.Nodes() {
|
||||
volfile := New(vvf.name)
|
||||
vvf.fn.(volumeVolfileFunc)(volfile, volinfo, nodeid)
|
||||
vvf.fn.(volumeVolfileFunc)(volfile, volinfo, peerid)
|
||||
volfiledata, err := volfile.Generate("", xopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = save(nodeid.String()+"-"+volfile.FileName, volfiledata)
|
||||
err = save(peerid.String()+"-"+volfile.FileName, volfiledata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -98,14 +98,14 @@ func generateBrickLevelVolfiles(clusterinfo []*volume.Volinfo, xopts *map[string
|
||||
for _, brick := range volinfo.GetBricks() {
|
||||
for _, bvf := range brickVolfiles {
|
||||
if bvf.nodeLevel {
|
||||
for _, nodeid := range nodes {
|
||||
for _, peerid := range nodes {
|
||||
volfile := New(bvf.name)
|
||||
bvf.fn.(brickVolfileFunc)(volfile, &brick, volinfo, nodeid)
|
||||
bvf.fn.(brickVolfileFunc)(volfile, &brick, volinfo, peerid)
|
||||
volfiledata, err := volfile.Generate("", xopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = save(nodeid.String()+"-"+volfile.FileName, volfiledata)
|
||||
err = save(peerid.String()+"-"+volfile.FileName, volfiledata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateBitdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateBitdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = "gluster/bitd"
|
||||
|
||||
bitd := volfile.RootEntry.Add("debug/io-stats", nil, nil).SetName("bitd")
|
||||
@@ -20,7 +20,7 @@ func generateBitdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid
|
||||
if exists && val == "on" {
|
||||
name := fmt.Sprintf("%s-bit-rot-%d", vol.Name, volIdx)
|
||||
bitdvol := bitd.Add("features/bit-rot", vol, nil).SetName(name).SetIgnoreOptions([]string{"scrubber"})
|
||||
clusterGraph(volfile, bitdvol, vol, nodeid, &clusterGraphFilters{onlyLocalBricks: true})
|
||||
clusterGraph(volfile, bitdvol, vol, peerid, &clusterGraphFilters{onlyLocalBricks: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateBrickVolfile(volfile *Volfile, b *brick.Brickinfo, vol *volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateBrickVolfile(volfile *Volfile, b *brick.Brickinfo, vol *volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = fmt.Sprintf("%s.%s.%s",
|
||||
vol.Name,
|
||||
b.PeerID,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateTCPFuseVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateTCPFuseVolfile(volfile *Volfile, vol *volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = vol.VolfileID
|
||||
|
||||
dht := volfile.RootEntry.Add("debug/io-stats", vol, nil).SetName(vol.Name).
|
||||
@@ -20,7 +20,7 @@ func generateTCPFuseVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.U
|
||||
Add("performance/write-behind", vol, nil).
|
||||
Add("cluster/distribute", vol, nil)
|
||||
|
||||
clusterGraph(volfile, dht, vol, nodeid, nil)
|
||||
clusterGraph(volfile, dht, vol, peerid, nil)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateTCPGfProxyFuseVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateTCPGfProxyFuseVolfile(volfile *Volfile, vol *volume.Volinfo, peerid uuid.UUID) {
|
||||
|
||||
/*
|
||||
Name should be different for snapshot
|
||||
@@ -18,7 +18,7 @@ func generateTCPGfProxyFuseVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid
|
||||
Add("protocol/client", vol, nil).SetExtraData(map[string]string{"brick.path": "gfproxyd-" + vol.Name, "brick.hostname": ""})
|
||||
}
|
||||
|
||||
func generateGfproxydVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateGfproxydVolfile(volfile *Volfile, vol *volume.Volinfo, peerid uuid.UUID) {
|
||||
|
||||
volfile.FileName = "gfproxyd/" + vol.Name
|
||||
|
||||
@@ -33,7 +33,7 @@ func generateGfproxydVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.
|
||||
Add("performance/read-ahead", vol, nil).
|
||||
Add("cluster/distribute", vol, nil)
|
||||
|
||||
clusterGraph(volfile, dht, vol, nodeid, nil)
|
||||
clusterGraph(volfile, dht, vol, peerid, nil)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateQuotadVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateQuotadVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = "gluster/quotad"
|
||||
|
||||
quotaOpts := make(map[string]string)
|
||||
@@ -22,7 +22,7 @@ func generateQuotadVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, node
|
||||
val, exists := v.Options["features.quota"]
|
||||
if exists && val == "on" {
|
||||
dht := quota.Add("cluster/distribute", v, nil).SetName(v.Name)
|
||||
clusterGraph(volfile, dht, v, nodeid, nil)
|
||||
clusterGraph(volfile, dht, v, peerid, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateRebalanceVolfile(volfile *Volfile, vol *volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateRebalanceVolfile(volfile *Volfile, vol *volume.Volinfo, peerid uuid.UUID) {
|
||||
|
||||
volfile.FileName = "rebalance/" + vol.Name
|
||||
|
||||
dht := volfile.RootEntry.Add("debug/io-stats", vol, nil).SetName(vol.Name).
|
||||
Add("cluster/distribute", vol, nil)
|
||||
|
||||
clusterGraph(volfile, dht, vol, nodeid, nil)
|
||||
clusterGraph(volfile, dht, vol, peerid, nil)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateScrubVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateScrubVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = "gluster/scrub"
|
||||
|
||||
scrub := volfile.RootEntry.Add("debug/io-stats", nil, nil).SetName("scrub")
|
||||
@@ -19,7 +19,7 @@ func generateScrubVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodei
|
||||
if exists && val == "on" {
|
||||
name := fmt.Sprintf("%s-bit-rot-%d", vol.Name, volIdx)
|
||||
scrubvol := scrub.Add("features/bit-rot", vol, nil).SetName(name)
|
||||
clusterGraph(volfile, scrubvol, vol, nodeid, &clusterGraphFilters{onlyLocalBricks: true})
|
||||
clusterGraph(volfile, scrubvol, vol, peerid, &clusterGraphFilters{onlyLocalBricks: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/pborman/uuid"
|
||||
)
|
||||
|
||||
func generateShdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid uuid.UUID) {
|
||||
func generateShdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, peerid uuid.UUID) {
|
||||
volfile.FileName = "gluster/glustershd"
|
||||
shd := volfile.RootEntry.Add("debug/io-stats", nil, nil).SetName("glustershd")
|
||||
|
||||
@@ -16,7 +16,7 @@ func generateShdVolfile(volfile *Volfile, clusterinfo []*volume.Volinfo, nodeid
|
||||
volume.SubvolReplicate,
|
||||
volume.SubvolDisperse,
|
||||
}}
|
||||
clusterGraph(volfile, shd, vol, nodeid, &filters)
|
||||
clusterGraph(volfile, shd, vol, peerid, &filters)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ const (
|
||||
|
||||
// GeorepRemoteHost represents Remote host UUID and Hostname
|
||||
type GeorepRemoteHost struct {
|
||||
PeerID uuid.UUID `json:"nodeid"`
|
||||
PeerID uuid.UUID `json:"peerid"`
|
||||
Hostname string `json:"host"`
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ type GeorepWorker struct {
|
||||
|
||||
// GeorepSSHPublicKey represents one nodes SSH Public key
|
||||
type GeorepSSHPublicKey struct {
|
||||
PeerID uuid.UUID `json:"nodeid"`
|
||||
PeerID uuid.UUID `json:"peerid"`
|
||||
GsyncdKey string `json:"gsyncd"`
|
||||
TarKey string `json:"tar"`
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const (
|
||||
|
||||
// RebalNodeStatus represents the rebalance status on the Node
|
||||
type RebalNodeStatus struct {
|
||||
NodeID uuid.UUID `json:"nodeid"`
|
||||
PeerID uuid.UUID `json:"peerid"`
|
||||
Status string `json:"status"`
|
||||
RebalancedFiles string `json:"rebalanced-files"`
|
||||
RebalancedSize string `json:"size"`
|
||||
|
||||
@@ -52,7 +52,7 @@ func HandleEventNotify(status map[string]string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
rebalNodeStatus.NodeID = gdctx.MyUUID
|
||||
rebalNodeStatus.PeerID = gdctx.MyUUID
|
||||
rebalNodeStatus.Status = status["status"]
|
||||
rebalNodeStatus.RebalancedFiles = status["files"]
|
||||
rebalNodeStatus.RebalancedSize = status["size"]
|
||||
|
||||
@@ -197,7 +197,7 @@ func txnRebalanceStatus(c transaction.TxnCtx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
rebalNodeStatus.NodeID = gdctx.MyUUID
|
||||
rebalNodeStatus.PeerID = gdctx.MyUUID
|
||||
rebalNodeStatus.Status = rspDict["status"]
|
||||
rebalNodeStatus.RebalancedFiles = rspDict["files"]
|
||||
rebalNodeStatus.RebalancedSize = rspDict["size"]
|
||||
|
||||
Reference in New Issue
Block a user