From 21ad5ef5cec09027e46212ef52f9cf4aaeab675d Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Mon, 27 Jul 2009 16:15:39 +0000 Subject: [PATCH] Add additional messages regarding kinds of boot failures due to notinstalled filesystem corrupted mount failed missing kernel Each of these events occurs with enough frequency that differentiating them is helpful both for operators and for the user. --- source/BootManager.py | 18 ++++++++++++------ source/notify_messages.py | 3 +++ source/steps/ValidateNodeInstall.py | 6 +++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/source/BootManager.py b/source/BootManager.py index 7460fd8..1d9a5b5 100755 --- a/source/BootManager.py +++ b/source/BootManager.py @@ -169,14 +169,13 @@ class BootManager: at the top of each of the invididual step functions. """ - def _nodeNotInstalled(): + def _nodeNotInstalled(message='MSG_NODE_NOT_INSTALLED'): # called by the _xxxState() functions below upon failure self.VARS['RUN_LEVEL']= 'failboot' + notify = getattr(notify_messages, message) self.VARS['STATE_CHANGE_NOTIFY']= 1 - self.VARS['STATE_CHANGE_NOTIFY_MESSAGE']= \ - notify_messages.MSG_NODE_NOT_INSTALLED - raise BootManagerException, \ - notify_messages.MSG_NODE_NOT_INSTALLED + self.VARS['STATE_CHANGE_NOTIFY_MESSAGE']= notify + raise BootManagerException, notify def _bootRun(): # implements the boot logic, which consists of first @@ -193,13 +192,20 @@ class BootManager: pass InstallInit.Run( self.VARS, self.LOG ) - if ValidateNodeInstall.Run( self.VARS, self.LOG ): + ret = ValidateNodeInstall.Run( self.VARS, self.LOG ) + if ret == 1: WriteModprobeConfig.Run( self.VARS, self.LOG ) MakeInitrd.Run( self.VARS, self.LOG ) WriteNetworkConfig.Run( self.VARS, self.LOG ) CheckForNewDisks.Run( self.VARS, self.LOG ) SendHardwareConfigToPLC.Run( self.VARS, self.LOG ) ChainBootNode.Run( self.VARS, self.LOG ) + elif ret == -1: + _nodeNotInstalled('MSG_NODE_FILESYSTEM_CORRUPT') + elif ret == -2: + _nodeNotInstalled('MSG_NODE_MOUNT_FAILED') + elif ret == -3: + _nodeNotInstalled('MSG_NODE_MISSING_KERNEL') else: _nodeNotInstalled() diff --git a/source/notify_messages.py b/source/notify_messages.py index 0e2b34f..6d2e175 100644 --- a/source/notify_messages.py +++ b/source/notify_messages.py @@ -17,5 +17,8 @@ MSG_INSUFFICIENT_MEMORY= "insufficientmemory" MSG_NO_NODE_CONFIG_FILE= "noconfig" MSG_AUTH_FAIL= "authfail" MSG_NODE_NOT_INSTALLED= "notinstalled" +MSG_NODE_FILESYSTEM_CORRUPT= "filesystemcorrupted" +MSG_NODE_MOUNT_FAILED= "mountfailed" +MSG_NODE_MISSING_KERNEL= "missingkernel" MSG_HOSTNAME_NOT_RESOLVE= "hostnamenotresolve" MSG_NO_DETECTED_NETWORK= "nodetectednetwork" diff --git a/source/steps/ValidateNodeInstall.py b/source/steps/ValidateNodeInstall.py index ad853b6..845348a 100644 --- a/source/steps/ValidateNodeInstall.py +++ b/source/steps/ValidateNodeInstall.py @@ -93,7 +93,7 @@ def Run( vars, log ): except BootManagerException, e: log.write( "BootManagerException during fsck of /root and /vservers : %s\n" % str(e) ) - return 0 + return -1 try: # then attempt to mount them @@ -112,7 +112,7 @@ def Run( vars, log ): except BootManagerException, e: log.write( "BootManagerException during mount of /root, /vservers and /proc: %s\n" % str(e) ) - return 0 + return -2 ROOT_MOUNTED= 1 vars['ROOT_MOUNTED']= 1 @@ -126,7 +126,7 @@ def Run( vars, log ): os.stat("%s/boot/initrd-boot" % SYSIMG_PATH) except OSError, e: log.write( "Couldn't locate base kernel (you might be using the stock kernel).\n") - return 0 + return -3 # check if the model specified kernel is installed option = '' -- 2.43.0