Remove stale volumes if endpoint/svc creation fails.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2016-10-21 16:43:07 +05:30
parent f74fbfc044
commit 90263476d5

View File

@ -550,6 +550,10 @@ func (p *glusterfsVolumeProvisioner) CreateVolume() (r *api.GlusterfsVolumeSourc
endpoint, service, err := p.createEndpointService(epNamespace, epServiceName, dynamicHostIps, p.options.PVC.Name)
if err != nil {
glog.Errorf("glusterfs: failed to create endpoint/service")
err = cli.VolumeDelete(volume.Id)
if err != nil {
glog.Errorf("glusterfs: error when deleting the volume :%v , manual deletion required", err)
}
return nil, 0, fmt.Errorf("failed to create endpoint/service %v", err)
}
glog.V(3).Infof("glusterfs: dynamic ep %v and svc : %v ", endpoint, service)