implement Ceph FS volume plugin and add to e2e volume test

Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
Huamin Chen
2015-04-09 14:05:24 -04:00
parent 64717962cf
commit fe559f2726
28 changed files with 1184 additions and 1 deletions

View File

@@ -379,6 +379,10 @@ func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
numVolumes++
allErrs = append(allErrs, validateCinderVolumeSource(source.Cinder).Prefix("cinder")...)
}
if source.CephFS != nil {
numVolumes++
allErrs = append(allErrs, validateCephFS(source.CephFS).Prefix("cephfs")...)
}
if numVolumes != 1 {
allErrs = append(allErrs, errs.NewFieldInvalid("", source, "exactly 1 volume type is required"))
}
@@ -513,6 +517,14 @@ func validateCinderVolumeSource(cd *api.CinderVolumeSource) errs.ValidationError
return allErrs
}
func validateCephFS(cephfs *api.CephFSVolumeSource) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if len(cephfs.Monitors) == 0 {
allErrs = append(allErrs, errs.NewFieldRequired("monitors"))
}
return allErrs
}
func ValidatePersistentVolumeName(name string, prefix bool) (bool, string) {
return NameIsDNSSubdomain(name, prefix)
}
@@ -568,6 +580,10 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList
numVolumes++
allErrs = append(allErrs, validateRBD(pv.Spec.RBD).Prefix("rbd")...)
}
if pv.Spec.CephFS != nil {
numVolumes++
allErrs = append(allErrs, validateCephFS(pv.Spec.CephFS).Prefix("cephfs")...)
}
if pv.Spec.ISCSI != nil {
numVolumes++
allErrs = append(allErrs, validateISCSIVolumeSource(pv.Spec.ISCSI).Prefix("iscsi")...)