Exemplo n.º 1
0
 def _ComputeNodeUpdate__updateSoftware(self):
     softwareDir = self.csurBasePath + '/software/computeNode/'
     softwareList = self.componentUpdateDict['Software']
     osDistLevel = self.computeNodeDict['osDistLevel']
     systemModel = self.computeNodeDict['systemModel']
     self.logger.info('Updating the software that was identified as needing to be updated.')
     if not '16s' in systemModel and self._ComputeNodeUpdate__prepareForCS900SoftwareUpdate():
         self.updateComponentProblemDict['Software']['prepareForCS900SoftwareUpdate'] = ''
         return None
     for software in softwareList:
         softwareName = re.match('(([a-zA-Z]+-*)+)', software).group(1).strip('-')
         time.sleep(2)
         while self.wait:
             time.sleep(1)
         if self.cancel:
             return None
         if None == 'hponcfg' and re.match('RHEL6.*', osDistLevel):
             command = 'rpm -q hponcfg'
             result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
             (out, err) = result.communicate()
             self.logger.info('The output of the command (' + command + ') used to check if hponcfg is installed was: ' + out.strip())
             if result.returncode == 0:
                 out = out.splitlines()
                 command = 'rpm -e ' + ' '.join(out)
                 result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                 (out, err) = result.communicate()
                 self.logger.info('The output of the command (' + command + ') used to remove hponcfg was: ' + out.strip())
                 if result.returncode != 0:
                     self.logger.error('Problems were encountered while trying to remove hponcfg; skipping update.\n' + err)
                     self.updateComponentProblemDict['Software'][softwareName] = ''
                     continue
                 
             
         if softwareName == 'hp-health':
             command = 'rpm -q hp-health'
             result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
             (out, err) = result.communicate()
             self.logger.info('The output of the command (' + command + ') used to check if hp-health is installed was: ' + out.strip())
             if result.returncode == 0:
                 if re.match('SLES12.*', osDistLevel):
                     command = 'systemctl stop hp-health'
                 else:
                     command = '/etc/init.d/hp-health stop'
                 self.timedProcessThread = TimedProcessThread(command, 120, self.computeNodeDict['loggerName'])
                 self.timedProcessThread.start()
                 self.pid = self.timedProcessThread.getProcessPID()
                 statusList = self.timedProcessThread.getCompletionStatus()
                 status = statusList[0]
                 self.pid = 0
                 if status == 'timedOut':
                     self.logger.error('hp-health could not be stopped; will try to kill it now.')
                     command = 'pgrep -x hpasmlited'
                     result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                     (out, err) = result.communicate()
                     self.logger.info('The output of the command (' + command + ') used to get the PID of hp-health was: ' + out.strip())
                     if result.returncode == 0:
                         hpHealthPID = out.strip()
                         command = 'kill -9 ' + hpHealthPID
                         self.timedProcessThread = TimedProcessThread(command, 120, self.computeNodeDict['loggerName'])
                         self.timedProcessThread.start()
                         self.pid = self.timedProcessThread.getProcessPID()
                         status = self.timedProcessThread.getCompletionStatus()
                         self.pid = 0
                         if status == 'timedOut':
                             self.logger.error('A second attempt to stop hp-health timed out; skipping update of hp-health.')
                             self.updateComponentProblemDict['Software'][softwareName] = ''
                             continue
                         
                     
                 elif status == 'Failed':
                     self.logger.error('An error was encountered while trying to stop hp-health; skipping update of hp-health.\n' + statusList[1])
                     self.updateComponentProblemDict['Software'][softwareName] = ''
                     continue
                 
             
         if softwareName == 'FusionIO':
             if not removeFusionIOPackages(self.csurResourceDict['fusionIOSoftwareRemovalPackageList'], 'software', self.computeNodeDict['loggerName']):
                 self.logger.error('The FusionIO software could not be removed before updating/re-installing; skipping update of FusionIO software.')
                 self.updateComponentProblemDict['Software'][softwareName] = ''
                 continue
             updateSoftwareList = re.sub(',\\s*', ' ', self.csurResourceDict['fusionIOSoftwareInstallPackageList'])
             softwarePackage = softwareDir + re.sub(' ', ' ' + softwareDir, updateSoftwareList)
         else:
             softwarePackage = softwareDir + software
         command = 'rpm -U --quiet --oldpackage --replacefiles --replacepkgs --nosignature ' + softwarePackage
         self.timedProcessThread = TimedProcessThread(command, 180, self.computeNodeDict['loggerName'])
         self.timedProcessThread.setDaemon(True)
         self.timedProcessThread.start()
         self.pid = self.timedProcessThread.getProcessPID()
         status = self.timedProcessThread.getCompletionStatus()
         self.pid = 0
         if software == 'FusionIO':
             if 'iomemory_vsl' in self.updateComponentProblemDict['Drivers'] or 'FusionIO' in self.updateComponentProblemDict['Firmware']:
                 self.logger.error('The FusionIO software update was skipped due to errors that were encountered during the FusionIO driver or firmware update.')
                 self.updateComponentProblemDict['Software']['FusionIO'] = ''
                 continue
             elif software == 'FusionIO':
                 fusionIOSoftwarePkgList = updateSoftwareList.split()
                 packageNames = ''
                 for package in fusionIOSoftwarePkgList:
                     packageNames += re.sub('-[0-9]{1}.*', '', package) + ' '
                 
                 packageNames = packageNames.strip()
             if status[0] == 'timedOut':
                 if software == 'FusionIO':
                     self.logger.info('Verifying the installation status of ' + packageNames + ', since it appears it may not of installed correctly.')
                     command = 'rpm -V --nomtime --nomode --nouser --nogroup ' + packageNames
                 else:
                     self.logger.info('Verifying the installation status of ' + softwareName + ', since it appears it may not of installed correctly.')
                     command = 'rpm -V --nomtime --nomode --nouser --nogroup ' + softwareName
                 result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                 (out, err) = result.communicate()
                 if software == 'FusionIO':
                     self.logger.info('The output of the command (' + command + ') used to verify the installation status of ' + packageNames + '  was: ' + out.strip())
                 else:
                     self.logger.info('The output of the command (' + command + ') used to verify the installation status of ' + softwareName + '  was: ' + out.strip())
                 if result.returncode != 0:
                     if software == 'FusionIO':
                         self.logger.error('Problems were encountered while updating ' + packageNames + '.\n' + err)
                     else:
                         self.logger.error('Problems were encountered while updating ' + softwareName + '.\n' + err)
                     self.updateComponentProblemDict['Software'][softwareName] = ''
                 
         if status[0] != 'Succeeded' or software == 'FusionIO':
             self.logger.error('Problems were encountered while updating ' + packageNames + '.\n' + err)
         else:
             self.logger.error('Problems were encountered while updating ' + softwareName + '.\n' + status[1])
         self.updateComponentProblemDict['Software'][softwareName] = ''
         continue
     
     self.logger.info('Done updating the software that was identified as needing to be updated.')
     if 'rpmsToRemove' in self.csurResourceDict and len(self.csurResourceDict['rpmsToRemove']) != 0:
         rpmsToRemove = self.csurResourceDict['rpmsToRemove']
         oneOffs = OneOffs()
         (result, rpmRemovalList) = oneOffs.removeRPMs(rpmsToRemove, self.computeNodeDict['loggerName'])
         if not result:
             self.updateComponentProblemDict['Software']['rpmRemovalFailure'] = rpmRemovalList
