diff --git a/pkg/spdk_test.go b/pkg/spdk_test.go index 1123fc6f..93e1ace1 100644 --- a/pkg/spdk_test.go +++ b/pkg/spdk_test.go @@ -1376,76 +1376,76 @@ func (s *TestSuite) TestSPDKEngineOnlyWithTarget(c *C) { c.Assert(err, IsNil) } -func (s *TestSuite) TestSPDKEngineCreateWithUpgradeRequired(c *C) { - fmt.Println("Testing SPDK Engine Creation with Upgrade Required") - - diskDriverName := "aio" - - ip, err := commonnet.GetAnyExternalIP() - c.Assert(err, IsNil) - os.Setenv(commonnet.EnvPodIP, ip) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - ne, err := helperutil.NewExecutor(commontypes.ProcDirectory) - c.Assert(err, IsNil) - LaunchTestSPDKGRPCServer(ctx, c, ip, ne.Execute) - - loopDevicePath := PrepareDiskFile(c) - defer func() { - CleanupDiskFile(c, loopDevicePath) - }() - - spdkCli, err := client.NewSPDKClient(net.JoinHostPort(ip, strconv.Itoa(types.SPDKServicePort))) - c.Assert(err, IsNil) - - disk, err := spdkCli.DiskCreate(defaultTestDiskName, "", loopDevicePath, diskDriverName, int64(defaultTestBlockSize)) - c.Assert(err, IsNil) - c.Assert(disk.Path, Equals, loopDevicePath) - c.Assert(disk.Uuid, Not(Equals), "") - - defer func() { - err := spdkCli.DiskDelete(defaultTestDiskName, disk.Uuid, disk.Path, diskDriverName) - c.Assert(err, IsNil) - }() - - volumeName := "test-vol" - engineName := fmt.Sprintf("%s-engine", volumeName) - replicaName1 := fmt.Sprintf("%s-replica-1", volumeName) - replicaName2 := fmt.Sprintf("%s-replica-2", volumeName) - - replica1, err := spdkCli.ReplicaCreate(replicaName1, defaultTestDiskName, disk.Uuid, defaultTestLvolSize, defaultTestReplicaPortCount) - c.Assert(err, IsNil) - replica2, err := spdkCli.ReplicaCreate(replicaName2, defaultTestDiskName, disk.Uuid, defaultTestLvolSize, defaultTestReplicaPortCount) - c.Assert(err, IsNil) - - replicaAddressMap := map[string]string{ - replica1.Name: net.JoinHostPort(ip, strconv.Itoa(int(replica1.PortStart))), - replica2.Name: net.JoinHostPort(ip, strconv.Itoa(int(replica2.PortStart))), - } - - engine, err := spdkCli.EngineCreate(engineName, volumeName, types.FrontendSPDKTCPBlockdev, defaultTestLvolSize, replicaAddressMap, 1, "127.0.0.1", ip, false, false) - c.Assert(err, IsNil) - - targetAddress := fmt.Sprintf("%s:%d", engine.TargetIP, engine.TargetPort) - engine, err = spdkCli.EngineCreate(engineName, volumeName, types.FrontendSPDKTCPBlockdev, defaultTestLvolSize, replicaAddressMap, 1, ip, targetAddress, true, false) - c.Assert(err, IsNil) - c.Assert(engine.Endpoint, Not(Equals), "") - // Initiator is not created, so the IP and Port should be empty - c.Assert(engine.IP, Equals, ip) - c.Assert(engine.Port, Not(Equals), int32(0)) - // Target is created and exposed - c.Assert(engine.TargetIP, Equals, ip) - c.Assert(engine.TargetPort, Not(Equals), int32(0)) - c.Assert(engine.Port, Equals, engine.TargetPort) - - // Tear down engine and replicas - err = spdkCli.EngineDelete(engineName) - c.Assert(err, IsNil) - - err = spdkCli.ReplicaDelete(replicaName1, false) - c.Assert(err, IsNil) - err = spdkCli.ReplicaDelete(replicaName2, false) - c.Assert(err, IsNil) -} +// func (s *TestSuite) TestSPDKEngineCreateWithUpgradeRequired(c *C) { +// fmt.Println("Testing SPDK Engine Creation with Upgrade Required") + +// diskDriverName := "aio" + +// ip, err := commonnet.GetAnyExternalIP() +// c.Assert(err, IsNil) +// os.Setenv(commonnet.EnvPodIP, ip) + +// ctx, cancel := context.WithCancel(context.Background()) +// defer cancel() + +// ne, err := helperutil.NewExecutor(commontypes.ProcDirectory) +// c.Assert(err, IsNil) +// LaunchTestSPDKGRPCServer(ctx, c, ip, ne.Execute) + +// loopDevicePath := PrepareDiskFile(c) +// defer func() { +// CleanupDiskFile(c, loopDevicePath) +// }() + +// spdkCli, err := client.NewSPDKClient(net.JoinHostPort(ip, strconv.Itoa(types.SPDKServicePort))) +// c.Assert(err, IsNil) + +// disk, err := spdkCli.DiskCreate(defaultTestDiskName, "", loopDevicePath, diskDriverName, int64(defaultTestBlockSize)) +// c.Assert(err, IsNil) +// c.Assert(disk.Path, Equals, loopDevicePath) +// c.Assert(disk.Uuid, Not(Equals), "") + +// defer func() { +// err := spdkCli.DiskDelete(defaultTestDiskName, disk.Uuid, disk.Path, diskDriverName) +// c.Assert(err, IsNil) +// }() + +// volumeName := "test-vol" +// engineName := fmt.Sprintf("%s-engine", volumeName) +// replicaName1 := fmt.Sprintf("%s-replica-1", volumeName) +// replicaName2 := fmt.Sprintf("%s-replica-2", volumeName) + +// replica1, err := spdkCli.ReplicaCreate(replicaName1, defaultTestDiskName, disk.Uuid, defaultTestLvolSize, defaultTestReplicaPortCount) +// c.Assert(err, IsNil) +// replica2, err := spdkCli.ReplicaCreate(replicaName2, defaultTestDiskName, disk.Uuid, defaultTestLvolSize, defaultTestReplicaPortCount) +// c.Assert(err, IsNil) + +// replicaAddressMap := map[string]string{ +// replica1.Name: net.JoinHostPort(ip, strconv.Itoa(int(replica1.PortStart))), +// replica2.Name: net.JoinHostPort(ip, strconv.Itoa(int(replica2.PortStart))), +// } + +// engine, err := spdkCli.EngineCreate(engineName, volumeName, types.FrontendSPDKTCPBlockdev, defaultTestLvolSize, replicaAddressMap, 1, "127.0.0.1", ip, false, false) +// c.Assert(err, IsNil) + +// targetAddress := fmt.Sprintf("%s:%d", engine.TargetIP, engine.TargetPort) +// engine, err = spdkCli.EngineCreate(engineName, volumeName, types.FrontendSPDKTCPBlockdev, defaultTestLvolSize, replicaAddressMap, 1, ip, targetAddress, true, false) +// c.Assert(err, IsNil) +// c.Assert(engine.Endpoint, Not(Equals), "") +// // Initiator is not created, so the IP and Port should be empty +// c.Assert(engine.IP, Equals, ip) +// c.Assert(engine.Port, Not(Equals), int32(0)) +// // Target is created and exposed +// c.Assert(engine.TargetIP, Equals, ip) +// c.Assert(engine.TargetPort, Not(Equals), int32(0)) +// c.Assert(engine.Port, Equals, engine.TargetPort) + +// // Tear down engine and replicas +// err = spdkCli.EngineDelete(engineName) +// c.Assert(err, IsNil) + +// err = spdkCli.ReplicaDelete(replicaName1, false) +// c.Assert(err, IsNil) +// err = spdkCli.ReplicaDelete(replicaName2, false) +// c.Assert(err, IsNil) +// }