ceph: fix obc upgrade from 1.3 to 1.4 external cluster
During the 1.3 cycle, we had implemented support for OBC external mode through an Endpoint in the StorageClass parameter. In 1.4, this is not the case anymore as we directly use the CephObjectStore external mode. However, we must maintain backward compatibility with the cluster using the Endpoint and not fail the upgrade. Thus checking for a CephObjectStore is invalid and should not always be assumed, now if we detect an Endpoint we return a simple context which fixes the upgrade. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
d15eea7d6e
commit
d2d1da5970
1 file changed
+16
-7
@@ -402,14 +402,23 @@ func (p *Provisioner) setObjectContext() error {
|
||||
return errors.Errorf(msg, "name")
|
||||
}
|
||||
|
||||
store, err := p.getObjectStore()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get cephObjectStore")
|
||||
}
|
||||
// We don't need the CephObjectStore if an endpoint is provided
|
||||
// In 1.3, OBC external is working with an Endpoint (from the SC param) and in 1.4 we have a CephObjectStore but we must keep backward compatibility
|
||||
// In 1.4, the Endpoint from the SC is not expected and never used so we will enter the "else" condition which gets a CephObjectStore and it is present
|
||||
if p.endpoint != "" {
|
||||
p.objectContext = cephObject.NewContext(p.context, p.clusterInfo, p.objectStoreName)
|
||||
} else {
|
||||
// Get CephObjectStore
|
||||
store, err := p.getObjectStore()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get cephObjectStore")
|
||||
}
|
||||
|
||||
p.objectContext, err = cephObject.NewMultisiteContext(p.context, p.clusterInfo, store)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to set multisite on provisioner's objectContext")
|
||||
// Set multisite context
|
||||
p.objectContext, err = cephObject.NewMultisiteContext(p.context, p.clusterInfo, store)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to set multisite on provisioner's objectContext")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user