예제 #1
0
파일: report.py 프로젝트: pexip/os-qemu
 def deserialize(cls, data):
     return cls(Hardware.deserialize(data["hardware"]),
                Scenario.deserialize(data["scenario"]), [
                    Progress.deserialize(record)
                    for record in data["progress_history"]
                ], Timings.deserialize(data["guest_timings"]),
                Timings.deserialize(data["qemu_timings"]),
                Timings.deserialize(data["vcpu_timings"]), data["binary"],
                data["dst_host"], data["kernel"], data["initrd"],
                data["transport"], data["sleep"])
예제 #2
0
파일: report.py 프로젝트: 8tab/qemu
 def deserialize(cls, data):
     return cls(
         Hardware.deserialize(data["hardware"]),
         Scenario.deserialize(data["scenario"]),
         [Progress.deserialize(record) for record in data["progress_history"]],
         Timings.deserialize(data["guest_timings"]),
         Timings.deserialize(data["qemu_timings"]),
         Timings.deserialize(data["vcpu_timings"]),
         data["binary"],
         data["dst_host"],
         data["kernel"],
         data["initrd"],
         data["transport"],
         data["sleep"])
예제 #3
0
파일: engine.py 프로젝트: knknkn1162/qemu
    def run(self, hardware, scenario, result_dir=os.getcwd()):
        abs_result_dir = os.path.join(result_dir, scenario._name)

        if self._transport == "tcp":
            uri = "tcp:%s:9000" % self._dst_host
        elif self._transport == "rdma":
            uri = "rdma:%s:9000" % self._dst_host
        elif self._transport == "unix":
            if self._dst_host != "localhost":
                raise Exception(
                    "Running use unix migration transport for non-local host")
            uri = "unix:/var/tmp/qemu-migrate-%d.migrate" % os.getpid()
            try:
                os.remove(uri[5:])
                os.remove(monaddr)
            except:
                pass

        if self._dst_host != "localhost":
            dstmonaddr = ("localhost", 9001)
        else:
            dstmonaddr = "/var/tmp/qemu-dst-%d-monitor.sock" % os.getpid()
        srcmonaddr = "/var/tmp/qemu-src-%d-monitor.sock" % os.getpid()

        src = QEMUMachine(self._binary,
                          args=self._get_src_args(hardware),
                          wrapper=self._get_src_wrapper(hardware),
                          name="qemu-src-%d" % os.getpid(),
                          monitor_address=srcmonaddr)

        dst = QEMUMachine(self._binary,
                          args=self._get_dst_args(hardware, uri),
                          wrapper=self._get_dst_wrapper(hardware),
                          name="qemu-dst-%d" % os.getpid(),
                          monitor_address=dstmonaddr)

        try:
            src.launch()
            dst.launch()

            ret = self._migrate(hardware, scenario, src, dst, uri)
            progress_history = ret[0]
            qemu_timings = ret[1]
            vcpu_timings = ret[2]
            if uri[0:5] == "unix:":
                os.remove(uri[5:])
            if self._verbose:
                print("Finished migration")

            src.shutdown()
            dst.shutdown()

            return Report(
                hardware, scenario, progress_history,
                Timings(self._get_timings(src) + self._get_timings(dst)),
                Timings(qemu_timings), Timings(vcpu_timings), self._binary,
                self._dst_host, self._kernel, self._initrd, self._transport,
                self._sleep)
        except Exception as e:
            if self._debug:
                print("Failed: %s" % str(e))
            try:
                src.shutdown()
            except:
                pass
            try:
                dst.shutdown()
            except:
                pass

            if self._debug:
                print(src.get_log())
                print(dst.get_log())
            raise