Exemplo n.º 2
0
    def __updateSoftware(self):
        softwareDir = self.csurBasePath + '/software/computeNode/'
        softwareDict = self.componentUpdateDict['Software']
        osDistLevel = self.computeNodeDict['osDistLevel']

        self.logger.info(
            "Updating the software that was identified as needing to be updated."
        )

        for software in softwareDict:
            #A second pause between each package update to help avoid any timing issues which may arise.
            time.sleep(2)

            #This pauses the updates during a keyboard interruption.
            while (self.wait):
                time.sleep(1)

            #Cancel the update if the user requested to end the program.
            if self.cancel:
                return
            '''
			Need to remove hponcfg first on RHEL systems if it is installed due to a package
			version mis-match causing a conflict during installation and subsequently an installation failure.
			'''
            if software == "hponcfg" and re.match("RHEL6.*", osDistLevel):
                #First make sure it is already installed before trying to remove it.
                command = "rpm -q hponcfg"
                result = subprocess.Popen(command,
                                          stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          shell=True)
                out, err = result.communicate()

                self.logger.debug(
                    "The output of the command (" + command +
                    ") used to check if hponcfg is installed was: " +
                    out.strip())

                if result.returncode == 0:
                    #Found multiple instances of hponcfg installed; thus converting the returned results to a string for removal.
                    out = out.splitlines()
                    command = "rpm -e " + ' '.join(out)
                    result = subprocess.Popen(command,
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE,
                                              shell=True)
                    out, err = result.communicate()

                    self.logger.debug("The output of the command (" + command +
                                      ") used to remove hponcfg was: " +
                                      out.strip())

                    if result.returncode != 0:
                        self.logger.error(
                            "Problems were encountered while trying to remove hponcfg; skipping update.\n"
                            + err)
                        self.updateComponentProblemDict['Software'][
                            software] = ''
                        continue

            #hp-health needs to be stopped first since it has been known to cause installation problems.
            if software == "hp-health":
                #First make sure it is already installed before trying to stop it.
                command = "rpm -q hp-health"
                result = subprocess.Popen(command,
                                          stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          shell=True)
                out, err = result.communicate()

                self.logger.debug(
                    "The output of the command (" + command +
                    ") used to check if hp-health is installed was: " +
                    out.strip())

                #This means hp-health is installed.
                if result.returncode == 0:
                    command = "/etc/init.d/hp-health stop"

                    #Spend up to two minutes trying to stop hp-health
                    self.timedProcessThread = TimedProcessThread(
                        command, 120, self.computeNodeDict['loggerName'])
                    self.timedProcessThread.start()
                    self.pid = self.timedProcessThread.getProcessPID()

                    statusList = self.timedProcessThread.getCompletionStatus()

                    status = statusList[0]

                    #Reset self.pid back to zero, since an active process is not running.
                    self.pid = 0

                    if status == 'timedOut':
                        self.logger.error(
                            "hp-health could not be stopped; will try to kill it now."
                        )

                        #This will return the process ID of hpasmlited.
                        command = "pgrep -x hpasmlited"
                        result = subprocess.Popen(command,
                                                  stdout=subprocess.PIPE,
                                                  stderr=subprocess.PIPE,
                                                  shell=True)
                        out, err = result.communicate()

                        self.logger.debug(
                            "The output of the command (" + command +
                            ") used to get the PID of hp-health was: " +
                            out.strip())

                        #The result should be 0 unless it just stopped suddenly.
                        if result.returncode == 0:
                            hpHealthPID = out.strip()
                            command = "kill -9 " + hpHealthPID
                            #Spend up to two more minutes trying to stop hp-health
                            self.timedProcessThread = TimedProcessThread(
                                command, 120,
                                self.computeNodeDict['loggerName'])
                            self.timedProcessThread.start()
                            self.pid = self.timedProcessThread.getProcessPID()
                            status = self.timedProcessThread.getCompletionStatus(
                            )

                            self.pid = 0

                            if status == "timedOut":
                                self.logger.error(
                                    "A second attempt to stop hp-health timed out; skipping update of hp-health."
                                )
                                self.updateComponentProblemDict['Software'][
                                    software] = ''
                                continue
                    elif status == 'Failed':
                        self.logger.error(
                            "An error was encountered while trying to stop hp-health; skipping update of hp-health.\n"
                            + statusList[1])
                        self.updateComponentProblemDict['Software'][
                            software] = ''
                        continue
            '''
			Before FusionIO software is updated the old packages are removed.  Also, since there are a set of packages to 
			install we need to add the softwareDir to each package.
			'''
            if software == 'FusionIO':
                if not removeFusionIOPackages(
                        self.
                        csurResourceDict['fusionIOSoftwareRemovalPackageList'],
                        'software', self.computeNodeDict['loggerName']):
                    self.logger.error(
                        "The FusionIO software could not be removed before updating/re-installing; skipping update of FusionIO software."
                    )
                    self.updateComponentProblemDict['Software'][software] = ''
                    continue

                softwarePackage = softwareDir + re.sub(' ', ' ' + softwareDir,
                                                       softwareDict[software])
            else:
                softwarePackage = softwareDir + softwareDict[software]

            #This command will update/install the software RPM and set its version to the CSUR version.
            command = "rpm -U --quiet --oldpackage --replacepkgs --nosignature " + softwarePackage
            '''
                        Need to do this with a thread, since a defunct process causes a hang situation.
                        The thread is given two minutes for each rpm, which should be sufficient.
                        Also, we set the thread to be a daemon thread so that the program can still exit
                        at which time the thread should exit and it appears that the RPM defunct processes
                        also go away as well.
			'''

            self.timedProcessThread = TimedProcessThread(
                command, 120, self.computeNodeDict['loggerName'])
            self.timedProcessThread.setDaemon(True)
            self.timedProcessThread.start()
            self.pid = self.timedProcessThread.getProcessPID()

            status = self.timedProcessThread.getCompletionStatus()

            self.pid = 0
            '''
			This transforms the variable software from FusionIO to a list of the of FusionIO package names 
			for verification purposes, since FusionIO is not a recognized package name when running rpm -V.	
			'''
            if software == 'FusionIO':
                fusionIOSoftwarePkgList = softwareDict[software].split()

                packageNames = ''

                for package in fusionIOSoftwarePkgList:
                    packageNames += re.sub('-[0-9]{1}.*', '', package) + " "

                packageNames = packageNames.strip()

            if status[0] == 'timedOut':
                '''
                                Let's verify whether or not the RPM was successfully installed, since it appears that
                                a defunct RPM process will cause a timeout to occur, yet the RPM installed successfully.
                                '''

                if software == 'FusionIO':
                    self.logger.info(
                        "Verifying the installation status of " +
                        packageNames +
                        ", since it appears it may not of installed correctly."
                    )
                    command = "rpm -V --nomtime " + packageNames
                else:
                    self.logger.info(
                        "Verifying the installation status of " + software +
                        ", since it appears it may not of installed correctly."
                    )
                    command = "rpm -V --nomtime " + software

                result = subprocess.Popen(command,
                                          stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          shell=True)
                out, err = result.communicate()

                if software == 'FusionIO':
                    self.logger.debug(
                        "The output of the command (" + command +
                        ") used to verify the installation status of " +
                        packageNames + "  was: " + out.strip())
                else:
                    self.logger.debug(
                        "The output of the command (" + command +
                        ") used to verify the installation status of " +
                        software + "  was: " + out.strip())

                if result.returncode != 0:
                    if software == 'FusionIO':
                        self.logger.error(
                            "Problems were encountered while updating " +
                            packageNames + ".\n" + err)
                    else:
                        self.logger.error(
                            "Problems were encountered while updating " +
                            software + ".\n" + err)

                    self.updateComponentProblemDict['Software'][software] = ''
            elif status[0] != "Succeeded":
                if software == 'FusionIO':
                    self.logger.error(
                        "Problems were encountered while updating " +
                        packageNames + ".\n" + err)
                else:
                    self.logger.error(
                        "Problems were encountered while updating " +
                        software + ".\n" + status[1])

                self.updateComponentProblemDict['Software'][software] = ''

        self.logger.info(
            "Done updating the software that was identified as needing to be updated."
        )
