From 698eb1bb4077d01a9a76eb96cda9152a771b788d Mon Sep 17 00:00:00 2001 From: Lei Xue Date: Thu, 8 Dec 2022 17:27:11 +0800 Subject: [PATCH 1/2] fmt/gomod update --- .travis.yml | 8 +- cmd/cmd.go | 43 +++++++++- cmd/daemon.go | 4 +- go.mod | 21 +++-- go.sum | 44 ++++++++++ gotgt.go | 34 +------- hack/ci/ceph-deploy-ceph.log | 126 +++++++++++++++++++++++++++++ {ci => hack/ci}/ceph_entrypoint.sh | 0 {ci => hack/ci}/ceph_install.sh | 4 +- {ci => hack/ci}/ceph_micro-osd.sh | 0 10 files changed, 233 insertions(+), 51 deletions(-) create mode 100644 go.sum create mode 100644 hack/ci/ceph-deploy-ceph.log rename {ci => hack/ci}/ceph_entrypoint.sh (100%) rename {ci => hack/ci}/ceph_install.sh (82%) rename {ci => hack/ci}/ceph_micro-osd.sh (100%) diff --git a/.travis.yml b/.travis.yml index e95557a..faf4be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ env: language: go go: - - 1.13.x - - 1.14.x + - 1.18.x + - 1.19.x install: - true @@ -20,8 +20,8 @@ before_script: - echo ${TGT_CFG} - echo ${TARGET} - sudo apt-get update - - ci/ceph_install.sh - - bash ci/ceph_micro-osd.sh /tmp/micro-ceph + - hack/ci/ceph_install.sh + - bash hack/ci/ceph_micro-osd.sh /tmp/micro-ceph - export CEPH_CONF=/tmp/micro-ceph/ceph.conf - ceph status - sudo apt-get install -y libcunit1 libcunit1-doc libcunit1-dev diff --git a/cmd/cmd.go b/cmd/cmd.go index a6fe842..550293f 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -18,23 +18,44 @@ package cmd import ( "fmt" + "net/http" + "os" "strings" + "github.com/docker/go-connections/sockets" "github.com/gostor/gotgt/pkg/api/client" "github.com/spf13/cobra" + + "github.com/gostor/gotgt/pkg/version" ) -func NewCommand(cli *client.Client) *cobra.Command { +func NewCommand() *cobra.Command { + 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: ``, - Run: func(cmd *cobra.Command, args []string) { + RunE: 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 { + fmt.Fprintf(os.Stderr, "%v", err) + return err + } // Do Stuff Here + return nil }, } + + cmd.PersistentFlags().StringVar(&host, "host", host, "Endpoint for SCSI target daemon") cmd.AddCommand( - newDaemonCommand(cli), + newDaemonCommand(), newCreateCommand(cli), newRemoveCommand(cli), newListCommand(cli), @@ -43,6 +64,22 @@ func NewCommand(cli *client.Client) *cobra.Command { return cmd } +func newHTTPClient(host string) (*http.Client, error) { + tr := &http.Transport{ + TLSClientConfig: nil, + } + proto, addr, _, err := client.ParseHost(host) + if err != nil { + return nil, err + } + + sockets.ConfigureTransport(tr, proto, addr) + + return &http.Client{ + Transport: tr, + }, nil +} + // NoArgs validate args and returns an error if there are any args func NoArgs(cmd *cobra.Command, args []string) error { if len(args) == 0 { diff --git a/cmd/daemon.go b/cmd/daemon.go index ca87535..c9087ae 100644 --- a/cmd/daemon.go +++ b/cmd/daemon.go @@ -23,7 +23,6 @@ import ( "strings" "syscall" - "github.com/gostor/gotgt/pkg/api/client" "github.com/gostor/gotgt/pkg/apiserver" "github.com/gostor/gotgt/pkg/config" _ "github.com/gostor/gotgt/pkg/port/iscsit" @@ -33,7 +32,7 @@ import ( "github.com/spf13/cobra" ) -func newDaemonCommand(cli *client.Client) *cobra.Command { +func newDaemonCommand() *cobra.Command { var host string var driver string var logLevel string @@ -48,7 +47,6 @@ func newDaemonCommand(cli *client.Client) *cobra.Command { } flags := cmd.Flags() flags.StringVar(&logLevel, "log", "info", "Log level of SCSI target daemon") - flags.StringVar(&host, "host", "tcp://127.0.0.1:23457", "Host for SCSI target daemon") flags.StringVar(&driver, "driver", "iscsi", "SCSI low level driver") flags.BoolVar(&blockMultipleHosts, "block-multiple-hosts", false, "Disable login from multiple hosts") return cmd diff --git a/go.mod b/go.mod index b0faa0f..4b79c68 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,23 @@ module github.com/gostor/gotgt -go 1.14 +go 1.18 require ( github.com/ceph/go-ceph v0.0.0-20180104205452-bd5bc6d4cb3e - github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e + github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/docker/go-connections v0.4.0 - github.com/gorilla/mux v1.7.2 + github.com/gorilla/mux v1.8.0 github.com/satori/go.uuid v1.2.0 - github.com/sirupsen/logrus v1.4.2 - github.com/spf13/cobra v0.0.5 - golang.org/x/net v0.0.0-20190611141213-3f473d35a33a + github.com/sirupsen/logrus v1.9.0 + github.com/spf13/cobra v1.6.1 + golang.org/x/net v0.4.0 +) + +require ( + github.com/Microsoft/go-winio v0.6.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/tools v0.1.12 // indirect ) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..52e05c9 --- /dev/null +++ b/go.sum @@ -0,0 +1,44 @@ +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/ceph/go-ceph v0.0.0-20180104205452-bd5bc6d4cb3e h1:Q1ZRAdVYuGVbwSecWiWnySuQbqHymS55EfovH/QRzm8= +github.com/ceph/go-ceph v0.0.0-20180104205452-bd5bc6d4cb3e/go.mod h1:DhWkbjUxN0QRc0xQvpI9QhzqQSzYysRuZVcqSfiStds= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/gotgt.go b/gotgt.go index 4c32f92..52672b6 100644 --- a/gotgt.go +++ b/gotgt.go @@ -19,47 +19,15 @@ package main import ( "fmt" - "net/http" "os" - "github.com/docker/go-connections/sockets" "github.com/gostor/gotgt/cmd" - "github.com/gostor/gotgt/pkg/api/client" - "github.com/gostor/gotgt/pkg/version" ) func main() { - host := "tcp://127.0.0.1:23457" - httpClient, err := newHTTPClient(host) - if err != nil { - fmt.Fprintf(os.Stderr, "%v", err) - os.Exit(1) - } - - cli, err := client.NewClient(host, version.Version, httpClient, nil) - if err != nil { - fmt.Fprintf(os.Stderr, "%v", err) - os.Exit(1) - } - if err := cmd.NewCommand(cli).Execute(); err != nil { + if err := cmd.NewCommand().Execute(); err != nil { fmt.Println(err) os.Exit(-1) } } - -func newHTTPClient(host string) (*http.Client, error) { - tr := &http.Transport{ - TLSClientConfig: nil, - } - proto, addr, _, err := client.ParseHost(host) - if err != nil { - return nil, err - } - - sockets.ConfigureTransport(tr, proto, addr) - - return &http.Client{ - Transport: tr, - }, nil -} diff --git a/hack/ci/ceph-deploy-ceph.log b/hack/ci/ceph-deploy-ceph.log new file mode 100644 index 0000000..c551c5d --- /dev/null +++ b/hack/ci/ceph-deploy-ceph.log @@ -0,0 +1,126 @@ +[2022-12-08 17:05:40,120][ceph_deploy.conf][DEBUG ] found configuration file at: /home/xuelei/.cephdeploy.conf +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] Invoked (2.0.1): /usr/local/bin/ceph-deploy install --release quincy k8s-master +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] ceph-deploy options: +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] verbose : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] quiet : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] username : None +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] overwrite_conf : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] ceph_conf : None +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] cluster : ceph +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] stable : None +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] release : quincy +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] testing : None +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] dev : master +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] dev_commit : None +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_mon : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_mgr : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_mds : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_rgw : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_osd : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_tests : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_common : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] install_all : False +[2022-12-08 17:05:40,120][ceph_deploy.cli][INFO ] adjust_repos : True +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] repo : False +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] host : ['k8s-master'] +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] local_mirror : None +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] repo_url : None +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] gpg_url : None +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] nogpgcheck : False +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] cd_conf : +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] default_release : False +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] version_kind : stable +[2022-12-08 17:05:40,121][ceph_deploy.cli][INFO ] func : +[2022-12-08 17:05:40,121][ceph_deploy.install][DEBUG ] Installing stable version quincy on cluster ceph hosts k8s-master +[2022-12-08 17:05:40,121][ceph_deploy.install][DEBUG ] Detecting platform for host k8s-master ... +[2022-12-08 17:05:40,137][k8s-master][DEBUG ] connection detected need for sudo +[2022-12-08 17:05:40,152][k8s-master][DEBUG ] connected to host: k8s-master +[2022-12-08 17:05:40,160][ceph_deploy][ERROR ] RuntimeError: AttributeError: module 'platform' has no attribute 'linux_distribution' + +[2022-12-08 17:11:46,588][ceph_deploy.conf][DEBUG ] found configuration file at: /home/xuelei/.cephdeploy.conf +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] Invoked (2.1.0): /usr/local/bin/ceph-deploy install --release quincy k8s-master +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] ceph-deploy options: +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] verbose : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] quiet : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] username : None +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] overwrite_conf : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] ceph_conf : None +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] cluster : ceph +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] stable : None +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] release : quincy +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] testing : None +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] dev : master +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] dev_commit : None +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_mon : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_mgr : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_mds : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_rgw : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_osd : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_tests : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_common : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] install_all : False +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] adjust_repos : True +[2022-12-08 17:11:46,588][ceph_deploy.cli][INFO ] repo : False +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] host : ['k8s-master'] +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] local_mirror : None +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] repo_url : None +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] gpg_url : None +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] nogpgcheck : False +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] cd_conf : +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] default_release : False +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] version_kind : stable +[2022-12-08 17:11:46,589][ceph_deploy.cli][INFO ] func : +[2022-12-08 17:11:46,589][ceph_deploy.install][DEBUG ] Installing stable version quincy on cluster ceph hosts k8s-master +[2022-12-08 17:11:46,589][ceph_deploy.install][DEBUG ] Detecting platform for host k8s-master ... +[2022-12-08 17:11:46,609][k8s-master][DEBUG ] connection detected need for sudo +[2022-12-08 17:11:46,628][k8s-master][DEBUG ] connected to host: k8s-master +[2022-12-08 17:11:46,638][ceph_deploy.install][INFO ] Distro info: ubuntu 20.04 focal +[2022-12-08 17:11:46,638][k8s-master][INFO ] installing Ceph on k8s-master +[2022-12-08 17:11:46,638][k8s-master][INFO ] Running command: sudo env DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --assume-yes -q update +[2022-12-08 17:11:46,778][k8s-master][DEBUG ] Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease +[2022-12-08 17:11:46,823][k8s-master][DEBUG ] Get:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease [114 kB] +[2022-12-08 17:11:46,924][k8s-master][DEBUG ] Hit:3 http://nexus.infra.shg1.mthreads.com/repository/apt-releases bionic InRelease +[2022-12-08 17:11:46,943][k8s-master][DEBUG ] Ign:4 https://baltocdn.com/helm/stable/debian all InRelease +[2022-12-08 17:11:47,146][k8s-master][DEBUG ] Err:5 https://baltocdn.com/helm/stable/debian all Release +[2022-12-08 17:11:47,216][k8s-master][DEBUG ] Could not handshake: Error in the pull function. [IP: 151.139.128.10 443] +[2022-12-08 17:11:47,216][k8s-master][DEBUG ] Get:7 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [114 kB] +[2022-12-08 17:11:47,603][k8s-master][DEBUG ] Get:8 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease [267 kB] +[2022-12-08 17:11:48,233][k8s-master][DEBUG ] Hit:9 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease +[2022-12-08 17:11:48,528][k8s-master][DEBUG ] Get:10 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [108 kB] +[2022-12-08 17:11:48,922][k8s-master][DEBUG ] Get:11 http://mirrors.aliyun.com/ubuntu focal-security/main Sources [260 kB] +[2022-12-08 17:11:49,746][k8s-master][DEBUG ] Get:12 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages [1,892 kB] +[2022-12-08 17:11:52,517][k8s-master][DEBUG ] Hit:6 https://packages.cloud.google.com/apt kubernetes-xenial InRelease +[2022-12-08 17:11:52,572][k8s-master][DEBUG ] Get:13 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 InRelease [1,484 B] +[2022-12-08 17:11:52,572][k8s-master][DEBUG ] Get:14 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64 InRelease [1,481 B] +[2022-12-08 17:11:52,627][k8s-master][DEBUG ] Get:15 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64 InRelease [1,474 B] +[2022-12-08 17:11:55,290][k8s-master][DEBUG ] Get:16 http://mirrors.aliyun.com/ubuntu focal-security/main i386 Packages [530 kB] +[2022-12-08 17:11:56,868][k8s-master][DEBUG ] Get:17 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.7 kB] +[2022-12-08 17:11:56,986][k8s-master][DEBUG ] Get:18 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.5 kB] +[2022-12-08 17:11:57,026][k8s-master][DEBUG ] Get:19 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 Packages [777 kB] +[2022-12-08 17:11:59,427][k8s-master][DEBUG ] Get:20 http://mirrors.aliyun.com/ubuntu focal-security/universe i386 Packages [574 kB] +[2022-12-08 17:12:01,128][k8s-master][DEBUG ] Get:21 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [94.0 kB] +[2022-12-08 17:12:01,405][k8s-master][DEBUG ] Get:22 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 c-n-f Metadata [16.9 kB] +[2022-12-08 17:12:01,454][k8s-master][DEBUG ] Get:23 http://mirrors.aliyun.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B] +[2022-12-08 17:12:01,458][k8s-master][DEBUG ] Get:24 http://mirrors.aliyun.com/ubuntu focal-updates/main Sources [537 kB] +[2022-12-08 17:12:03,070][k8s-master][DEBUG ] Get:25 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages [2,270 kB] +[2022-12-08 17:12:09,735][k8s-master][DEBUG ] Get:26 http://mirrors.aliyun.com/ubuntu focal-updates/main i386 Packages [761 kB] +[2022-12-08 17:12:11,949][k8s-master][DEBUG ] Get:27 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [275 kB] +[2022-12-08 17:12:12,740][k8s-master][DEBUG ] Get:28 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 c-n-f Metadata [16.1 kB] +[2022-12-08 17:12:12,790][k8s-master][DEBUG ] Get:29 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages [1,009 kB] +[2022-12-08 17:12:15,710][k8s-master][DEBUG ] Get:30 http://mirrors.aliyun.com/ubuntu focal-updates/universe i386 Packages [704 kB] +[2022-12-08 17:12:17,757][k8s-master][DEBUG ] Get:31 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [407 kB] +[2022-12-08 17:12:18,945][k8s-master][DEBUG ] Get:32 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [23.2 kB] +[2022-12-08 17:12:19,017][k8s-master][DEBUG ] Get:33 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B] +[2022-12-08 17:12:19,023][k8s-master][DEBUG ] Get:34 http://mirrors.aliyun.com/ubuntu focal-proposed/main Sources [59.0 kB] +[2022-12-08 17:12:19,192][k8s-master][DEBUG ] Get:35 http://mirrors.aliyun.com/ubuntu focal-proposed/main i386 Packages [54.5 kB] +[2022-12-08 17:12:19,355][k8s-master][DEBUG ] Get:36 http://mirrors.aliyun.com/ubuntu focal-proposed/main amd64 Packages [227 kB] +[2022-12-08 17:12:20,006][k8s-master][DEBUG ] Get:37 http://mirrors.aliyun.com/ubuntu focal-proposed/main Translation-en [52.1 kB] +[2022-12-08 17:12:20,161][k8s-master][DEBUG ] Get:38 http://mirrors.aliyun.com/ubuntu focal-proposed/main amd64 DEP-11 Metadata [2,248 B] +[2022-12-08 17:12:20,169][k8s-master][DEBUG ] Get:39 http://mirrors.aliyun.com/ubuntu focal-proposed/universe amd64 DEP-11 Metadata [2,940 B] +[2022-12-08 17:12:20,178][k8s-master][DEBUG ] Get:40 http://mirrors.aliyun.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,968 B] +[2022-12-08 17:12:20,204][k8s-master][DEBUG ] Get:41 http://mirrors.aliyun.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.5 kB] +[2022-12-08 17:12:23,194][k8s-master][DEBUG ] Reading package lists... +[2022-12-08 17:12:23,205][k8s-master][WARNING] E: The repository 'https://baltocdn.com/helm/stable/debian all Release' no longer has a Release file. +[2022-12-08 17:12:23,206][k8s-master][ERROR ] RuntimeError: command returned non-zero exit status: 100 +[2022-12-08 17:12:23,206][ceph_deploy][ERROR ] RuntimeError: Failed to execute command: env DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --assume-yes -q update + diff --git a/ci/ceph_entrypoint.sh b/hack/ci/ceph_entrypoint.sh similarity index 100% rename from ci/ceph_entrypoint.sh rename to hack/ci/ceph_entrypoint.sh diff --git a/ci/ceph_install.sh b/hack/ci/ceph_install.sh similarity index 82% rename from ci/ceph_install.sh rename to hack/ci/ceph_install.sh index 8319d6a..0782598 100755 --- a/ci/ceph_install.sh +++ b/hack/ci/ceph_install.sh @@ -3,10 +3,10 @@ set -e set -x -sudo apt-get install -y python-virtualenv +sudo apt-get install -y python3-pip # ceph-deploy and ceph -CEPH_RELEASE=jewel +CEPH_RELEASE=quincy sudo pip install ceph-deploy ceph-deploy install --release ${CEPH_RELEASE} `hostname` diff --git a/ci/ceph_micro-osd.sh b/hack/ci/ceph_micro-osd.sh similarity index 100% rename from ci/ceph_micro-osd.sh rename to hack/ci/ceph_micro-osd.sh From 7745d3ae3bd28dc1f29ae19193a1815eb62c954e Mon Sep 17 00:00:00 2001 From: Lei Xue Date: Thu, 8 Dec 2022 17:51:02 +0800 Subject: [PATCH 2/2] compile with 'ceph' flag to enable/disable cephstore --- .../backingstore/cephstore/cephstore_linux.go | 9 ++++++--- .../backingstore/cephstore/cephstore_stub.go | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 pkg/scsi/backingstore/cephstore/cephstore_stub.go diff --git a/pkg/scsi/backingstore/cephstore/cephstore_linux.go b/pkg/scsi/backingstore/cephstore/cephstore_linux.go index 078cd67..81b8de7 100644 --- a/pkg/scsi/backingstore/cephstore/cephstore_linux.go +++ b/pkg/scsi/backingstore/cephstore/cephstore_linux.go @@ -1,3 +1,6 @@ +//go:build ceph +// +build ceph + /* Copyright 2018 The GoStor Authors All rights reserved. @@ -19,12 +22,12 @@ import ( "fmt" "strings" - "github.com/gostor/gotgt/pkg/api" - "github.com/gostor/gotgt/pkg/scsi" - "github.com/ceph/go-ceph/rados" "github.com/ceph/go-ceph/rbd" log "github.com/sirupsen/logrus" + + "github.com/gostor/gotgt/pkg/api" + "github.com/gostor/gotgt/pkg/scsi" ) // This ceph-rbd plugin is only for linux diff --git a/pkg/scsi/backingstore/cephstore/cephstore_stub.go b/pkg/scsi/backingstore/cephstore/cephstore_stub.go new file mode 100644 index 0000000..d3f9432 --- /dev/null +++ b/pkg/scsi/backingstore/cephstore/cephstore_stub.go @@ -0,0 +1,16 @@ +/* +Copyright 2018 The GoStor Authors All rights reserved. + +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. +*/ +package cephstore