support dpdk 27/46627/26
author00184532 <lu.yao135@zte.com.cn>
Fri, 3 Nov 2017 08:31:03 +0000 (16:31 +0800)
committerYao Lu <lu.yao135@zte.com.cn>
Tue, 16 Jan 2018 03:28:52 +0000 (03:28 +0000)
Change-Id: I30970093bab418d679d3a3396d16aaff257272f4
Signed-off-by: 00184532 <lu.yao135@zte.com.cn>
ci/deploy/deploy.sh
deploy/tempest.py
tests/unit/test_tempest.py

index ff74061..e34e4f9 100755 (executable)
@@ -64,7 +64,8 @@ SKIP_DEPLOY_DAISY=0
 VM_MULTINODE=("computer01" "computer02" "controller02" "controller03" "controller01")
 VALID_DEPLOY_SCENARIO=("os-nosdn-nofeature-noha" "os-nosdn-nofeature-ha" "os-odl_l3-nofeature-noha"
                        "os-odl_l2-nofeature-noha" "os-odl_l3-nofeature-ha" "os-odl_l2-nofeature-ha"
-                       "os-odl-nofeature-noha" "os-odl-nofeature-ha")
+                       "os-odl-nofeature-noha" "os-odl-nofeature-ha"
+                       "os-nosdn-ovs_dpdk-noha" "os-nosdn-ovs_dpdk-ha")
 
 #
 # END of variables to customize
index b28e126..0c48d77 100644 (file)
@@ -94,6 +94,7 @@ def prepare_install(client):
             build_pxe_for_discover(cluster_id, client, deployment_interface)
         elif conf['host'] and conf['host'] == 'yes':
             isbare = False if 'isbare' in conf and conf['isbare'] == 0 else True
+            enable_dpdk = True if 'scenario' in conf and 'ovs_dpdk' in conf['scenario'] else False
             print("discover host...")
             discover_host(hosts_name, client)
             time.sleep(10)
@@ -101,8 +102,8 @@ def prepare_install(client):
             hosts_info = get_hosts(client)
             cluster_info = get_cluster(client)
             cluster_id = cluster_info.id
-            add_hosts_interface(cluster_id, hosts_info, mac_address_map,
-                                host_interface_map, vip, isbare, client)
+            update_hosts_interface(cluster_id, hosts_info, mac_address_map,
+                                   host_interface_map, vip, isbare, client, enable_dpdk)
             if len(hosts_name) == 1:
                 protocol_type = 'LVM'
                 service_name = 'cinder'
@@ -199,9 +200,9 @@ def get_cluster(client):
     return cluster_info
 
 
-def add_hosts_interface(cluster_id, hosts_info, mac_address_map,
-                        host_interface_map,
-                        vip, isbare, client):
+def update_hosts_interface(cluster_id, hosts_info, mac_address_map,
+                           host_interface_map, vip,
+                           isbare, client, enable_dpdk):
     for host in hosts_info:
         dha_host_name = None
         host = host.to_dict()
