Add XenPool.setup/destroy

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-04-15 20:33:04 +02:00
parent 97d04791b7
commit 62c81044c5
2 changed files with 16 additions and 6 deletions

View File

@ -71,12 +71,18 @@ class LinuxKernel(Pool):
'driver': LinuxKernel.driver,
}
def destroy(self):
pass
def remove(self, volume):
pass
def rename(self, volume, old_name, new_name):
return volume
def setup(self):
pass
def start(self, volume):
path = volume.path
if not os.path.exists(path):

View File

@ -45,12 +45,6 @@ class XenPool(Pool):
assert dir_path, "No pool dir_path specified"
self.dir_path = os.path.normpath(dir_path)
create_dir_if_not_exists(self.dir_path)
appvms_path = os.path.join(self.dir_path, 'appvms')
create_dir_if_not_exists(appvms_path)
vm_templates_path = os.path.join(self.dir_path, 'vm-templates')
create_dir_if_not_exists(vm_templates_path)
def clone(self, source, target):
''' Clones the volume if the `source.pool` if the source is a
:py:class:`XenVolume`.
@ -148,6 +142,16 @@ class XenPool(Pool):
os.umask(old_umask)
return volume
def destroy(self):
pass
def setup(self):
create_dir_if_not_exists(self.dir_path)
appvms_path = os.path.join(self.dir_path, 'appvms')
create_dir_if_not_exists(appvms_path)
vm_templates_path = os.path.join(self.dir_path, 'vm-templates')
create_dir_if_not_exists(vm_templates_path)
def start(self, volume):
if volume.volume_type == 'volatile':
self._reset_volume(volume)