From fc5da26deeda577e8034b249caea6b7399b556d3 Mon Sep 17 00:00:00 2001
From: Steve Spencer <steven.spencer@reaktor.fi>
Date: Thu, 12 Nov 2015 10:42:26 +0200
Subject: [PATCH] Sync up with allowable docker volume mounting modes

---
 cloud/docker/docker.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/cloud/docker/docker.py b/cloud/docker/docker.py
index 12e7851f910..c6cf10f0783 100644
--- a/cloud/docker/docker.py
+++ b/cloud/docker/docker.py
@@ -79,8 +79,10 @@ options:
     version_added: "1.5"
   volumes:
     description:
-      - List of volumes to mount within the container using docker CLI-style
-      - 'syntax: C(/host:/container[:mode]) where "mode" may be "rw", "ro", "Z", "z".'
+      - List of volumes to mount within the container
+      - 'Use docker CLI-style syntax: C(/host:/container[:mode])'
+      - You can specify a read mode for the mount with either C(ro) or C(rw).  SELinux hosts can additionally
+        use C(z) or C(Z) mount options to use a shared or private label for the volume.
     default: null
   volumes_from:
     description:
@@ -629,8 +631,8 @@ class DockerManager(object):
                     mode = 'rw'
                     # with supplied bind mode
                     if len(parts) == 3:
-                        if parts[2] not in ['ro', 'rw', 'z', 'Z']:
-                            self.module.fail_json(msg='bind mode needs to be one of "ro", "rw", "z", or "Z"')
+                        if parts[2] not in ["rw", "rw,Z", "rw,z", "z,rw", "Z,rw", "Z", "z", "ro", "ro,Z", "ro,z", "z,ro", "Z,ro"]:
+                            self.module.fail_json(msg='invalid bind mode ' + parts[2])
                         else:
                             mode = parts[2]
                     self.binds[parts[0]] = {'bind': parts[1], 'mode': mode }