Volume add docstrings
This commit is contained in:
parent
b830cb5544
commit
20282c17fe
@ -30,18 +30,18 @@ from __future__ import absolute_import
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import pkg_resources
|
|
||||||
import lxml.etree
|
import lxml.etree
|
||||||
|
import pkg_resources
|
||||||
import qubes
|
import qubes
|
||||||
|
import qubes.devices
|
||||||
import qubes.exc
|
import qubes.exc
|
||||||
import qubes.utils
|
import qubes.utils
|
||||||
import qubes.devices
|
|
||||||
|
|
||||||
STORAGE_ENTRY_POINT = 'qubes.storage'
|
STORAGE_ENTRY_POINT = 'qubes.storage'
|
||||||
|
|
||||||
|
|
||||||
class StoragePoolException(qubes.exc.QubesException):
|
class StoragePoolException(qubes.exc.QubesException):
|
||||||
|
''' A general storage exception '''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class Volume(object):
|
|||||||
the libvirt XML template as <disk>.
|
the libvirt XML template as <disk>.
|
||||||
'''
|
'''
|
||||||
return qubes.devices.BlockDevice(self.path, self.name, self.script,
|
return qubes.devices.BlockDevice(self.path, self.name, self.script,
|
||||||
self.rw, self.domain, self.devtype) # NOQA
|
self.rw, self.domain, self.devtype)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return other.pool == self.pool and other.vid == self.vid \
|
return other.pool == self.pool and other.vid == self.vid \
|
||||||
@ -144,7 +144,7 @@ class Storage(object):
|
|||||||
self.get_pool(volume).resize(volume, size)
|
self.get_pool(volume).resize(volume, size)
|
||||||
|
|
||||||
def create(self, source_template=None):
|
def create(self, source_template=None):
|
||||||
|
''' Creates volumes on disk '''
|
||||||
if source_template is None and hasattr(self.vm, 'template'):
|
if source_template is None and hasattr(self.vm, 'template'):
|
||||||
source_template = self.vm.template
|
source_template = self.vm.template
|
||||||
|
|
||||||
@ -159,6 +159,7 @@ class Storage(object):
|
|||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
|
|
||||||
def clone(self, src_vm):
|
def clone(self, src_vm):
|
||||||
|
''' Clone volumes from the specified vm '''
|
||||||
self.vm.log.info('Creating directory: {0}'.format(self.vm.dir_path))
|
self.vm.log.info('Creating directory: {0}'.format(self.vm.dir_path))
|
||||||
if not os.path.exists(self.vm.dir_path):
|
if not os.path.exists(self.vm.dir_path):
|
||||||
self.log.info('Creating directory: {0}'.format(self.vm.dir_path))
|
self.log.info('Creating directory: {0}'.format(self.vm.dir_path))
|
||||||
@ -216,6 +217,7 @@ class Storage(object):
|
|||||||
return self.pools[volume.name]
|
return self.pools[volume.name]
|
||||||
|
|
||||||
def commit_template_changes(self):
|
def commit_template_changes(self):
|
||||||
|
''' Makes changes to an 'origin' volume persistent '''
|
||||||
for volume in self.vm.volumes.values():
|
for volume in self.vm.volumes.values():
|
||||||
if volume.volume_type == 'origin':
|
if volume.volume_type == 'origin':
|
||||||
self.get_pool(volume).commit_template_changes(volume)
|
self.get_pool(volume).commit_template_changes(volume)
|
||||||
@ -264,6 +266,9 @@ class Pool(object):
|
|||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
|
''' Called when removing the pool. Use this for implementation specific
|
||||||
|
clean up.
|
||||||
|
'''
|
||||||
raise NotImplementedError("Pool %s has destroy() not implemented" %
|
raise NotImplementedError("Pool %s has destroy() not implemented" %
|
||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
@ -283,6 +288,9 @@ class Pool(object):
|
|||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
''' Called when adding a pool to the system. Use this for implementation
|
||||||
|
specific set up.
|
||||||
|
'''
|
||||||
raise NotImplementedError("Pool %s has setup() not implemented" %
|
raise NotImplementedError("Pool %s has setup() not implemented" %
|
||||||
self.name)
|
self.name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user