Exemplo n.º 3
0
    def _ComputeNodeUpdate__updateDrivers(self):
        driverDir = self.csurBasePath + '/drivers/computeNode/'
        driverDict = self.componentUpdateDict['Drivers']
        systemModel = self.computeNodeDict['systemModel']
        osDistLevel = self.computeNodeDict['osDistLevel']
        self.logger.info('Updating the drivers that were identified as needing to be updated.')
        for driver in driverDict:
            time.sleep(2)
            while self.wait:
                time.sleep(1)
            if self.cancel:
                return None
            self.pid = None
            if driver == 'nx_nic':
                if systemModel == 'DL580G7' or systemModel == 'DL980G7':
                    command = 'rpm -qa|grep ^hpqlgc-nx'
                    result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                    (out, err) = result.communicate()
                    self.logger.info('The output of the command (' + command + ') used to check if the new nx_nic driver is installed was: ' + out.strip())
                    if result.returncode != 0:
                        command = 'rpm -e hp-nx_nic-kmp-default hp-nx_nic-tools'
                        result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                        (out, err) = result.communicate()
                        self.logger.info('The output of the command (' + command + ') used to remove the nx_nic driver was: ' + out.strip())
                        if result.returncode != 0:
                            self.logger.error('Problems were encountered while trying to remove hp-nx_nic-kmp-default and hp-nx_nic-tools; skipping update.\n' + err)
                            self.updateComponentProblemDict['Drivers'][driver] = ''
                            continue
                        
                    
            if driver == 'be2net':
                command = 'rpm -q hp-be2net-kmp-default'
                result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                (out, err) = result.communicate()
                self.logger.info('The output of the command (' + command + ') used to check if the old be2net driver is installed was: ' + out.strip())
                if result.returncode == 0:
                    command = 'rpm -e hp-be2net-kmp-default'
                    result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                    (out, err) = result.communicate()
                    self.logger.info('The output of the command (' + command + ') used to remove the be2net driver was: ' + out.strip())
                    if result.returncode != 0:
                        self.logger.error('Problems were encountered while trying to remove hp-be2net-kmp-default; skipping update.\n' + err)
                        self.updateComponentProblemDict['Drivers'][driver] = ''
                        continue
                    
                
            if driver == 'mlx4_en' and osDistLevel != 'SLES12.3':
                
                try:
                    if 'SLES' in osDistLevel:
                        packages = re.sub('\\s*,\\s*', ' ', self.csurResourceDict['slesMellanoxPackageList'])
                        mellanoxPackageList = packages.split(' ')
                    else:
                        packages = re.sub('\\s*,\\s*', ' ', self.csurResourceDict['rhelMellanoxPackageList'])
                        mellanoxPackageList = packages.split(' ')
                except KeyError:
                    err = None
                    self.logger.error('The resource key (' + str(err) + ') was not present in the resource file.')
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                    continue

                mellanoxRemovalList = []
                for package in mellanoxPackageList:
                    command = 'rpm -q ' + package + ' > /dev/null 2>&1'
                    result = subprocess.call(command, shell = True)
                    if result == 0:
                        mellanoxRemovalList.append(package)
                        continue
                if len(mellanoxRemovalList) > 0:
                    packages = ' '.join(mellanoxRemovalList)
                    command = 'rpm -e ' + packages
                    result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
                    (out, err) = result.communicate()
                    self.logger.info('The output of the command (' + command + ') used to remove the Mellanox conflicting RPMs was: ' + out.strip())
                    if result.returncode != 0:
                        self.logger.error('Problems were encountered while trying to remove the Mellanox conflicting RPMs; skipping update.\n' + err)
                        self.updateComponentProblemDict['Drivers'][driver] = ''
                        continue
                    
                
            if driver == 'iomemory_vsl':
                if self._ComputeNodeUpdate__checkIOMemoryVSL():
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                    continue
                if self._ComputeNodeUpdate__unloadFusionIODriver():
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                    continue
                dateTimestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
                iomemoryCfgBackup = '/etc/sysconfig/iomemory-vsl.' + dateTimestamp
                
                try:
                    shutil.copy2('/etc/sysconfig/iomemory-vsl', iomemoryCfgBackup)
                except IOError:
                    err = None
                    self.logger.error("Unable to make a backup of the system's iomemory-vsl configuration file.\n" + str(err))
                    self.updateComponentProblemDict['Drivers'][driver] = ''

                if not removeFusionIOPackages(self.csurResourceDict['fusionIODriverRemovalPackageList'], 'driver', self.computeNodeDict['loggerName'], kernel = self.computeNodeDict['kernel']):
                    self.logger.error('The FusionIO driver packages could not be removed before building/re-installing the FusionIO driver; skipping update of FusionIO driver.')
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                    continue
                
            if ':' not in driverDict[driver]:
                driverRPMList = driverDir + driverDict[driver]
            else:
                driverRPMsString = driverDict[driver]
                tmpDriverRPMList = driverRPMsString.replace(':', ' ' + driverDir)
                driverRPMList = driverDir + tmpDriverRPMList
            command = 'rpm -U --quiet --oldpackage --replacefiles --replacepkgs --nosignature ' + driverRPMList
            result = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, preexec_fn = os.setpgrp, shell = True)
            self.pid = result.pid
            (out, err) = result.communicate()
            self.logger.info('The output of the command (' + command + ") used to update the '" + driver + "' driver was: " + out.strip())
            if result.returncode != 0:
                self.logger.error("Problems were encountered while updating driver '" + driver + "'.\n" + err)
                self.updateComponentProblemDict['Drivers'][driver] = ''
                continue
            elif re.search('warning', out, re.MULTILINE | re.DOTALL | re.IGNORECASE) != None:
                self.logger.warn("Warnings were encountered while updating driver '" + driver + "'.\n" + out)
                self.updateComponentProblemDict['Drivers'][driver] = ''
            if driver == 'iomemory_vsl':
                self.fusionIODriverUpdateStarted = True
                if not self.fusionIODriverUpdate.buildInstallFusionIODriver(self.csurResourceDict.copy(), driverDir, self.computeNodeDict['loggerName']):
                    self.logger.error('Problems were encountered while building and installing the FusionIO driver.')
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                self.fusionIODriverUpdateStarted = False
                
                try:
                    shutil.copy2(iomemoryCfgBackup, '/etc/sysconfig/iomemory-vsl')
                except IOError:
                    err = None
                    self.logger.error("Failed to restore the system's iomemory-vsl configuration file.\n" + str(err))
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                

            if not driver == 'mlx4_en' and len(self.computeNodeDict['mellanoxBusList']) != 0 and os.path.exists(self.connectXCfgFile) or self._ComputeNodeUpdate__updateConnectX():
                self.updateComponentProblemDict['Drivers'][driver] = ''
            
        
        self.logger.info('Done updating the drivers that were identified as needing to be updated.')