@@ -214,6 +215,11 @@ def add_hosts_interface(cluster_id, hosts_info, mac_address_map,
             if interface_name in host_interface_map:
                 interface['assigned_networks'] = \
                     host_interface_map[interface_name]
+                if enable_dpdk:
+                    for assigned_network in interface['assigned_networks']:
+                        if assigned_network['name'] == 'physnet1':
+                            interface['vswitch_type'] = 'dvs'
+                            break
             for nodename in mac_address_map:
                 if interface['mac'] in mac_address_map[nodename]:
                     dha_host_name = nodename
@@ -228,7 +234,14 @@ def add_hosts_interface(cluster_id, hosts_info, mac_address_map,
                 host['os_version'] = iso_path + filename
         if host['os_version'] == iso_path:
             print("do not have os iso file in /var/lib/daisy/kolla/.")
+        if enable_dpdk:
+            host['hugepages'] = '20'
+            host['hugepagesize'] = '1G'
         client.hosts.update(host['id'], **host)
+        host_info = client.hosts.get(host['id']).to_dict()
+        if host_info.get('suggest_dvsc_cpus') and host_info['suggest_dvsc_cpus'][0] > 0:
+            host_isolcpus = {'isolcpus': host_info['suggest_dvsc_cpus']}
+            client.hosts.update(host['id'], **host_isolcpus)
         print("update role...")
         add_host_role(cluster_id, host['id'], dha_host_name, vip, client)
 
index b03b3c0..9a70aec 100644 (file)
@@ -34,7 +34,7 @@ from deploy.tempest import (
     update_network,
     get_hosts,
     get_cluster,
-    add_hosts_interface,
+    update_hosts_interface,
     add_host_role,
     enable_cinder_backend,
     enable_opendaylight
@@ -173,7 +173,7 @@ def test_get_cluster():
 
 @pytest.mark.parametrize('isbare', [
     (False), (True)])
-def test_add_hosts_interface(isbare, tmpdir):
+def test_update_hosts_interface(isbare, tmpdir):
     res_old_val = deploy.tempest.iso_path
     deploy.tempest.iso_path = os.path.join(tmpdir.dirname, tmpdir.basename) + '/'
     iso_file_path = os.path.join(deploy.tempest.iso_path, 'test_os.iso')
@@ -206,9 +206,9 @@ def test_add_hosts_interface(isbare, tmpdir):
                  {'ip': '', 'name': 'physnet1'}],
         'ens9': [{'ip': '', 'name': 'HEARTBEAT'}]}
     vip = '10.20.11.11'
-    add_hosts_interface(1, hosts_info, mac_address_map,
-                        host_interface_map,
-                        vip, isbare, client)
+    update_hosts_interface(1, hosts_info, mac_address_map,
+                           host_interface_map,
+                           vip, isbare, client, True)
     deploy.tempest.iso_path = res_old_val
     if isbare:
         assert client.hosts.get(host_id1).metadata == {
@@ -217,6 +217,8 @@ def test_add_hosts_interface(isbare, tmpdir):
             'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser',
             'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
                             'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
         assert client.hosts.get(host_id2).metadata == {
             'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -227,7 +229,10 @@ def test_add_hosts_interface(isbare, tmpdir):
                                 {'ip': '', 'name': 'MANAGEMENT'},
                                 {'ip': '', 'name': 'PUBLICAPI'},
                                 {'ip': '', 'name': 'STORAGE'},
-                                {'ip': '', 'name': 'physnet1'}]}],
+                                {'ip': '', 'name': 'physnet1'}],
+                            'vswitch_type': 'dvs'}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
         assert client.hosts.get(host_id3).metadata == {
             'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
@@ -235,6 +240,8 @@ def test_add_hosts_interface(isbare, tmpdir):
             'ipmi_user': 'zteroot', 'ipmi_passwd': 'superuser',
             'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
                             'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
     else:
         assert client.hosts.get(host_id1).metadata == {
@@ -242,6 +249,8 @@ def test_add_hosts_interface(isbare, tmpdir):
             'cluster': cluster_id, 'os_version': iso_file_path,
             'interfaces': [{'name': 'ens8', 'mac': '11:11:11:11:11:11',
                             'assigned_networks': [{'ip': '', 'name': 'EXTERNAL'}]}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
         assert client.hosts.get(host_id2).metadata == {
             'id': host_id2, 'name': 'controller02', 'cluster_id': cluster_id,
@@ -251,13 +260,18 @@ def test_add_hosts_interface(isbare, tmpdir):
                                 {'ip': '', 'name': 'MANAGEMENT'},
                                 {'ip': '', 'name': 'PUBLICAPI'},
                                 {'ip': '', 'name': 'STORAGE'},
-                                {'ip': '', 'name': 'physnet1'}]}],
+                                {'ip': '', 'name': 'physnet1'}],
+                            'vswitch_type': 'dvs'}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
         assert client.hosts.get(host_id3).metadata == {
             'id': host_id3, 'name': 'computer01', 'cluster_id': cluster_id,
             'cluster': cluster_id, 'os_version': iso_file_path,
             'interfaces': [{'name': 'ens9', 'mac': '33:33:33:33:33:33',
                             'assigned_networks': [{'ip': '', 'name': 'HEARTBEAT'}]}],
+            'hugepagesize': '1G',
+            'hugepages': '20',
         }
     tmpdir.remove()