Add bandwidth related standard resource classes
Introduce NET_BW_EGR_KILOBIT_PER_SEC and NET_BW_IGR_KILOBIT_PER_SEC resource classes. blueprint bandwidth-resource-provider Change-Id: I996bf705b14b564106426a2e57299638fb178750
This commit is contained in:
committed by
Matt Riedemann
parent
90b96170d3
commit
b93b40c6c0
@@ -41,12 +41,19 @@ class ResourceClass(fields.StringField):
|
|||||||
IPV4_ADDRESS = 'IPV4_ADDRESS'
|
IPV4_ADDRESS = 'IPV4_ADDRESS'
|
||||||
VGPU = 'VGPU'
|
VGPU = 'VGPU'
|
||||||
VGPU_DISPLAY_HEAD = 'VGPU_DISPLAY_HEAD'
|
VGPU_DISPLAY_HEAD = 'VGPU_DISPLAY_HEAD'
|
||||||
|
# Standard resource class for network bandwidth egress measured in
|
||||||
|
# kilobits per second.
|
||||||
|
NET_BW_EGR_KILOBIT_PER_SEC = 'NET_BW_EGR_KILOBIT_PER_SEC'
|
||||||
|
# Standard resource class for network bandwidth ingress measured in
|
||||||
|
# kilobits per second.
|
||||||
|
NET_BW_IGR_KILOBIT_PER_SEC = 'NET_BW_IGR_KILOBIT_PER_SEC'
|
||||||
|
|
||||||
# The ordering here is relevant. If you must add a value, only
|
# The ordering here is relevant. If you must add a value, only
|
||||||
# append.
|
# append.
|
||||||
STANDARD = (VCPU, MEMORY_MB, DISK_GB, PCI_DEVICE, SRIOV_NET_VF,
|
STANDARD = (VCPU, MEMORY_MB, DISK_GB, PCI_DEVICE, SRIOV_NET_VF,
|
||||||
NUMA_SOCKET, NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB,
|
NUMA_SOCKET, NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB,
|
||||||
IPV4_ADDRESS, VGPU, VGPU_DISPLAY_HEAD)
|
IPV4_ADDRESS, VGPU, VGPU_DISPLAY_HEAD,
|
||||||
|
NET_BW_EGR_KILOBIT_PER_SEC, NET_BW_IGR_KILOBIT_PER_SEC)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def normalize_name(cls, rc_name):
|
def normalize_name(cls, rc_name):
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ tests:
|
|||||||
- name: list resource classes
|
- name: list resource classes
|
||||||
GET: /resource_classes
|
GET: /resource_classes
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.resource_classes.`len`: 12 # Number of standard resource classes
|
$.resource_classes.`len`: 14 # Number of standard resource classes
|
||||||
|
|
||||||
- name: create resource class
|
- name: create resource class
|
||||||
POST: /resource_classes
|
POST: /resource_classes
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ tests:
|
|||||||
GET: /resource_classes
|
GET: /resource_classes
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.resource_classes.`len`: 12 # Number of standard resource classes
|
$.resource_classes.`len`: 14 # Number of standard resource classes
|
||||||
$.resource_classes[0].name: VCPU
|
$.resource_classes[0].name: VCPU
|
||||||
|
|
||||||
- name: non admin forbidden
|
- name: non admin forbidden
|
||||||
@@ -138,9 +138,9 @@ tests:
|
|||||||
- name: list resource classes after addition of custom res class
|
- name: list resource classes after addition of custom res class
|
||||||
GET: /resource_classes
|
GET: /resource_classes
|
||||||
response_json_paths:
|
response_json_paths:
|
||||||
$.resource_classes.`len`: 13 # 12 standard plus 1 custom
|
$.resource_classes.`len`: 15 # 14 standard plus 1 custom
|
||||||
$.resource_classes[12].name: $ENVIRON['CUSTOM_RES_CLASS']
|
$.resource_classes[14].name: $ENVIRON['CUSTOM_RES_CLASS']
|
||||||
$.resource_classes[12].links[?rel = "self"].href: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
|
$.resource_classes[14].links[?rel = "self"].href: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
|
||||||
|
|
||||||
- name: update standard resource class bad json
|
- name: update standard resource class bad json
|
||||||
PUT: /resource_classes/VCPU
|
PUT: /resource_classes/VCPU
|
||||||
|
|||||||
@@ -337,20 +337,10 @@ class TestResourceClass(TestString):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestResourceClass, self).setUp()
|
super(TestResourceClass, self).setUp()
|
||||||
self.field = rc_fields.ResourceClassField()
|
self.field = rc_fields.ResourceClassField()
|
||||||
self.coerce_good_values = [
|
# NOTE(gibi): We assume that the input value of a STANDARD RC is always
|
||||||
('VCPU', 'VCPU'),
|
# the same as the coerced value
|
||||||
('MEMORY_MB', 'MEMORY_MB'),
|
self.coerce_good_values = [(v, v) for v in
|
||||||
('DISK_GB', 'DISK_GB'),
|
rc_fields.ResourceClass.STANDARD]
|
||||||
('PCI_DEVICE', 'PCI_DEVICE'),
|
|
||||||
('SRIOV_NET_VF', 'SRIOV_NET_VF'),
|
|
||||||
('NUMA_SOCKET', 'NUMA_SOCKET'),
|
|
||||||
('NUMA_CORE', 'NUMA_CORE'),
|
|
||||||
('NUMA_THREAD', 'NUMA_THREAD'),
|
|
||||||
('NUMA_MEMORY_MB', 'NUMA_MEMORY_MB'),
|
|
||||||
('IPV4_ADDRESS', 'IPV4_ADDRESS'),
|
|
||||||
('VGPU', 'VGPU'),
|
|
||||||
('VGPU_DISPLAY_HEAD', 'VGPU_DISPLAY_HEAD'),
|
|
||||||
]
|
|
||||||
self.coerce_bad_values = [object(), dict()]
|
self.coerce_bad_values = [object(), dict()]
|
||||||
self.to_primitive_values = self.coerce_good_values[0:1]
|
self.to_primitive_values = self.coerce_good_values[0:1]
|
||||||
self.from_primitive_values = self.coerce_good_values[0:1]
|
self.from_primitive_values = self.coerce_good_values[0:1]
|
||||||
|
|||||||
Reference in New Issue
Block a user