]> review.fuel-infra Code Review - tools/sustaining.git/commitdiff
8.0 support 80/16580/2
authorDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Mon, 1 Feb 2016 06:49:20 +0000 (09:49 +0300)
committerDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Mon, 1 Feb 2016 12:54:29 +0000 (15:54 +0300)
Added support for predictable interface names (enpXsY)
and a workaround for fuel client not supporting
nova networking anymore.

Also, fixed an error when running `destroy` mode without ISO_URL.

Change-Id: Ic1783a6ffe61878840a180c3bbb33f67d4675882

jenkins/build_cluster/build_cluster.py

index c5ea5fd5285eca41b2a9a7d61e103544adcfb055..e75d1c494d7e613fae367b1b70e584f89649ad2a 100755 (executable)
@@ -13,6 +13,8 @@ import netaddr
 import scancodes
 
 cfg = dict()
+is_new = False
+
 # required vars
 cfg["ENV_NAME"] = os.getenv("ENV_NAME")
 cfg["ISO_URL"] = os.getenv("ISO_URL")
@@ -44,12 +46,10 @@ cfg["ISO_DIR"] = os.getenv("PWD") + "/" + os.getenv("ISO_DIR", "iso") + "/"
 if cfg["ISO_URL"]:
     cfg["ISO_PATH"] = cfg["ISO_DIR"] + cfg["ISO_URL"] \
         .split("/")[-1].split(".torrent")[0]
-
-# new releases such as 8.0 and 9.0 use new interface naming scheme
-# e.g. 'enp0s4' instead of 'eth1' so we should get version of Fuel from ISO name
-
-new_versions = ["8.0", "9.0"]
-is_new = any(v in cfg["ISO_URL"] for v in new_versions)
+    # new releases such as 8.0 and 9.0 use new interface naming scheme
+    # e.g. 'enp0s4' instead of 'eth1' so we should get version of Fuel from ISO name
+    new_versions = ["8.0", "9.0"]
+    is_new = any(v in cfg["ISO_URL"] for v in new_versions)
 
 cfg["PREPARE_CLUSTER"] = os.getenv("PREPARE_CLUSTER")
 cfg["RELEASE"] = os.getenv("RELEASE")
@@ -373,8 +373,10 @@ def send_keys(instance):
 
 
 def inject_ifconfig_ssh():
+
+    iface = "eth1" if not is_new else "enp0s4"
     rule = \
-        "DEVICE=eth1\n" \
+        "DEVICE={iface}\n" \
         "ONBOOT=yes\n" \
         "BOOTPROTO=static\n" \
         "NM_CONTROLLED=no\n" \
@@ -383,13 +385,14 @@ def inject_ifconfig_ssh():
         "GATEWAY={gw}\n" \
         "DNS1={dns}\n" \
         .format(
+            iface=iface,
             ip=str(cfg["PUBLIC_SUBNET"].ip + 2),
             netmask=str(cfg["PUBLIC_SUBNET"].netmask),
             gw=str(cfg["PUBLIC_SUBNET"].ip + 1),
             dns=str(cfg["ADMIN_SUBNET"].ip + 1)
         )
     print ("\nTo fuel:\n{0}".format(rule))
-    ifcfg = "/etc/sysconfig/network-scripts/ifcfg-eth1"
+    ifcfg = "/etc/sysconfig/network-scripts/ifcfg-{iface}".format(iface=iface)
     psw = cfg["FUEL_SSH_PASSWORD"]
     usr = cfg["FUEL_SSH_USERNAME"]
     admip = str(cfg["ADMIN_SUBNET"].ip + 2)
@@ -403,7 +406,7 @@ def inject_ifconfig_ssh():
         "-o",
         "StrictHostKeyChecking=no",
         "{usr}@{admip}".format(usr=usr, admip=admip),
-        "cat - > {ifcfg} ; /etc/init.d/network restart".format(ifcfg=ifcfg)
+        "cat - > {ifcfg} ; /sbin/ifup {iface}".format(ifcfg=ifcfg, iface=iface)
     ]
 
     retries = 0
@@ -467,8 +470,9 @@ def configure_nailgun():
     conf_opts = {
         "HA": "--mode ha",
         "NO_HA": "--mode multinode",
-        "neutron_vlan": "--net neutron --nst vlan",
-        "neutron_gre": "--net neutron --nst gre",
+        "neutron_vlan": "--net neutron --nst vlan" if not is_new else "--nst vlan",
+        "neutron_gre": "--net neutron --nst gre" if not is_new else "--nst gre",
+        "neutron_tun": "--net neutron --nst tun" if not is_new else "--nst tun",
         "nova": "--net nova",
         "Ubuntu": 2,
         "CentOS": 1