func checkStatus(ctx transaction.TxnCtx) error { var volname string if err := ctx.Get("volname", &volname); err != nil { ctx.Logger().WithFields(log.Fields{ "error": err, "key": "volname", }).Error("checkStatus: Failed to get key from transaction context.") return err } vol, err := volume.GetVolume(volname) if err != nil { ctx.Logger().WithFields(log.Fields{ "error": err, "key": "volname", }).Error("checkStatus: Failed to get volume information from store.") return err } var brickStatuses []*brick.Brickstatus for _, binfo := range vol.Bricks { // Skip bricks that aren't on this node. // TODO: Rename Brickinfo field 'ID' to 'NodeUUID' if uuid.Equal(binfo.ID, gdctx.MyUUID) == false { continue } // TODO: Check actual brick status when we get them running. fakeStatus := &brick.Brickstatus{ Hostname: binfo.Hostname, Path: binfo.Path, ID: binfo.ID, Online: false, Pid: 1234, } brickStatuses = append(brickStatuses, fakeStatus) } // Store the results in transaction context. This will be consumed by // the node that initiated the transaction. ctx.SetNodeResult(gdctx.MyUUID, brickStatusTxnKey, brickStatuses) return nil }