Skip to content

Commit

Permalink
Making G suffix required while creating vsm via API call in -size flag
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekpandey14 committed May 2, 2017
1 parent afe571c commit adf9876
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion command/vsm_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *VsmCreateCommand) Run(args []string) int {
flags := c.M.FlagSet("vsm-create", FlagSetClient)
flags.Usage = func() { c.M.Ui.Output(c.Help()) }
flags.StringVar(&c.vsmname, "name", "", "")
flags.StringVar(&c.size, "size", "5", "")
flags.StringVar(&c.size, "size", "5G", "")

if err := flags.Parse(args); err != nil {
return 1
Expand Down Expand Up @@ -105,6 +105,10 @@ func (c *VsmCreateCommand) Run(args []string) int {
return 1
}
if c.vsmname != " " {
if strings.HasSuffix(c.size, "G") != true {
fmt.Println("-size should contain the suffix 'G',which represent the size in GB (exp: 10G)")
return 0
}
err := CreateApiVsm(c.vsmname, c.size)
if err != nil {
fmt.Println("Error Creating Vsm")
Expand Down

0 comments on commit adf9876

Please sign in to comment.