X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fnodes%2Fnode_downloads.php;h=c037c1a7bcbfba614ea071e5956a2034975873b5;hb=2acd8f63883ad55c2c3c204d3b11db86da3417d2;hp=8af032b3571299e9954ae4f2edae48bffd2f4f85;hpb=f99cfc8401815836073effa34c5cda024e77a3a9;p=plewww.git diff --git a/planetlab/nodes/node_downloads.php b/planetlab/nodes/node_downloads.php index 8af032b..c037c1a 100644 --- a/planetlab/nodes/node_downloads.php +++ b/planetlab/nodes/node_downloads.php @@ -1,7 +1,5 @@ GetBootMedium($node_id,"node-preview",""); - print ("
\n$preview\n"); print ("
Configuration file cannot be created until missing values above are updated.";
}
@@ -142,64 +130,51 @@ switch ($action) {
case "download-node-floppy":
case "download-node-iso":
case "download-node-usb":
+ case "download-node-usb-partition":
+
- $return= $api->GetNodes( array( $node_id ) );
- $node_detail= $return[0];
+ $nodes = $api->GetNodes( array( $node_id ) );
+ $node = $nodes[0];
// non-admin people need to be affiliated with the right site
if( ! plc_is_admin() ) {
- $node_site_id = $node_detail['site_id'];
+ $node_site_id = $node['site_id'];
$in_site = plc_in_site($node_site_id);
if( ! $in_site) {
$error= "Insufficient permission. You cannot create configuration files for this node.";
}
}
- $hostname= $node_detail['hostname'];
- $return= $api->GetInterfaces( array( "node_id" => $node_id ), NULL );
+ $hostname= $node['hostname'];
+ // search for the primary interface
+ $interfaces = $api->GetInterfaces( array( "node_id" => $node_id, "is_primary"=>true ), NULL );
$can_gen_config= 1;
- $has_primary= 0;
-
- if( count($return) > 0 ) {
- foreach( $return as $interface_detail ) {
- if( $interface_detail['is_primary'] == true ) {
- $has_primary= 1;
- break;
- }
- }
- }
- if( !$has_primary ) {
+ if ( ! $interfaces ) {
$can_gen_config= 0;
} else {
- if( $node_detail['hostname'] == "" ) {
+ $interface = $interfaces[0];
+ if ( $node['hostname'] == "" ) {
$can_gen_config= 0;
- $node_detail['hostname']= "Missing";
+ $node['hostname']= plc_warning("Missing");
}
+ # fields to check
$fields= array("method","ip");
+ if ( $interface['method'] == "static" )
+ $fields = array_merge ( $fields, array("gateway","netmask","network","broadcast","dns1"));
foreach( $fields as $field ) {
- if( $interface_detail[$field] == "" ) {
+ if( $interface[$field] == "" ) {
$can_gen_config= 0;
- $interface_detail[$field]= "Missing";
+ $interface[$field]= plc_warning("Missing");
}
}
- if( $interface_detail['method'] == "static" ) {
- $fields= array("gateway","netmask","network","broadcast","dns1");
- foreach( $fields as $field ) {
- if( $interface_detail[$field] == "" ) {
- $can_gen_config= 0;
- $interface_detail[$field]= "Missing";
- }
- }
- }
-
- if( $interface_detail['method'] != "static"
- && $interface_detail['method'] != "dhcp" ) {
+ if( $interface['method'] != "static"
+ && $interface['method'] != "dhcp" ) {
$can_gen_config= 0;
- $interface_detail['method']= "Unknown method";
+ $interface['method']= "Unknown method";
}
}
@@ -210,18 +185,26 @@ switch ($action) {
case 'download-node-floppy':
$boot_action='node-floppy';
$location = "%d/%n-%v-rename-into-plnode%s";
+ $options = array();
break;
case 'download-node-iso':
$boot_action='node-iso';
$location = "%d/%n-%a-%v%s";
+ $options = array();
break;
case 'download-node-usb':
$boot_action='node-usb';
$location = "%d/%n-%a-%v%s";
+ $options = array();
+ break;
+ case "download-node-usb-partition":
+ $boot_action='node-usb';
+ $location = "%d/%n-%a-%v-partition%s";
+ $options = array('partition');
break;
}
- $filename=$api->GetBootMedium($node_id,$boot_action,$location);
+ $filename=$api->GetBootMedium($node_id,$boot_action,$location,$options);
$error=$api->error();
if (empty($error) && empty($filename)) {
$error="Unexpected error from GetBootMedium - probably wrong directory modes";
@@ -236,77 +219,69 @@ switch ($action) {
}
}
- drupal_set_title("Download boot material for $hostname");
+ drupal_set_title("Download boot medium for $hostname");
$header= <<
+WARNING: Downloading a new boot medium
+for this node will generate a new node key, and any
+formerly downloaded boot medium for that node will become outdated.
+ ");
- print (" This node has no configured primary interface.
+
+In order to create a configuration file for this node using this page,
+the interface settings must be up to date. Below is summary of these
+values.
+Current interface settings
\n");
-
-if( $has_primary ) {
- print( "\n" );
-
- print( "
\n" );
-} else {
- print( " " );
- print( "Node Details \n" );
- print( "node_id: " );
- print( "$node_id \n" );
-
- $nn_id = $interface_detail['interface_id'];
- print( "Hostname: " );
- print( "" . $node_detail['hostname'] . " " );
-
- print( "Interface Details \n" );
- print( "Method: " );
- print( "" . $interface_detail['method'] . " \n" );
-
- if( $interface_detail['method'] == "static" ) {
- print( "IP: " );
- print( "" . $interface_detail['ip'] . " \n" );
- print( "Gateway: " );
- print( "" . $interface_detail['gateway'] . " \n" );
- print( "Network mask: " );
- print( "" . $interface_detail['netmask'] . " \n" );
- print( "Network address: " );
- print( "" . $interface_detail['network'] . " \n" );
- print( "Broadcast address: " );
- print( "" . $interface_detail['broadcast'] . " \n" );
- print( "DNS 1: " );
- print( "" . $interface_detail['dns1'] . " \n" );
- } else {
- print( "DNS 2: " );
- if( $interface_detail['dns2'] == "" ) {
- print( "Optional, missing " . $interface_detail['dns2'] . " \n" );
- }
- }
+ print ("
");
+ print ("Current node configuration
");
- print (" \n");
- $nn_id = $interface_detail['interface_id'];
- $settings=$api->GetInterfaceTags(array("interface_id" => array($nn_id)));
- foreach ($settings as $setting) {
- $category=$setting['category'];
- $name=$setting['tagname'];
- $value=$setting['value'];
- print (" Additional Settings \n");
- }
+ $details = new PlekitDetails (false);
+ $details->start();
- print( " $category $name $value