Merge "vswitch optionality on worker node"
This commit is contained in:
commit
5e1cdcd909
|
@ -15,7 +15,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2016 Wind River Systems, Inc.
|
# Copyright (c) 2013-2019 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
@ -491,10 +491,7 @@ def _update_vswitch_cpu_counts(host, cpu, counts, capabilities=None):
|
||||||
first and that all other allocations will be dynamically adjusted based on
|
first and that all other allocations will be dynamically adjusted based on
|
||||||
how many cores are remaining.
|
how many cores are remaining.
|
||||||
"""
|
"""
|
||||||
labels = pecan.request.dbapi.label_get_by_host(host.uuid)
|
vswitch_type = cutils.get_vswitch_type(pecan.request.dbapi)
|
||||||
if not cutils.has_openstack_compute(labels):
|
|
||||||
raise wsme.exc.ClientSideError(_('vSwitch cpus can only be used with '
|
|
||||||
'openstack-compute nodes.'))
|
|
||||||
for s in range(0, len(host.nodes)):
|
for s in range(0, len(host.nodes)):
|
||||||
if capabilities:
|
if capabilities:
|
||||||
count = capabilities.get('num_cores_on_processor%d' % s, None)
|
count = capabilities.get('num_cores_on_processor%d' % s, None)
|
||||||
|
@ -504,6 +501,10 @@ def _update_vswitch_cpu_counts(host, cpu, counts, capabilities=None):
|
||||||
if count is None:
|
if count is None:
|
||||||
continue
|
continue
|
||||||
count = int(count)
|
count = int(count)
|
||||||
|
if constants.VSWITCH_TYPE_NONE == vswitch_type and count != 0:
|
||||||
|
raise wsme.exc.ClientSideError(
|
||||||
|
_('vSwitch cpus can only be used with a vswitch_type '
|
||||||
|
'specified.'))
|
||||||
if count < 0:
|
if count < 0:
|
||||||
raise wsme.exc.ClientSideError(_('vSwitch cpus must be non-negative.'))
|
raise wsme.exc.ClientSideError(_('vSwitch cpus must be non-negative.'))
|
||||||
if host.hyperthreading:
|
if host.hyperthreading:
|
||||||
|
|
|
@ -4220,6 +4220,21 @@ class HostController(rest.RestController):
|
||||||
"Please refer to system admin guide for more details.") %
|
"Please refer to system admin guide for more details.") %
|
||||||
(ihost['hostname']))
|
(ihost['hostname']))
|
||||||
|
|
||||||
|
def _semantic_check_worker_cpu_assignments(self, host):
|
||||||
|
"""
|
||||||
|
Perform semantic checks that cpu assignments are valid. Changes in
|
||||||
|
vswitch_type may alter vswitch core requirements.
|
||||||
|
"""
|
||||||
|
# If vswitch_type is none, enforce 0 vswitch cpu cores
|
||||||
|
if constants.VSWITCH_TYPE_NONE == cutils.get_vswitch_type(
|
||||||
|
pecan.request.dbapi):
|
||||||
|
host_cpus = pecan.request.dbapi.icpu_get_by_ihost(host['uuid'])
|
||||||
|
for cpu in host_cpus:
|
||||||
|
if cpu.allocated_function == constants.VSWITCH_FUNCTION:
|
||||||
|
raise wsme.exc.ClientSideError(
|
||||||
|
_('vSwitch cpus can only be used with a vswitch_type '
|
||||||
|
'specified.'))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _handle_ttys_dcd_change(ihost, ttys_dcd):
|
def _handle_ttys_dcd_change(ihost, ttys_dcd):
|
||||||
"""
|
"""
|
||||||
|
@ -5186,6 +5201,9 @@ class HostController(rest.RestController):
|
||||||
self._semantic_check_data_addresses(ihost)
|
self._semantic_check_data_addresses(ihost)
|
||||||
self._semantic_check_data_vrs_attributes(ihost)
|
self._semantic_check_data_vrs_attributes(ihost)
|
||||||
|
|
||||||
|
# Check if cpu assignments are valid
|
||||||
|
self._semantic_check_worker_cpu_assignments(ihost)
|
||||||
|
|
||||||
# check if the platform reserved memory is valid
|
# check if the platform reserved memory is valid
|
||||||
ihost_inodes = pecan.request.dbapi.inode_get_by_ihost(ihost['uuid'])
|
ihost_inodes = pecan.request.dbapi.inode_get_by_ihost(ihost['uuid'])
|
||||||
mib_reserved = 0
|
mib_reserved = 0
|
||||||
|
|
|
@ -2547,6 +2547,8 @@ class ConductorManager(service.PeriodicService):
|
||||||
cpu_count, hyperthreading):
|
cpu_count, hyperthreading):
|
||||||
"""Return the initial number of reserved logical cores for vswitch
|
"""Return the initial number of reserved logical cores for vswitch
|
||||||
use. This can be overridden later by the end user."""
|
use. This can be overridden later by the end user."""
|
||||||
|
if constants.VSWITCH_TYPE_NONE == cutils.get_vswitch_type(self.dbapi):
|
||||||
|
return 0
|
||||||
if cutils.host_has_function(ihost, constants.WORKER) and node == 0:
|
if cutils.host_has_function(ihost, constants.WORKER) and node == 0:
|
||||||
physical_cores = (cpu_count / 2) if hyperthreading else cpu_count
|
physical_cores = (cpu_count / 2) if hyperthreading else cpu_count
|
||||||
system_mode = self.dbapi.isystem_get_one().system_mode
|
system_mode = self.dbapi.isystem_get_one().system_mode
|
||||||
|
|
Loading…
Reference in New Issue