Skip to content

Commit

Permalink
formatted the checkin i.e. openebs@002701d via gofmt tool
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitKumarDas committed Aug 2, 2016
1 parent cc37f49 commit c9c5fa9
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 51 deletions.
12 changes: 5 additions & 7 deletions api/client/vsm/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (

"github.com/openebs/openebs/api/client"
"github.com/openebs/openebs/cli"
"github.com/openebs/openebs/types"
"github.com/openebs/openebs/pkg/spf13/cobra"
"github.com/openebs/openebs/types"
)

type listOptions struct {
all bool
all bool
}

type preProcessor struct {
Expand Down Expand Up @@ -55,22 +55,20 @@ func runList(openEBSCli *client.OpenEBSCli, opts *listOptions) error {
ctx := context.Background()

options := types.VSMListOptions{
All: opts.all,
All: opts.all,
}

vsms, err := openEBSCli.Client().VSMList(ctx, options)
if err != nil {
return err
}


if len(vsms) > 0 {
fmt.Fprintf(openEBSCli.Out(), "TODO Formatting\n")
}
}

fmt.Fprintf(openEBSCli.Out(), "TODO \n")
// TODO - KIRAN -- Check how to format the output.

// TODO - KIRAN -- Check how to format the output.

return nil
}
3 changes: 1 addition & 2 deletions api/server/router/vsm/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/openebs/openebs/types"
)


// stateBackend includes functions to implement to provide container state lifecycle functionality.
//type stateBackend interface {
// ContainerCreate(config types.ContainerCreateConfig, validateHostname bool) (types.ContainerCreateResponse, error)
Expand All @@ -30,6 +29,6 @@ type monitorBackend interface {

// Backend is all the methods that need to be implemented to provide VSM specific functionality.
type Backend interface {
// stateBackend
// stateBackend
monitorBackend
}
2 changes: 1 addition & 1 deletion api/server/router/vsm/vsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (validationError) IsValidationError() bool {
return true
}

// vsmRouter is a router to talk with the VSMs
// vsmRouter is a router to talk with the VSMs
type vsmRouter struct {
backend Backend
routes []router.Route
Expand Down
4 changes: 1 addition & 3 deletions api/server/router/vsm/vsm_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *vsmRouter) getVsmsJSON(ctx context.Context, w http.ResponseWriter, r *h
}

config := &types.VSMListOptions{
All: httputils.BoolValue(r, "all"),
All: httputils.BoolValue(r, "all"),
}

vsms, err := s.backend.Vsms(config)
Expand All @@ -38,7 +38,6 @@ func (s *vsmRouter) getVsmsJSON(ctx context.Context, w http.ResponseWriter, r *h
return httputils.WriteJSON(w, http.StatusOK, vsms)
}


//func (s *containerRouter) postContainersCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
// if err := httputils.ParseForm(r); err != nil {
// return err
Expand Down Expand Up @@ -95,4 +94,3 @@ func (s *vsmRouter) getVsmsJSON(ctx context.Context, w http.ResponseWriter, r *h
//
// return nil
//}

6 changes: 3 additions & 3 deletions cli/cobraadaptor/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"github.com/openebs/openebs/api/client/vsm"
"github.com/openebs/openebs/cli"
cliflags "github.com/openebs/openebs/cli/flags"
"github.com/openebs/openebs/pkg/term"
"github.com/openebs/openebs/pkg/spf13/cobra"
"github.com/openebs/openebs/pkg/term"
)

// CobraAdaptor is an adaptor for supporting spf13/cobra commands in the
// openebs/cli framework
type CobraAdaptor struct {
rootCmd *cobra.Command
rootCmd *cobra.Command
openEBSCli *client.OpenEBSCli
}

Expand Down Expand Up @@ -42,7 +42,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")

return CobraAdaptor{
rootCmd: rootCmd,
rootCmd: rootCmd,
openEBSCli: openEBSCli,
}
}
Expand Down
2 changes: 0 additions & 2 deletions client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type CommonAPIClient interface {
ServerVersion(ctx context.Context) (types.Version, error)
}


