Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Hotfix: delete cephfs volume report error: 'cephfs.ObjectNotFound: [E…
Browse files Browse the repository at this point in the history
…rrno 2] error in getxattr'
  • Loading branch information
lowang-bh committed Jul 29, 2020
1 parent 0c2e8e9 commit fc016bc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ceph/cephfs/cephfs-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const (
provisionCmd = "/usr/local/bin/cephfs_provisioner"
provisionerIDAnn = "cephFSProvisionerIdentity"
cephShareAnn = "cephShare"
cephVolumeGroup = "CEPH_VOLUME_GROUP"
provisionerNameKey = "PROVISIONER_NAME"
secretNamespaceKey = "PROVISIONER_SECRET_NAMESPACE"
)
Expand Down Expand Up @@ -124,7 +125,7 @@ func (p *cephFSProvisioner) Provision(options controller.VolumeOptions) (*v1.Per
if err != nil {
return nil, err
}
var share, user string
var share, user, cephVolGroupVal string
if deterministicNames {
share = options.PVC.Name
user = fmt.Sprintf("k8s.%s.%s", options.PVC.Namespace, options.PVC.Name)
Expand All @@ -151,6 +152,7 @@ func (p *cephFSProvisioner) Provision(options controller.VolumeOptions) (*v1.Per
"CEPH_AUTH_KEY=" + adminSecret,
"CEPH_VOLUME_ROOT=" + pvcRoot}
if deterministicNames {
cephVolGroupVal = options.PVC.Namespace
cmd.Env = append(cmd.Env, "CEPH_VOLUME_GROUP="+options.PVC.Namespace)
}
if *disableCephNamespaceIsolation {
Expand Down Expand Up @@ -197,6 +199,7 @@ func (p *cephFSProvisioner) Provision(options controller.VolumeOptions) (*v1.Per
Annotations: map[string]string{
provisionerIDAnn: p.identity,
cephShareAnn: share,
cephVolumeGroup: cephVolGroupVal,
},
},
Spec: v1.PersistentVolumeSpec{
Expand Down Expand Up @@ -249,7 +252,7 @@ func (p *cephFSProvisioner) Delete(volume *v1.PersistentVolume) error {
if err != nil {
return err
}
cluster, adminID, adminSecret, pvcRoot, mon, _, err := p.parseParameters(class.Parameters)
cluster, adminID, adminSecret, pvcRoot, mon, deterministicNames, err := p.parseParameters(class.Parameters)
if err != nil {
return err
}
Expand All @@ -266,6 +269,12 @@ func (p *cephFSProvisioner) Delete(volume *v1.PersistentVolume) error {
if *disableCephNamespaceIsolation {
cmd.Env = append(cmd.Env, "CEPH_NAMESPACE_ISOLATION_DISABLED=true")
}
if deterministicNames {
cephVolGroupVal := volume.Annotations[cephVolumeGroup]
if cephVolGroupVal != "" {
cmd.Env = append(cmd.Env, "CEPH_VOLUME_GROUP=" + cephVolGroupVal)
}
}

output, cmdErr := cmd.CombinedOutput()
if cmdErr != nil {
Expand Down

0 comments on commit fc016bc

Please sign in to comment.