Merge "support dpdk"
This commit is contained in:
commit
6f28c32b08
|
@ -29,6 +29,7 @@ from daisy.common import exception
|
||||||
import daisy.registry.client.v1.api as registry
|
import daisy.registry.client.v1.api as registry
|
||||||
import daisy.api.backends.common as daisy_cmn
|
import daisy.api.backends.common as daisy_cmn
|
||||||
from daisy.api.backends.kolla import config as kconfig
|
from daisy.api.backends.kolla import config as kconfig
|
||||||
|
import re
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
@ -334,6 +335,15 @@ def _daisy_conf_mcast_flag():
|
||||||
return daisy_conf_mcast_enabled
|
return daisy_conf_mcast_enabled
|
||||||
|
|
||||||
|
|
||||||
|
def convert_string_to_hex(isocpus):
|
||||||
|
isocpus_list = re.findall(r"\d+\.?\d*", isocpus.encode())
|
||||||
|
isocpus_int = 0
|
||||||
|
for i in isocpus_list:
|
||||||
|
isocpus_int = isocpus_int + 2**int(i)
|
||||||
|
isocpus_hex = hex(isocpus_int)[2:]
|
||||||
|
return isocpus_hex
|
||||||
|
|
||||||
|
|
||||||
class MulticastServerTask(object):
|
class MulticastServerTask(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -517,6 +527,7 @@ def get_cluster_kolla_config(req, cluster_id):
|
||||||
ext_macname_list = []
|
ext_macname_list = []
|
||||||
sto_macname_list = []
|
sto_macname_list = []
|
||||||
hbt_macname_list = []
|
hbt_macname_list = []
|
||||||
|
enable_dvs_list = []
|
||||||
vlans_id = {}
|
vlans_id = {}
|
||||||
openstack_version = '3.0.0'
|
openstack_version = '3.0.0'
|
||||||
docker_namespace = 'kolla'
|
docker_namespace = 'kolla'
|
||||||
|
@ -640,6 +651,29 @@ def get_cluster_kolla_config(req, cluster_id):
|
||||||
break
|
break
|
||||||
storage_ip_list.append(com_host_ip)
|
storage_ip_list.append(com_host_ip)
|
||||||
kolla_config.update({'Storage_ips': storage_ip_list})
|
kolla_config.update({'Storage_ips': storage_ip_list})
|
||||||
|
LOG.info("update enable_dvs config")
|
||||||
|
params = {'cluster_id': cluster_id}
|
||||||
|
hosts = registry.get_hosts_detail(req.context, **params)
|
||||||
|
for host in hosts:
|
||||||
|
host_detail = registry.get_host_metadata(req.context,
|
||||||
|
host['id'])
|
||||||
|
enable_dvs = False
|
||||||
|
isolcpus = ''
|
||||||
|
for interface in host_detail['interfaces']:
|
||||||
|
vswitch_type = interface.get("vswitch_type")
|
||||||
|
if vswitch_type == 'dvs':
|
||||||
|
enable_dvs = True
|
||||||
|
isolcpus = host_detail['isolcpus']
|
||||||
|
break
|
||||||
|
enable_dvs_list.append(enable_dvs)
|
||||||
|
if len(set(enable_dvs_list)) != 1:
|
||||||
|
msg = (_("hosts interface vswitch type must be same!"))
|
||||||
|
LOG.error(msg)
|
||||||
|
raise HTTPForbidden(msg)
|
||||||
|
else:
|
||||||
|
isolcpus_hex = convert_string_to_hex(isolcpus)
|
||||||
|
kolla_config.update({'enable_dvs': enable_dvs})
|
||||||
|
kolla_config.update({'ovs_dpdk_pmd_coremask': isolcpus_hex})
|
||||||
return (kolla_config, mgt_ip_list, host_name_ip_list)
|
return (kolla_config, mgt_ip_list, host_name_ip_list)
|
||||||
|
|
||||||
|
|
||||||
|
@ -654,3 +688,4 @@ def generate_kolla_config_file(req, cluster_id, kolla_config, multicast_flag):
|
||||||
kolla_config)
|
kolla_config)
|
||||||
kconfig.enable_neutron_backend(req, cluster_id, kolla_config)
|
kconfig.enable_neutron_backend(req, cluster_id, kolla_config)
|
||||||
#kconfig.enable_ceilometer()
|
#kconfig.enable_ceilometer()
|
||||||
|
kconfig.enable_openvswitch_dpdk(kolla_config)
|
||||||
|
|
|
@ -302,6 +302,21 @@ def update_globals_yml(config_data, multicast_flag):
|
||||||
default_flow_style=False)
|
default_flow_style=False)
|
||||||
|
|
||||||
|
|
||||||
|
def enable_openswitch_dpdk(kolla_config):
|
||||||
|
if kolla_config['enable_dvs']:
|
||||||
|
openswitch_dpdk_config = {
|
||||||
|
'enable_ovs_dpdk': 'yes',
|
||||||
|
'neutron_bridge_name': 'dpdk_bridge',
|
||||||
|
'tunnel_interface': 'dpdk_bridge',
|
||||||
|
'enable_openvswitch': 'yes',
|
||||||
|
'ovs_hugepage_mountpoint': '/mnt/huge_1GB'}
|
||||||
|
openswitch_dpdk_config['ovs_dpdk_pmd_coremask'] = \
|
||||||
|
kolla_config['ovs_dpdk_pmd_coremask']
|
||||||
|
update_kolla_globals_yml(openswitch_dpdk_config)
|
||||||
|
else:
|
||||||
|
LOG.info(_("no need to config openvswitch dpdk"))
|
||||||
|
|
||||||
|
|
||||||
def update_password_yml():
|
def update_password_yml():
|
||||||
LOG.info(_("begin to update kolla's passwd.yml file..."))
|
LOG.info(_("begin to update kolla's passwd.yml file..."))
|
||||||
cmd = 'python '\
|
cmd = 'python '\
|
||||||
|
|
|
@ -769,18 +769,24 @@ def _host_update(context, values, host_id):
|
||||||
for networks_plane in merged_assigned_networks:
|
for networks_plane in merged_assigned_networks:
|
||||||
network_plane_names = \
|
network_plane_names = \
|
||||||
networks_plane['name'].split(',')
|
networks_plane['name'].split(',')
|
||||||
|
#because EXTERNAL plane will not be assigned ip,
|
||||||
|
#when EXTERNAL and DATAPLANE with same cidr/vlan, skip EXTERNAL plane
|
||||||
|
if network_plane_names[0] == 'EXTERNAL' and len(network_plane_names) > 1:
|
||||||
|
network_plane_name = network_plane_names[1]
|
||||||
|
else:
|
||||||
|
network_plane_name = network_plane_names[0]
|
||||||
network_plane_ip = networks_plane.get('ip')
|
network_plane_ip = networks_plane.get('ip')
|
||||||
if network_plane_ip:
|
if network_plane_ip:
|
||||||
check_ip_exist(
|
check_ip_exist(
|
||||||
values['cluster'],
|
values['cluster'],
|
||||||
network_plane_names[0],
|
network_plane_name,
|
||||||
network_plane_ip,
|
network_plane_ip,
|
||||||
session)
|
session)
|
||||||
else:
|
else:
|
||||||
network_plane_ip = \
|
network_plane_ip = \
|
||||||
according_to_cidr_distribution_ip(
|
according_to_cidr_distribution_ip(
|
||||||
values['cluster'],
|
values['cluster'],
|
||||||
network_plane_names[0],
|
network_plane_name,
|
||||||
session)
|
session)
|
||||||
|
|
||||||
if 'MANAGEMENT' in network_plane_names:
|
if 'MANAGEMENT' in network_plane_names:
|
||||||
|
|
|
@ -287,6 +287,20 @@ host5_meta = {u'os_version_id': None,
|
||||||
u'dvsp_cpus': None,
|
u'dvsp_cpus': None,
|
||||||
u'deleted_at': None,
|
u'deleted_at': None,
|
||||||
u'id': u'9423980b-ec76-475a-b45f-558eb4b7dfed',
|
u'id': u'9423980b-ec76-475a-b45f-558eb4b7dfed',
|
||||||
|
u'interfaces': [{u'assigned_networks':
|
||||||
|
[{u'ip': u'127.0.0.1',
|
||||||
|
u'name': u'MANAGEMENT',
|
||||||
|
u'type': u'MANAGEMENT'}],
|
||||||
|
u'host_id':
|
||||||
|
u'9423980b-ec76-475a-b45f-558eb4b7dfed',
|
||||||
|
u'id': u'299fc41d-dde5-45ca-be3b-c94693d2b9ce',
|
||||||
|
u'ip': u'192.168.1.11', u'is_deployment': True,
|
||||||
|
u'mac': u'4c:09:b4:b2:79:8a',
|
||||||
|
u'mode': None, u'name': u'enp132s0f0',
|
||||||
|
u'netmask': u'255.255.255.0',
|
||||||
|
u'pci': u'0000:84:00.0', u'slave1': None,
|
||||||
|
u'slave2': None, u'type': u'ether',
|
||||||
|
u'vswitch_type': 'dvs'}],
|
||||||
u'vcpu_pin_set': None,
|
u'vcpu_pin_set': None,
|
||||||
u'dvsv_cpus': None,
|
u'dvsv_cpus': None,
|
||||||
u'hwm_ip': None,
|
u'hwm_ip': None,
|
||||||
|
@ -314,7 +328,8 @@ host5_meta = {u'os_version_id': None,
|
||||||
u'root_pwd': u'ossdbg1',
|
u'root_pwd': u'ossdbg1',
|
||||||
u'dvs_high_cpuset': None,
|
u'dvs_high_cpuset': None,
|
||||||
u'dvs_cpus': None,
|
u'dvs_cpus': None,
|
||||||
u'root_lv_size': 102400}
|
u'root_lv_size': 102400,
|
||||||
|
u'isolcpus': u'1,13'}
|
||||||
|
|
||||||
host6_meta = {u'os_version_id': None,
|
host6_meta = {u'os_version_id': None,
|
||||||
u'config_set_id': None,
|
u'config_set_id': None,
|
||||||
|
@ -437,6 +452,8 @@ class TestInstall(test.TestCase):
|
||||||
self.installer = install.KOLLAInstallTask(
|
self.installer = install.KOLLAInstallTask(
|
||||||
self.req, '8ad27e36-f3e2-48b4-84b8-5b676c6fabde')
|
self.req, '8ad27e36-f3e2-48b4-84b8-5b676c6fabde')
|
||||||
|
|
||||||
|
@mock.patch("daisy.registry.client.v1.api.get_host_metadata")
|
||||||
|
@mock.patch("daisy.registry.client.v1.api.get_hosts_detail")
|
||||||
@mock.patch('daisy.api.backends.kolla.common.get_computer_node_cfg')
|
@mock.patch('daisy.api.backends.kolla.common.get_computer_node_cfg')
|
||||||
@mock.patch('daisy.api.backends.kolla.common.get_controller_node_cfg')
|
@mock.patch('daisy.api.backends.kolla.common.get_controller_node_cfg')
|
||||||
@mock.patch('daisy.api.backends.kolla.common.get_host_detail')
|
@mock.patch('daisy.api.backends.kolla.common.get_host_detail')
|
||||||
|
@ -449,7 +466,8 @@ class TestInstall(test.TestCase):
|
||||||
mock_do_get_cluster_networks_detail,
|
mock_do_get_cluster_networks_detail,
|
||||||
mock_do_get_roles_detail,
|
mock_do_get_roles_detail,
|
||||||
mock_do_get_hosts_of_role, mock_do_get_host_detail,
|
mock_do_get_hosts_of_role, mock_do_get_host_detail,
|
||||||
mock_do_get_controller_node_cfg, mock_do_get_computer_node_cfg):
|
mock_do_get_controller_node_cfg, mock_do_get_computer_node_cfg,
|
||||||
|
mock_do_get_hosts_detail, mock_get_host_metadata):
|
||||||
daisy_kolla_ver_path = '/var/lib/daisy/versionfile/kolla/'
|
daisy_kolla_ver_path = '/var/lib/daisy/versionfile/kolla/'
|
||||||
cmd = 'mkdir -p %s' % daisy_kolla_ver_path
|
cmd = 'mkdir -p %s' % daisy_kolla_ver_path
|
||||||
subprocesscall(cmd)
|
subprocesscall(cmd)
|
||||||
|
@ -480,7 +498,8 @@ class TestInstall(test.TestCase):
|
||||||
'host_name': u'',
|
'host_name': u'',
|
||||||
'dat_macname': u'',
|
'dat_macname': u'',
|
||||||
'ext_macname': u''}
|
'ext_macname': u''}
|
||||||
|
mock_do_get_hosts_detail.return_value = [host5_meta]
|
||||||
|
mock_get_host_metadata.return_value = host5_meta
|
||||||
(kolla_config, mgt_ip_list, host_name_ip_list) =\
|
(kolla_config, mgt_ip_list, host_name_ip_list) =\
|
||||||
kcommon.get_cluster_kolla_config(
|
kcommon.get_cluster_kolla_config(
|
||||||
self.req,
|
self.req,
|
||||||
|
|
Loading…
Reference in New Issue