Skip to content

Commit

Permalink
Fix(deploy): fix deploy curvefs panic due to poolset is nil (#280).
Browse files Browse the repository at this point in the history
Signed-off-by: Wine93 <[email protected]>
  • Loading branch information
Wine93 committed Nov 22, 2023
1 parent 3ec9bc0 commit 959933e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/task/task/common/create_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ type step2SetClusterPool struct {
storage *storage.Storage
}

func getPoolset(curveadm *cli.CurveAdm, kind string) configure.Poolset {
if kind == configure.KIND_CURVEFS {
return configure.Poolset{}
}
return curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
}

func getClusterPool(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (configure.CurveClusterTopo, error) {
poolset := curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
poolset := getPoolset(curveadm, dc.GetKind())
oldPool := configure.CurveClusterTopo{}
dcs, err := curveadm.ParseTopology()
if err != nil {
Expand Down Expand Up @@ -99,7 +106,7 @@ func prepare(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (clusterPoolJson
// 2. scale out cluster or migrate servers
if curveadm.MemStorage().Get(comm.KEY_SCALE_OUT_CLUSTER) != nil { // scale out cluster
dcs := curveadm.MemStorage().Get(comm.KEY_SCALE_OUT_CLUSTER).([]*topology.DeployConfig)
poolset := curveadm.MemStorage().Get(comm.KEY_POOLSET).(configure.Poolset)
poolset := getPoolset(curveadm, dc.GetKind())
configure.ScaleOutClusterPool(&clusterPool, dcs, poolset)
} else if curveadm.MemStorage().Get(comm.KEY_MIGRATE_SERVERS) != nil { // migrate servers
migrates := curveadm.MemStorage().Get(comm.KEY_MIGRATE_SERVERS).([]*configure.MigrateServer)
Expand Down

0 comments on commit 959933e

Please sign in to comment.