"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/share/drivers/lvm.py" between
manila-11.0.0.tar.gz and manila-11.0.1.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Victoria" series (latest release).

lvm.py  (manila-11.0.0):lvm.py  (manila-11.0.1)
skipping to change at line 36 skipping to change at line 36
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_utils import importutils from oslo_utils import importutils
from oslo_utils import timeutils from oslo_utils import timeutils
import six import six
from manila import exception from manila import exception
from manila.i18n import _ from manila.i18n import _
from manila.share import driver from manila.share import driver
from manila.share.drivers import generic from manila.share.drivers import generic
from manila.share import utils from manila.share import utils as share_utils
from manila import utils
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
share_opts = [ share_opts = [
cfg.StrOpt('lvm_share_export_root', cfg.StrOpt('lvm_share_export_root',
default='$state_path/mnt', default='$state_path/mnt',
help='Base folder where exported shares are located.'), help='Base folder where exported shares are located.'),
cfg.ListOpt('lvm_share_export_ips', cfg.ListOpt('lvm_share_export_ips',
help='List of IPs to export shares belonging to the LVM ' help='List of IPs to export shares belonging to the LVM '
'storage driver.'), 'storage driver.'),
skipping to change at line 259 skipping to change at line 260
share_device_name = self._get_local_path(share) share_device_name = self._get_local_path(share)
self._set_random_uuid_to_device(share) self._set_random_uuid_to_device(share)
self._copy_volume( self._copy_volume(
snapshot_device_name, share_device_name, share['size']) snapshot_device_name, share_device_name, share['size'])
location = self._get_helper(share).create_exports( location = self._get_helper(share).create_exports(
self.share_server, share['name']) self.share_server, share['name'])
self._mount_device(share, share_device_name) self._mount_device(share, share_device_name)
return location return location
def delete_share(self, context, share, share_server=None): def delete_share(self, context, share, share_server=None):
self._unmount_device(share, raise_if_missing=False) self._unmount_device(share, raise_if_missing=False,
retry_busy_device=True)
self._delete_share(context, share) self._delete_share(context, share)
self._deallocate_container(share['name']) self._deallocate_container(share['name'])
def _unmount_device(self, share_or_snapshot, raise_if_missing=True): def _unmount_device(self, share_or_snapshot, raise_if_missing=True,
retry_busy_device=False):
"""Unmount the filesystem of a share or snapshot LV.""" """Unmount the filesystem of a share or snapshot LV."""
mount_path = self._get_mount_path(share_or_snapshot) mount_path = self._get_mount_path(share_or_snapshot)
if os.path.exists(mount_path): if os.path.exists(mount_path):
# umount, may be busy
try: retries = 10 if retry_busy_device else 1
self._execute('umount', '-f', mount_path, run_as_root=True)
except exception.ProcessExecutionError as exc: @utils.retry(exception.ShareBusyException, retries=retries)
if 'device is busy' in exc.stderr.lower(): def _unmount_device_with_retry():
raise exception.ShareBusyException( try:
reason=share_or_snapshot['name']) self._execute('umount', '-f', mount_path, run_as_root=True)
elif 'not mounted' in exc.stderr.lower(): except exception.ProcessExecutionError as exc:
if raise_if_missing: if 'is busy' in exc.stderr.lower():
LOG.error('Unable to find device: %s', exc) raise exception.ShareBusyException(
reason=share_or_snapshot['name'])
elif 'not mounted' in exc.stderr.lower():
if raise_if_missing:
LOG.error('Unable to find device: %s', exc)
raise
else:
LOG.error('Unable to umount: %s', exc)
raise raise
else:
LOG.error('Unable to umount: %s', exc) _unmount_device_with_retry()
raise
# remove dir # remove dir
self._execute('rmdir', mount_path, run_as_root=True) self._execute('rmdir', mount_path, run_as_root=True)
def ensure_shares(self, context, shares): def ensure_shares(self, context, shares):
updates = {} updates = {}
for share in shares: for share in shares:
updates[share['id']] = { updates[share['id']] = {
'export_locations': self.ensure_share(context, share)} 'export_locations': self.ensure_share(context, share)}
return updates return updates
skipping to change at line 417 skipping to change at line 426
device_name = self._get_local_path(share) device_name = self._get_local_path(share)
self._mount_device(share, device_name) self._mount_device(share, device_name)
# Also remount the snapshot # Also remount the snapshot
device_name = self._get_local_path(snapshot) device_name = self._get_local_path(snapshot)
self._mount_device(snapshot, device_name) self._mount_device(snapshot, device_name)
# Lastly we add all the access rules back # Lastly we add all the access rules back
self._get_helper(share).update_access(self.share_server, self._get_helper(share).update_access(self.share_server,
share['name'], share['name'],
share_access_rules, share_access_rules,
[], []) [], [])
snapshot_access_rules, __, __ = utils.change_rules_to_readonly( snapshot_access_rules, __, __ = share_utils.change_rules_to_readonly(
snapshot_access_rules, [], []) snapshot_access_rules, [], [])
self._get_helper(share).update_access(self.share_server, self._get_helper(share).update_access(self.share_server,
snapshot['name'], snapshot['name'],
snapshot_access_rules, snapshot_access_rules,
[], []) [], [])
def create_snapshot(self, context, snapshot, share_server=None): def create_snapshot(self, context, snapshot, share_server=None):
self._create_snapshot(context, snapshot) self._create_snapshot(context, snapshot)
device_name = self._get_local_path(snapshot) device_name = self._get_local_path(snapshot)
skipping to change at line 479 skipping to change at line 488
:param context: Current context :param context: Current context
:param snapshot: Snapshot model with snapshot data. :param snapshot: Snapshot model with snapshot data.
:param access_rules: All access rules for given snapshot :param access_rules: All access rules for given snapshot
:param add_rules: Empty List or List of access rules which should be :param add_rules: Empty List or List of access rules which should be
added. access_rules already contains these rules. added. access_rules already contains these rules.
:param delete_rules: Empty List or List of access rules which should be :param delete_rules: Empty List or List of access rules which should be
removed. access_rules doesn't contain these rules. removed. access_rules doesn't contain these rules.
:param share_server: None or Share server model :param share_server: None or Share server model
""" """
helper = self._get_helper(snapshot['share']) helper = self._get_helper(snapshot['share'])
access_rules, add_rules, delete_rules = utils.change_rules_to_readonly( access_rules, add_rules, delete_rules = (
access_rules, add_rules, delete_rules) share_utils.change_rules_to_readonly(
access_rules, add_rules, delete_rules)
)
helper.update_access(self.share_server, helper.update_access(self.share_server,
snapshot['name'], access_rules, snapshot['name'], access_rules,
add_rules=add_rules, delete_rules=delete_rules) add_rules=add_rules, delete_rules=delete_rules)
def update_share_usage_size(self, context, shares): def update_share_usage_size(self, context, shares):
updated_shares = [] updated_shares = []
out, err = self._execute( out, err = self._execute(
'df', '-l', '--output=target,used', 'df', '-l', '--output=target,used',
'--block-size=g') '--block-size=g')
skipping to change at line 516 skipping to change at line 527
"found.") % mount_path) "found.") % mount_path)
except Exception: except Exception:
LOG.exception("Failed to gather 'used_size' for share %s.", LOG.exception("Failed to gather 'used_size' for share %s.",
share['id']) share['id'])
return updated_shares return updated_shares
def get_backend_info(self, context): def get_backend_info(self, context):
return { return {
'export_ips': ','.join(self.share_server['public_addresses']), 'export_ips': ','.join(self.share_server['public_addresses']),
'db_version': utils.get_recent_db_migration_id(), 'db_version': share_utils.get_recent_db_migration_id(),
} }
 End of changes. 8 change blocks. 
20 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)