+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import string
from Exceptions import *
import BootAPI
-
-
-SKIP_MODEL_STRING= "/minhw"
-
+import ModelOptions
def Run( vars, log ):
"""
- Contact PLC and get the attributes for this node. Also, if the node model
- string ends in SKIP_MODEL_STRING, override the hardware requirements
- configuration value, and skip the checks.
+
+ Contact PLC and get the attributes for this node. Also, parse in
+ options from the node model strong.
Also, update any node network settings at PLC, minus the ip address,
so, upload the mac (if node_id was in conf file), gateway, network,
WAS_NODE_KEY_IN_CONF Set to 1 if the node key was in the conf file
BOOT_STATE The current node boot state
NODE_MODEL The user specified model of this node
+ NODE_MODEL_OPTIONS The options extracted from the user specified
+ model of this node
NETWORK_SETTINGS A dictionary of the values of the network settings
SKIP_HARDWARE_REQUIREMENT_CHECK Whether or not we should skip hardware
requirement checks
except ValueError, var:
raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
-
details= BootAPI.call_api_function( vars, "BootGetNodeDetails", () )
vars['BOOT_STATE']= details['boot_state']
log.write( "Current boot state: %s\n" % vars['BOOT_STATE'] )
log.write( "Node make/model: %s\n" % vars['NODE_MODEL'] )
- # if the end of NODE_MODEL string ends in SKIP_MODEL_STRING, skip hardware
- # requirement checks (overrides configuration)
+ # parse in the model options from the node_model string
model= vars['NODE_MODEL']
- len_skip_str= len(SKIP_MODEL_STRING)
- if model[-len_skip_str:] == SKIP_MODEL_STRING:
- vars['SKIP_HARDWARE_REQUIREMENT_CHECK']= 1
+ options= ModelOptions.Get(model)
+ vars['NODE_MODEL_OPTIONS']=options
+
+ # Check if we should skip hardware requirement check
+ if options & ModelOptions.MINHW:
+ vars['SKIP_HARDWARE_REQUIREMENT_CHECK']=1
log.write( "node model indicates override to hardware requirements.\n" )
-
# this contains all the node networks, for now, we are only concerned
# in the primary network