Revert "Add validation for performance tuning" 13/1613/1
authorKrisztián Lengyel <krisztian.lengyel@nokia.com>
Wed, 18 Sep 2019 17:11:43 +0000 (17:11 +0000)
committerKrisztián Lengyel <krisztian.lengyel@nokia.com>
Wed, 18 Sep 2019 17:11:43 +0000 (17:11 +0000)
This reverts commit 4408a79c76b53683792df8b45b49aa0062275515.

Reason for revert: Its dependency is missing.

Change-Id: I73bfca888b5f61721bcaad6a7b349155155c1438

recuserconfighandlers/recperformanceprofileshandler/recperformanceprofileshandler.py [deleted file]
validators/src/PerformanceProfilesValidation.py
validators/src/VersionValidation.py

diff --git a/recuserconfighandlers/recperformanceprofileshandler/recperformanceprofileshandler.py b/recuserconfighandlers/recperformanceprofileshandler/recperformanceprofileshandler.py
deleted file mode 100644 (file)
index d83dd4e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /usr/bin/python
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from cmframework.apis import cmuserconfig
-from cmframework.apis import cmerror
-from cmdatahandlers.api import configerror
-
-"""
-This plugin is used to handle REC specific performance profiles configs.
-"""
-
-
-class recperformanceprofileshandler(cmuserconfig.CMUserConfigPlugin):
-    low_latency_options = [
-        'intel_idle.max_cstate=5',
-        'processor.max_cstate=5',
-    ]
-
-    def __init__(self):
-        super(recperformanceprofileshandler, self).__init__()
-
-    def handle(self, confman):
-        try:
-            self._set_default_type_for_provider_networks(confman)
-        except configerror.ConfigError as exp:
-            raise cmerror.CMError(str(exp))
-
-    def set_low_latency_options(self, confman):
-        perfprofconf = self.confman.get_performance_profiles_config_handler()
-        for profile in perfprofconf.get_performance_profiles():
-            perfprofconf.set_low_latency_kcmd_options(profile, self.low_latency_options)
index 1d97430..34bea2e 100644 (file)
@@ -20,7 +20,6 @@ from cmframework.apis import cmvalidator
 
 
 class PerformanceProfilesValidation(cmvalidator.CMValidator):
-    DOMAIN = 'cloud.performance_profiles'
     SUBSCRIPTION = r'^cloud\.performance_profiles$'
 
     HUGEPAGESZ = 'hugepagesz'
@@ -31,24 +30,20 @@ class PerformanceProfilesValidation(cmvalidator.CMValidator):
     CAAS_CPU_POOLS = 'caas_cpu_pools'
     CAAS_CPU_POOL_ATTRIBUTES = ['exclusive_pool_percentage', 'shared_pool_percentage']
     CAAS_CPU_POOL_SHARE = 'caas_cpu_pool_share'
-    TUNING = 'tuning'
 
     NUMA0 = 'numa0'
     NUMA1 = 'numa1'
     NUMA_VALUES = [NUMA0, NUMA1]
 
     HUGEPAGESZ_VALUES = ['2M', '1G']
-    TUNING_OPTIONS = ['low_latency', 'standard']
 
     INFO_HUGEPAGESZ = 'Valid values: %s' % HUGEPAGESZ_VALUES
     INFO_HUGEPAGES = 'Must be positive integer'
     INFO_CPUS = 'Must be zero or positive integer'
     INFO_PLATFORM_CPUS = 'Platform requires at least one core from NUMA0'
-    INFO_TUNING = 'Valid tuning options are %s' % TUNING_OPTIONS
 
     ERR_MISSING_DATA = 'Performance profiles validation input does not contain {} data'
     ERR_INVALID_VALUE = 'Invalid %s value in performance profile {}: %s'
-    ERR_INVALID_CONFIG = 'Invalid {} config (not a dict)'
 
     ERR_HUGEPAGESZ = ERR_INVALID_VALUE % (HUGEPAGESZ, INFO_HUGEPAGESZ)
     ERR_DEFAULT_HUGEPAGESZ = ERR_INVALID_VALUE % (DEFAULT_HUGEPAGESZ, INFO_HUGEPAGESZ)
@@ -60,7 +55,6 @@ class PerformanceProfilesValidation(cmvalidator.CMValidator):
     ERR_CPU_POOL_RATIO = 'caas_cpu_pools total cpu percentage exceeded'
     ERR_CAAS_CPU_POOL_TYPE = 'caas_cpu_pools percentage values should be integer'
     ERR_CAAS_DEFAULT_POOL = 'caas_cpu_pool_share value should be integer between 0 and 100'
-    ERR_TUNING = "Invalid %s value in {}. %s" % (TUNING, INFO_TUNING)
 
     @staticmethod
     def raise_error(context, err_type):
@@ -73,13 +67,12 @@ class PerformanceProfilesValidation(cmvalidator.CMValidator):
         conf = self.get_conf(props)
         if isinstance(conf, dict):
             self.validate(conf)
-        elif conf:
-            self.raise_error(self.DOMAIN, self.ERR_INVALID_CONFIG)
 
     def get_conf(self, props):
-        if not isinstance(props, dict) or self.DOMAIN not in props:
-            self.raise_error(self.DOMAIN, self.ERR_MISSING_DATA)
-        return json.loads(props[self.DOMAIN])
+        domain = 'cloud.performance_profiles'
+        if not isinstance(props, dict) or domain not in props:
+            self.raise_error(domain, self.ERR_MISSING_DATA)
+        return json.loads(props[domain])
 
     def validate(self, conf):
         for profile, entries in conf.iteritems():
@@ -105,8 +98,6 @@ class PerformanceProfilesValidation(cmvalidator.CMValidator):
             self.validate_caas_cpu_pools(profile, value)
         elif key == self.CAAS_CPU_POOL_SHARE:
             self.validate_caas_cpu_pool_share(value)
-        elif key == self.TUNING:
-            self.validate_tuning(profile, value)
 
     def validate_hugepagesz(self, profile, value):
         if value not in self.HUGEPAGESZ_VALUES:
@@ -155,10 +146,6 @@ class PerformanceProfilesValidation(cmvalidator.CMValidator):
         if sum_ratio > 100:
             self.raise_error(profile, self.ERR_CPU_POOL_RATIO)
 
-    def validate_tuning(self, profile, option):
-        if option not in self.TUNING_OPTIONS:
-            self.raise_error(profile, self.ERR_TUNING)
-
     def allowed_attributes(self, profile, entries, allowed_attributes):
         for key in entries.keys():
             if key not in allowed_attributes:
index 5bdff9c..2fa73f3 100644 (file)
@@ -22,10 +22,10 @@ from cmdatahandlers.api import validation
 
 class VersionValidation(cmvalidator.CMValidator):
     domain = 'cloud.version'
-    version = [2, 0, 5]
+    version = [2, 0, 4]
 
     # Should be same as 'version' in release build
-    devel_version = [2, 0, 5]
+    devel_version = [2, 0, 4]
 
     # Example:
     # {1: 'This is the first change requiring new template version (1.1.0)',