Exemplo n.º 4
0
    def __updateDrivers(self):
        driverDir = self.csurBasePath + '/drivers/computeNode/'
        driverDict = self.componentUpdateDict['Drivers']
        systemModel = self.computeNodeDict['systemModel']
        osDistLevel = self.computeNodeDict['osDistLevel']

        self.logger.info(
            "Updating the drivers that were identified as needing to be updated."
        )

        for driver in driverDict:
            time.sleep(2)

            #This pauses the updates during a keyboard interruption.
            while (self.wait):
                time.sleep(1)

            #Cancel the update if the user requested to end the program.
            if self.cancel:
                return

            #Make sure self.pid is set to 0 for each iteration.
            self.pid = 0
            '''
			nx_nic and be2net driver has to be removed first if it is an old driver, since the packages have been renamed.
			Thus, we first check to see if new version is installed and if not this implies the old driver is present,
			which we then remove.
			'''
            if driver == "nx_nic" and ((systemModel == 'DL580G7') or
                                       (systemModel == 'DL980G7')):
                command = "rpm -qa|grep ^hpqlgc-nx"
                result = subprocess.Popen(command,
                                          stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          shell=True)
                out, err = result.communicate()

                self.logger.debug(
                    "The output of the command (" + command +
                    ") used to check if the new nx_nic driver is installed was: "
                    + out.strip())

                if result.returncode != 0:
                    command = "rpm -e hp-nx_nic-kmp-default hp-nx_nic-tools"
                    result = subprocess.Popen(command,
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE,
                                              shell=True)
                    out, err = result.communicate()

                    self.logger.debug(
                        "The output of the command (" + command +
                        ") used to remove the nx_nic driver was: " +
                        out.strip())

                    if result.returncode != 0:
                        self.logger.error(
                            "Problems were encountered while trying to remove hp-nx_nic-kmp-default and hp-nx_nic-tools; skipping update.\n"
                            + err)
                        self.updateComponentProblemDict['Drivers'][driver] = ''
                        continue

            if driver == "be2net":
                command = "rpm -q hp-be2net-kmp-default"
                result = subprocess.Popen(command,
                                          stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          shell=True)
                out, err = result.communicate()

                self.logger.debug(
                    "The output of the command (" + command +
                    ") used to check if the old be2net driver is installed was: "
                    + out.strip())

                if result.returncode == 0:
                    command = "rpm -e hp-be2net-kmp-default"
                    result = subprocess.Popen(command,
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE,
                                              shell=True)
                    out, err = result.communicate()

                    self.logger.debug(
                        "The output of the command (" + command +
                        ") used to remove the be2net driver was: " +
                        out.strip())

                    if result.returncode != 0:
                        self.logger.error(
                            "Problems were encountered while trying to remove hp-be2net-kmp-default; skipping update.\n"
                            + err)
                        self.updateComponentProblemDict['Drivers'][driver] = ''
                        continue
            '''
			This was added for CS500 Haswell.
                        Before the Mellanox driver can be updated we need to remove some RPMs that conflict with the change.
                        '''
            if driver == 'mlx4_en':
                mellanoxPackageList = [
                    'mlnx-en-kmp-default', 'mlnx-en-utils', 'libmlx4-rdmav2',
                    'libmlx4', 'libibverbs', 'libibverbs1', 'librdmacm',
                    'libmthca-rdmav2', 'libibcm'
                ]
                mellanoxRemovalList = []

                #Before trying to remove a package we need to see if it is present.
                for package in mellanoxPackageList:
                    command = "rpm -q " + package + " > /dev/null 2>&1"
                    result = subprocess.call(command, shell=True)

                    if result == 0:
                        mellanoxRemovalList.append(package)

