Skip to content

Commit 9da36ce

Browse files
committed
Introduce share clone command
1 parent a61710d commit 9da36ce

File tree

25 files changed

+2844
-5
lines changed

25 files changed

+2844
-5
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ fmt:
2222
vet:
2323
go vet -mod=vendor ./cmd/... ./pkg/...
2424

25+
static:
26+
staticcheck ./cmd/... ./pkg/...
27+
2528
mod:
2629
go mod vendor

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ Usage:
3636

3737
Available Commands:
3838
backup
39+
completion Generate the autocompletion script for the specified shell
3940
help Help about any command
4041
image Clone an image
4142
server Clone a server
43+
share Clone a share
4244
version Print version information
4345
volume Clone a volume
4446

@@ -50,6 +52,9 @@ Flags:
5052
--timeout-backup string timeout to wait for a backup status (default "24h")
5153
--timeout-image string timeout to wait for an image status (default "24h")
5254
--timeout-server string timeout to wait for a server status (default "24h")
55+
--timeout-share string timeout to wait for a share status (default "24h")
56+
--timeout-share-replica string timeout to wait for a share replica status (default "24h")
57+
--timeout-share-snapshot string timeout to wait for a share snapshot status (default "24h")
5358
--timeout-snapshot string timeout to wait for a snapshot status (default "24h")
5459
--timeout-volume string timeout to wait for a volume status (default "24h")
5560
--to-application-credential-id string destination application credential ID
@@ -207,6 +212,29 @@ $ source openrc-of-the-source-project
207212
$ cyclone backup clone my-backup --to-region my-region-1 --threads=16
208213
```
209214

215+
### Manila shares support
216+
217+
Manila share type must support replicas, i.e.
218+
219+
```sh
220+
$ openstack share type show default -c optional_extra_specs -f json | jq '.optional_extra_specs.replication_type'
221+
"dr"
222+
```
223+
224+
#### Clone a Manila share to a new share in a new availability zone
225+
226+
```sh
227+
$ source openrc-of-the-source-project
228+
$ cyclone share my-share --to-share-name my-new-share --to-az my-region-1b
229+
```
230+
231+
#### Move an existing Manila share to a new availability zone
232+
233+
```sh
234+
$ source openrc-of-the-source-project
235+
$ cyclone share move my-share --to-az my-region-1b
236+
```
237+
210238
## Build
211239

212240
```sh

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.20
44

55
require (
66
github.com/google/uuid v1.3.0
7-
github.com/gophercloud/gophercloud v1.3.1-0.20230409194245-e5cad997df12
7+
github.com/gophercloud/gophercloud v1.4.1-0.20230614092438-44d55f08cdc0
88
github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8
99
github.com/klauspost/compress v1.16.4
1010
github.com/machinebox/progress v0.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8
139139
github.com/gophercloud/gophercloud v0.20.0/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4=
140140
github.com/gophercloud/gophercloud v1.0.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c=
141141
github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
142-
github.com/gophercloud/gophercloud v1.3.1-0.20230409194245-e5cad997df12 h1:pbKZbcXc3cELg93TPRegTJ0tQ9GnYtFAOZA7ZcYVTgo=
143-
github.com/gophercloud/gophercloud v1.3.1-0.20230409194245-e5cad997df12/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
142+
github.com/gophercloud/gophercloud v1.4.1-0.20230614092438-44d55f08cdc0 h1:TNfpghMRzEdmU8xPrmMsNZ4Qhx7im/d8BSh9XufBwG8=
143+
github.com/gophercloud/gophercloud v1.4.1-0.20230614092438-44d55f08cdc0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
144144
github.com/gophercloud/utils v0.0.0-20220927104426-4113af8d2663/go.mod h1:qOGlfG6OIJ193/c3Xt/XjOfHataNZdQcVgiu93LxBUM=
145145
github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8 h1:K9r5WEeAiaEgFZsuOP0OYjE4TtyFcCLG1nI08t9AP6A=
146146
github.com/gophercloud/utils v0.0.0-20230330070308-5bd5e1d608f8/go.mod h1:VSalo4adEk+3sNkmVJLnhHoOyOYYS8sTWLG4mv5BKto=

pkg/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func initRootCmdFlags() {
102102
RootCmd.PersistentFlags().StringP("timeout-server", "", "24h", "timeout to wait for a server status")
103103
RootCmd.PersistentFlags().StringP("timeout-snapshot", "", "24h", "timeout to wait for a snapshot status")
104104
RootCmd.PersistentFlags().StringP("timeout-backup", "", "24h", "timeout to wait for a backup status")
105+
RootCmd.PersistentFlags().StringP("timeout-share", "", "24h", "timeout to wait for a share status")
106+
RootCmd.PersistentFlags().StringP("timeout-share-snapshot", "", "24h", "timeout to wait for a share snapshot status")
107+
RootCmd.PersistentFlags().StringP("timeout-share-replica", "", "24h", "timeout to wait for a share replica status")
105108
RootCmd.PersistentFlags().BoolP("image-web-download", "", false, "use Glance web-download image import method")
106109
viper.BindPFlag("debug", RootCmd.PersistentFlags().Lookup("debug"))
107110
viper.BindPFlag("yes", RootCmd.PersistentFlags().Lookup("yes"))
@@ -120,6 +123,9 @@ func initRootCmdFlags() {
120123
viper.BindPFlag("timeout-server", RootCmd.PersistentFlags().Lookup("timeout-server"))
121124
viper.BindPFlag("timeout-snapshot", RootCmd.PersistentFlags().Lookup("timeout-snapshot"))
122125
viper.BindPFlag("timeout-backup", RootCmd.PersistentFlags().Lookup("timeout-backup"))
126+
viper.BindPFlag("timeout-share", RootCmd.PersistentFlags().Lookup("timeout-share"))
127+
viper.BindPFlag("timeout-share-snapshot", RootCmd.PersistentFlags().Lookup("timeout-share-snapshot"))
128+
viper.BindPFlag("timeout-share-replica", RootCmd.PersistentFlags().Lookup("timeout-share-replica"))
123129
viper.BindPFlag("image-web-download", RootCmd.PersistentFlags().Lookup("image-web-download"))
124130
}
125131

@@ -152,6 +158,9 @@ func parseTimeoutArgs() error {
152158
parseTimeoutArg("timeout-server", &waitForServerSec, &errors)
153159
parseTimeoutArg("timeout-snapshot", &waitForSnapshotSec, &errors)
154160
parseTimeoutArg("timeout-backup", &waitForBackupSec, &errors)
161+
parseTimeoutArg("timeout-share", &waitForShareSec, &errors)
162+
parseTimeoutArg("timeout-share-snapshot", &waitForShareSnapshotSec, &errors)
163+
parseTimeoutArg("timeout-share-replica", &waitForShareReplicaSec, &errors)
155164
if len(errors) > 0 {
156165
return fmt.Errorf("%q", errors)
157166
}

0 commit comments

Comments
 (0)