Commit 973b8b7f authored by Robert Ricci's avatar Robert Ricci

If the new node has given us a type, and that type does not exist

(as is the case for the ops node), create it automatically.
parent 4bb0ea52
......@@ -99,6 +99,22 @@ function guess_node_type($proc,$disk) {
return $node_type;
}
#
# Create a new node type
# XXX - Right now, this is really only meant for inserting a node_types entry
# for ops. It misses doing a lot of important things, like setting the class and
# default OSID for this type.
#
function make_node_type($type,$proc,$disk) {
#
# Just insert a stub entry for this type
#
DBQueryFatal("insert into node_types set type='$type', speed='$speed',
HD='$disk';");
}
function guess_IP ($prefix, $number) {
$hostname = $prefix . $number;
......
......@@ -116,9 +116,26 @@ if ($use_temp_IP) {
}
#
# Make an educated guess as to what type it belongs to
# Handle the node's type
#
if (!$type) {
if ($type) {
#
# If they gave us a type, let's see if that type exists or not
#
if (TBValidNodeType($type)) {
#
# Great, it already exists, nothin' else to do
#
} else {
#
# Okay, it doesn't exist. We'll create it.
#
make_node_type($type,$cpuspeed,$disksize);
}
} else {
#
# Make an educated guess as to what type it belongs to
#
$type = guess_node_type($cpuspeed,$disksize);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment