From 36b7e2f6e8490c312e4c55d9c757a855bf7cac6a Mon Sep 17 00:00:00 2001 From: YLShiJustFly Date: Tue, 29 Aug 2023 16:27:18 +0800 Subject: [PATCH] support spdk tgt Signed-off-by: YLShiJustFly --- Makefile | 1 - cli/command/client/map.go | 16 +++ cli/command/target/add.go | 45 +++++--- cli/command/target/cmd.go | 2 +- cli/command/target/delete.go | 18 +++- cli/command/target/list.go | 3 + cli/command/target/start.go | 3 + cli/command/target/stop.go | 4 + go.mod | 37 ++++--- go.sum | 61 +++++++++++ internal/errno/errno.go | 20 ++-- internal/playbook/factory.go | 2 + internal/task/scripts/add_spdk_target.go | 84 +++++++++++++++ internal/task/scripts/start_spdk.go | 76 ++++++++++++++ internal/task/scripts/target.go | 128 ++++++++++++++--------- internal/task/step/daemon.go | 3 + internal/task/task/bs/add_target.go | 26 +++-- internal/task/task/bs/delete_target.go | 96 +++++++++++++---- internal/task/task/bs/list_targets.go | 76 ++++++++------ internal/task/task/bs/start_tgtd.go | 63 ++++++++--- 20 files changed, 594 insertions(+), 170 deletions(-) create mode 100644 internal/task/scripts/add_spdk_target.go create mode 100644 internal/task/scripts/start_spdk.go diff --git a/Makefile b/Makefile index 4e92ad68c..175ba24d9 100644 --- a/Makefile +++ b/Makefile @@ -73,4 +73,3 @@ upload: lint: go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION) $(GOBIN_GOLANGCILINT) run -v - diff --git a/cli/command/client/map.go b/cli/command/client/map.go index 5255c7a14..fb7758fa3 100644 --- a/cli/command/client/map.go +++ b/cli/command/client/map.go @@ -110,6 +110,22 @@ func ParseSize(size string) (int, error) { return n, nil } +func ParseOriginDevname(origindevname string) error { + if !strings.HasSuffix(origindevname, "/dev/") { + return errno.ERR_SPDK_TARGET_DEVNAME_IS_ABNORMAL. + F("origindevname: %s", origindevname) + } + return nil +} + +func ParseDevno(size string) (int, error) { + n, err := strconv.Atoi(size) + if err != nil || n < 0 { + return 0, errno.ERR_SPDK_TARGET_DEVNO_IS_ABNORMAL + } + return n, nil +} + func ParseBlockSize(blocksize string) (uint64, error) { if !strings.HasSuffix(blocksize, "B") { return 0, errno.ERR_VOLUME_BLOCKSIZE_MUST_END_WITH_BYTE_SUFFIX. diff --git a/cli/command/target/add.go b/cli/command/target/add.go index af5fcd649..9c955ff74 100644 --- a/cli/command/target/add.go +++ b/cli/command/target/add.go @@ -45,12 +45,15 @@ var ( ) type addOptions struct { - image string - host string - size string - create bool - filename string - blocksize string + image string + host string + size string + create bool + filename string + blocksize string + devno string + originbdevname string + spdk bool } func checkAddOptions(curveadm *cli.CurveAdm, options addOptions) error { @@ -60,6 +63,17 @@ func checkAddOptions(curveadm *cli.CurveAdm, options addOptions) error { return err } else if _, err = client.ParseBlockSize(options.blocksize); err != nil { return err + } else if options.spdk { + if len(options.devno) != 0 { + if _, err = client.ParseDevno(options.size); err != nil { + return err + } + } + if len(options.originbdevname) != 0 { + if err = client.ParseOriginDevname(options.size); err != nil { + return err + } + } } else if !utils.PathExist(options.filename) { return errno.ERR_CLIENT_CONFIGURE_FILE_NOT_EXIST. F("file path: %s", utils.AbsPath(options.filename)) @@ -91,6 +105,9 @@ func NewAddCommand(curveadm *cli.CurveAdm) *cobra.Command { flags.StringVar(&options.size, "size", "10GiB", "Specify volume size") flags.StringVarP(&options.filename, "conf", "c", "client.yaml", "Specify client configuration file") flags.StringVar(&options.blocksize, "blocksize", "4096B", "Specify volume blocksize") + flags.BoolVar(&options.spdk, "spdk", false, "create iscsi spdk target") + flags.StringVar(&options.devno, "devno", "0", "Specify bdev num(when set --spdk flag)") + flags.StringVar(&options.originbdevname, "originbdevname", "/dev/cbd0", "Specify cbd dev(when set --spdk flag)") return cmd } @@ -108,12 +125,15 @@ func genAddPlaybook(curveadm *cli.CurveAdm, Configs: ccs, Options: map[string]interface{}{ comm.KEY_TARGET_OPTIONS: bs.TargetOption{ - Host: options.host, - User: user, - Volume: name, - Size: size, - Blocksize: blocksize, - Create: options.create, + Host: options.host, + User: user, + Volume: name, + Size: size, + Blocksize: blocksize, + Create: options.create, + Devno: options.devno, + OriginBdevname: options.originbdevname, + Spdk: options.spdk, }, }, }) @@ -130,7 +150,6 @@ func runAdd(curveadm *cli.CurveAdm, options addOptions) error { return errno.ERR_REQUIRE_CURVEBS_KIND_CLIENT_CONFIGURE_FILE. F("kind: %s", cc.GetKind()) } - // 2) generate map playbook pb, err := genAddPlaybook(curveadm, []*configure.ClientConfig{cc}, options) if err != nil { diff --git a/cli/command/target/cmd.go b/cli/command/target/cmd.go index e830e7edb..8bf1afadf 100644 --- a/cli/command/target/cmd.go +++ b/cli/command/target/cmd.go @@ -32,7 +32,7 @@ func NewTargetCommand(curveadm *cli.CurveAdm) *cobra.Command { cmd := &cobra.Command{ Use: "target", Short: "Manage SCSI target of CurveBS", - Args: cliutil.NoArgs, + Args: cliutil.ExactArgs(1), RunE: cliutil.ShowHelp(curveadm.Err()), } diff --git a/cli/command/target/delete.go b/cli/command/target/delete.go index 84bbafabd..9c607a5d4 100644 --- a/cli/command/target/delete.go +++ b/cli/command/target/delete.go @@ -39,8 +39,10 @@ var ( ) type deleteOptions struct { - host string - tid string + host string + tid string + devno string + spdk bool } func NewDeleteCommand(curveadm *cli.CurveAdm) *cobra.Command { @@ -60,6 +62,7 @@ func NewDeleteCommand(curveadm *cli.CurveAdm) *cobra.Command { flags := cmd.Flags() flags.StringVar(&options.host, "host", "localhost", "Specify target host") + flags.BoolVar(&options.spdk, "spdk", false, "delete iscsi spdk target") return cmd } @@ -73,8 +76,10 @@ func genDeletePlaybook(curveadm *cli.CurveAdm, options deleteOptions) (*playbook Configs: nil, Options: map[string]interface{}{ comm.KEY_TARGET_OPTIONS: bs.TargetOption{ - Host: options.host, - Tid: options.tid, + Host: options.host, + Tid: options.tid, + Spdk: options.spdk, + Devno: options.devno, }, }, }) @@ -84,11 +89,16 @@ func genDeletePlaybook(curveadm *cli.CurveAdm, options deleteOptions) (*playbook func runDelete(curveadm *cli.CurveAdm, options deleteOptions) error { // 1) generate list playbook + pb, err := genDeletePlaybook(curveadm, options) if err != nil { return err } + if err != nil { + return err + } + // 2) run playground err = pb.Run() if err != nil { diff --git a/cli/command/target/list.go b/cli/command/target/list.go index bfdb03a96..b7a70147e 100644 --- a/cli/command/target/list.go +++ b/cli/command/target/list.go @@ -41,6 +41,7 @@ var ( type listOptions struct { host string + spdk bool } func NewListCommand(curveadm *cli.CurveAdm) *cobra.Command { @@ -59,6 +60,7 @@ func NewListCommand(curveadm *cli.CurveAdm) *cobra.Command { flags := cmd.Flags() flags.StringVar(&options.host, "host", "localhost", "Specify target host") + flags.BoolVar(&options.spdk, "spdk", false, "list iscsi spdk target") return cmd } @@ -73,6 +75,7 @@ func genListPlaybook(curveadm *cli.CurveAdm, options listOptions) (*playbook.Pla Options: map[string]interface{}{ comm.KEY_TARGET_OPTIONS: bs.TargetOption{ Host: options.host, + Spdk: options.spdk, }, }, }) diff --git a/cli/command/target/start.go b/cli/command/target/start.go index b2ae799da..adc43f6b0 100644 --- a/cli/command/target/start.go +++ b/cli/command/target/start.go @@ -44,6 +44,7 @@ var ( type startOptions struct { host string filename string + spdk bool } func NewStartCommand(curveadm *cli.CurveAdm) *cobra.Command { @@ -62,6 +63,7 @@ func NewStartCommand(curveadm *cli.CurveAdm) *cobra.Command { flags := cmd.Flags() flags.StringVar(&options.host, "host", "localhost", "Specify target host") flags.StringVarP(&options.filename, "conf", "c", "client.yaml", "Specify client configuration file") + flags.BoolVar(&options.spdk, "spdk", false, "start iscsi spdk target") return cmd } @@ -78,6 +80,7 @@ func genStartPlaybook(curveadm *cli.CurveAdm, Options: map[string]interface{}{ comm.KEY_TARGET_OPTIONS: bs.TargetOption{ Host: options.host, + Spdk: options.spdk, }, }, }) diff --git a/cli/command/target/stop.go b/cli/command/target/stop.go index 43f83b438..87af3e457 100644 --- a/cli/command/target/stop.go +++ b/cli/command/target/stop.go @@ -40,6 +40,7 @@ var ( type stopOptions struct { host string + spdk bool } func NewStopCommand(curveadm *cli.CurveAdm) *cobra.Command { @@ -57,6 +58,7 @@ func NewStopCommand(curveadm *cli.CurveAdm) *cobra.Command { flags := cmd.Flags() flags.StringVar(&options.host, "host", "localhost", "Specify target host") + flags.BoolVar(&options.spdk, "spdk", false, "stop iscsi spdk target") return cmd } @@ -71,6 +73,7 @@ func genStopPlaybook(curveadm *cli.CurveAdm, options stopOptions) (*playbook.Pla Options: map[string]interface{}{ comm.KEY_TARGET_OPTIONS: bs.TargetOption{ Host: options.host, + Spdk: options.spdk, }, }, }) @@ -79,6 +82,7 @@ func genStopPlaybook(curveadm *cli.CurveAdm, options stopOptions) (*playbook.Pla } func runStop(curveadm *cli.CurveAdm, options stopOptions) error { + // 1) generate stop playbook pb, err := genStopPlaybook(curveadm, options) if err != nil { diff --git a/go.mod b/go.mod index a5f78bf36..63e994b54 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/opencurve/curveadm -go 1.18 +go 1.21 require ( github.com/docker/cli v24.0.1+incompatible @@ -11,7 +11,7 @@ require ( github.com/google/uuid v1.3.0 github.com/jpillora/longestcommon v0.0.0-20161227235612-adb9d91ee629 github.com/kpango/glg v1.6.14 - github.com/mattn/go-sqlite3 v1.14.16 + github.com/mattn/go-sqlite3 v1.14.17 github.com/mcuadros/go-defaults v1.2.0 github.com/melbahja/goph v1.3.0 github.com/mitchellh/hashstructure/v2 v2.0.2 @@ -24,7 +24,7 @@ require ( github.com/stretchr/testify v1.8.2 github.com/vbauerster/mpb/v7 v7.5.3 go.uber.org/zap v1.24.0 - golang.org/x/crypto v0.8.0 + golang.org/x/crypto v0.13.0 ) require ( @@ -33,11 +33,13 @@ require ( github.com/VividCortex/ewma v1.2.0 // indirect github.com/Wine93/grace v0.0.0-20221021033009-7d0348013a3c // indirect github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect + github.com/andybalholm/brotli v1.0.5 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.8.7 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v24.0.1+incompatible // indirect @@ -52,6 +54,7 @@ require ( github.com/facebookgo/stats v0.0.0-20151006221625-1b76add642e4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect + github.com/gaukas/godicttls v0.0.4 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-gonic/gin v1.9.0 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -62,15 +65,16 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/pprof v0.0.0-20230406165453-00490a63f317 // indirect + github.com/google/pprof v0.0.0-20230912144702-c363fe2c2ed8 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/imroc/req/v3 v3.33.2 // indirect + github.com/imroc/req/v3 v3.42.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/kpango/fastime v1.1.6 // indirect github.com/kr/fs v0.1.0 // indirect @@ -86,7 +90,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect - github.com/onsi/ginkgo/v2 v2.9.2 // indirect + github.com/onsi/ginkgo/v2 v2.12.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/pelletier/go-toml/v2 v2.0.7 // indirect @@ -99,8 +103,9 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-19 v0.3.2 // indirect - github.com/quic-go/qtls-go1-20 v0.2.2 // indirect - github.com/quic-go/quic-go v0.33.0 // indirect + github.com/quic-go/qtls-go1-20 v0.3.4 // indirect + github.com/quic-go/quic-go v0.38.1 // indirect + github.com/refraction-networking/utls v1.5.3 // indirect github.com/rivo/uniseg v0.4.3 // indirect github.com/sevlyar/go-daemon v0.1.6 // indirect github.com/sirupsen/logrus v1.9.0 // indirect @@ -115,14 +120,14 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/term v0.7.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.8.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/term v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.13.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect diff --git a/go.sum b/go.sum index 2de2646ed..51bf08c4c 100644 --- a/go.sum +++ b/go.sum @@ -54,6 +54,8 @@ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpH github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -86,6 +88,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e85keuznYcH5rqI438v41pKcBl4ZxQ= github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -150,6 +154,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw= github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= +github.com/gaukas/godicttls v0.0.4 h1:NlRaXb3J6hAnTmWdsEKb9bcSBD6BvcIjdGdeb0zfXbk= +github.com/gaukas/godicttls v0.0.4/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67deKr9/NCI= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= @@ -161,6 +167,7 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= @@ -245,6 +252,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230406165453-00490a63f317 h1:hFhpt7CTmR3DX+b4R19ydQFtofxT0Sv3QsKNMVQYTMQ= github.com/google/pprof v0.0.0-20230406165453-00490a63f317/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= +github.com/google/pprof v0.0.0-20230912144702-c363fe2c2ed8 h1:gpptm606MZYGaMHMsB4Srmb6EbW/IVHnt04rcMXnkBQ= +github.com/google/pprof v0.0.0-20230912144702-c363fe2c2ed8/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -271,6 +280,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imroc/req/v3 v3.33.2 h1:mqphLIo++p+IPYdjgP/Wd5rqXUjKvuEIst2U+EsLIwQ= github.com/imroc/req/v3 v3.33.2/go.mod h1:cZ+7C3L/AYOr4tLGG16hZF90F1WzAdAdzt1xFSlizXY= +github.com/imroc/req/v3 v3.42.0 h1:g7wWva3aIJI02mrnqmXe0N5SVkXHQPsYN3Tmw2ZHn3U= +github.com/imroc/req/v3 v3.42.0/go.mod h1:W7dOrfQORA9nFoj+CafIZ6P5iyk+rWdbp2sffOAvABU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -293,6 +304,8 @@ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uia github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= @@ -331,6 +344,8 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mattn/go-sqlite3 v1.6.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= +github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -363,9 +378,15 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= +github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= +github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= +github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI= +github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -421,8 +442,16 @@ github.com/quic-go/qtls-go1-19 v0.3.2 h1:tFxjCFcTQzK+oMxG6Zcvp4Dq8dx4yD3dDiIiyc8 github.com/quic-go/qtls-go1-19 v0.3.2/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8GEa3E= github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= +github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM= +github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= +github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= +github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y0= github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA= +github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE= +github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4= +github.com/refraction-networking/utls v1.5.3 h1:Ds5Ocg1+MC1ahNx5iBEcHe0jHeLaA/fLey61EENm7ro= +github.com/refraction-networking/utls v1.5.3/go.mod h1:SPuDbBmgLGp8s+HLNc83FuavwZCFoMmExj+ltUHiHUw= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -523,6 +552,10 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -535,6 +568,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -561,6 +596,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -600,6 +637,10 @@ golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -622,6 +663,10 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -678,11 +723,19 @@ golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -693,6 +746,10 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -750,6 +807,10 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/errno/errno.go b/internal/errno/errno.go index ccdbb2c3f..ab72a6e2f 100644 --- a/internal/errno/errno.go +++ b/internal/errno/errno.go @@ -419,15 +419,17 @@ var ( ERR_CLIENT_ID_NOT_FOUND = EC(410022, "client id not found") // 420: common (curvebs client) - ERR_VOLUME_ALREADY_MAPPED = EC(420000, "volume already mapped") - ERR_VOLUME_CONTAINER_LOSED = EC(420001, "volume container is losed") - ERR_VOLUME_CONTAINER_ABNORMAL = EC(420002, "volume container is abnormal") - ERR_CREATE_VOLUME_FAILED = EC(420003, "create volume failed") - ERR_MAP_VOLUME_FAILED = EC(420004, "map volume to NBD device failed") - ERR_ENCODE_VOLUME_INFO_TO_JSON_FAILED = EC(420005, "encode volume info to json failed") - ERR_UNMAP_VOLUME_FAILED = EC(420006, "unmap volume failed") - ERR_OLD_TARGET_DAEMON_IS_ABNORMAL = EC(420007, "old target daemon is abnormal") - ERR_TARGET_DAEMON_IS_ABNORMAL = EC(420008, "target daemon is abnormal") + ERR_VOLUME_ALREADY_MAPPED = EC(420000, "volume already mapped") + ERR_VOLUME_CONTAINER_LOSED = EC(420001, "volume container is losed") + ERR_VOLUME_CONTAINER_ABNORMAL = EC(420002, "volume container is abnormal") + ERR_CREATE_VOLUME_FAILED = EC(420003, "create volume failed") + ERR_MAP_VOLUME_FAILED = EC(420004, "map volume to NBD device failed") + ERR_ENCODE_VOLUME_INFO_TO_JSON_FAILED = EC(420005, "encode volume info to json failed") + ERR_UNMAP_VOLUME_FAILED = EC(420006, "unmap volume failed") + ERR_OLD_TARGET_DAEMON_IS_ABNORMAL = EC(420007, "old target daemon is abnormal") + ERR_TARGET_DAEMON_IS_ABNORMAL = EC(420008, "target daemon is abnormal") + ERR_SPDK_TARGET_DEVNO_IS_ABNORMAL = EC(420009, "spdk target devno is abnormal") + ERR_SPDK_TARGET_DEVNAME_IS_ABNORMAL = EC(420010, "spdk target without block dev") // 430: common (curvefs client) ERR_FS_PATH_ALREADY_MOUNTED = EC(430000, "path already mounted") diff --git a/internal/playbook/factory.go b/internal/playbook/factory.go index 68ce8993d..7f1f889bb 100644 --- a/internal/playbook/factory.go +++ b/internal/playbook/factory.go @@ -275,6 +275,7 @@ func (p *Playbook) createTasks(step *PlaybookStep) (*tasks.Tasks, error) { t, err = bs.NewMapTask(curveadm, config.GetCC(i)) case UNMAP_IMAGE: t, err = bs.NewUnmapTask(curveadm, nil) + // bs/target case START_TARGET_DAEMON: t, err = bs.NewStartTargetDaemonTask(curveadm, config.GetCC(i)) @@ -286,6 +287,7 @@ func (p *Playbook) createTasks(step *PlaybookStep) (*tasks.Tasks, error) { t, err = bs.NewDeleteTargetTask(curveadm, nil) case LIST_TARGETS: t, err = bs.NewListTargetsTask(curveadm, nil) + // fs case CHECK_CLIENT_S3: t, err = checker.NewClientS3ConfigureTask(curveadm, config.GetCC(i)) diff --git a/internal/task/scripts/add_spdk_target.go b/internal/task/scripts/add_spdk_target.go new file mode 100644 index 000000000..3f0d4027b --- /dev/null +++ b/internal/task/scripts/add_spdk_target.go @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2021 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: CurveAdm + * Created Date: 2022-02-08 + * Author: Jingli Chen (Wine93) + */ + +package scripts + +/* + * Usage: target USER VOLUME CREATE SIZE + * Example: target curve test true 10 + * See Also: https://linux.die.net/man/8/tgtadm + */ + +var ADD_SPDK_TARGET = ` +#!/usr/bin/env bash + +g_sockname="/var/tmp/spdk.sock" +g_rpcpath="/usr/libexec/spdk/scripts/rpc.py" +g_isexclusive=0 +g_targetip=10.0.0.1 +g_targetport=3260 +g_initiatorip=10.0.0.0 +g_initiatormask=8 +g_volumename=disk1 +g_volume=$1 +g_devno=$2 +g_originbdev=$3 +g_blocksize=$4 +g_user=$5 +g_create=$6 +g_size=$7 + +g_cbdpath=//${g_devno}_${g_user}_ +g_curvebdev=cbd_${g_devno} +g_ocf=ocf_${g_devno} +g_aio=aio_${g_devno} + +mkdir -p /curvebs/nebd/data/lock +touch /etc/curve/curvetab + +if [ $g_create == "true" ]; then + output=$(curve_ops_tool create -userName=$g_user -fileName=$g_volume -fileLength=$g_size) + if [ $? -ne 0 ]; then + if [ "$output" != "CreateFile fail with errCode: 101" ]; then + exit 1 + fi + fi +fi + +if sudo ${g_rpcpath} -s ${g_sockname} iscsi_get_target_nodes >/dev/null | grep "$g_curvebdev" | grep name >/dev/null; then + echo "spdk target is already created, please try anther name" + exit 1 +fi + +sudo ${g_rpcpath} -s ${g_sockname} bdev_aio_create ${g_aio} ${g_originbdev} 512 >/dev/null +sudo ${g_rpcpath} -s ${g_sockname} bdev_cdb_create -b ${g_curvebdev} --cbd ${g_cbdpath} --exclusive=${g_isexclusive} --blocksize=${g_blocksize} >/dev/null +sudo ${g_rpcpath} -s ${g_sockname} bdev_ocf_create $g_ocf wb $g_aio $g_curvebdev > /dev/null + +sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_portal_group 1 ${g_targetip}:${g_targetport} > /dev/null +sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_initiator_group 2 ANY ${g_initiatorip}/${g_initiatormask} > /dev/null + +sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_target_node ${g_volumename} "Data Disk1" "g_ocf:0 ${g_aio}:1" 1:2 64 -d > /dev/null + +sudo iscsiadm --mode discovery -t sendtargets --portal 10.0.0.1:3260 +exit 0 + +` diff --git a/internal/task/scripts/start_spdk.go b/internal/task/scripts/start_spdk.go new file mode 100644 index 000000000..96720e04a --- /dev/null +++ b/internal/task/scripts/start_spdk.go @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2021 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: CurveAdm + * Created Date: 2022-02-08 + * Author: Jingli Chen (Wine93) + */ + +package scripts + +/* + * Usage: target USER VOLUME CREATE SIZE + * Example: target curve test true 10 + * See Also: https://linux.die.net/man/8/tgtadm + */ + +var START_SPDK = ` +#!/usr/bin/env bash + +g_binarypath="/usr/local/bin/spdk_tgt" +g_cpumask=0x3 +g_sockname="/var/tmp/spdk.sock" +g_iscsi_log="/var/log/spdk.log" + +mkdir -p /curvebs/nebd/data/lock +touch /etc/curve/curvetab + +process_name="spdk_tgt" + +if ps aux | grep -v grep | grep "$process_name" >/dev/null; then + echo "spdk iscsi_tgt has already been started, now exit!" + exit 1 +fi + +nohup ${g_binarypath} -m ${g_cpumask} -r ${g_sockname} > ${g_iscsi_log} 2>&1 & + +i=1 +while true +do + result=$(cat $VSDK_LOG_FILE | grep "please run rpc") + if [[ "$result" != "" ]]; then + i=0 + break + else + sleep 0.1 + i++ + fi + if [ "$i" -ge 50 ]; then + break + fi +done + +if [ "$i" -eq 0]; then + echo "spdk spdk_tgt started success!" +else + echo "wait for 5s, spdk iscsi_tgt has not launched, please try again!" + exit 1 +fi + +exit 0 + +` diff --git a/internal/task/scripts/target.go b/internal/task/scripts/target.go index 5767f8540..8bf90187a 100644 --- a/internal/task/scripts/target.go +++ b/internal/task/scripts/target.go @@ -36,7 +36,25 @@ g_volume=$2 g_create=$3 g_size=$4 g_blocksize=$5 +g_devno=$6 +g_originbdev=$7 +g_spdk=$8 + g_tid=1 +g_sockname="/var/tmp/spdk.sock" +g_rpcpath="/usr/libexec/spdk/scripts/rpc.py" +g_isexclusive=0 +g_targetip=10.0.0.1 +g_targetport=3260 +g_initiatorip=10.0.0.0 +g_initiatormask=8 +g_volumename=disk1 + +g_cbdpath=//${g_devno}_${g_user}_ +g_curvebdev=cbd_${g_devno} +g_ocf=ocf_${g_devno} +g_aio=aio_${g_devno} + g_image=cbd:pool/${g_volume}_${g_user}_ g_image_md5=$(echo -n ${g_image} | md5sum | awk '{ print $1 }') g_targetname=iqn.$(date +"%Y-%m").com.opencurve:curve.${g_image_md5} @@ -52,55 +70,71 @@ if [ $g_create == "true" ]; then fi fi fi -for ((i=1;;i++)); do - tgtadm --lld iscsi --mode target --op show --tid $i 1>/dev/null 2>&1 - if [ $? -ne 0 ]; then - g_tid=$i - break - fi -done - -tgtadm --lld iscsi \ - --mode target \ - --op new \ - --tid ${g_tid} \ - --targetname ${g_targetname} -if [ $? -ne 0 ]; then - echo "tgtadm target new failed" - exit 1 -fi -tgtadm --lld iscsi \ - --mode logicalunit \ - --op new \ - --tid ${g_tid} \ - --lun 1 \ - --bstype curve \ - --backing-store ${g_image} \ - --blocksize ${g_blocksize} -if [ $? -ne 0 ]; then - echo "tgtadm logicalunit new failed" - exit 1 -fi +if [ $g_spdk == "true" ]; then + for ((i=1;;i++)); do + tgtadm --lld iscsi --mode target --op show --tid $i 1>/dev/null 2>&1 + if [ $? -ne 0 ]; then + g_tid=$i + break + fi + done -tgtadm --lld iscsi \ - --mode logicalunit \ - --op update \ - --tid ${g_tid} \ - --lun 1 \ - --params vendor_id=NetEase,product_id=CurveVolume,product_rev=2.0 -if [ $? -ne 0 ]; then - echo "tgtadm logicalunit update failed" - exit 1 -fi + tgtadm --lld iscsi \ + --mode target \ + --op new \ + --tid ${g_tid} \ + --targetname ${g_targetname} + if [ $? -ne 0 ]; then + echo "tgtadm target new failed" + exit 1 + fi + + tgtadm --lld iscsi \ + --mode logicalunit \ + --op new \ + --tid ${g_tid} \ + --lun 1 \ + --bstype curve \ + --backing-store ${g_image} \ + --blocksize ${g_blocksize} + if [ $? -ne 0 ]; then + echo "tgtadm logicalunit new failed" + exit 1 + fi + + tgtadm --lld iscsi \ + --mode logicalunit \ + --op update \ + --tid ${g_tid} \ + --lun 1 \ + --params vendor_id=NetEase,product_id=CurveVolume,product_rev=2.0 + if [ $? -ne 0 ]; then + echo "tgtadm logicalunit update failed" + exit 1 + fi + + tgtadm --lld iscsi \ + --mode target \ + --op bind \ + --tid ${g_tid} \ + -I ALL + if [ $? -ne 0 ]; then + echo "tgtadm target bind failed" + exit 1 + fi +else + if sudo ${g_rpcpath} -s ${g_sockname} iscsi_get_target_nodes >/dev/null | grep "$g_curvebdev" | grep name >/dev/null; then + echo "spdk target is already created, please try anther name" + exit 1 + fi + sudo ${g_rpcpath} -s ${g_sockname} bdev_aio_create ${g_aio} ${g_originbdev} 512 >/dev/null + sudo ${g_rpcpath} -s ${g_sockname} bdev_cdb_create -b ${g_curvebdev} --cbd ${g_cbdpath} --exclusive=${g_isexclusive} --blocksize=${g_blocksize} >/dev/null + sudo ${g_rpcpath} -s ${g_sockname} bdev_ocf_create $g_ocf wb $g_aio $g_curvebdev > /dev/null + sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_portal_group 1 ${g_targetip}:${g_targetport} > /dev/null + sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_initiator_group 2 ANY ${g_initiatorip}/${g_initiatormask} > /dev/null + sudo ${g_rpcpath} -s ${g_sockname} iscsi_create_target_node ${g_volumename} "Data Disk1" "g_ocf:0 ${g_aio}:1" 1:2 64 -d > /dev/null + sudo iscsiadm --mode discovery -t sendtargets --portal 10.0.0.1:3260 -tgtadm --lld iscsi \ - --mode target \ - --op bind \ - --tid ${g_tid} \ - -I ALL -if [ $? -ne 0 ]; then - echo "tgtadm target bind failed" - exit 1 fi ` diff --git a/internal/task/step/daemon.go b/internal/task/step/daemon.go index 71a0cd4e1..e84fb773d 100644 --- a/internal/task/step/daemon.go +++ b/internal/task/step/daemon.go @@ -77,6 +77,9 @@ type AddDaemonTask struct { type DelDaemonTask struct { ContainerId *string + Cmd string + Args []string + TaskName string Tid string MemStorage *utils.SafeMap module.ExecOptions diff --git a/internal/task/task/bs/add_target.go b/internal/task/task/bs/add_target.go index 2383fe24c..8b151fcf2 100644 --- a/internal/task/task/bs/add_target.go +++ b/internal/task/task/bs/add_target.go @@ -36,13 +36,16 @@ import ( ) type TargetOption struct { - Host string - User string - Volume string - Create bool - Size int - Tid string - Blocksize uint64 + Host string + User string + Volume string + Create bool + Size int + Tid string + Blocksize uint64 + Devno string + OriginBdevname string + Spdk bool } func NewAddTargetTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*task.Task, error) { @@ -61,7 +64,10 @@ func NewAddTargetTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*task containerId := DEFAULT_TGTD_CONTAINER_NAME targetScriptPath := "/curvebs/tools/sbin/target.sh" targetScript := scripts.TARGET - cmd := fmt.Sprintf("/bin/bash %s %s %s %v %d %d", targetScriptPath, user, volume, options.Create, options.Size, options.Blocksize) + cmd := fmt.Sprintf("/bin/bash %s %s %d %s %v %d %v", + targetScriptPath, volume, + options.Devno, options.OriginBdevname, + options.Blocksize, user, options.Create, options.Size, options.Spdk) toolsConf := fmt.Sprintf(FORMAT_TOOLS_CONF, cc.GetClusterMDSAddr()) t.AddStep(&step.ListContainers{ @@ -96,7 +102,9 @@ func NewAddTargetTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*task t.AddStep(&step.AddDaemonTask{ // install addTarget.task ContainerId: &containerId, Cmd: "/bin/bash", - Args: []string{targetScriptPath, user, volume, strconv.FormatBool(options.Create), strconv.Itoa(options.Size), strconv.FormatUint(options.Blocksize, 10)}, + Args: []string{targetScriptPath, options.Volume, options.Devno, + options.OriginBdevname, strconv.FormatUint(options.Blocksize, 10), + user, strconv.FormatBool(options.Create), strconv.Itoa(options.Size), strconv.FormatBool(options.Spdk)}, TaskName: "addTarget" + TranslateVolumeName(volume, user), ExecOptions: curveadm.ExecOptions(), }) diff --git a/internal/task/task/bs/delete_target.go b/internal/task/task/bs/delete_target.go index 7f5a6135e..ec8e4f78f 100644 --- a/internal/task/task/bs/delete_target.go +++ b/internal/task/task/bs/delete_target.go @@ -59,6 +59,8 @@ func NewDeleteTargetTask(curveadm *cli.CurveAdm, cc *client.ClientConfig) (*task subname := fmt.Sprintf("hostname=%s tid=%s", hc.GetHostname(), options.Tid) t := task.NewTask("Delete Target", subname, hc.GetSSHConfig()) + listcmd := "/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock iscsi_get_target_nodes" + sendtargetcmd := "sudo iscsiadm --mode discovery -t sendtargets --portal 10.0.0.1:3260" // add step var output string @@ -75,29 +77,77 @@ func NewDeleteTargetTask(curveadm *cli.CurveAdm, cc *client.ClientConfig) (*task t.AddStep(&step2CheckTgtdStatus{ output: &output, }) - t.AddStep(&step.ContainerExec{ - ContainerId: &containerId, - Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op show"), - Out: &output, - ExecOptions: curveadm.ExecOptions(), - }) - t.AddStep(&step2FormatTarget{ - host: options.Host, - hostname: hc.GetHostname(), - output: &output, - memStorage: curveadm.MemStorage(), - }) - t.AddStep(&step.DelDaemonTask{ - ContainerId: &containerId, - Tid: tid, - MemStorage: curveadm.MemStorage(), - ExecOptions: curveadm.ExecOptions(), - }) - t.AddStep(&step.ContainerExec{ - ContainerId: &containerId, - Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op delete --tid %s", tid), - ExecOptions: curveadm.ExecOptions(), - }) + if options.Spdk { + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: listcmd, + Out: &output, + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step2FormatTarget{ + host: options.Host, + hostname: hc.GetHostname(), + output: &output, + memStorage: curveadm.MemStorage(), + }) + t.AddStep(&step.DelDaemonTask{ + ContainerId: &containerId, + Tid: options.Tid, + MemStorage: curveadm.MemStorage(), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock iscsi_delete_target_node %s", options.Tid), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock bdev_ocf_delete ocf_%s", options.Devno), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock bdev_cbd_delete cdb_%s", options.Devno), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock bdev_aio_delete aio_%s", options.Devno), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: sendtargetcmd, + ExecOptions: curveadm.ExecOptions(), + }) + + } else { + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op show"), + Out: &output, + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step2FormatTarget{ + host: options.Host, + hostname: hc.GetHostname(), + output: &output, + memStorage: curveadm.MemStorage(), + }) + t.AddStep(&step.DelDaemonTask{ + ContainerId: &containerId, + Tid: tid, + MemStorage: curveadm.MemStorage(), + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op delete --tid %s", tid), + ExecOptions: curveadm.ExecOptions(), + }) + } + return t, nil } diff --git a/internal/task/task/bs/list_targets.go b/internal/task/task/bs/list_targets.go index 32abc7dc3..1ff7b4c46 100644 --- a/internal/task/task/bs/list_targets.go +++ b/internal/task/task/bs/list_targets.go @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021 NetEase Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2021 NetEase Inc. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ /* - * Project: CurveAdm - * Created Date: 2022-02-09 - * Author: Jingli Chen (Wine93) - */ +* Project: CurveAdm +* Created Date: 2022-02-09 +* Author: Jingli Chen (Wine93) +*/ package bs @@ -46,7 +46,7 @@ type ( output *string memStorage *utils.SafeMap } -) + ) func addTarget(memStorage *utils.SafeMap, id string, target *step.Target) { memStorage.TX(func(kv *utils.SafeMap) error { @@ -65,13 +65,13 @@ func addTarget(memStorage *utils.SafeMap, id string, target *step.Target) { Output Example: Target 3: iqn.2022-02.com.opencurve:curve.wine93/test03 - ... - LUN information: - LUN: 0 - ... - LUN: 1 - ... - Backing store path: cbd:pool//test03_wine93_ +... +LUN information: +LUN: 0 +... +LUN: 1 +... +Backing store path: cbd:pool//test03_wine93_ */ func (s *step2FormatTarget) Execute(ctx *context.Context) error { output := *s.output @@ -128,12 +128,24 @@ func NewListTargetsTask(curveadm *cli.CurveAdm, v interface{}) (*task.Task, erro t.AddStep(&step2CheckTgtdStatus{ output: &output, }) - t.AddStep(&step.ContainerExec{ - ContainerId: &containerId, - Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op show"), - Out: &output, - ExecOptions: curveadm.ExecOptions(), - }) + if options.Spdk { + + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("/usr/libexec/spdk/scripts/rpc.py -s /var/tmp/spdk.sock iscsi_delete_target_node %s", options.Tid), + Out: &output, + ExecOptions: curveadm.ExecOptions(), + }) + + } else { + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: fmt.Sprintf("tgtadm --lld iscsi --mode target --op show"), + Out: &output, + ExecOptions: curveadm.ExecOptions(), + }) + } + t.AddStep(&step2FormatTarget{ host: options.Host, hostname: hc.GetHostname(), diff --git a/internal/task/task/bs/start_tgtd.go b/internal/task/task/bs/start_tgtd.go index 7c5142b63..2e20bca46 100644 --- a/internal/task/task/bs/start_tgtd.go +++ b/internal/task/task/bs/start_tgtd.go @@ -31,6 +31,7 @@ import ( "github.com/opencurve/curveadm/internal/configure" "github.com/opencurve/curveadm/internal/errno" "github.com/opencurve/curveadm/internal/task/context" + "github.com/opencurve/curveadm/internal/task/scripts" "github.com/opencurve/curveadm/internal/task/step" "github.com/opencurve/curveadm/internal/task/task" ) @@ -64,15 +65,19 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig return nil, err } - // new task - subname := fmt.Sprintf("host=%s image=%s", options.Host, cc.GetContainerImage()) - t := task.NewTask("Start Target Daemon", subname, hc.GetSSHConfig()) - // add step to task var status, containerId, out string containerName := DEFAULT_TGTD_CONTAINER_NAME hostname := containerName host2addr := fmt.Sprintf("%s:%s", hostname, hc.GetHostname()) + targetScriptPath := "/curvebs/tools/sbin/start_spdk.sh" + targetScript := scripts.START_SPDK + cmd := fmt.Sprintf("/bin/bash %s", targetScriptPath) + // new task + subname := fmt.Sprintf("host=%s image=%s", options.Host, cc.GetContainerImage()) + t := task.NewTask("Start Target Daemon", subname, hc.GetSSHConfig()) + + // add step to task t.AddStep(&step.ListContainers{ ShowAll: true, @@ -137,17 +142,45 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig Out: &out, ExecOptions: curveadm.ExecOptions(), }) - t.AddStep(&step.ContainerExec{ - Command: "tgtd", - ContainerId: &containerId, - ExecOptions: curveadm.ExecOptions(), - }) - t.AddStep(&step.AddDaemonTask{ // install tgtd.task - ContainerId: &containerId, - Cmd: "tgtd", - TaskName: "tgtd", - ExecOptions: curveadm.ExecOptions(), - }) + if options.Spdk { + t.AddStep(&step.InstallFile{ // install start_spdk.sh + Content: &targetScript, + ContainerId: &containerId, + ContainerDestPath: targetScriptPath, + ExecOptions: curveadm.ExecOptions(), + }) + + t.AddStep(&step.InstallFile{ // install start_spdk.sh + Content: &targetScript, + ContainerId: &containerId, + ContainerDestPath: targetScriptPath, + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + ContainerId: &containerId, + Command: cmd, + ExecOptions: curveadm.ExecOptions(), + }) + } else { + t.AddStep(&step.AddDaemonTask{ // install addTarget.task + ContainerId: &containerId, + Cmd: "/bin/bash", + Args: []string{targetScriptPath}, + TaskName: "start spdk target", + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.ContainerExec{ + Command: "tgtd", + ContainerId: &containerId, + ExecOptions: curveadm.ExecOptions(), + }) + t.AddStep(&step.AddDaemonTask{ // install tgtd.task + ContainerId: &containerId, + Cmd: "tgtd", + TaskName: "tgtd", + ExecOptions: curveadm.ExecOptions(), + }) + } return t, nil }