Merge "Add method for update plugin settings"

This commit is contained in:
Jenkins
2016-01-22 13:32:10 +00:00
committed by Gerrit Code Review
4 changed files with 73 additions and 5 deletions

View File

@@ -2370,6 +2370,48 @@ class FuelWebClient(object):
plugin_data[path[-1]] = value
self.client.update_cluster_attributes(cluster_id, attr)
def get_plugin_data(self, cluster_id, plugin_name, version):
"""Return data (settings) for specified version of plugin
:param cluster_id: int
:param plugin_name: string
:param version: string
:return: dict
"""
attr = self.client.get_cluster_attributes(cluster_id)
plugin_data = attr['editable'][plugin_name]
plugin_versions = plugin_data['metadata']['versions']
for p in plugin_versions:
if p['metadata']['plugin_version'] == version:
return p
raise AssertionError("Plugin {0} version {1} is not "
"found".format(plugin_name, version))
def update_plugin_settings(self, cluster_id, plugin_name, version, data):
"""Update settings for specified version of plugin
:param plugin_name: string
:param version: string
:param data: dict - settings for the plugin
:return: None
"""
attr = self.client.get_cluster_attributes(cluster_id)
plugin_versions = attr['editable'][plugin_name]['metadata']['versions']
plugin_data = None
for item in plugin_versions:
if item['metadata']['plugin_version'] == version:
plugin_data = item
break
assert_true(plugin_data is not None, "Plugin {0} version {1} is not "
"found".format(plugin_name, version))
for option, value in data.items():
plugin_data = item
path = option.split("/")
for p in path[:-1]:
plugin_data = plugin_data[p]
plugin_data[path[-1]] = value
self.client.update_cluster_attributes(cluster_id, attr)
@logwrap
def prepare_ceph_to_delete(self, remote_ceph):
hostname = ''.join(remote_ceph.execute(

View File

@@ -403,6 +403,7 @@ CONTRAIL_PLUGIN_PATH = os.environ.get('CONTRAIL_PLUGIN_PATH')
CONTRAIL_PLUGIN_PACK_UB_PATH = os.environ.get('CONTRAIL_PLUGIN_PACK_UB_PATH')
CONTRAIL_PLUGIN_PACK_CEN_PATH = os.environ.get('CONTRAIL_PLUGIN_PACK_CEN_PATH')
DVS_PLUGIN_PATH = os.environ.get('DVS_PLUGIN_PATH')
DVS_PLUGIN_VERSION = os.environ.get('DVS_PLUGIN_VERSION')
GLUSTER_PLUGIN_PATH = os.environ.get('GLUSTER_PLUGIN_PATH')
GLUSTER_CLUSTER_ENDPOINT = os.environ.get('GLUSTER_CLUSTER_ENDPOINT')
EXAMPLE_PLUGIN_PATH = os.environ.get('EXAMPLE_PLUGIN_PATH')

View File

@@ -22,11 +22,35 @@ from system_test.helpers.decorators import action
from system_test.helpers.utils import case_factory
from system_test.tests.actions_base import ActionsBase
from fuelweb_test.settings import DVS_PLUGIN_PATH
from fuelweb_test.settings import DVS_PLUGIN_VERSION
class VMwareActions(ActionsBase):
"""VMware vCenter/DVS related actions"""
plugin_version = None
@deferred_decorator([make_snapshot_if_step_fail])
@action
def enable_plugin(self):
"""Enable plugin for Fuel"""
assert_true(self.plugin_name, "plugin_name is not specified")
msg = "Plugin couldn't be enabled. Check plugin version. Test aborted"
assert_true(
self.fuel_web.check_plugin_exists(
self.cluster_id,
self.plugin_name),
msg)
plugin_data = self.fuel_web.get_plugin_data(self.cluster_id,
self.plugin_name,
self.plugin_version)
options = {'metadata/enabled': True,
'metadata/chosen_id': plugin_data['metadata']['plugin_id']}
self.fuel_web.update_plugin_data(self.cluster_id,
self.plugin_name, options)
@deferred_decorator([make_snapshot_if_step_fail])
@action
def configure_dvs_plugin(self):
@@ -39,12 +63,11 @@ class VMwareActions(ActionsBase):
self.plugin_name),
msg)
options = {'#1_vmware_dvs_net_maps/value': self.full_config[
options = {'vmware_dvs_net_maps/value': self.full_config[
'template']['cluster_template']['settings']['vmware_dvs'][
'dvswitch_name']}
self.fuel_web.update_plugin_data(
self.cluster_id,
self.plugin_name, options)
self.fuel_web.update_plugin_settings(
self.cluster_id, self.plugin_name, self.plugin_version, options)
@deferred_decorator([make_snapshot_if_step_fail])
@action
@@ -179,6 +202,7 @@ class DeployWithVMware(VMwareActions):
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',
@@ -218,6 +242,7 @@ class ScaleWithVMware(VMwareActions):
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',

View File

@@ -16,7 +16,7 @@ template:
settings:
!include cluster_configs/settings/vmware/vcenter_main.yaml
nova-compute:
!include cluster_configs/settings/vmware/nova_compute/1cluster_ctrl.yaml
!include cluster_configs/settings/vmware/nova_compute/2clusters_ctrl_comp-vmware.yaml
glance:
enable: false
vmware_dvs: