define extensions in vars even if not yet set
[bootmanager.git] / source / steps / CheckHardwareRequirements.py
index a262860..39f8785 100644 (file)
@@ -1,5 +1,5 @@
-#!/usr/bin/python2
-
+#!/usr/bin/python
+#
 # Copyright (c) 2003 Intel Corporation
 # All rights reserved.
 #
@@ -40,7 +40,6 @@ def Run( vars, log ):
                             this node to be usable after install
     SKIP_HARDWARE_REQUIREMENT_CHECK
                             If set, don't check if minimum requirements are met
-    BOOT_CD_VERSION          A tuple of the current bootcd version                            
     Sets the following variables:
     INSTALL_BLOCK_DEVICES    list of block devices to install onto
     """
@@ -58,16 +57,13 @@ def Run( vars, log ):
 
         MINIMUM_DISK_SIZE= int(vars["MINIMUM_DISK_SIZE"])
 
-        TOTAL_MINIMUM_DISK_SIZE= \
-                   int(vars["TOTAL_MINIMUM_DISK_SIZE"])
+        # use vs_ or lxc_variants
+        varname=vars['virt']+"_TOTAL_MINIMUM_DISK_SIZE"
+        TOTAL_MINIMUM_DISK_SIZE= int(vars[varname])
 
         SKIP_HARDWARE_REQUIREMENT_CHECK= \
                    int(vars["SKIP_HARDWARE_REQUIREMENT_CHECK"])
         
-        BOOT_CD_VERSION= vars["BOOT_CD_VERSION"]
-        if BOOT_CD_VERSION == "":
-            raise ValueError, "BOOT_CD_VERSION"
-
     except KeyError, var:
         raise BootManagerException, \
               "Missing variable in install store: %s" % var
@@ -87,29 +83,19 @@ def Run( vars, log ):
             log.write( "Insufficient memory to run node: %s kb\n" % total_mem )
             log.write( "Required memory: %s kb\n" % MINIMUM_MEMORY )
 
-            techs=[]
+            include_pis= 0
+            include_techs= 1
+            include_support= 0
             
             sent= 0
             try:
-                #sent= BootAPI.call_api_function( vars, "BootNotifyOwners",
-                #                         (notify_messages.MSG_INSUFFICIENT_MEMORY,
-                #                          include_pis,
-                #                          include_techs,
-                #                          include_support) )
-                params = {"hostname" : vars['hostname'] + vars['domainname']}
-                person_ids = BootAPI.call_api_function( vars, "GetSites", 
-                                            (vars['SITE_ID'], ['person_ids']))[0]
-                persons = BootAPI.call_api_function( vars, "GetPersons", 
-                                            (person_ids, ['person_id', 'roles']))
-                for person in persons:
-                    if "tech" in person['roles']: techs.append(person['person_id'])
-                msg = BootAPI.call_api_function( vars, "GetMessages", 
-                                   ({"message_id": notify_messages.MSG_INSUFFICIENT_MEMORY}),)[0]
-                sent= BootAPI.call_api_function( vars, "NotifyPersons",
-                                         (techs, msg['subject'] % params, msg['body'] % params))
+                sent= BootAPI.call_api_function( vars, "BootNotifyOwners",
+                                         (notify_messages.MSG_INSUFFICIENT_MEMORY,
+                                          include_pis,
+                                          include_techs,
+                                          include_support) )
             except BootManagerException, e:
-                log.write( "Call to NotifyPersons failed: %s.\n" % e )
+                log.write( "Call to BootNotifyOwners failed: %s.\n" % e )
                 
             if sent == 0:
                 log.write( "Unable to notify site contacts of problem.\n" )
@@ -259,10 +245,4 @@ def Run( vars, log ):
             
     log.write( "Total size for all usable block devices: %4.2f GB\n" % total_size )
 
-    # turn off UDMA for all block devices on 2.x cds (2.4 kernel)
-    if BOOT_CD_VERSION[0] == 2:
-        for device in install_devices:
-            log.write( "Disabling UDMA on %s\n" % device )
-            utils.sysexec_noerr( "/sbin/hdparm -d0 %s" % device, log )
-
     return 1