Volumes are now prefixed with the project name

When created through the compose file, volumes are prefixed
with the name of the project they belong to + underscore,
similarly to how containers are currently handled.

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2015-12-08 17:21:20 -08:00
commit ec5111f1c2
5 changed files with 77 additions and 12 deletions

View file

@ -10,10 +10,16 @@ class Volume(object):
self.driver_opts = driver_opts
def create(self):
return self.client.create_volume(self.name, self.driver, self.driver_opts)
return self.client.create_volume(
self.full_name, self.driver, self.driver_opts
)
def remove(self):
return self.client.remove_volume(self.name)
return self.client.remove_volume(self.full_name)
def inspect(self):
return self.client.inspect_volume(self.name)
return self.client.inspect_volume(self.full_name)
@property
def full_name(self):
return '{0}_{1}'.format(self.project, self.name)