Example #1
0
    def validate_bmc_info(self, info):
        try:
            cid = int(info)
            if cid < 1:
                raise BMCError("Not a valid moonshot cartridge id.")
        except Exception as e:
            raise BMCError("Not a valid moonshot cartridge id.")

        return True
Example #2
0
 def get_sol_command(self, machine):
     bmc = machine.bmc
     try:
         return get_sol_command(host=bmc.ip,
                                username=bmc.username,
                                password=bmc.password)
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))
Example #3
0
 def deactivate_sol(self, machine):
     bmc = machine.bmc
     try:
         deactivate_sol(host=bmc.ip,
                        username=bmc.username,
                        password=bmc.password)
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))
Example #4
0
 def get_power(self, machine):
     bmc = machine.bmc
     try:
         return get_power(host=bmc.ip,
                          username=bmc.username,
                          password=bmc.password,
                          bridge_info=self.get_bridge_info(machine))
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))
Example #5
0
 def set_power(self, machine, power_state):
     bmc = machine.bmc
     try:
         set_power(power_state,
                   host=bmc.ip,
                   username=bmc.username,
                   password=bmc.password)
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))
Example #6
0
 def set_bootdev(self, machine, bootdev):
     bmc = machine.bmc
     try:
         set_bootdev(bootdev,
                     host=bmc.ip,
                     username=bmc.username,
                     password=bmc.password)
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))
Example #7
0
 def set_power(self, machine, power_state):
     bmc = machine.bmc
     try:
         # Moonshot reacts with error "Unknown (0x80)" to "chassis power reset" command
         # "chassis power cycle" reboots machine everytime
         if power_state == "reset":
             power_state = "cycle"
         set_power(power_state,
                   host=bmc.ip,
                   username=bmc.username,
                   password=bmc.password,
                   bridge_info=self.get_bridge_info(machine))
     except IPMIError as e:
         raise BMCError("BMC error: %s" % str(e))