コード例 #1
0
ファイル: trace.py プロジェクト: xiar/infrasim-compute
    def init(self):
        if self.__seabios_out == "on":
            self.__chardev_for_so = CCharDev({
                "backend":
                "file",
                "path":
                os.path.join(config.infrasim_log_dir, self.__node_name,
                             "seabios.log"),
            })
            self.__chardev_for_so.set_id("seabios")
            self.__chardev_for_so.init()

        if self.__guest_out == "on":
            self.__chardev_for_go = CCharDev({
                "backend":
                "file",
                "path":
                os.path.join(config.infrasim_log_dir, self.__node_name,
                             "guest.log")
            })

            self.__chardev_for_go.set_id("guest")
            self.__chardev_for_go.init()

            self.__serial_for_go = CSerial(self.__chardev_for_go,
                                           {"index": "0"})
            self.__serial_for_go.init()
コード例 #2
0
class GuestAgent(CElement):
    def __init__(self, workspace):
        super(GuestAgent, self).__init__()
        self.__chardev = None
        self.__workspace = workspace
        self.__serial = None

    def precheck(self):
        if self.__chardev:
            self.__chardev.precheck()

        if self.__serial:
            self.__serial.precheck()

    def init(self):
        self.__chardev = CCharDev({
            "backend": "socket",
            "path": os.path.join(self.__workspace, "guest.agt"),
            "server": "on",
            "wait": False
        })
        self.__chardev.set_id("guest-agent")
        self.__chardev.init()

        self.__serial = CSerial(self.__chardev,
                                {"index": 3})
        self.__serial.init()

    def handle_parms(self):
        self.__chardev.handle_parms()
        self.__serial.handle_parms()
        self.add_option(self.__chardev.get_option())
        self.add_option(self.__serial.get_option())
コード例 #3
0
ファイル: trace.py プロジェクト: xiar/infrasim-compute
class QTrace(CElement):
    def __init__(self, trace_settings, workspace):
        super(QTrace, self).__init__()
        self.__seabios_out = trace_settings.get("seabios")
        self.__guest_out = trace_settings.get("guest")

        self.__chardev_for_so = None

        self.__chardev_for_go = None
        self.__serial_for_go = None
        self.__node_name = workspace.split('/')[-1]

    def precheck(self):
        pass

    def init(self):
        if self.__seabios_out == "on":
            self.__chardev_for_so = CCharDev({
                "backend":
                "file",
                "path":
                os.path.join(config.infrasim_log_dir, self.__node_name,
                             "seabios.log"),
            })
            self.__chardev_for_so.set_id("seabios")
            self.__chardev_for_so.init()

        if self.__guest_out == "on":
            self.__chardev_for_go = CCharDev({
                "backend":
                "file",
                "path":
                os.path.join(config.infrasim_log_dir, self.__node_name,
                             "guest.log")
            })

            self.__chardev_for_go.set_id("guest")
            self.__chardev_for_go.init()

            self.__serial_for_go = CSerial(self.__chardev_for_go,
                                           {"index": "0"})
            self.__serial_for_go.init()

    def handle_parms(self):
        if self.__chardev_for_so:
            self.__chardev_for_so.handle_parms()
            self.add_option(
                "{} -device isa-debugcon,iobase=0x402,chardev=seabios".format(
                    self.__chardev_for_so.get_option()))

        if self.__chardev_for_go and self.__serial_for_go:
            self.__chardev_for_go.handle_parms()
            self.__serial_for_go.handle_parms()
            self.add_option(self.__chardev_for_go.get_option())
            self.add_option(self.__serial_for_go.get_option())
コード例 #4
0
ファイル: guest_agent.py プロジェクト: xiar/infrasim-compute
    def init(self):
        self.__chardev = CCharDev({
            "backend":
            "socket",
            "path":
            os.path.join(self.__workspace, "guest.agt"),
            "server":
            "on",
            "wait":
            False
        })
        self.__chardev.set_id("guest-agent")
        self.__chardev.init()

        self.__serial = CSerial(self.__chardev, {"index": 3})
        self.__serial.init()
