From 6b4b3c77dc13f6b2862bf86126d60029ea61a803 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Tue, 19 Nov 2024 09:20:18 +0800 Subject: [PATCH] feat(v2 upgrade): support engine live upgrade Longhorn 9104 Signed-off-by: Derek Su --- pkg/spdk/engine.go | 3 +-- pkg/spdk/engine_test.go | 7 +++---- pkg/spdk/server.go | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/spdk/engine.go b/pkg/spdk/engine.go index 3b281508..02128250 100644 --- a/pkg/spdk/engine.go +++ b/pkg/spdk/engine.go @@ -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, diff --git a/pkg/spdk/engine_test.go b/pkg/spdk/engine_test.go index c9e303aa..10dd1887 100644 --- a/pkg/spdk/engine_test.go +++ b/pkg/spdk/engine_test.go @@ -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", @@ -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", @@ -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, diff --git a/pkg/spdk/server.go b/pkg/spdk/server.go index 24222192..a855837f 100644 --- a/pkg/spdk/server.go +++ b/pkg/spdk/server.go @@ -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 {