Implement ability to specify external volumes
External volumes are created and managed by the user. They are not namespaced. They are expected to exist at the beginning of the up phase. Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
05935b5e54
commit
9cb58b796e
6 changed files with 93 additions and 21 deletions
|
|
@ -77,7 +77,9 @@ class Project(object):
|
|||
project.volumes.append(
|
||||
Volume(
|
||||
client=client, project=name, name=vol_name,
|
||||
driver=data.get('driver'), driver_opts=data.get('driver_opts')
|
||||
driver=data.get('driver'),
|
||||
driver_opts=data.get('driver_opts'),
|
||||
external=data.get('external', False)
|
||||
)
|
||||
)
|
||||
return project
|
||||
|
|
@ -235,11 +237,17 @@ class Project(object):
|
|||
def initialize_volumes(self):
|
||||
try:
|
||||
for volume in self.volumes:
|
||||
if volume.is_user_created:
|
||||
if volume.external:
|
||||
log.info(
|
||||
'Found user-created volume "{0}". No new namespaced '
|
||||
'Volume {0} declared as external. No new '
|
||||
'volume will be created.'.format(volume.name)
|
||||
)
|
||||
if not volume.exists():
|
||||
raise ConfigurationError(
|
||||
'Volume {0} declared as external, but could not be'
|
||||
' found. Please create the volume manually and try'
|
||||
' again.'.format(volume.full_name)
|
||||
)
|
||||
continue
|
||||
volume.create()
|
||||
except NotFound:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue