Exemple #1
0
    def wait_available(self):
        """Wait until the Virtual Machine is available for usage."""
        end = time.time() + self.timeout

        while db.guest_get_status(self.task_id) == "starting" and self.do_run:
            try:
                socket.create_connection((self.ipaddr, self.port), 1).close()
                break
            except socket.timeout:
                log.debug("%s: not ready yet", self.vmid)
            except socket.error:
                log.debug("%s: not ready yet", self.vmid)
                time.sleep(1)

            if time.time() > end:
                raise CuckooGuestCriticalTimeout(
                    "Machine %s: the guest initialization hit the critical " "timeout, analysis aborted." % self.vmid
                )
Exemple #2
0
    def wait_available(self):
        """Wait until the Virtual Machine is available for usage."""
        start = timeit.default_timer()

        while db.guest_get_status(self.task_id) == "starting" and self.do_run:
            try:
                socket.create_connection((self.ipaddr, self.port), 1).close()
                break
            except socket.timeout:
                log.debug("Task #%s: %s is not ready yet", self.task_id, self.vmid)
            except socket.error:
                log.debug("Task #%s: %s is not ready yet", self.task_id, self.vmid)
                time.sleep(1)

            if timeit.default_timer() - start > self.timeout:
                raise CuckooGuestCriticalTimeout(
                    f"Machine {self.vmid}: the guest initialization hit the critical timeout, analysis aborted"
                )