示例#1
0
 def __registerWithAutoDetectionDaemon(self):
     log.info("Trying to connect with autodetection deamon from " +
              self.__management_ip)
     if self.__debug:
         HOST = "192.168.0.2"
         PORT = DaemonLocations.autodetectDaemon[1] + 100000
         print "TARGET ", HOST, PORT
     else:
         HOST = DaemonLocations.autodetectDaemon[0]
         PORT = DaemonLocations.autodetectDaemon[1]
     client = ReservationClient()
     success = False
     command = "register_target"
     payload = str(self.__management_ip)
     retries = 0
     while (retries < 3 and not success):
         try:
             retries += 1
             client.connect(HOST, PORT)
             reply = client.sendRequest(command, payload)
             if reply == "success":
                 success = True
         except Exception, e:
             print e
             log.warning("Retry " + str(retries) +
                         " sleeping for 10 seconds")
             time.sleep(10)
示例#2
0
    def __init__(self, ip, node, debug):
        self.__node = node
        self.__toGiga = (1.0 / 10**9)
        self.__toGigaBinary = (1.0 / 2**30)
        self.__processor_count = 0
        self.__processor_core_count = {}
        self.__interfaces = {}
        self.__next_interface_id = 0
        self.__ip = ip
        self.__debug = debug
        self.__target = None
        self.__lshw = None

        self.__target = ReservationClient()
        #if not self.__debug:
        self.__switchd = ReservationClient()
        self.__if_list = []
        log.info("Detecting " + str(ip))
        self.finished = False
        self.start()
示例#3
0
    print message + "\n"
    help()
    os._exit(1)


def convertToDate(string):
    dates = string.split("/")
    return datetime.date(int(dates[2]), int(dates[1]), int(dates[0]))


if (len(sys.argv) < 2):
    error("missing parameter(s)")

HOST = DaemonLocations.reservationDaemon[0]
PORT = DaemonLocations.reservationDaemon[1] + 100000
client = ReservationClient()
client.connect(HOST, PORT)

username = os.environ['USER']
command = sys.argv[1]
payload = None

#command = "cleanexpired"
#payload = pickle.dumps(())
#client.sendRequest(command, payload)
#os._exit(1)

#command = "reloadhendb"
#payload = pickle.dumps(())
#client.sendRequest(command, payload)
#os._exit(1)