Skip to content

Commit

Permalink
Merge pull request #79 from openvstorage/fix_write_buffer_problem
Browse files Browse the repository at this point in the history
fix write buffer problems
  • Loading branch information
jeroenmaelbrancke authored Feb 7, 2018
2 parents 952f5c6 + 55b276c commit fe41482
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 22 deletions.
44 changes: 44 additions & 0 deletions setup/storagedriver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (C) 2016 iNuron NV
#
# This file is part of Open vStorage Open Source Edition (OSE),
# as available from
#
# http://www.openvstorage.org and
# http://www.openvstorage.com.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License v3 (GNU AGPLv3)
# as published by the Free Software Foundation, in version 3 as it comes
# in the LICENSE.txt file of the Open vStorage OSE distribution.
#
# Open vStorage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY of any kind.
from ovs.lib.helpers.toolbox import Toolbox
from ovs.log.log_handler import LogHandler
from ..helpers.storagedriver import StoragedriverHelper
from ..helpers.vpool import VPoolHelper


class StoragedriverSetup(object):
LOGGER = LogHandler.get(source='setup', name='ci_storagedriver_setup')

# These will be all possible settings for the StorageDriver. Messing them up is their own responsibility (they should not bypass the API by default!!)
STORAGEDRIVER_PARAMS = {"volume_manager": (dict, None, False),
"backend_connection_manager": (dict, None, False)}

@staticmethod
def change_config(vpool_name, vpool_details, storagerouter_ip, *args, **kwargs):

# Settings volumedriver
storagedriver_config = vpool_details.get('storagedriver')
if storagedriver_config is not None:
Toolbox.verify_required_params(StoragedriverSetup.STORAGEDRIVER_PARAMS, storagedriver_config)
StoragedriverSetup.LOGGER.info('Updating volumedriver configuration of vPool `{0}` on storagerouter `{1}`.'.format(vpool_name, storagerouter_ip))
vpool = VPoolHelper.get_vpool_by_name(vpool_name)
storagedriver = [sd for sd in vpool.storagedrivers if sd.storagerouter.ip == storagerouter_ip][0]
if not storagedriver:
error_msg = 'Unable to find the storagedriver of vPool {0} on storagerouter {1}'.format(vpool_name, storagerouter_ip)
raise RuntimeError(error_msg)
StoragedriverHelper.change_config(storagedriver, storagedriver_config)
vpool.invalidate_dynamics('configuration')
StoragedriverSetup.LOGGER.info('Updating volumedriver config of vPool `{0}` should have succeeded on storagerouter `{1}`'.format(vpool_name, storagerouter_ip))
23 changes: 1 addition & 22 deletions setup/vpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
# Open vStorage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY of any kind.
from ovs.lib.generic import GenericController
from ovs.lib.helpers.toolbox import Toolbox
from ovs.log.log_handler import LogHandler
from ..helpers.backend import BackendHelper
from ..helpers.storagedriver import StoragedriverHelper
from ..helpers.storagerouter import StoragerouterHelper
from ..helpers.vpool import VPoolHelper
from ..validate.decorators import required_roles, check_vpool


Expand All @@ -29,10 +26,6 @@ class VPoolSetup(object):
ADD_VPOOL_TIMEOUT = 500
REQUIRED_VPOOL_ROLES = ['DB', 'WRITE', 'DTL']

# These will be all possible settings for the StorageDriver. Messing them up is their own responsibility (they should not bypass the API by default!!)
STORAGEDRIVER_PARAMS = {"volume_manager": (dict, None, False),
"backend_connection_manager": (dict, None, False)}

def __init__(self):
pass

Expand Down Expand Up @@ -123,21 +116,7 @@ def add_vpool(vpool_name, vpool_details, api, storagerouter_ip, proxy_amount=2,
raise RuntimeError(error_msg)
else:
VPoolSetup.LOGGER.info('Creation of vPool `{0}` should have succeeded on storagerouter `{1}`'.format(vpool_name, storagerouter_ip))

# Settings volumedriver
storagedriver_config = vpool_details.get('storagedriver')
if storagedriver_config is not None:
Toolbox.verify_required_params(VPoolSetup.STORAGEDRIVER_PARAMS, storagedriver_config)
VPoolSetup.LOGGER.info('Updating volumedriver configuration of vPool `{0}` on storagerouter `{1}`.'.format(vpool_name, storagerouter_ip))
vpool = VPoolHelper.get_vpool_by_name(vpool_name)
storagedriver = [sd for sd in vpool.storagedrivers if sd.storagerouter.ip == storagerouter_ip][0]
if not storagedriver:
error_msg = 'Unable to find the storagedriver of vPool {0} on storagerouter {1}'.format(vpool_name, storagerouter_ip)
raise RuntimeError(error_msg)
StoragedriverHelper.change_config(storagedriver, storagedriver_config)
VPoolSetup.LOGGER.info('Updating volumedriver config of vPool `{0}` should have succeeded on storagerouter `{1}`'.format(vpool_name, storagerouter_ip))

return storagerouter_ip, '/mnt/{0}'.format(vpool_name)
return storagerouter_ip, '/mnt/{0}'.format(vpool_name)

@staticmethod
def execute_scrubbing():
Expand Down

0 comments on commit fe41482

Please sign in to comment.