Skip to content

Commit 71599f1

Browse files
committed
Fix(deploy): fix deploy curvefs panic due to poolset is nil (#280).
Signed-off-by: Wine93 <[email protected]>
1 parent b156037 commit 71599f1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/task/task/common/create_pool.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ type step2SetClusterPool struct {
4848
storage *storage.Storage
4949
}
5050

51+
func getPoolset(curveadm *cli.CurveAdm, kind string) configure.Poolset {
52+
if kind == configure.KIND_CURVEFS {
53+
return configure.Poolset{}
54+
}
55+
return curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
56+
}
57+
5158
func getClusterPool(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (configure.CurveClusterTopo, error) {
52-
poolset := curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
59+
poolset := getPoolset(curveadm, dc.GetKind())
5360
oldPool := configure.CurveClusterTopo{}
5461
dcs, err := curveadm.ParseTopology()
5562
if err != nil {
@@ -99,7 +106,7 @@ func prepare(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (clusterPoolJson
99106
// 2. scale out cluster or migrate servers
100107
if curveadm.MemStorage().Get(comm.KEY_SCALE_OUT_CLUSTER) != nil { // scale out cluster
101108
dcs := curveadm.MemStorage().Get(comm.KEY_SCALE_OUT_CLUSTER).([]*topology.DeployConfig)
102-
poolset := curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
109+
poolset := getPoolset(curveadm, dc.GetKind())
103110
configure.ScaleOutClusterPool(&clusterPool, dcs, poolset)
104111
} else if curveadm.MemStorage().Get(comm.KEY_MIGRATE_SERVERS) != nil { // migrate servers
105112
migrates := curveadm.MemStorage().Get(comm.KEY_MIGRATE_SERVERS).([]*configure.MigrateServer)

0 commit comments

Comments
 (0)