// SystemAPIClient defines API client methods for the system
type SystemAPIClient interface {
Info(ctx context.Context) (types.Info, error)
Expand All @@ -23,4 +22,3 @@ type SystemAPIClient interface {
type VSMAPIClient interface {
VSMList(ctx context.Context, options types.VSMListOptions) ([]types.Vsm, error)
}

18 changes: 6 additions & 12 deletions cmd/openebsd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/Sirupsen/logrus"
"github.com/openebs/openebs/api"
"github.com/openebs/openebs/version"
apiserver "github.com/openebs/openebs/api/server"
"github.com/openebs/openebs/api/server/middleware"
"github.com/openebs/openebs/api/server/router"
Expand All @@ -17,12 +16,13 @@ import (
cliflags "github.com/openebs/openebs/cli/flags"
"github.com/openebs/openebs/daemon"
"github.com/openebs/openebs/opts"
"github.com/openebs/openebs/pkg/jsonlog"
"github.com/openebs/openebs/pkg/listeners"
flag "github.com/openebs/openebs/pkg/mflag"
"github.com/openebs/openebs/pkg/pidfile"
"github.com/openebs/openebs/pkg/signal"
"github.com/openebs/openebs/pkg/jsonlog"
"github.com/openebs/openebs/pkg/listeners"
"github.com/openebs/openebs/utils"
"github.com/openebs/openebs/version"
)

const (
Expand Down Expand Up @@ -76,7 +76,6 @@ func (cli *DaemonCli) start() (err error) {
utils.EnableDebug()
}


logrus.SetFormatter(&logrus.TextFormatter{
TimestampFormat: jsonlog.RFC3339NanoFixed,
DisableColors: cli.Config.RawLogs,
Expand All @@ -86,7 +85,7 @@ func (cli *DaemonCli) start() (err error) {
return fmt.Errorf("Failed to set umask: %v", err)
}

//TODO : Kiran
//TODO : Kiran
//if len(cli.LogConfig.Config) > 0 {
// if err := logger.ValidateLogOpts(cli.LogConfig.Type, cli.LogConfig.Config); err != nil {
// return fmt.Errorf("Failed to set log opts: %v", err)
Expand Down Expand Up @@ -152,7 +151,6 @@ func (cli *DaemonCli) start() (err error) {
api.Accept(protoAddrParts[1], ls...)
}


signal.Trap(func() {
cli.stop()
<-stopc // wait for daemonCli.start() to return
Expand All @@ -165,12 +163,11 @@ func (cli *DaemonCli) start() (err error) {

//name, _ := os.Hostname()


logrus.Info("Daemon has completed initialization")

logrus.WithFields(logrus.Fields{
"version": version.Version,
"commit": version.GitCommit,
"version": version.Version,
"commit": version.GitCommit,
}).Info("OpenEBS daemon")

cli.initMiddlewares(api, serverConfig)
Expand Down Expand Up @@ -250,7 +247,6 @@ func loadDaemonCliConfig(config *daemon.Config, flags *flag.FlagSet, commonConfi
config.Hosts = commonConfig.Hosts
config.LogLevel = commonConfig.LogLevel


if configFile != "" {
c, err := daemon.MergeDaemonConfigurations(config, flags, configFile)
if err != nil {
Expand All @@ -269,7 +265,6 @@ func loadDaemonCliConfig(config *daemon.Config, flags *flag.FlagSet, commonConfi
return nil, err
}


// ensure that the log level is the one set after merging configurations
cliflags.SetDaemonLogLevel(config.LogLevel)

Expand All @@ -291,7 +286,6 @@ func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config
vm := middleware.NewVersionMiddleware(v, api.DefaultVersion, api.MinVersion)
s.UseMiddleware(vm)


u := middleware.NewUserAgentMiddleware(v)
s.UseMiddleware(u)

Expand Down
4 changes: 1 addition & 3 deletions daemon/vsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import (
"github.com/openebs/openebs/types"
)


// Vsms returns the list of VSMs to show given the user's filtering.
func (daemon *Daemon) Vsms(config *types.VSMListOptions) ([]*types.Vsm, error) {
vsms := []*types.Vsm{}
vsms := []*types.Vsm{}
//TODO Fill with some data

return vsms, nil
}

2 changes: 1 addition & 1 deletion types/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ func (v VersionResponse) ServerOK() bool {

// VSMListOptions holds paramters to list the VSMs
type VSMListOptions struct {
All bool
All bool
}
33 changes: 16 additions & 17 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@ type Version struct {
// Info contains response of Remote API:
// GET "/info"
type Info struct {
ID string
Debug bool
SystemTime string
KernelVersion string
OperatingSystem string
OSType string
Architecture string
NCPU int
MemTotal int64
ExperimentalBuild bool
ServerVersion string
ID string
Debug bool
SystemTime string
KernelVersion string
OperatingSystem string
OSType string
Architecture string
NCPU int
MemTotal int64
ExperimentalBuild bool
ServerVersion string
}

// Vsm contains response of Remote API:
// GET "/vsm/json"
type Vsm struct {
Name string
IPAddress string
IOPS string
Volumes string
Status string
Name string
IPAddress string
IOPS string
Volumes string
Status string
}

0 comments on commit c9c5fa9

Please sign in to comment.