コード例 #5
0
ファイル: trace.py プロジェクト: InfraSIM/infrasim-compute
class QTrace(CElement):
    def __init__(self, trace_settings, workspace):
        super(QTrace, self).__init__()
        self.__seabios_out = trace_settings.get("seabios")
        self.__guest_out = trace_settings.get("guest")

        self.__chardev_for_so = None

        self.__chardev_for_go = None
        self.__serial_for_go = None
        self.__node_name = workspace.split('/')[-1]

    def precheck(self):
        pass

    def init(self):
        if self.__seabios_out == "on":
            self.__chardev_for_so = CCharDev({
                "backend": "file",
                "path": os.path.join(config.infrasim_log_dir, self.__node_name, "seabios.log"),
            })
            self.__chardev_for_so.set_id("seabios")
            self.__chardev_for_so.init()

        if self.__guest_out == "on":
            self.__chardev_for_go = CCharDev({
                "backend": "file",
                "path": os.path.join(config.infrasim_log_dir, self.__node_name, "guest.log")
            })

            self.__chardev_for_go.set_id("guest")
            self.__chardev_for_go.init()

            self.__serial_for_go = CSerial(self.__chardev_for_go, {"index": "0"})
            self.__serial_for_go.init()

    def handle_parms(self):
        if self.__chardev_for_so:
            self.__chardev_for_so.handle_parms()
            self.add_option("{} -device isa-debugcon,iobase=0x402,chardev=seabios".format(
                self.__chardev_for_so.get_option()))

        if self.__chardev_for_go and self.__serial_for_go:
            self.__chardev_for_go.handle_parms()
            self.__serial_for_go.handle_parms()
            self.add_option(self.__chardev_for_go.get_option())
            self.add_option(self.__serial_for_go.get_option())
コード例 #6
0
    def init(self):
        self.__chardev = CCharDev({
            "backend": "socket",
            "path": os.path.join(self.__workspace, "guest.agt"),
            "server": "on",
            "wait": False
        })
        self.__chardev.set_id("guest-agent")
        self.__chardev.init()

        self.__serial = CSerial(self.__chardev,
                                {"index": 3})
        self.__serial.init()
コード例 #7
0
ファイル: guest_agent.py プロジェクト: xiar/infrasim-compute
class GuestAgent(CElement):
    def __init__(self, workspace):
        super(GuestAgent, self).__init__()
        self.__chardev = None
        self.__workspace = workspace
        self.__serial = None

    def precheck(self):
        if self.__chardev:
            self.__chardev.precheck()

        if self.__serial:
            self.__serial.precheck()

    def init(self):
        self.__chardev = CCharDev({
            "backend":
            "socket",
            "path":
            os.path.join(self.__workspace, "guest.agt"),
            "server":
            "on",
            "wait":
            False
        })
        self.__chardev.set_id("guest-agent")
        self.__chardev.init()

        self.__serial = CSerial(self.__chardev, {"index": 3})
        self.__serial.init()

    def handle_parms(self):
        self.__chardev.handle_parms()
        self.__serial.handle_parms()
        self.add_option(self.__chardev.get_option())
        self.add_option(self.__serial.get_option())
コード例 #8
0
ファイル: trace.py プロジェクト: InfraSIM/infrasim-compute
    def init(self):
        if self.__seabios_out == "on":
            self.__chardev_for_so = CCharDev({
                "backend": "file",
                "path": os.path.join(config.infrasim_log_dir, self.__node_name, "seabios.log"),
            })
            self.__chardev_for_so.set_id("seabios")
            self.__chardev_for_so.init()

        if self.__guest_out == "on":
            self.__chardev_for_go = CCharDev({
                "backend": "file",
                "path": os.path.join(config.infrasim_log_dir, self.__node_name, "guest.log")
            })

            self.__chardev_for_go.set_id("guest")
            self.__chardev_for_go.init()

            self.__serial_for_go = CSerial(self.__chardev_for_go, {"index": "0"})
            self.__serial_for_go.init()
コード例 #9
0
ファイル: compute.py プロジェクト: InfraSIM/infrasim-compute
    def handle_parms(self):
        self.add_option("-vnc :{}".format(self.__display))
        self.add_option("-name {}".format(self.get_task_name()))
        if self.__sol_enabled:
            self.add_option("-device sga")

        if self.__enable_kvm:
            self.add_option("--enable-kvm")

        self.add_option("-uuid {}".format(self.__uuid))

        if self.__smbios:
            self.add_option("-smbios file={}".format(self.__smbios))

        if self.__bios:
            self.add_option("-bios {}".format(self.__bios))

        if self.__mem_path:
            self.add_option("-mem-path {}".format(self.__mem_path))

        if self.__extra_option:
            self.add_option(self.__extra_option)

        boot_param = []
        if self.__boot_order:
            bootdev_path = self.get_workspace() + '/bootdev'
            if os.path.exists(bootdev_path) is True:
                with open(bootdev_path, "r") as f:
                    boot_param = f.readlines()
                boot_param[0] = boot_param[0].strip()
                if boot_param[0] == "default":
                    self.__boot_order = "c"
                elif boot_param[0] == "pxe":
                    self.__boot_order = "n"
                elif boot_param[0] == "cdrom":
                    self.__boot_order = "d"
                else:
                    self.__boot_order = "ncd"
                boot_param.append("order={}".format(self.__boot_order))
            else:
                boot_param.append("order={}".format(self.__boot_order))
        if self.__boot_menu:
            boot_param.append("menu={}".format(self.__boot_menu))
        if self.__boot_splash_name:
            boot_param.append("splash={}".format(self.__boot_splash_name))
        if self.__boot_splash_time:
            boot_param.append("splash-time={}".format(self.__boot_splash_time))
        tmp = ","
        self.add_option("-boot {}".format(tmp.join(boot_param)))

        if self.__socket_serial and self.__sol_enabled:
            chardev = CCharDev({
                "backend": "socket",
                "path": self.__socket_serial,
                "wait": "off"
            })
            chardev.logger = self.logger
            chardev.set_id("serial0")
            chardev.init()
            chardev.precheck()
            chardev.handle_parms()
            self.add_option(chardev.get_option())

            # serial index 0 must be used for SOL
            serial_obj = CSerial(chardev, {"index": 0})
            serial_obj.init()
            serial_obj.precheck()
            serial_obj.handle_parms()
            self.add_option(serial_obj.get_option())

        if self.__kernel and self.__initrd:
            self.add_option("-kernel {} -initrd {}".format(self.__kernel, self.__initrd))

        if self.__cmdline:
            self.add_option("--append \"{}\"".format(self.__cmdline))

        if self.__shm_key:
            self.add_option("-communicate shmkey={}".format(self.__shm_key))

        for element_obj in self.__element_list:
            element_obj.handle_parms()
コード例 #10
0
    def handle_parms(self):
        self.add_option("-vnc :{}".format(self.__display))
        self.add_option("-name {}".format(self.get_task_name()))
        if self.__sol_enabled:
            self.add_option("-device sga")

        if self.__enable_kvm:
            self.add_option("--enable-kvm")

        if self.__smbios:
            self.add_option("-smbios file={}".format(self.__smbios))

        if self.__bios:
            self.add_option("-bios {}".format(self.__bios))

        if self.__mem_path:
            self.add_option("-mem-path {}".format(self.__mem_path))

        if self.__extra_option:
            self.add_option(self.__extra_option)

        boot_param = []
        if self.__boot_order:
            bootdev_path = self.get_workspace() + '/bootdev'
            if os.path.exists(bootdev_path) is True:
                with open(bootdev_path, "r") as f:
                    boot_param = f.readlines()
                boot_param[0] = boot_param[0].strip()
                if boot_param[0] == "default":
                    self.__boot_order = "c"
                elif boot_param[0] == "pxe":
                    self.__boot_order = "n"
                elif boot_param[0] == "cdrom":
                    self.__boot_order = "d"
                else:
                    self.__boot_order = "ncd"
                boot_param.append("order={}".format(self.__boot_order))
            else:
                boot_param.append("order={}".format(self.__boot_order))
        if self.__boot_menu:
            boot_param.append("menu={}".format(self.__boot_menu))
        if self.__boot_splash_name:
            boot_param.append("splash={}".format(self.__boot_splash_name))
        if self.__boot_splash_time:
            boot_param.append("splash-time={}".format(self.__boot_splash_time))
        tmp = ","
        self.add_option("-boot {}".format(tmp.join(boot_param)))

        if self.__socket_serial and self.__sol_enabled:
            chardev = CCharDev({
                "backend": "socket",
                "path": self.__socket_serial,
                "wait": "off"
            })
            chardev.logger = self.logger
            chardev.set_id("serial0")
            chardev.init()
            chardev.precheck()
            chardev.handle_parms()
            self.add_option(chardev.get_option())

            # serial index 0 must be used for SOL
            serial_obj = CSerial(chardev, {"index": 0})
            serial_obj.init()
            serial_obj.precheck()
            serial_obj.handle_parms()
            self.add_option(serial_obj.get_option())

        self.add_option("-uuid {}".format(str(uuid.uuid4())))

        if self.__kernel and self.__initrd:
            self.add_option("-kernel {} -initrd {}".format(
                self.__kernel, self.__initrd))

        if self.__cmdline:
            self.add_option("--append \"{}\"".format(self.__cmdline))

        if self.__shm_key:
            self.add_option("-communicate shmkey={}".format(self.__shm_key))

        for element_obj in self.__element_list:
            element_obj.handle_parms()