Closed wimpers closed 7 years ago
https://github.com/openvstorage/framework/pull/1109 --> openvstorage-2.7.4-rev.4243.1b1eb26
@QA: VDiskController.get_config_params should no longer return any information regarding caching: Caching strategy, caching behavior, readcache limit
In the GUI, on the management actions tab, all 'caching' information should be gone
Test the fetching of the information (as mentioned in the ticket) and the changing of the caching (editing the values of the cache - test for backwards compatibility eg. old api still functions)(Not mentioned in the ticket)
# 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 ci.helpers.api import OVSClient
class VDiskTest(object):
def __init__(self):
self.api = OVSClient('10.100.199.151', 'admin', 'admin')
def run(self):
# Run all test cases
self.test_get_config_params()
self.test_set_config_params(old=False)
self.test_set_config_params(old=True)
def _get_config_params(self, vdisk_guid):
task_guid = self.api.get('/vdisks/{0}/get_config_params'.format(vdisk_guid))
task_result = self.api.wait_for_task(task_id=task_guid, timeout=30)
if not task_result[0]:
error_msg = "Fetching config_params for vdisk '{0}' failed with '{1}'".format(vdisk_guid, task_result[1])
raise RuntimeError(error_msg)
return task_result[1]
def _set_config_params(self, vdisk_guid, data):
task_guid = self.api.post('/vdisks/{0}/set_config_params'.format(vdisk_guid), data)
task_result = self.api.wait_for_task(task_id=task_guid, timeout=30)
if not task_result[0]:
error_msg = "Setting config_params for vdisk '{0}' with config '{1}' failed with '{2}'".format(vdisk_guid, data, task_result[1])
raise RuntimeError(error_msg)
return task_result[0]
def test_get_config_params(self):
# GUID fetched on GUI
guid = 'da968368-978a-4d1b-907c-5999d6d622a3'
required_keys = ['dtl_mode', 'dtl_target', 'metadata_cache_size', 'sco_size', 'write_buffer']
config_params = self._get_config_params(guid)
if len(config_params.keys()) != len(required_keys):
raise ValueError("Found more keys than expected. Expected '{0}' and found '{1}'".format(', '.join(required_keys), ', '.join(config_params.keys())))
elif set(required_keys) != set(config_params.keys()):
raise ValueError("Found different keys than expected. Expected '{0}' and found '{1}'".format(', '.join(required_keys),', '.join(config_params.keys())))
else:
# Test passed
print "get_config_params test passed"
def test_set_config_params(self, old=False):
# GUID fetched on GUI
guid = 'da968368-978a-4d1b-907c-5999d6d622a3'
if old is True:
data = {
'new_config_params': {
'dtl_mode': 'no_sync',
'dtl_target': [],
'readcache_limit': 1,
'write_buffer': 128,
'cache_strategy': None,
'dedupe_mode': 'non_dedupe',
'sco_size': 4
}
}
else:
data = {
'new_config_params':{
'dtl_mode': 'no_sync',
'dtl_target': [],
'write_buffer': 128,
'sco_size': 4
}
}
success = self._set_config_params(guid, data)
if success is True:
# Store checked keys
failed_keys = []
successful_keys = []
required_succesful_keys = ['dtl_mode', 'dtl_target', 'sco_size', 'write_buffer']
config_params = self._get_config_params(guid)
for key in config_params.keys():
if key in config_params and key in data['new_config_params']:
if data['new_config_params'][key] == config_params[key]:
successful_keys.append(key)
else:
failed_keys.append(key)
else:
failed_keys.append(key)
if set(successful_keys) != set(required_succesful_keys):
raise ValueError("Certain keys do not match the required keys. Found '{0}' and expected '{1}'".format(', '.join(successful_keys), ', '.join(required_succesful_keys)))
else:
print "set_config_params test passed"
else:
raise RuntimeError('Setting config went wrong')
if __name__ == "__main__":
VDiskTest().run()
Pages
Previous vdisk detail page:
New detail page:
API
Traceback (most recent call last):
File "/opt/OpenvStorage/ci/test/vdisktest.py", line 114, in <module>
VDiskTest().run()
File "/opt/OpenvStorage/ci/test/vdisktest.py", line 29, in run
self.test_set_config_params(old=True)
File "/opt/OpenvStorage/ci/test/vdisktest.py", line 90, in test_set_config_params
success = self._set_config_params(guid, data)
File "/opt/OpenvStorage/ci/test/vdisktest.py", line 46, in _set_config_params
raise RuntimeError(error_msg)
RuntimeError: Setting config_params for vdisk 'da968368-978a-4d1b-907c-5999d6d622a3' with config '{'new_config_params': {'write_buffer': 128, 'sco_size': 4, 'cache_strategy': None, 'dtl_target': [], 'dedupe_mode': 'non_dedupe', 'readcache_limit': 1, 'dtl_mode': 'no_sync'}}' failed with 'Failed to update the values for vDisk myvdisk01'
Process finished with exit code 1
The api code seems to fail when supplying the old params of set_config_params. Log:
2016-11-02 11:39:31 53700 +0100 - ovs-node1 - 12701/140444680058688 - lib/vdisk - 880 - ERROR - Error updating "cache_strategy": u'cache_strategy'
2016-11-02 11:39:31 53700 +0100 - ovs-node1 - 12701/140444680058688 - lib/vdisk - 881 - ERROR - Error updating "dedupe_mode": u'dedupe_mode'
2016-11-02 11:39:31 53700 +0100 - ovs-node1 - 12701/140444680058688 - lib/vdisk - 882 - ERROR - Error updating "readcache_limit": u'readcache_limit'
API is not backwards compatible.
Test failed.
https://github.com/openvstorage/framework/pull/1113 --> openvstorage-2.7.4-rev.4254.b181bf9
This fixes the API backwards incompatibility
Backwards compatible fix has been implemented.
get_config_params test passed
set_config_params test passed with new settings
set_config_params test passed with old settings
Test passed.
On a vDisk detail page remove the caching section (strategy, dedupe, read cache limit)