HP IVM by Shell job fails when sudo is needed to run hpvminfo command

  • KM03812247
  • 28-May-2021
  • 10-Jun-2021

Summary

HP IVM by Shell job fails when sudo is needed to run hpvminfo command

Error

While discovering HP IVM virtualization with a non-root user which has sudo rights to run hpvminfo command, the discovery incorrectly fails.

It caused by isIvmSystem() function returns False.

Fix

to modify isIvmSystem() method in the file ivm_discoverer.py:
   def isIvmSystem(self):



       logger.debug("Checking if hpvminfo is installed")

       output = self._shell.execCmd(IvmHypervisorDiscoverer.HPVMINFO_PATH)

       if output:

           if __isCommandUnrecognized(output):

               raise ValueError("Failed to determine if discovering IVM system")

 

       ### modification Start

       ### - Look for Permission denied error

           if re.search(r"Permission denied", output, re.I):

               # raise InsufficientPermissionsException, command

               logger.debug("DEBUG: class IvmHypervisorDiscoverer: isIvmSystem(): Must have root permissions to run %s " % IvmHypervisorDiscoverer.HPVMINFO_PATH)

           return True

       ### modification End


 

       if self._shell.getLastCmdReturnCode() == 0:

           return True