Package: openstack-cluster-installer
Version: 42.3.0~bpo12+1
Tags: patch

When provisioning a new node the interface names in
/etc/network/interfaces are set to 'Array' if OCI is unable to find the
correct interface to use. This is due to
get_ethname_from_network_config() returning an array when there is an
error, but the return value is not checked in
slave_install_server_os_command()

I've attached a patch which check for an array and returns it, which
means that the attempt to provision the node will instead fail and
return the error.

--

Regards
Jim
diff --git a/src/inc/slave_actions.php b/src/inc/slave_actions.php
index 910f503f..f1963a53 100644
--- a/src/inc/slave_actions.php
+++ b/src/inc/slave_actions.php
@@ -1105,7 +1105,7 @@ function get_ethname_from_network_config($con, $conf, $machine_id, $iface_in){
             $neth = mysqli_num_rows($reth);
             if($neth != 1){
                 $out["status"]  = "error";
-                $out["message"] = "Cannot find block device: $q<br>";
+                $out["message"] = "Cannot find matching ethernet device for $iface_in";
                 return $out;
             }
             $aeth = mysqli_fetch_array($reth);
@@ -1239,6 +1239,7 @@ function slave_install_server_os_command($con, $conf, $machine_id){
         }
 
         $iface1 = get_ethname_from_network_config($con, $conf, $machine_id, $mgmt_net["iface1"]);
+        if (is_array($iface1)) { return $iface1; }
 
         $netvlan = $mgmt_net["vlan"];
 
@@ -1246,6 +1247,7 @@ function slave_install_server_os_command($con, $conf, $machine_id){
 
         if($mgmt_net["iface2"] != "none"){
             $iface2 = get_ethname_from_network_config($con, $conf, $machine_id, $mgmt_net["iface2"]);
+            if (is_array($iface2)) { return $iface2; }
             if(is_null($netvlan)){
                 if($cluster["bgp_to_the_host"] == "yes" && $machine["force_no_bgp2host"] == "no"){
                     $mytype = "bgp";
@@ -1304,9 +1306,11 @@ function slave_install_server_os_command($con, $conf, $machine_id){
             }
 
             $iface1 = get_ethname_from_network_config($con, $conf, $machine_id, $onenet["iface1"]);
+            if (is_array($iface1)) { return $iface1; }
 
             if($onenet["iface2"] != "none"){
                 $iface2 = get_ethname_from_network_config($con, $conf, $machine_id, $onenet["iface2"]);
+                if (is_array($iface2)) { return $iface2; }
                 if(is_null($netvlan)){
                     if($cluster["bgp_to_the_host"] == "yes" && $machine["force_no_bgp2host"] == "no"){
                         $mytype = "bgp";

Reply via email to