mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
format error strings: error strings should not
be capitalized,make first letter as lower case Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
committed by
Prashanth Pai
parent
eb279a36a6
commit
e010dd6fdb
@@ -133,7 +133,7 @@ func testbitrot(t *testing.T) {
|
||||
|
||||
//check bitrot status on started volume
|
||||
_, err = client.BitrotScrubStatus(volumeName)
|
||||
r.Contains(err.Error(), "Bitrot is not enabled")
|
||||
r.Contains(err.Error(), "bitrot is not enabled")
|
||||
|
||||
//enable bitrot on volume
|
||||
err = client.BitrotEnable(volumeName)
|
||||
@@ -150,7 +150,7 @@ func testbitrot(t *testing.T) {
|
||||
|
||||
//check bitrot status
|
||||
_, err = client.BitrotScrubStatus(volumeName)
|
||||
r.Contains(err.Error(), "Bitrot is not enabled")
|
||||
r.Contains(err.Error(), "bitrot is not enabled")
|
||||
|
||||
//stop volume
|
||||
err = client.VolumeStop(volumeName)
|
||||
@@ -170,15 +170,15 @@ func testbitrot(t *testing.T) {
|
||||
|
||||
//check bitrot status
|
||||
scrubStatus, err = client.BitrotScrubStatus(volumeName)
|
||||
r.Contains(err.Error(), "Bitrot is not enabled")
|
||||
r.Contains(err.Error(), "bitrot is not enabled")
|
||||
|
||||
//disable bitrot on volume
|
||||
err = client.BitrotDisable(volumeName)
|
||||
r.Contains(err.Error(), "Bitrot is already disabled")
|
||||
r.Contains(err.Error(), "bitrot is already disabled")
|
||||
|
||||
//check bitrot status
|
||||
_, err = client.BitrotScrubStatus(volumeName)
|
||||
r.Contains(err.Error(), "Bitrot is not enabled")
|
||||
r.Contains(err.Error(), "bitrot is not enabled")
|
||||
|
||||
//stop volume
|
||||
err = client.VolumeStop(volumeName)
|
||||
|
||||
@@ -158,7 +158,7 @@ func parseRemoteData(data string) (string, string, string, error) {
|
||||
remotehostvol := strings.Split(data, "::")
|
||||
|
||||
if len(remotehostvol) != 2 {
|
||||
return "", "", "", errors.New("Invalid Remote Volume details, use <remoteuser>@<remotehost>::<remotevol> format")
|
||||
return "", "", "", errors.New("invalid Remote Volume details, use <remoteuser>@<remotehost>::<remotevol> format")
|
||||
}
|
||||
|
||||
remoteuserhost := strings.Split(remotehostvol[0], "@")
|
||||
|
||||
@@ -83,7 +83,7 @@ var peerRemoveCmd = &cobra.Command{
|
||||
peerID := cmd.Flags().Args()[0]
|
||||
var err error
|
||||
if uuid.Parse(peerID) == nil {
|
||||
err = errors.New("Failed to parse peerID")
|
||||
err = errors.New("failed to parse peerID")
|
||||
}
|
||||
if err == nil {
|
||||
err = client.PeerRemove(peerID)
|
||||
|
||||
@@ -20,7 +20,7 @@ func formatBoolYesNo(value bool) string {
|
||||
func sizeToMb(value string) (uint64, error) {
|
||||
sizeParts := validSizeFormat.FindStringSubmatch(value)
|
||||
if len(sizeParts) == 0 {
|
||||
return 0, errors.New("Invalid size format")
|
||||
return 0, errors.New("invalid size format")
|
||||
}
|
||||
|
||||
// If Size unit is specified as M/K/G/T, Default Size unit is M
|
||||
|
||||
@@ -110,7 +110,7 @@ func bricksAsUUID(bricks []string) ([]api.BrickReq, error) {
|
||||
for _, brick := range bricks {
|
||||
hostBrickData := strings.Split(brick, ":")
|
||||
if len(hostBrickData) != 2 {
|
||||
return nil, errors.New("Invalid Brick details, use <host>:<path> or <peerid>:<path>")
|
||||
return nil, errors.New("invalid Brick details, use <host>:<path> or <peerid>:<path>")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ func volumeInfoHandler2(cmd *cobra.Command, isInfo bool) error {
|
||||
}
|
||||
} else {
|
||||
if flagCmdFilterKey != "" || flagCmdFilterValue != "" {
|
||||
return errors.New("Invalid command. Cannot give filter arguments when providing volname")
|
||||
return errors.New("invalid command. Cannot give filter arguments when providing volname")
|
||||
}
|
||||
vols, err = client.Volumes(volname)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func validateSnapActivate(c transaction.TxnCtx) error {
|
||||
switch vol.State == volume.VolStarted {
|
||||
case true:
|
||||
if req.Force == false {
|
||||
return errors.New("Snapshot already started. Use force to override the behaviour")
|
||||
return errors.New("snapshot already started. Use force to override the behaviour")
|
||||
}
|
||||
fallthrough
|
||||
case false:
|
||||
|
||||
@@ -368,7 +368,7 @@ func validateSnapCreate(c transaction.TxnCtx) error {
|
||||
"Bricks", statusStr,
|
||||
).Error("Bricks are offline")
|
||||
|
||||
return errors.New("One or more brick is offline")
|
||||
return errors.New("one or more brick is offline")
|
||||
}
|
||||
statusComptability := snapshot.CheckBricksCompatability(volinfo)
|
||||
if statusComptability != nil {
|
||||
@@ -376,7 +376,7 @@ func validateSnapCreate(c transaction.TxnCtx) error {
|
||||
"Bricks", statusStr,
|
||||
).Error("Bricks are not compatable")
|
||||
|
||||
return errors.New("One or more brick is not compatable")
|
||||
return errors.New("one or more brick is not compatable")
|
||||
}
|
||||
if nodeData, err = populateBrickMountData(volinfo, req.SnapName); err != nil {
|
||||
return err
|
||||
@@ -595,7 +595,7 @@ func validateOriginNodeSnapCreate(c transaction.TxnCtx) error {
|
||||
|
||||
if volinfo.State != volume.VolStarted {
|
||||
|
||||
return errors.New("Volume has not started")
|
||||
return errors.New("volume has not started")
|
||||
}
|
||||
barrierOp := volinfo.Options["features.barrier"]
|
||||
if err := c.Set("barrier-enabled", &barrierOp); err != nil {
|
||||
|
||||
@@ -41,7 +41,7 @@ func validateSnapDeactivate(c transaction.TxnCtx) error {
|
||||
}
|
||||
}
|
||||
case false:
|
||||
return errors.New("Snapshot is already stopped")
|
||||
return errors.New("snapshot is already stopped")
|
||||
|
||||
}
|
||||
if err := c.SetNodeResult(gdctx.MyUUID, "brickListToOperate", &brickinfos); err != nil {
|
||||
|
||||
@@ -108,7 +108,7 @@ func expandGroupOptions(opts map[string]string) (map[string]string, error) {
|
||||
}
|
||||
options[option.Name] = op.DefaultValue
|
||||
default:
|
||||
return nil, errors.New("Need either on or off")
|
||||
return nil, errors.New("need either on or off")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error {
|
||||
if req.DisperseData > 0 {
|
||||
if req.DisperseCount > 0 && req.DisperseRedundancy > 0 {
|
||||
if req.DisperseCount != req.DisperseData+req.DisperseRedundancy {
|
||||
return errors.New("Disperse count should be equal to sum of disperse-data and redundancy")
|
||||
return errors.New("disperse count should be equal to sum of disperse-data and redundancy")
|
||||
}
|
||||
} else if req.DisperseRedundancy > 0 {
|
||||
req.DisperseCount = req.DisperseData + req.DisperseRedundancy
|
||||
@@ -21,7 +21,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error {
|
||||
req.DisperseRedundancy = req.DisperseCount - req.DisperseData
|
||||
} else {
|
||||
if count-req.DisperseData >= req.DisperseData {
|
||||
return errors.New("Need redundancy count along with disperse-data")
|
||||
return errors.New("need redundancy count along with disperse-data")
|
||||
}
|
||||
req.DisperseRedundancy = count - req.DisperseData
|
||||
req.DisperseCount = count
|
||||
@@ -30,7 +30,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error {
|
||||
|
||||
if req.DisperseCount <= 0 {
|
||||
if count < 3 {
|
||||
return errors.New("Number of bricks must be greater than 2")
|
||||
return errors.New("number of bricks must be greater than 2")
|
||||
}
|
||||
req.DisperseCount = count
|
||||
}
|
||||
@@ -40,11 +40,11 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error {
|
||||
}
|
||||
|
||||
if req.DisperseCount != count {
|
||||
return errors.New("Disperse count and the number of bricks must be same for a pure disperse volume")
|
||||
return errors.New("disperse count and the number of bricks must be same for a pure disperse volume")
|
||||
}
|
||||
|
||||
if 2*req.DisperseRedundancy >= req.DisperseCount {
|
||||
return errors.New("Invalid redundancy value")
|
||||
return errors.New("invalid redundancy value")
|
||||
}
|
||||
|
||||
s.DisperseCount = req.DisperseCount
|
||||
|
||||
@@ -67,11 +67,11 @@ func populateSubvols(volinfo *volume.Volinfo, req *api.VolCreateReq) error {
|
||||
var err error
|
||||
for idx, subvolreq := range req.Subvols {
|
||||
if subvolreq.ReplicaCount == 0 && subvolreq.Type == "replicate" {
|
||||
return errors.New("Replica count not specified")
|
||||
return errors.New("replica count not specified")
|
||||
}
|
||||
|
||||
if subvolreq.ReplicaCount > 0 && subvolreq.ReplicaCount != len(subvolreq.Bricks) {
|
||||
return errors.New("Invalid number of bricks")
|
||||
return errors.New("invalid number of bricks")
|
||||
}
|
||||
|
||||
name := fmt.Sprintf("%s-%s-%d", volinfo.Name, strings.ToLower(subvolreq.Type), idx)
|
||||
@@ -94,7 +94,7 @@ func populateSubvols(volinfo *volume.Volinfo, req *api.VolCreateReq) error {
|
||||
|
||||
if subvolreq.ArbiterCount != 0 {
|
||||
if subvolreq.ReplicaCount != 3 || subvolreq.ArbiterCount != 1 {
|
||||
return errors.New("For arbiter configuration, replica count must be 3 and arbiter count must be 1. The 3rd brick of the replica will be the arbiter")
|
||||
return errors.New("for arbiter configuration, replica count must be 3 and arbiter count must be 1. The 3rd brick of the replica will be the arbiter")
|
||||
}
|
||||
s.ArbiterCount = 1
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func validateVolCreateReq(req *api.VolCreateReq) error {
|
||||
}
|
||||
|
||||
if req.Transport != "" && req.Transport != "tcp" && req.Transport != "rdma" {
|
||||
return errors.New("Invalid transport. Supported values: tcp or rdma")
|
||||
return errors.New("invalid transport. Supported values: tcp or rdma")
|
||||
}
|
||||
|
||||
if len(req.Subvols) <= 0 {
|
||||
|
||||
@@ -37,15 +37,15 @@ func expandValidatePrepare(c transaction.TxnCtx) error {
|
||||
newReplicaCount = volinfo.Subvols[0].ReplicaCount
|
||||
}
|
||||
if (len(req.Bricks)+len(volinfo.GetBricks()))%newReplicaCount != 0 {
|
||||
return errors.New("Invalid number of bricks")
|
||||
return errors.New("invalid number of bricks")
|
||||
}
|
||||
|
||||
if volinfo.Type == volume.Replicate && req.ReplicaCount != 0 {
|
||||
// TODO: Only considered first sub volume's ReplicaCount
|
||||
if req.ReplicaCount < volinfo.Subvols[0].ReplicaCount {
|
||||
return errors.New("Invalid number of bricks")
|
||||
return errors.New("invalid number of bricks")
|
||||
} else if req.ReplicaCount == volinfo.Subvols[0].ReplicaCount {
|
||||
return errors.New("Replica count is same")
|
||||
return errors.New("replica count is same")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ func validateVolStatedumpReq(req *api.VolStatedumpReq) error {
|
||||
|
||||
var tmp api.VolStatedumpReq // zero value of struct
|
||||
if *req == tmp {
|
||||
return errors.New("At least one of the statedump req options must be set")
|
||||
return errors.New("at least one of the statedump req options must be set")
|
||||
}
|
||||
|
||||
if req.Client != tmp.Client {
|
||||
|
||||
@@ -40,7 +40,7 @@ func Unserialize(buf []byte) (map[string]string, error) {
|
||||
count := int(binary.BigEndian.Uint32(tmpHeader))
|
||||
|
||||
if count < 0 {
|
||||
return nil, errors.New("Invalid dict count")
|
||||
return nil, errors.New("invalid dict count")
|
||||
}
|
||||
|
||||
for i := 0; i < count; i++ {
|
||||
@@ -135,7 +135,7 @@ func Serialize(dict map[string]string) ([]byte, error) {
|
||||
}
|
||||
|
||||
if dictSerializedSize != totalBytesWritten {
|
||||
return nil, errors.New("Dict serialized size mismatch")
|
||||
return nil, errors.New("dict serialized size mismatch")
|
||||
}
|
||||
|
||||
return buffer.Bytes(), nil
|
||||
@@ -144,7 +144,7 @@ func Serialize(dict map[string]string) ([]byte, error) {
|
||||
func getSerializedDictLen(dict map[string]string) (int, error) {
|
||||
|
||||
if dict == nil || len(dict) == 0 {
|
||||
return 0, errors.New("Nil or empty dict")
|
||||
return 0, errors.New("nil or empty dict")
|
||||
}
|
||||
|
||||
totalSize := int(dictHeaderLen) // dict count
|
||||
|
||||
@@ -29,7 +29,7 @@ type Step struct {
|
||||
|
||||
var (
|
||||
// ErrStepFuncNotFound is returned if the stepfunc isn't found.
|
||||
ErrStepFuncNotFound = errors.New("StepFunc was not found")
|
||||
ErrStepFuncNotFound = errors.New("stepFunc was not found")
|
||||
)
|
||||
|
||||
// do runs the DoFunc on the nodes
|
||||
|
||||
@@ -99,7 +99,7 @@ func (e *Entry) SetIgnoreOptions(opts []string) *Entry {
|
||||
// Generate generates Volfile content
|
||||
func (v *Volfile) Generate(graph string, extra *map[string]extrainfo) (string, error) {
|
||||
if v.Name == "" || v.FileName == "" {
|
||||
return "", errors.New("Incomplete details")
|
||||
return "", errors.New("incomplete details")
|
||||
}
|
||||
|
||||
return v.RootEntry.Generate(graph, extra)
|
||||
|
||||
@@ -88,7 +88,7 @@ func UsageInfo(volname string) (*SizeInfo, error) {
|
||||
|
||||
if fstat.Type != fuseSuperMagic {
|
||||
// Do a crude check if mountpoint is a glusterfs mount
|
||||
return nil, errors.New("Not FUSE mount")
|
||||
return nil, errors.New("not FUSE mount")
|
||||
}
|
||||
|
||||
return createSizeInfo(&fstat), nil
|
||||
|
||||
@@ -132,7 +132,7 @@ func NewBrickEntries(bricks []api.BrickReq, volName string, volID uuid.UUID) ([]
|
||||
for _, b := range bricks {
|
||||
u := uuid.Parse(b.PeerID)
|
||||
if u == nil {
|
||||
return nil, errors.New("Invalid UUID specified as host for brick")
|
||||
return nil, errors.New("invalid UUID specified as host for brick")
|
||||
}
|
||||
|
||||
p, e := peer.GetPeerF(b.PeerID)
|
||||
|
||||
@@ -138,7 +138,7 @@ func GetBrickMountRoot(brickPath string) (string, error) {
|
||||
if mntSt := mntStat.Sys().(*syscall.Stat_t); brickSt.Dev == mntSt.Dev {
|
||||
return "/", nil
|
||||
}
|
||||
return "", errors.New("Failed To Get Mount Root")
|
||||
return "", errors.New("failed to get mount root")
|
||||
}
|
||||
|
||||
//GetBrickMountInfo return mount related information
|
||||
@@ -153,7 +153,7 @@ func GetBrickMountInfo(mountRoot string) (*Mntent, error) {
|
||||
return entry, nil
|
||||
}
|
||||
}
|
||||
return nil, errors.New("Mount Point Not Found")
|
||||
return nil, errors.New("mount point not found")
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +72,13 @@ const (
|
||||
)
|
||||
|
||||
// ErrInvalidArg validates if argument is Invalid
|
||||
var ErrInvalidArg = errors.New("Invalid Value")
|
||||
var ErrInvalidArg = errors.New("invalid Value")
|
||||
|
||||
// ErrEmptyArg validates for empty arguments
|
||||
var ErrEmptyArg = errors.New("No value passed")
|
||||
var ErrEmptyArg = errors.New("no value passed")
|
||||
|
||||
//ErrInvalidRange validates if option is out of range
|
||||
var ErrInvalidRange = errors.New("Option is out of valid range")
|
||||
var ErrInvalidRange = errors.New("option is out of valid range")
|
||||
|
||||
// Option is a struct which represents one single xlator option exported by
|
||||
// the translator.
|
||||
|
||||
@@ -68,7 +68,7 @@ func (ee *ElasticEtcd) startServer(initialCluster string) error {
|
||||
case <-time.After(42 * time.Second):
|
||||
ee.log.Debug("timedout trying to start embedded server")
|
||||
etcd.Server.Stop() // trigger a shutdown
|
||||
return errors.New("Etcd embedded server took too long to start")
|
||||
return errors.New("etcd embedded server took too long to start")
|
||||
case err := <-etcd.Err():
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -19,33 +19,33 @@ var (
|
||||
ErrVolAlreadyStarted = errors.New("volume already started")
|
||||
ErrVolAlreadyStopped = errors.New("volume already stopped")
|
||||
ErrWrongGraphType = errors.New("graph: incorrect graph type")
|
||||
ErrDeviceIDNotFound = errors.New("Failed to get device id")
|
||||
ErrBrickIsMountPoint = errors.New("Brick path is already a mount point")
|
||||
ErrBrickUnderRootPartition = errors.New("Brick path is under root partition")
|
||||
ErrBrickNotDirectory = errors.New("Brick path is not a directory")
|
||||
ErrBrickPathAlreadyInUse = errors.New("Brick path is already in use by other gluster volume")
|
||||
ErrDeviceIDNotFound = errors.New("failed to get device id")
|
||||
ErrBrickIsMountPoint = errors.New("brick path is already a mount point")
|
||||
ErrBrickUnderRootPartition = errors.New("brick path is under root partition")
|
||||
ErrBrickNotDirectory = errors.New("brick path is not a directory")
|
||||
ErrBrickPathAlreadyInUse = errors.New("brick path is already in use by other gluster volume")
|
||||
ErrNoHostnamesPresent = errors.New("no hostnames present")
|
||||
ErrBrickPathConvertFail = errors.New("Failed to convert the brickpath to absolute path")
|
||||
ErrBrickNotLocal = errors.New("Brickpath doesn't belong to localhost")
|
||||
ErrBrickPathTooLong = errors.New("Brickpath too long")
|
||||
ErrBrickPathConvertFail = errors.New("failed to convert the brickpath to absolute path")
|
||||
ErrBrickNotLocal = errors.New("brickpath doesn't belong to localhost")
|
||||
ErrBrickPathTooLong = errors.New("brickpath too long")
|
||||
ErrSubDirPathTooLong = errors.New("sub directory path is too long")
|
||||
ErrIPAddressNotFound = errors.New("Failed to find IP address")
|
||||
ErrPeerLocalNode = errors.New("The peer being added is the local node")
|
||||
ErrProcessNotFound = errors.New("The process is not running or is inaccessible")
|
||||
ErrProcessAlreadyRunning = errors.New("Process is already running")
|
||||
ErrBitrotAlreadyEnabled = errors.New("Bitrot is already enabled")
|
||||
ErrBitrotAlreadyDisabled = errors.New("Bitrot is already disabled")
|
||||
ErrBitrotNotEnabled = errors.New("Bitrot is not enabled")
|
||||
ErrIPAddressNotFound = errors.New("failed to find IP address")
|
||||
ErrPeerLocalNode = errors.New("peer being added is the local node")
|
||||
ErrProcessNotFound = errors.New("process is not running or is inaccessible")
|
||||
ErrProcessAlreadyRunning = errors.New("process is already running")
|
||||
ErrBitrotAlreadyEnabled = errors.New("bitrot is already enabled")
|
||||
ErrBitrotAlreadyDisabled = errors.New("bitrot is already disabled")
|
||||
ErrBitrotNotEnabled = errors.New("bitrot is not enabled")
|
||||
ErrUnknownValue = errors.New("unknown value specified")
|
||||
ErrGetFailed = errors.New("failed to get value from the store")
|
||||
ErrUnmarshallFailed = errors.New("failed to unmarshall from json")
|
||||
ErrClusterNotFound = errors.New("Cluster instance not found in store")
|
||||
ErrDuplicateBrickPath = errors.New("Duplicate brick entry")
|
||||
ErrRestrictedKeyFound = errors.New("Key names starting with '_' are restricted in metadata field")
|
||||
ErrClusterNotFound = errors.New("cluster instance not found in store")
|
||||
ErrDuplicateBrickPath = errors.New("duplicate brick entry")
|
||||
ErrRestrictedKeyFound = errors.New("key names starting with '_' are restricted in metadata field")
|
||||
ErrVolFileNotFound = errors.New("volume file not found")
|
||||
ErrEmptySnapName = errors.New("Snapshot name is empty")
|
||||
ErrEmptySnapName = errors.New("snapshot name is empty")
|
||||
ErrSnapExists = errors.New("snapshot already exists")
|
||||
ErrSnapNotFound = errors.New("Snapshot not found")
|
||||
ErrSnapNotFound = errors.New("snapshot not found")
|
||||
ErrInvalidVolFlags = errors.New("invalid volume flags")
|
||||
ErrMetadataSizeOutOfBounds = errors.New("metadata size exceeds max allowed size of 4KB")
|
||||
ErrFetchingVolfileContent = errors.New("unable to fetch volfile content")
|
||||
|
||||
@@ -38,17 +38,17 @@ func (e ErrProgMismatch) Error() string {
|
||||
// Given that the remote server accepted the RPC call, following errors
|
||||
// represent error status of an attempt to call remote procedure
|
||||
var (
|
||||
ErrProgUnavail = errors.New("Remote server has not exported program")
|
||||
ErrProcUnavail = errors.New("Remote server has no such procedure")
|
||||
ErrGarbageArgs = errors.New("Remote procedure cannot decode params")
|
||||
ErrSystemErr = errors.New("System error on remote server")
|
||||
ErrProgUnavail = errors.New("remote server has not exported program")
|
||||
ErrProcUnavail = errors.New("remote server has no such procedure")
|
||||
ErrGarbageArgs = errors.New("remote procedure cannot decode params")
|
||||
ErrSystemErr = errors.New("system error on remote server")
|
||||
)
|
||||
|
||||
// These errors represent invalid replies from server and auth rejection.
|
||||
var (
|
||||
ErrInvalidRPCMessageType = errors.New("Invalid RPC message type received")
|
||||
ErrInvalidRPCRepyType = errors.New("Invalid RPC reply received. Reply type should be MsgAccepted or MsgDenied")
|
||||
ErrInvalidMsgDeniedType = errors.New("Invalid MsgDenied reply. Possible values are RPCMismatch and AuthError")
|
||||
ErrInvalidMsgAccepted = errors.New("Invalid MsgAccepted reply received")
|
||||
ErrAuthError = errors.New("Remote server rejected identity of the caller")
|
||||
ErrInvalidRPCMessageType = errors.New("invalid RPC message type received")
|
||||
ErrInvalidRPCRepyType = errors.New("invalid RPC reply received. Reply type should be MsgAccepted or MsgDenied")
|
||||
ErrInvalidMsgDeniedType = errors.New("invalid MsgDenied reply. Possible values are RPCMismatch and AuthError")
|
||||
ErrInvalidMsgAccepted = errors.New("invalid MsgAccepted reply received")
|
||||
ErrAuthError = errors.New("remote server rejected identity of the caller")
|
||||
)
|
||||
|
||||
@@ -78,7 +78,7 @@ func PmapSet(programNumber, programVersion uint32, protocol Protocol, port uint3
|
||||
|
||||
client := initPmapClient("")
|
||||
if client == nil {
|
||||
return result, errors.New("Could not create pmap client")
|
||||
return result, errors.New("could not create pmap client")
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
@@ -101,7 +101,7 @@ func PmapUnset(programNumber, programVersion uint32) (bool, error) {
|
||||
|
||||
client := initPmapClient("")
|
||||
if client == nil {
|
||||
return result, errors.New("Could not create pmap client")
|
||||
return result, errors.New("could not create pmap client")
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
@@ -122,7 +122,7 @@ func PmapGetPort(host string, programNumber, programVersion uint32, protocol Pro
|
||||
|
||||
client := initPmapClient(host)
|
||||
if client == nil {
|
||||
return port, errors.New("Could not create pmap client")
|
||||
return port, errors.New("could not create pmap client")
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
@@ -154,7 +154,7 @@ func PmapGetMaps(host string) ([]PortMapping, error) {
|
||||
|
||||
client := initPmapClient(host)
|
||||
if client == nil {
|
||||
return nil, errors.New("Could not create pmap client")
|
||||
return nil, errors.New("could not create pmap client")
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func isValidProcedureName(procedureName string) bool {
|
||||
func RegisterProcedure(procedure Procedure, validateProcName bool) error {
|
||||
|
||||
if validateProcName && !isValidProcedureName(procedure.Name) {
|
||||
return errors.New("Invalid procedure name")
|
||||
return errors.New("invalid procedure name")
|
||||
}
|
||||
|
||||
procedureRegistry.Lock()
|
||||
|
||||
@@ -24,7 +24,7 @@ func FormRemotePeerAddress(peeraddress string) (string, error) {
|
||||
}
|
||||
|
||||
if host == "" {
|
||||
return "", errors.New("Invalid peer address")
|
||||
return "", errors.New("invalid peer address")
|
||||
}
|
||||
|
||||
remotePeerAddress := host + ":" + port
|
||||
|
||||
@@ -24,6 +24,6 @@ func TestFormRemotePeerAddress(t *testing.T) {
|
||||
assert.Equal(t, peer, "192.168.1.1:80")
|
||||
|
||||
_, err = FormRemotePeerAddress(":8080")
|
||||
assert.Contains(t, err.Error(), "Invalid peer address")
|
||||
assert.Contains(t, err.Error(), "invalid peer address")
|
||||
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ func validateOptions(v *volume.Volinfo, key string, value string) error {
|
||||
switch key {
|
||||
case "metadata-self-heal":
|
||||
if v.Subvols[0].ReplicaCount == 1 {
|
||||
return errors.New("Option cannot be set for a non replicate volume")
|
||||
return errors.New("option cannot be set for a non replicate volume")
|
||||
}
|
||||
case "self-heal-daemon":
|
||||
if !isVolReplicate(v.Type) {
|
||||
return errors.New("Option cannot be set for a non replicate volume")
|
||||
return errors.New("option cannot be set for a non replicate volume")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -80,7 +80,7 @@ func (f *Fstab) load() error {
|
||||
}
|
||||
|
||||
if len(parts) != 6 {
|
||||
return errors.New("Invalid mount entry: " + line)
|
||||
return errors.New("invalid mount entry: " + line)
|
||||
}
|
||||
f.Mounts = append(f.Mounts, FstabMount{
|
||||
Device: parts[0],
|
||||
|
||||
@@ -56,7 +56,7 @@ func GetVgAvailableSize(vgname string) (uint64, uint64, error) {
|
||||
vgdata := strings.Split(strings.TrimRight(string(out), "\n"), ":")
|
||||
|
||||
if len(vgdata) != 17 {
|
||||
return 0, 0, errors.New("Failed to get free size of VG: " + vgname)
|
||||
return 0, 0, errors.New("failed to get free size of VG: " + vgname)
|
||||
}
|
||||
|
||||
// Physical extent size index is 12
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
var (
|
||||
// ErrVolNotDistribute : Cannot run rebalance on a non distribute volume
|
||||
ErrVolNotDistribute = errors.New("Not a distribute volume")
|
||||
ErrVolNotDistribute = errors.New("not a distribute volume")
|
||||
// ErrRebalanceNotStarted : Rebalance not started on the volume
|
||||
ErrRebalanceNotStarted = errors.New("Rebalance not started")
|
||||
ErrRebalanceNotStarted = errors.New("rebalance not started")
|
||||
// ErrRebalanceInvalidOption : Invalid option provided to the rebalance start command
|
||||
ErrRebalanceInvalidOption = errors.New("Invalid Rebalance start option")
|
||||
ErrRebalanceInvalidOption = errors.New("invalid Rebalance start option")
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ func GetRebalanceInfo(volname string) (*rebalanceapi.RebalInfo, error) {
|
||||
|
||||
if resp.Count != 1 {
|
||||
log.WithField("volume", volname).Error("Rebalance info not found for the volume or rebalance process is not started for this volume")
|
||||
return nil, errors.New("Rebalance info not found for the volume or rebalance process is not started for this volume")
|
||||
return nil, errors.New("rebalance info not found for the volume or rebalance process is not started for this volume")
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(resp.Kvs[0].Value, &rebalinfo); err != nil {
|
||||
|
||||
@@ -18,11 +18,11 @@ func handleReplicaSubvolReq(req *smartvolapi.Volume) error {
|
||||
}
|
||||
|
||||
if req.ReplicaCount > 3 {
|
||||
return errors.New("Invalid Replica Count")
|
||||
return errors.New("invalid Replica Count")
|
||||
}
|
||||
req.SubvolType = "replicate"
|
||||
if req.ArbiterCount > 1 {
|
||||
return errors.New("Invalid Arbiter Count")
|
||||
return errors.New("invalid Arbiter Count")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -36,7 +36,7 @@ func handleDisperseSubvolReq(req *smartvolapi.Volume) error {
|
||||
req.SubvolType = "disperse"
|
||||
|
||||
if req.DisperseDataCount > 0 && req.DisperseRedundancyCount <= 0 {
|
||||
return errors.New("Disperse redundancy count is required")
|
||||
return errors.New("disperse redundancy count is required")
|
||||
}
|
||||
|
||||
if req.DisperseDataCount > 0 {
|
||||
@@ -53,7 +53,7 @@ func handleDisperseSubvolReq(req *smartvolapi.Volume) error {
|
||||
}
|
||||
|
||||
if 2*req.DisperseRedundancyCount >= req.DisperseCount {
|
||||
return errors.New("Invalid redundancy count")
|
||||
return errors.New("invalid redundancy count")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -88,7 +88,7 @@ func getBricksLayout(req *smartvolapi.Volume) ([]smartvolapi.Subvol, error) {
|
||||
}
|
||||
|
||||
if req.SnapshotReserveFactor < 1 {
|
||||
return nil, errors.New("Invalid Snapshot Reserve Factor")
|
||||
return nil, errors.New("invalid Snapshot Reserve Factor")
|
||||
}
|
||||
|
||||
// Default Subvol Type
|
||||
@@ -108,7 +108,7 @@ func getBricksLayout(req *smartvolapi.Volume) ([]smartvolapi.Subvol, error) {
|
||||
|
||||
subvolplanner, exists := subvolPlanners[req.SubvolType]
|
||||
if !exists {
|
||||
return nil, errors.New("Sub volume type not supported")
|
||||
return nil, errors.New("subvolume type not supported")
|
||||
}
|
||||
|
||||
// Initialize the planner
|
||||
@@ -157,7 +157,7 @@ func PlanBricks(req *smartvolapi.Volume) error {
|
||||
}
|
||||
|
||||
if len(availableVgs) == 0 {
|
||||
return errors.New("No devices registered or available for allocating bricks")
|
||||
return errors.New("no devices registered or available for allocating bricks")
|
||||
}
|
||||
|
||||
subvols, err := getBricksLayout(req)
|
||||
@@ -226,7 +226,7 @@ func PlanBricks(req *smartvolapi.Volume) error {
|
||||
|
||||
// If the devices are not available as it is required for Volume.
|
||||
if len(sv.Bricks) != numBricksAllocated {
|
||||
return errors.New("No space available or all the devices are not registered")
|
||||
return errors.New("no space available or all the devices are not registered")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ func validateVolCreateReq(req *smartvolapi.VolCreateReq) error {
|
||||
}
|
||||
|
||||
if req.Transport != "" && req.Transport != "tcp" && req.Transport != "rdma" {
|
||||
return errors.New("Invalid transport. Supported values: tcp or rdma")
|
||||
return errors.New("invalid transport. Supported values: tcp or rdma")
|
||||
}
|
||||
|
||||
if req.Size < minVolumeSize {
|
||||
return errors.New("Invalid Volume Size, Minimum size required is " + strconv.Itoa(minVolumeSize))
|
||||
return errors.New("invalid Volume Size, Minimum size required is " + strconv.Itoa(minVolumeSize))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -109,7 +109,7 @@ func smartVolumeCreateHandler(w http.ResponseWriter, r *http.Request) {
|
||||
applyDefaults(&req)
|
||||
|
||||
if req.SnapshotReserveFactor < 1 {
|
||||
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, errors.New("Invalid Snapshot Reserve Factor"))
|
||||
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, errors.New("invalid Snapshot Reserve Factor"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user