From: Stephen Soltesz Date: Fri, 31 Jul 2009 23:18:32 +0000 (+0000) Subject: Automatically add the ifname and alias InterfaceTags to extra interfaces. X-Git-Tag: PLEWWW-4.3-25~3 X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=commitdiff_plain;h=0d235851082e23a8fecd38631ede995fc0b1124a Automatically add the ifname and alias InterfaceTags to extra interfaces. This will allow BootCDs to be generated correctly for nodes with extra interfaces without any extra configuration by the user or admin. Without this fix, extra interfaces over-write ifcfg-eth0 on the bootcd and prevent booting with the correct network settings. --- diff --git a/planetlab/common/actions.php b/planetlab/common/actions.php index 198718f..5649a8c 100644 --- a/planetlab/common/actions.php +++ b/planetlab/common/actions.php @@ -396,11 +396,20 @@ switch ($action) { $interface[$field]= intval( $interface[$field] ); } } - $result=$api->AddInterface( intval( $node_id ), $interface ); - if ($result >0 ) - drupal_set_message ("Interface $result added into node $node_id"); - else + $interface_id =$api->AddInterface( intval( $node_id ), $interface ); + if ($interface_id >0 ) { + $api->begin(); + $api->AddInterfaceTag($interface_id,"alias",strval($interface_id)); + $api->AddInterfaceTag($interface_id,"ifname","eth0"); + list($id1, $id2) = $api->commit(); + if ( $id1 > 0 && $id2 > 0 ) { + drupal_set_message ("Interface $interface_id added into node $node_id"); + } else { + drupal_set_error ("Could not add interface tags to interface $interface_id"); + } + } else { drupal_set_error ("Could not create interface"); + } plc_redirect (l_node($node_id)); }