Skip to content

Commit

Permalink
PWX-38611 : Replacing gob.Register with gob.RegisterName and passing …
Browse files Browse the repository at this point in the history
…the value from px

Signed-off-by: Dolly Talreja <[email protected]>
  • Loading branch information
dtalreja-px committed Aug 28, 2024
1 parent f00296e commit e1e7b79
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/client/cluster/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (c *clusterClient) Uuid() string {
return ""
}

func (c *clusterClient) StartWithConfiguration(bool, string, []string, string, *cluster.ClusterServerConfiguration) error {
func (c *clusterClient) StartWithConfiguration(bool, string, []string, string, *cluster.ClusterServerConfiguration, string) error {
return nil
}

Expand Down
1 change: 1 addition & 0 deletions cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ type Cluster interface {
snapshotPrefixes []string,
selfClusterDomain string,
config *ClusterServerConfiguration,
gobRegisterName string,
) error

// Get a unique identifier for this cluster. Depending on the implementation, this could
Expand Down
4 changes: 2 additions & 2 deletions cluster/cluster_not_supported.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/libopenstorage/openstorage/pkg/defrag"
"github.com/libopenstorage/openstorage/pkg/diags"
"github.com/libopenstorage/openstorage/pkg/job"
"github.com/libopenstorage/openstorage/pkg/schedule"
"github.com/libopenstorage/openstorage/pkg/nodedrain"
"github.com/libopenstorage/openstorage/pkg/schedule"
"github.com/libopenstorage/openstorage/pkg/storagepool"
"github.com/libopenstorage/openstorage/schedpolicy"
"github.com/libopenstorage/openstorage/secrets"
Expand Down Expand Up @@ -117,7 +117,7 @@ func (m *NullClusterManager) Start(arg1 bool, arg2 string, arg3 string) error {
}

// StartWithConfiguration
func (m *NullClusterManager) StartWithConfiguration(arg1 bool, arg2 string, arg3 []string, arg4 string, arg5 *ClusterServerConfiguration) error {
func (m *NullClusterManager) StartWithConfiguration(arg1 bool, arg2 string, arg3 []string, arg4 string, arg5 *ClusterServerConfiguration, arg6 string) error {
return ErrNotImplemented
}

Expand Down
6 changes: 4 additions & 2 deletions cluster/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,8 @@ func (c *ClusterManager) Start(
gossipPort,
[]string{ClusterDBKey},
selfClusterDomain,
&cluster.ClusterServerConfiguration{})
&cluster.ClusterServerConfiguration{},
"")
}

func (c *ClusterManager) StartWithConfiguration(
Expand All @@ -1457,6 +1458,7 @@ func (c *ClusterManager) StartWithConfiguration(
snapshotPrefixes []string,
selfClusterDomain string,
config *cluster.ClusterServerConfiguration,
gobRegisterName string,
) error {
var err error

Expand Down Expand Up @@ -1511,7 +1513,7 @@ func (c *ClusterManager) StartWithConfiguration(
// Start the gossip protocol.
// Replacing gob.Register with gob.RegisterName to avoid any issue caused due to the movement from portworx to pure-px
// gossip: Error in unmarshalling peer's local data. Error : gob: name not registered for interface.
gob.RegisterName("github.com/portworx/porx/vendor/github.com/libopenstorage/openstorage/api.Node", api.Node{})
gob.RegisterName(gobRegisterName+"api.Node", api.Node{})
quorumTimeout := types.DEFAULT_QUORUM_TIMEOUT
if c.config.QuorumTimeoutInSeconds > 0 {
quorumTimeout = time.Duration(c.config.QuorumTimeoutInSeconds) * time.Second
Expand Down
2 changes: 1 addition & 1 deletion cluster/manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestUpdateSchedulerNodeName(t *testing.T) {

err = inst.StartWithConfiguration(false, "1001", []string{}, "", &cluster.ClusterServerConfiguration{
ConfigSystemTokenManager: manager,
})
}, "gobRegisterName/path")
assert.NoError(t, err)

node, err := inst.Inspect(nodeID)
Expand Down
8 changes: 4 additions & 4 deletions cluster/mock/cluster.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/osd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ func start(c *cli.Context) error {
ConfigObjectStoreManager: objectstore.NewfakeObjectstore(),
ConfigSystemTokenManager: auth.SystemTokenManagerInst(),
},
"",
); err != nil {
return fmt.Errorf("Unable to start cluster manager: %v", err)
}
Expand Down

0 comments on commit e1e7b79

Please sign in to comment.