Use os-resource-classes lib for resource classes names
The os-resource-classes lib is the official source of the standard placement resource classes. Currently, the neutron-lib contains a copy of those constants. However, they are already marked as deprecated and are going to be removed with next major release. Related-Bug: #1934256 Change-Id: I33ecd6f32410f9b7ab1e87a6640201ea157bc383
This commit is contained in:
parent
2acb96c374
commit
26b06d246a
@ -54,6 +54,7 @@ neutron-lib==2.12.0
|
||||
openstacksdk==0.31.2
|
||||
os-client-config==1.28.0
|
||||
os-ken==2.0.0
|
||||
os-resource-classes==0.2.0
|
||||
os-service-types==1.7.0
|
||||
os-vif==1.15.1
|
||||
osc-lib==1.8.0
|
||||
|
@ -13,8 +13,8 @@
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants as nlib_const
|
||||
from neutron_lib.placement import constants as place_const
|
||||
from neutron_lib.placement import utils as place_utils
|
||||
import os_resource_classes as orc
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -209,9 +209,9 @@ class PlacementState(object):
|
||||
inventories = {}
|
||||
for direction, rp_class in (
|
||||
(nlib_const.EGRESS_DIRECTION,
|
||||
place_const.CLASS_NET_BW_EGRESS_KBPS),
|
||||
orc.NET_BW_EGR_KILOBIT_PER_SEC),
|
||||
(nlib_const.INGRESS_DIRECTION,
|
||||
place_const.CLASS_NET_BW_INGRESS_KBPS)):
|
||||
orc.NET_BW_IGR_KILOBIT_PER_SEC)):
|
||||
if bw_values[direction] is not None:
|
||||
inventory = dict(self._rp_inventory_defaults)
|
||||
inventory['total'] = bw_values[direction]
|
||||
|
@ -34,9 +34,9 @@ from neutron_lib.db import resource_extend
|
||||
from neutron_lib import exceptions as lib_exc
|
||||
from neutron_lib.exceptions import qos as qos_exc
|
||||
from neutron_lib.placement import client as pl_client
|
||||
from neutron_lib.placement import constants as pl_constants
|
||||
from neutron_lib.placement import utils as pl_utils
|
||||
from neutron_lib.services.qos import constants as qos_consts
|
||||
import os_resource_classes as orc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -151,9 +151,9 @@ class QoSPlugin(qos.QoSPluginBase):
|
||||
# NOTE(ralonsoh): we should move this translation dict to n-lib.
|
||||
rule_direction_class = {
|
||||
nl_constants.INGRESS_DIRECTION:
|
||||
pl_constants.CLASS_NET_BW_INGRESS_KBPS,
|
||||
orc.NET_BW_IGR_KILOBIT_PER_SEC,
|
||||
nl_constants.EGRESS_DIRECTION:
|
||||
pl_constants.CLASS_NET_BW_EGRESS_KBPS
|
||||
orc.NET_BW_EGR_KILOBIT_PER_SEC
|
||||
}
|
||||
for rule in min_bw_rules:
|
||||
resources[rule_direction_class[rule.direction]] = rule.min_kbps
|
||||
@ -285,9 +285,9 @@ class QoSPlugin(qos.QoSPluginBase):
|
||||
# TODO(lajoskatona): move this to neutron-lib, see similar
|
||||
# dict @l125.
|
||||
if d_dir == 'egress':
|
||||
drctn = pl_constants.CLASS_NET_BW_EGRESS_KBPS
|
||||
drctn = orc.NET_BW_EGR_KILOBIT_PER_SEC
|
||||
else:
|
||||
drctn = pl_constants.CLASS_NET_BW_INGRESS_KBPS
|
||||
drctn = orc.NET_BW_IGR_KILOBIT_PER_SEC
|
||||
return {drctn: diff}
|
||||
return {}
|
||||
|
||||
|
@ -23,11 +23,11 @@ from neutron_lib import exceptions as lib_exc
|
||||
from neutron_lib.exceptions import placement as pl_exc
|
||||
from neutron_lib.exceptions import qos as qos_exc
|
||||
from neutron_lib.objects import utils as obj_utils
|
||||
from neutron_lib.placement import constants as pl_constants
|
||||
from neutron_lib.plugins import constants as plugins_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services.qos import constants as qos_consts
|
||||
from neutron_lib.utils import net as net_utils
|
||||
import os_resource_classes as orc
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
import webob.exc
|
||||
@ -158,7 +158,7 @@ class TestQosPlugin(base.BaseQosTestCase):
|
||||
port['resource_request']['required']
|
||||
)
|
||||
self.assertEqual(
|
||||
{pl_constants.CLASS_NET_BW_EGRESS_KBPS: 10},
|
||||
{orc.NET_BW_EGR_KILOBIT_PER_SEC: 10},
|
||||
port['resource_request']['resources'],
|
||||
)
|
||||
|
||||
@ -179,8 +179,8 @@ class TestQosPlugin(base.BaseQosTestCase):
|
||||
)
|
||||
self.assertEqual(
|
||||
{
|
||||
pl_constants.CLASS_NET_BW_EGRESS_KBPS: 10,
|
||||
pl_constants.CLASS_NET_BW_INGRESS_KBPS: 20
|
||||
orc.NET_BW_EGR_KILOBIT_PER_SEC: 10,
|
||||
orc.NET_BW_IGR_KILOBIT_PER_SEC: 20
|
||||
},
|
||||
port['resource_request']['resources'],
|
||||
)
|
||||
@ -213,7 +213,7 @@ class TestQosPlugin(base.BaseQosTestCase):
|
||||
port['resource_request']['required']
|
||||
)
|
||||
self.assertEqual(
|
||||
{pl_constants.CLASS_NET_BW_EGRESS_KBPS: 10},
|
||||
{orc.NET_BW_EGR_KILOBIT_PER_SEC: 10},
|
||||
port['resource_request']['resources'],
|
||||
)
|
||||
|
||||
|
@ -44,6 +44,7 @@ oslo.utils>=4.5.0 # Apache-2.0
|
||||
oslo.versionedobjects>=1.35.1 # Apache-2.0
|
||||
osprofiler>=2.3.0 # Apache-2.0
|
||||
os-ken>=2.0.0 # Apache-2.0
|
||||
os-resource-classes>=0.2.0 # Apache-2.0
|
||||
ovs>=2.10.0 # Apache-2.0
|
||||
ovsdbapp>=1.11.0 # Apache-2.0
|
||||
packaging>=20.4 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user