fix: relax some replication validations (#10210)

Also inherit storage class from source object
if replication configuration does not have a storage
class specified for destination bucket.
master
poornas 4 years ago committed by GitHub
parent 195f95196e
commit 121164db56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/bucket-replication.go
  2. 2
      docs/bucket/replication/README.md
  3. 7
      pkg/bucket/replication/replication.go
  4. 2
      pkg/bucket/replication/rule.go

@ -117,12 +117,16 @@ func putReplicationOpts(dest replication.Destination, objInfo ObjectInfo) (putOp
if err != nil {
return
}
sc := dest.StorageClass
if sc == "" {
sc = objInfo.StorageClass
}
putOpts = miniogo.PutObjectOptions{
UserMetadata: meta,
UserTags: tag.ToMap(),
ContentType: objInfo.ContentType,
ContentEncoding: objInfo.ContentEncoding,
StorageClass: dest.StorageClass,
StorageClass: sc,
ReplicationVersionID: objInfo.VersionID,
ReplicationStatus: miniogo.ReplicationStatusReplica,
ReplicationMTime: objInfo.ModTime,

@ -59,7 +59,7 @@ The replication configuration can now be added to the source bucket by applying
```
```
mc replicate add myminio/srcbucket/Tax --priority 1 --arn "arn:minio:replication::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket" --tags "Year=2019&Company=AcmeCorp" --storage-class "STANDARD"
mc replicate add myminio/srcbucket/Tax --priority 1 --arn "arn:minio:replication:us-east-1:c5be6b16-769d-432a-9ef1-4567081f3566:destbucket" --tags "Year=2019&Company=AcmeCorp" --storage-class "STANDARD"
Replication configuration applied successfully to myminio/srcbucket.
```

@ -145,11 +145,8 @@ func (c Config) FilterActionableRules(obj ObjectOpts) []Rule {
// GetDestination returns destination bucket and storage class.
func (c Config) GetDestination() Destination {
for _, rule := range c.Rules {
if rule.Status == Disabled {
continue
}
return rule.Destination
if len(c.Rules) > 0 {
return c.Rules[0].Destination
}
return Destination{}
}

@ -146,7 +146,7 @@ func (r Rule) Validate(bucket string, sameTarget bool) error {
if err := r.DeleteMarkerReplication.Validate(); err != nil {
return err
}
if r.Priority <= 0 {
if r.Priority < 0 {
return errPriorityMissing
}
if r.Destination.Bucket == bucket && sameTarget {

Loading…
Cancel
Save