After add/remove_pool execute Pool.setup/destroy
This commit is contained in:
parent
9674d03088
commit
97d04791b7
@ -1492,13 +1492,19 @@ class Qubes(PropertyHolder):
|
||||
def add_pool(self, **kwargs):
|
||||
""" Add a storage pool to config."""
|
||||
name = kwargs['name']
|
||||
self.pools[name] = self._get_pool(**kwargs)
|
||||
assert name not in self.pools.keys(), \
|
||||
"Pool named %s already exists" % name
|
||||
pool = self._get_pool(**kwargs)
|
||||
pool.setup()
|
||||
self.pools[name] = pool
|
||||
self.save()
|
||||
|
||||
def remove_pool(self, name):
|
||||
""" Remove a storage pool from config file. """
|
||||
try:
|
||||
pool = self.pools[name]
|
||||
del self.pools[name]
|
||||
pool.destroy()
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
""" Qubes storage system"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
@ -164,7 +163,8 @@ class Storage(object):
|
||||
pool = self.get_pool(target)
|
||||
source = src_vm.volumes[name]
|
||||
volume = pool.clone(source, target)
|
||||
assert volume, "%s.clone() returned '%s'" % (pool.__class__, volume)
|
||||
assert volume, "%s.clone() returned '%s'" % (pool.__class__,
|
||||
volume)
|
||||
self.vm.volumes[name] = volume
|
||||
|
||||
# TODO migrate this
|
||||
@ -236,6 +236,7 @@ class Pool(object):
|
||||
# :pylint: disable=unused-argument
|
||||
assert name, "Pool name is missing"
|
||||
self.name = name
|
||||
kwargs['name'] = self.name
|
||||
|
||||
def create(self, volume, source_volume):
|
||||
''' Create the given volume on disk or copy from provided
|
||||
@ -261,6 +262,10 @@ class Pool(object):
|
||||
raise NotImplementedError("Pool %s has clone() not implemented" %
|
||||
self.name)
|
||||
|
||||
def destroy(self):
|
||||
raise NotImplementedError("Pool %s has destroy() not implemented" %
|
||||
self.name)
|
||||
|
||||
def remove(self, volume):
|
||||
''' Remove volume'''
|
||||
raise NotImplementedError("Pool %s has remove() not implemented" %
|
||||
@ -271,6 +276,10 @@ class Pool(object):
|
||||
raise NotImplementedError("Pool %s has start() not implemented" %
|
||||
self.name)
|
||||
|
||||
def setup(self):
|
||||
raise NotImplementedError("Pool %s has setup() not implemented" %
|
||||
self.name)
|
||||
|
||||
def stop(self, volume):
|
||||
''' Do what ever is needed on stop'''
|
||||
raise NotImplementedError("Pool %s has stop() not implemented" %
|
||||
|
Loading…
Reference in New Issue
Block a user