Skip to content

Commit

Permalink
feat(backingimage): support v2 backing image
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 6341

Signed-off-by: Jack Lin <[email protected]>
  • Loading branch information
ChanYiLin authored and derekbit committed Dec 9, 2024
1 parent 079275c commit ff0f09d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions app/cmd/basic/bdev_lvol.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ func BdevLvolResizeCmd() cli.Command {
Usage: "Specify this or alias",
},
cli.Uint64Flag{
Name: "size",
Name: "size-in-mib",

Check warning on line 399 in app/cmd/basic/bdev_lvol.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/basic/bdev_lvol.go#L399

Added line #L399 was not covered by tests
Required: true,
},
},
Usage: "resize a lvol to a new size: \"resize --alias <LVSTORE NAME>/<LVOL NAME> --size <SIZE>\", or \"resize --uuid <LVOL UUID> --size <SIZE>\"",
Usage: "resize a lvol to a new size: \"resize --alias <LVSTORE NAME>/<LVOL NAME> --size-in-mib <SIZE>\", or \"resize --uuid <LVOL UUID> --size-in-mib <SIZE>\"",

Check warning on line 403 in app/cmd/basic/bdev_lvol.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/basic/bdev_lvol.go#L403

Added line #L403 was not covered by tests
Action: func(c *cli.Context) {
if err := bdevLvolResize(c); err != nil {
logrus.WithError(err).Fatalf("Failed to run resize bdev lvol command")
Expand All @@ -420,7 +420,7 @@ func bdevLvolResize(c *cli.Context) error {
name = c.String("uuid")
}

resized, err := spdkCli.BdevLvolResize(name, c.Uint64("size"))
resized, err := spdkCli.BdevLvolResize(name, c.Uint64("size-in-mib"))

Check warning on line 423 in app/cmd/basic/bdev_lvol.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/basic/bdev_lvol.go#L423

Added line #L423 was not covered by tests
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions app/cmd/nvmecli/nvmecli.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func ConnectCmd() cli.Command {
}

func connect(c *cli.Context) error {
executor, err := util.NewExecutor(c.String("host-proc"))
executor, err := util.NewExecutor(c.GlobalString("host-proc"))

Check warning on line 108 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L108

Added line #L108 was not covered by tests
if err != nil {
return err
}
Expand All @@ -131,7 +131,7 @@ func DisconnectCmd() cli.Command {
}

func disconnect(c *cli.Context) error {
executor, err := util.NewExecutor(c.String("host-proc"))
executor, err := util.NewExecutor(c.GlobalString("host-proc"))

Check warning on line 134 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L134

Added line #L134 was not covered by tests
if err != nil {
return err
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func GetCmd() cli.Command {
}

func get(c *cli.Context) error {
executor, err := util.NewExecutor(c.String("host-proc"))
executor, err := util.NewExecutor(c.GlobalString("host-proc"))

Check warning on line 170 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L170

Added line #L170 was not covered by tests
if err != nil {
return err
}
Expand Down Expand Up @@ -216,7 +216,7 @@ func StartCmd() cli.Command {
}

func start(c *cli.Context) error {
initiator, err := nvme.NewInitiator(c.String("name"), c.String("nqn"), c.String("host-proc"))
initiator, err := nvme.NewInitiator(c.String("name"), c.String("nqn"), c.GlobalString("host-proc"))

Check warning on line 219 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L219

Added line #L219 was not covered by tests
if err != nil {
return err
}
Expand Down Expand Up @@ -257,7 +257,7 @@ func StopCmd() cli.Command {
}

func stop(c *cli.Context) error {
initiator, err := nvme.NewInitiator(c.String("name"), c.String("nqn"), c.String("host-proc"))
initiator, err := nvme.NewInitiator(c.String("name"), c.String("nqn"), c.GlobalString("host-proc"))

Check warning on line 260 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L260

Added line #L260 was not covered by tests
if err != nil {
return err
}
Expand Down Expand Up @@ -289,7 +289,7 @@ func FlushCmd() cli.Command {
}

func flush(c *cli.Context) error {
executor, err := util.NewExecutor(c.String("host-proc"))
executor, err := util.NewExecutor(c.GlobalString("host-proc"))

Check warning on line 292 in app/cmd/nvmecli/nvmecli.go

View check run for this annotation

Codecov / codecov/patch

app/cmd/nvmecli/nvmecli.go#L292

Added line #L292 was not covered by tests
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/spdk/client/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ func (c *Client) BdevLvolSetParent(lvol, parent string) (set bool, err error) {
//
// "name": Required. UUID or alias of the logical volume to resize.
//
// "size": Required. Desired size of the logical volume in bytes.
func (c *Client) BdevLvolResize(name string, size uint64) (resized bool, err error) {
// "sizeInMib": Required. Desired size of the logical volume in bytes.
func (c *Client) BdevLvolResize(name string, sizeInMib uint64) (resized bool, err error) {

Check warning on line 416 in pkg/spdk/client/basic.go

View check run for this annotation

Codecov / codecov/patch

pkg/spdk/client/basic.go#L416

Added line #L416 was not covered by tests
req := spdktypes.BdevLvolResizeRequest{
Name: name,
Size: size,
Name: name,
SizeInMib: sizeInMib,

Check warning on line 419 in pkg/spdk/client/basic.go

View check run for this annotation

Codecov / codecov/patch

pkg/spdk/client/basic.go#L418-L419

Added lines #L418 - L419 were not covered by tests
}

cmdOutput, err := c.jsonCli.SendCommand("bdev_lvol_resize", req)
Expand Down
4 changes: 2 additions & 2 deletions pkg/spdk/types/lvol.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ type BdevLvolSetParentRequest struct {
}

type BdevLvolResizeRequest struct {
Name string `json:"name"`
Size uint64 `json:"size"`
Name string `json:"name"`
SizeInMib uint64 `json:"size_in_mib"`
}

type BdevLvolShallowCopyRequest struct {
Expand Down

0 comments on commit ff0f09d

Please sign in to comment.