Don't bind pre-bound pvc & pv if size request not satisfied

This commit is contained in:
Matthew Wong 2016-08-16 12:24:18 -04:00
parent 5962874414
commit fe817674ab

View File

@ -117,9 +117,14 @@ func (pvIndex *persistentVolumeOrderedIndex) findByClaim(claim *api.PersistentVo
// the claim.
for _, volume := range volumes {
if isVolumeBoundToClaim(volume, claim) {
// this claim and volume are bound; return it,
// whether the claim is prebound or for volumes
// intended for dynamic provisioning v1
// this claim and volume are pre-bound; return
// the volume if the size request is satisfied,
// otherwise leave the claim pending
volumeQty := volume.Spec.Capacity[api.ResourceStorage]
volumeSize := volumeQty.Value()
if volumeSize < requestedSize {
return nil, nil
}
return volume, nil
}