Merge pull request #116 from march1993/master

fix some issues
This commit is contained in:
Lei Xue
2023-04-19 09:17:44 +08:00
committed by GitHub
5 changed files with 30 additions and 27 deletions

View File

@@ -30,23 +30,24 @@ import (
)
func NewCommand() *cobra.Command {
var cli *client.Client
var cli client.Client
var host string = "tcp://127.0.0.1:23457"
var cmd = &cobra.Command{
Use: "gotgt",
Short: "Gotgt is a very fast and stable SCSI target framework",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
httpClient, err := newHTTPClient(host)
if err != nil {
fmt.Fprintf(os.Stderr, "%v", err)
return err
}
cli, err = client.NewClient(host, version.Version, httpClient, nil)
if err != nil {
if _cli, err := client.NewClient(host, version.Version, httpClient, nil); err != nil {
fmt.Fprintf(os.Stderr, "%v", err)
return err
} else {
cli = *_cli
}
// Do Stuff Here
return nil
@@ -56,10 +57,10 @@ func NewCommand() *cobra.Command {
cmd.PersistentFlags().StringVar(&host, "host", host, "Endpoint for SCSI target daemon")
cmd.AddCommand(
newDaemonCommand(),
newCreateCommand(cli),
newRemoveCommand(cli),
newListCommand(cli),
newVersionCommand(cli),
newCreateCommand(&cli),
newRemoveCommand(&cli),
newListCommand(&cli),
newVersionCommand(&cli),
)
return cmd
}

View File

@@ -5,7 +5,7 @@
"path": "file:/var/tmp/disk.img",
"online": true,
"thinProvisioning": false,
"blockShift": 9,
"blockShift": 9
}
],
"iscsiportals": [
@@ -17,7 +17,9 @@
"iscsitargets": {
"iqn.2016-09.com.gotgt.gostor:02:example-tgt-0": {
"tpgts": {
"1":[0]
"1": [
0
]
},
"luns": {
"0": 1000

View File

@@ -39,7 +39,7 @@ import (
// versionMatcher defines a variable matcher to be parsed by the router
// when a request is about to be served.
const versionMatcher = "/v{version:[0-9.]+}"
const versionMatcher = "/v{version:[0-9.]+(?:-dirty)}"
// Config provides the configuration for the API server
type Config struct {

View File

@@ -23,7 +23,7 @@ import (
"runtime"
)
const (
var (
// Version shows the version of gotgt.
Version = "Not provided."
// SCSIVersion string MUST be shorter than 4 characters