예제 #1
0
def check_monster_status():
    try:
        database.ping_db()
    except AssertionError:
        logger.warning("Database is not responding normally...")
        raise
    else:
        logger.info("Database is up!")

    try:
        rackspace.Provisioner()
    except Exception:
        logger.warning("Rackspace credentials did not authenticate.")
        raise
    else:
        logger.info("Rackspace credentials look good!")
    try:
        razor_ip = active.config['secrets']['razor']['ip']
        check_port(host=razor_ip, port=8026, attempts=1)
    except KeyError:
        logger.info("No razor IP specified; Razor provisioner will not be "
                    "available.")
    except Exception:
        logger.warning("Specified Razor host did not seem responsive on port "
                       "8026. Razor provisioner will likely be unavailable.")
    else:
        logger.info("Razor host is up and responding on port 8026!")
예제 #2
0
 def get_server(self, node_name, image, flavor, nics):
     logger.info("Requesting a new server for {}...".format(node_name))
     for creation_attempt in range(3):
         server = self.compute_client.servers.create(node_name, image,
                                                     flavor, nics=nics)
         password = server.adminPass
         for wait_for_state in range(100):
             server = self.compute_client.servers.get(server.id)
             if server.status == "ACTIVE":
                 check_port(server.accessIPv4, 22, timeout=2)
                 return server, password
             logger.info("NODE: {:<23} STATUS: {:<8} PROGRESS: {:>3}%"
                         .format(node_name, server.status, server.progress))
             time.sleep(10)
         else:
             logger.error("Unable to build server for {}. Retrying..."
                          .format(node_name))
             server.delete()
     else:
         logger.exception("Server creation failed three times; exiting...")
예제 #3
0
 def rdo(self, node):
     logger.info("Installing RDO kernel.")
     kernel = active.config['rcbops']['compute']['kernel']['centos']
     if kernel['version'] not in node.run_cmd("uname -r")['return']:
         node.run_cmd(kernel['install'] + "; reboot now")
         check_port(node.ipaddress, 22)