Example #1
0
    def hwInfo(self):
        ret = None

        if ret is None:
            ret = _PcHp().info()
        if ret is None:
            ret = _PcAsus().info()
        if ret is None:
            ret = _PcAliyun().info()
        if ret is None:
            ret = _PcDiy().info()
        if ret is None:
            return ret

        r = FmUtil.getMachineInfoWithCache("CHASSIS")
        if r is not None:
            if r == "computer":
                ret.chassis_type = ChassisType.COMPUTER
            elif r == "laptop":
                ret.chassis_type = ChassisType.LAPTOP
            elif r == "tablet":
                ret.chassis_type = ChassisType.TABLET
            elif r == "handset":
                ret.chassis_type = ChassisType.HANDSET
            elif r == "headless":
                ret.chassis_type = ChassisType.HEADLESS
            else:
                assert False

        return ret
Example #2
0
    def info(self):
        self.manu = FmUtil.dmiDecodeWithCache("system-manufacturer")
        if self.manu != "Alibaba Cloud":
            return None
        assert FmUtil.dmiDecodeWithCache("system-product-name") == "Alibaba Cloud ECS"

        self.sn = FmUtil.dmiDecodeWithCache("system-serial-number")

        self.model = FmUtil.getMachineInfoWithCache("ALIYUN-HWNAME")
        assert self.model in self._MODELS

        ret = HwInfoPcBranded()
        ret.vendor = "ALIYUN"
        ret.model = self.model
        ret.hwSpec = self._hwSpec()
        ret.serialNumber = self.sn
        ret.arch = "amd64"
        ret.chassis_type = ChassisType.COMPUTER
        ret.hwDict = self._hwDict(ret.hwSpec)
        ret.changeList = self._changeList(ret.hwSpec, ret.hwDict)
        ret.kernelCfgRules = self._kernelCfgRules()
        ret.useFlags = self._useFlags()
        ret.grubExtraWaitTime = 20
        return ret