Skip to content

Commit

Permalink
feat(v2 upgrade): support engine live upgrade
Browse files Browse the repository at this point in the history
Longhorn 9104

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Nov 19, 2024
1 parent f654d45 commit 6b4b3c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions pkg/spdk/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ func (e *Engine) checkInitiatorAndTargetCreationRequirements(podIP, initiatorIP,
return initiatorCreationRequired, targetCreationRequired, err
}

func (e *Engine) Create(spdkClient *spdkclient.Client, replicaAddressMap map[string]string, portCount int32, superiorPortAllocator *commonbitmap.Bitmap, initiatorAddress, targetAddress string, upgradeRequired, salvageRequested bool) (ret *spdkrpc.Engine, err error) {
func (e *Engine) Create(spdkClient *spdkclient.Client, replicaAddressMap map[string]string, portCount int32, superiorPortAllocator *commonbitmap.Bitmap, initiatorAddress, targetAddress string, salvageRequested bool) (ret *spdkrpc.Engine, err error) {
logrus.WithFields(logrus.Fields{
"portCount": portCount,
"upgradeRequired": upgradeRequired,
"replicaAddressMap": replicaAddressMap,
"initiatorAddress": initiatorAddress,
"targetAddress": targetAddress,
Expand Down
7 changes: 3 additions & 4 deletions pkg/spdk/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) {
expectedError: nil,
},
{
name: "Create local target instance only",
name: "Create local target instance on the node with initiator instance",
podIP: "192.168.1.1",
initiatorIP: "192.168.1.1",
targetIP: "192.168.1.1",
Expand All @@ -58,7 +58,7 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) {
expectedError: nil,
},
{
name: "Create remote target instance only",
name: "Create local target instance on the node without initiator instance",
podIP: "192.168.1.2",
initiatorIP: "192.168.1.1",
targetIP: "192.168.1.2",
Expand Down Expand Up @@ -94,9 +94,8 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) {
expectedError: nil,
},
}

for testName, testCase := range testCases {
c.Logf("testing TestCheckInitiatorAndTargetCreationRequirements.%v", testName)
c.Logf("testing checkInitiatorAndTargetCreationRequirements.%v", testName)

engine := &Engine{
Port: testCase.port,
Expand Down
2 changes: 1 addition & 1 deletion pkg/spdk/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ func (s *Server) EngineCreate(ctx context.Context, req *spdkrpc.EngineCreateRequ
spdkClient := s.spdkClient
s.Unlock()

return e.Create(spdkClient, req.ReplicaAddressMap, req.PortCount, s.portAllocator, req.InitiatorAddress, req.TargetAddress, req.UpgradeRequired, req.SalvageRequested)
return e.Create(spdkClient, req.ReplicaAddressMap, req.PortCount, s.portAllocator, req.InitiatorAddress, req.TargetAddress, req.SalvageRequested)
}

func localTargetExists(e *Engine) bool {
Expand Down

0 comments on commit 6b4b3c7

Please sign in to comment.