openvstorage / framework

The Framework is a set of components and tools which brings the user an interface (GUI / API) to setup, extend and manage an Open vStorage platform.
Other
27 stars 23 forks source link

Dropdown in add vpool wizard keeps on loading presets when using alba backend that has no presets with satisfiable policy #1072

Closed domsj closed 8 years ago

domsj commented 8 years ago

The dropdown keeps on showing that it's loading the presets, while it should say there are no presets available that can currently be used to write new data with. (Or maybe that there are no presets at all, and some hint to go create one on the backend page.)

This came out of @khenderick testing what the impact of having no default preset in alba would be, but is applicable even when there are presets present.

(Another minor glitch exists on the presets tab of backend page: the colspan for the empty list view isn't large enough)

khenderick commented 8 years ago

Fixed by #1073 and openvstorage/framework-alba-plugin#249, packaged in openvstorage-2.7.4-rev.4188.eb2ed2f and openvstorage-backend-1.7.4-rev.780.3c3a382

JeffreyDevloo commented 8 years ago

Information

I never encountered this error before. When there was no satisfiable policy, I'd get a error remark on the vpool wizard.

Steps

Test case 1

Test case 2

Output

Test case 1

selection_021

The vpool can still be created (intended behaviour) and will fail mid-way.

Test case 2 Removal of preset

alba delete-preset default --config arakoon://config/ovs/arakoon/mybackend-abm/config?ini=%2Fopt%2FOpenvStorage%2Fconfig%2Farakoon_cacc.ini

Vpool wizard: selection_022

Test result

Test passed.

Packages

JeffreyDevloo commented 8 years ago

Information

Forgot to validate using the web api directly.

Steps

Code:

from ci.helpers.api import OVSClient
from ovs.dal.lists.storagerouterlist import StorageRouterList
from ovs.dal.lists.albabackendlist import AlbaBackendList
# Loading integration test ovsclient for password login

# Requires a backend to be already setup

class StoragerouterHelper(object):

    @staticmethod
    def get_storagerouter_by_ip(storagerouter_ip):
        """

        :param storagerouter_ip: ip of a storagerouter
        :type storagerouter_ip: str
        :return: storagerouter object
        :rtype: ovs.dal.hybrids.storagerouter.StorageRouter
        """
        return StorageRouterList.get_by_ip(storagerouter_ip)

class BackendHelper(object):

    @staticmethod
    def get_albabackend_by_name(albabackend_name):
        """
        Get a Albabackend by name

        :param albabackend_name: albabackend name
        :type albabackend_name: str
        :return: alba backend object
        :rtype: ovs.dal.hybrids.albabackend
        """

        try:
            return [alba_backend for alba_backend in AlbaBackendList.get_albabackends()
                    if alba_backend.name == albabackend_name][0]
        except IndexError:
            error_msg = "No Alba backend found with name: {0}".format(albabackend_name)
            raise NameError(error_msg)

class VPoolTest(object):

    def __init__(self):
        self.vpool_details = {
            "backend_name": "mybackend",
            "preset": "default",
            "storage_ip": "10.100.199.151",
            "fragment_cache": {
                "strategy": {"cache_on_read": True, "cache_on_write": True},
                "location": "disk"
            },
            "storagedriver": {
                "sco_size": 4,
                "cluster_size": 4,
                "volume_write_buffer": 512,
                "strategy": "none",
                "global_write_buffer": 2,
                "global_read_buffer": 0,
                "deduplication": "non_dedupe",
                "dtl_transport": "tcp",
                "dtl_mode": "a_sync"
            }
        }
        self.storagerouter_ip = '10.100.199.151'
        self.vpool_name = 'test-check'
        self.api = OVSClient(self.storagerouter_ip, 'admin', 'admin')

    def validate(self, old=True):
        if old is True:
            self.test_vpool(self.storagerouter_ip, self.vpool_name, self.vpool_details, self.api)

    @staticmethod
    def test_vpool(storagerouter_ip, vpool_name, vpool_details, api):
        """
        Will add a vpool without checking whether or not the mount point is in use
        :return:
        """

        # Add vpool because mointpoint is not in use
        # Build ADD_VPOOL parameters
        call_parameters = {
            "call_parameters": {
                "vpool_name": vpool_name,
                "type": "alba",
                "backend_connection_info": {
                    "host": "",
                    "port": 80,
                    "username": "",
                    "password": "",
                    "backend": {
                        "backend": BackendHelper.get_albabackend_by_name(vpool_details['backend_name']).guid,
                        "metadata": vpool_details['preset']
                    }
                },
                "storage_ip": vpool_details['storage_ip'],
                "storagerouter_ip": storagerouter_ip,
                "readcache_size": int(vpool_details['storagedriver']['global_read_buffer']),
                "writecache_size": int(vpool_details['storagedriver']['global_write_buffer']),
                "fragment_cache_on_read": vpool_details['fragment_cache']['strategy']['cache_on_read'],
                "fragment_cache_on_write": vpool_details['fragment_cache']['strategy']['cache_on_write'],
                "config_params": {
                    "dtl_mode": vpool_details['storagedriver']['dtl_mode'],
                    "sco_size": int(vpool_details['storagedriver']['sco_size']),
                    "dedupe_mode": vpool_details['storagedriver']['deduplication'],
                    "cluster_size": int(vpool_details['storagedriver']['cluster_size']),
                    "write_buffer": int(vpool_details['storagedriver']['volume_write_buffer']),
                    "dtl_transport": vpool_details['storagedriver']['dtl_transport'],
                    "cache_strategy": vpool_details['storagedriver']['strategy']
                }
            }
        }

        task_guid = api.post(
            api='/storagerouters/{0}/add_vpool/'.format(
                StoragerouterHelper.get_storagerouter_by_ip(storagerouter_ip).guid),
            data=call_parameters
        )
        task_result = api.wait_for_task(task_id=task_guid, timeout=120)
        if not task_result[0]:
            error_msg = "vPool `{0}` has failed to create on storagerouter `{1}`. Call returned {2}".format(vpool_name,storagerouter_ip, task_result)
            raise RuntimeError(error_msg)
        else:
            print "Creation of vPool `{0}` should have succeeded on storagerouter `{1}`".format(vpool_name,
                                                                                                storagerouter_ip)
            return storagerouter_ip, "/mnt/{0}".format(vpool_name)

Output

In [3]: VPoolTest().validate()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-d7ab03d39d97> in <module>()
----> 1 VPoolTest().validate()

<ipython-input-2-c6aab5a434d0> in validate(self, old)
     69     def validate(self, old=True):
     70         if old is True:
---> 71             self.test_vpool(self.storagerouter_ip, self.vpool_name, self.vpool_details, self.api)
     72 
     73     @staticmethod

<ipython-input-2-c6aab5a434d0> in test_vpool(storagerouter_ip, vpool_name, vpool_details, api)
    120         if not task_result[0]:
    121             error_msg = "vPool `{0}` has failed to create on storagerouter `{1}`. Call returned {2}".format(vpool_name,storagerouter_ip, task_result)
--> 122             raise RuntimeError(error_msg)
    123         else:
    124             print "Creation of vPool `{0}` should have succeeded on storagerouter `{1}`".format(vpool_name,

RuntimeError: vPool `test-check` has failed to create on storagerouter `10.100.199.151`. Call returned (False, u'Given preset default is not available in backend 42b8588b-3541-4156-ae30-fb7f3b4f9368')

Test result

A preset must be given for the API to create a vpool. Test passed.