From 730db45eab02457c524a4576c578b3436187c162 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Mon, 25 Jul 2016 11:29:07 -0400 Subject: [PATCH] allow a read-only rbd image mounted by multiple pods Signed-off-by: Huamin Chen --- plugin/pkg/scheduler/algorithm/predicates/predicates.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index 71b96c228f3..5e7b535ec0d 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -108,7 +108,10 @@ func isVolumeConflict(volume api.Volume, pod *api.Pod) bool { if volume.RBD != nil && existingVolume.RBD != nil { mon, pool, image := volume.RBD.CephMonitors, volume.RBD.RBDPool, volume.RBD.RBDImage emon, epool, eimage := existingVolume.RBD.CephMonitors, existingVolume.RBD.RBDPool, existingVolume.RBD.RBDImage - if haveSame(mon, emon) && pool == epool && image == eimage { + // two RBDs images are the same if they share the same Ceph monitor, are in the same RADOS Pool, and have the same image name + // only one read-write mount is permitted for the same RBD image. + // same RBD image mounted by multiple Pods conflicts unless all Pods mount the image read-only + if haveSame(mon, emon) && pool == epool && image == eimage && !(volume.RBD.ReadOnly && existingVolume.RBD.ReadOnly) { return true } }