#Now remove any of the packages that were present.
                if len(mellanoxRemovalList) > 0:
                    packages = " ".join(mellanoxRemovalList)

                    command = "rpm -e " + packages

                    result = subprocess.Popen(command,
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE,
                                              shell=True)
                    out, err = result.communicate()

                    self.logger.debug(
                        "The output of the command (" + command +
                        ") used to remove the Mellanox conflicting RPMs was: "
                        + out.strip())

                    if result.returncode != 0:
                        self.logger.error(
                            "Problems were encountered while trying to remove the Mellanox conflicting RPMs; skipping update.\n"
                            + err)
                        self.updateComponentProblemDict['Drivers'][driver] = ''
                        continue

            if driver == 'iomemory_vsl':
                #Make a backup of /etc/sysconfig/iomemory-vsl, which will be restored during the post update.
                dateTimestamp = (
                    datetime.datetime.now()).strftime('%Y%m%d%H%M%S')

                iomemoryCfgBackup = '/etc/sysconfig/iomemory-vsl.' + dateTimestamp

                try:
                    shutil.copy2('/etc/sysconfig/iomemory-vsl',
                                 iomemoryCfgBackup)
                except IOError as err:
                    self.logger.error(
                        "Unable to make a backup of the system's iomemory-vsl configuration file.\n"
                        + str(err))
                    self.updateComponentProblemDict['Drivers'][driver] = ''

                if not removeFusionIOPackages(
                        self.
                        csurResourceDict['fusionIODriverRemovalPackageList'],
                        'driver',
                        self.computeNodeDict['loggerName'],
                        kernel=self.computeNodeDict['kernel']):
                    self.logger.error(
                        "The FusionIO driver packages could not be removed before building/re-installing the FusionIO driver; skipping update of FusionIO driver."
                    )
                    self.updateComponentProblemDict['Drivers'][driver] = ''
                    continue

            #Driver dependencies are seperated by a ':'.
            if ':' not in driverDict[driver]:
                driverRPMList = driverDir + driverDict[driver]
            else:
                driverRPMsString = driverDict[driver]
                tmpDriverRPMList = driverRPMsString.replace(
                    ':', ' ' + driverDir)
                driverRPMList = driverDir + tmpDriverRPMList

            command = "rpm -U --oldpackage --replacepkgs --nosignature " + driverRPMList
            result = subprocess.Popen(command,
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.PIPE,
                                      preexec_fn=os.setpgrp,
                                      shell=True)
            self.pid = result.pid
            out, err = result.communicate()

            self.logger.debug("The output of the command (" + command +
                              ") used to update the '" + driver +
                              "' driver was: " + out.strip())

            if result.returncode != 0:
                self.logger.error(
                    "Problems were encountered while updating driver '" +
                    driver + "'.\n" + err)
                self.updateComponentProblemDict['Drivers'][driver] = ''
                continue

            if driver == 'iomemory_vsl':
                self.fusionIODriverUpdateStarted = True

                if not self.fusionIODriverUpdate.buildInstallFusionIODriver(
                        self.csurResourceDict.copy(), driverDir,
                        self.computeNodeDict['loggerName']):
                    self.logger.error(
                        "Problems were encountered while building and installing the FusionIO driver."
                    )
                    self.updateComponentProblemDict['Drivers'][driver] = ''

                self.fusionIODriverUpdateStarted = False

                #Restore the original FusionIO configuration file.
                try:
                    shutil.copy2(iomemoryCfgBackup,
                                 '/etc/sysconfig/iomemory-vsl')
                except IOError as err:
                    self.logger.error(
                        "Failed to restore the system's iomemory-vsl configuration file.\n"
                        + str(err))
                    self.updateComponentProblemDict['Drivers'][driver] = ''

        self.logger.info(
            "Done updating the drivers that were identified as needing to be updated."
        )