registry/storage/driver/azure: fix Move method
Something seems broken on azure/azure sdk side - it is currently not possible to copy a blob of type AppendBlob using `CopyFromURL`. Using the AppendBlob client via NewAppendBlobClient does not work either. According to Azure the correct way to do this is by using StartCopyFromURL. Because this is an async operation, we need to do polling ourselves. A simple backoff mechanism is used, where during each iteration, the configured delay is multiplied by the retry number. Also introduces two new config options for the Azure driver: copy_status_poll_max_retry, and copy_status_poll_delay. Signed-off-by: Flavian Missi <fmissi@redhat.com>
This commit is contained in:
parent
ba46c769b3
commit
2b72c4d1ca
5 changed files with 149 additions and 29 deletions
|
@ -8,7 +8,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
defaultRealm = "core.windows.net"
|
||||
defaultRealm = "core.windows.net"
|
||||
defaultCopyStatusPollMaxRetry = 5
|
||||
defaultCopyStatusPollDelay = "100ms"
|
||||
)
|
||||
|
||||
type Credentials struct {
|
||||
|
@ -19,14 +21,16 @@ type Credentials struct {
|
|||
}
|
||||
|
||||
type Parameters struct {
|
||||
Container string `mapstructure:"container"`
|
||||
AccountName string `mapstructure:"accountname"`
|
||||
AccountKey string `mapstructure:"accountkey"`
|
||||
Credentials Credentials `mapstructure:"credentials"`
|
||||
ConnectionString string `mapstructure:"connectionstring"`
|
||||
Realm string `mapstructure:"realm"`
|
||||
RootDirectory string `mapstructure:"rootdirectory"`
|
||||
ServiceURL string `mapstructure:"serviceurl"`
|
||||
Container string `mapstructure:"container"`
|
||||
AccountName string `mapstructure:"accountname"`
|
||||
AccountKey string `mapstructure:"accountkey"`
|
||||
Credentials Credentials `mapstructure:"credentials"`
|
||||
ConnectionString string `mapstructure:"connectionstring"`
|
||||
Realm string `mapstructure:"realm"`
|
||||
RootDirectory string `mapstructure:"rootdirectory"`
|
||||
ServiceURL string `mapstructure:"serviceurl"`
|
||||
CopyStatusPollMaxRetry int `mapstructure:"copy_status_poll_max_retry"`
|
||||
CopyStatusPollDelay string `mapstructure:"copy_status_poll_delay"`
|
||||
}
|
||||
|
||||
func NewParameters(parameters map[string]interface{}) (*Parameters, error) {
|
||||
|
@ -45,5 +49,11 @@ func NewParameters(parameters map[string]interface{}) (*Parameters, error) {
|
|||
if params.ServiceURL == "" {
|
||||
params.ServiceURL = fmt.Sprintf("https://%s.blob.%s", params.AccountName, params.Realm)
|
||||
}
|
||||
if params.CopyStatusPollMaxRetry == 0 {
|
||||
params.CopyStatusPollMaxRetry = defaultCopyStatusPollMaxRetry
|
||||
}
|
||||
if params.CopyStatusPollDelay == "" {
|
||||
params.CopyStatusPollDelay = defaultCopyStatusPollDelay
|
||||
}
|
||||
return ¶ms, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue