def _actionSignOn(self):  # pylint: disable=R0914
        """ Implement sign-on """

        #
        # Validate parameters (raises exception on failure).
        #
        sOs = self._getStringParam(constants.tbreq.SIGNON_PARAM_OS,
                                   coreconsts.g_kasOses)
        sOsVersion = self._getStringParam(
            constants.tbreq.SIGNON_PARAM_OS_VERSION)
        sCpuVendor = self._getStringParam(
            constants.tbreq.SIGNON_PARAM_CPU_VENDOR)
        sCpuArch = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_ARCH,
                                        coreconsts.g_kasCpuArches)
        sCpuName = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_NAME,
                                        fStrip=True,
                                        sDefValue='')
        # new
        lCpuRevision = self._getLongParam(
            constants.tbreq.SIGNON_PARAM_CPU_REVISION, lMin=0, lDefValue=0)
        # new
        cCpus = self._getIntParam(constants.tbreq.SIGNON_PARAM_CPU_COUNT, 1,
                                  16384)
        fCpuHwVirt = self._getBoolParam(
            constants.tbreq.SIGNON_PARAM_HAS_HW_VIRT)
        fCpuNestedPaging = self._getBoolParam(
            constants.tbreq.SIGNON_PARAM_HAS_NESTED_PAGING)
        fCpu64BitGuest = self._getBoolParam(
            constants.tbreq.SIGNON_PARAM_HAS_64_BIT_GUEST, fDefValue=True)
        fChipsetIoMmu = self._getBoolParam(
            constants.tbreq.SIGNON_PARAM_HAS_IOMMU)
        fRawMode = self._getBoolParam(
            constants.tbreq.SIGNON_PARAM_WITH_RAW_MODE, fDefValue=None)
        cMbMemory = self._getLongParam(constants.tbreq.SIGNON_PARAM_MEM_SIZE,
                                       8, 1073741823)
        # 8MB..1PB
        cMbScratch = self._getLongParam(
            constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE, 0, 1073741823)
        # 0..1PB
        sReport = self._getStringParam(constants.tbreq.SIGNON_PARAM_REPORT,
                                       fStrip=True,
                                       sDefValue='')
        # new
        iTestBoxScriptRev = self._getIntParam(
            constants.tbreq.SIGNON_PARAM_SCRIPT_REV, 1, 100000000)
        iPythonHexVersion = self._getIntParam(
            constants.tbreq.SIGNON_PARAM_PYTHON_VERSION, 0x020300f0,
            0x030f00f0)
        self._checkForUnknownParameters()

        # Null conversions for new parameters.
        if not sReport:
            sReport = None
        if not sCpuName:
            sCpuName = None
        if lCpuRevision <= 0:
            lCpuRevision = None

        #
        # Connect to the database and validate the testbox.
        #
        oDb = TMDatabaseConnection(self._oSrvGlue.dprint)
        oTestBoxLogic = TestBoxLogic(oDb)
        oTestBox = oTestBoxLogic.tryFetchTestBoxByUuid(self._sTestBoxUuid)
        if oTestBox is None:
            oSystemLogLogic = SystemLogLogic(oDb)
            oSystemLogLogic.addEntry(SystemLogData.ksEvent_TestBoxUnknown,
                                     'addr=%s  uuid=%s  os=%s  %d cpus' \
                                     % (self._sTestBoxAddr, self._sTestBoxUuid, sOs, cCpus),
                                     24, fCommit = True)
            return self._resultResponse(constants.tbresp.STATUS_NACK)

        #
        # Update the row in TestBoxes if something changed.
        #
        if oTestBox.cMbScratch is not None and oTestBox.cMbScratch != 0:
            cPctScratchDiff = (cMbScratch -
                               oTestBox.cMbScratch) * 100 / oTestBox.cMbScratch
        else:
            cPctScratchDiff = 100

        # pylint: disable=R0916
        if   self._sTestBoxAddr != oTestBox.ip \
          or sOs                != oTestBox.sOs \
          or sOsVersion         != oTestBox.sOsVersion \
          or sCpuVendor         != oTestBox.sCpuVendor \
          or sCpuArch           != oTestBox.sCpuArch \
          or sCpuName           != oTestBox.sCpuName \
          or lCpuRevision       != oTestBox.lCpuRevision \
          or cCpus              != oTestBox.cCpus \
          or fCpuHwVirt         != oTestBox.fCpuHwVirt \
          or fCpuNestedPaging   != oTestBox.fCpuNestedPaging \
          or fCpu64BitGuest     != oTestBox.fCpu64BitGuest \
          or fChipsetIoMmu      != oTestBox.fChipsetIoMmu \
          or fRawMode           != oTestBox.fRawMode \
          or cMbMemory          != oTestBox.cMbMemory \
          or abs(cPctScratchDiff) >= min(4 + cMbScratch / 10240, 12) \
          or sReport            != oTestBox.sReport \
          or iTestBoxScriptRev  != oTestBox.iTestBoxScriptRev \
          or iPythonHexVersion  != oTestBox.iPythonHexVersion:
            oTestBoxLogic.updateOnSignOn(oTestBox.idTestBox,
                                         oTestBox.idGenTestBox,
                                         sTestBoxAddr=self._sTestBoxAddr,
                                         sOs=sOs,
                                         sOsVersion=sOsVersion,
                                         sCpuVendor=sCpuVendor,
                                         sCpuArch=sCpuArch,
                                         sCpuName=sCpuName,
                                         lCpuRevision=lCpuRevision,
                                         cCpus=cCpus,
                                         fCpuHwVirt=fCpuHwVirt,
                                         fCpuNestedPaging=fCpuNestedPaging,
                                         fCpu64BitGuest=fCpu64BitGuest,
                                         fChipsetIoMmu=fChipsetIoMmu,
                                         fRawMode=fRawMode,
                                         cMbMemory=cMbMemory,
                                         cMbScratch=cMbScratch,
                                         sReport=sReport,
                                         iTestBoxScriptRev=iTestBoxScriptRev,
                                         iPythonHexVersion=iPythonHexVersion)

        #
        # Update the testbox status, making sure there is a status.
        #
        oStatusLogic = TestBoxStatusLogic(oDb)
        oStatusData = oStatusLogic.tryFetchStatus(oTestBox.idTestBox)
        if oStatusData is not None:
            self._cleanupOldTest(oDb, oStatusData)
        else:
            oStatusLogic.insertIdleStatus(oTestBox.idTestBox,
                                          oTestBox.idGenTestBox,
                                          fCommit=True)

        #
        # ACK the request.
        #
        dResponse = \
        {
            constants.tbresp.ALL_PARAM_RESULT:  constants.tbresp.STATUS_ACK,
            constants.tbresp.SIGNON_PARAM_ID:   oTestBox.idTestBox,
            constants.tbresp.SIGNON_PARAM_NAME: oTestBox.sName,
        }
        return self._writeResponse(dResponse)
    def _actionSignOn(self):        # pylint: disable=R0914
        """ Implement sign-on """

        #
        # Validate parameters (raises exception on failure).
        #
        sOs                 = self._getStringParam(constants.tbreq.SIGNON_PARAM_OS, coreconsts.g_kasOses);
        sOsVersion          = self._getStringParam(constants.tbreq.SIGNON_PARAM_OS_VERSION);
        sCpuVendor          = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_VENDOR);
        sCpuArch            = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_ARCH, coreconsts.g_kasCpuArches);
        sCpuName            = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_NAME, fStrip = True, sDefValue = ''); # new
        lCpuRevision        = self._getLongParam(  constants.tbreq.SIGNON_PARAM_CPU_REVISION, lMin = 0, lDefValue = 0);   # new
        cCpus               = self._getIntParam(   constants.tbreq.SIGNON_PARAM_CPU_COUNT, 1, 16384);
        fCpuHwVirt          = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_HW_VIRT);
        fCpuNestedPaging    = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_NESTED_PAGING);
        fCpu64BitGuest      = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_64_BIT_GUEST, fDefValue = True);
        fChipsetIoMmu       = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_IOMMU);
        cMbMemory           = self._getLongParam(  constants.tbreq.SIGNON_PARAM_MEM_SIZE,     8, 1073741823); # 8MB..1PB
        cMbScratch          = self._getLongParam(  constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE, 0, 1073741823); # 0..1PB
        sReport             = self._getStringParam(constants.tbreq.SIGNON_PARAM_REPORT, fStrip = True, sDefValue = '');   # new
        iTestBoxScriptRev   = self._getIntParam(   constants.tbreq.SIGNON_PARAM_SCRIPT_REV, 1, 100000000);
        iPythonHexVersion   = self._getIntParam(   constants.tbreq.SIGNON_PARAM_PYTHON_VERSION, 0x020300f0, 0x030f00f0);
        self._checkForUnknownParameters();

        # Null conversions for new parameters.
        if len(sReport) == 0:
            sReport = None;
        if len(sCpuName) == 0:
            sCpuName = None;
        if lCpuRevision <= 0:
            lCpuRevision = None;

        #
        # Connect to the database and validate the testbox.
        #
        oDb = TMDatabaseConnection(self._oSrvGlue.dprint);
        oTestBoxLogic = TestBoxLogic(oDb);
        oTestBox      = oTestBoxLogic.tryFetchTestBoxByUuid(self._sTestBoxUuid);
        if oTestBox is None:
            oSystemLogLogic = SystemLogLogic(oDb);
            oSystemLogLogic.addEntry(SystemLogData.ksEvent_TestBoxUnknown,
                                     'addr=%s  uuid=%s  os=%s  %d cpus' \
                                     % (self._sTestBoxAddr, self._sTestBoxUuid, sOs, cCpus),
                                     24, fCommit = True);
            return self._resultResponse(constants.tbresp.STATUS_NACK);

        #
        # Update the row in TestBoxes if something changed.
        #
        if   self._sTestBoxAddr != oTestBox.ip \
          or sOs                != oTestBox.sOs \
          or sOsVersion         != oTestBox.sOsVersion \
          or sCpuVendor         != oTestBox.sCpuVendor \
          or sCpuArch           != oTestBox.sCpuArch \
          or sCpuName           != oTestBox.sCpuName \
          or lCpuRevision       != oTestBox.lCpuRevision \
          or cCpus              != oTestBox.cCpus \
          or fCpuHwVirt         != oTestBox.fCpuHwVirt \
          or fCpuNestedPaging   != oTestBox.fCpuNestedPaging \
          or fCpu64BitGuest     != oTestBox.fCpu64BitGuest \
          or fChipsetIoMmu      != oTestBox.fChipsetIoMmu \
          or cMbMemory          != oTestBox.cMbMemory \
          or cMbScratch         != oTestBox.cMbScratch \
          or sReport            != oTestBox.sReport \
          or iTestBoxScriptRev  != oTestBox.iTestBoxScriptRev \
          or iPythonHexVersion  != oTestBox.iPythonHexVersion:
            oTestBoxLogic.updateOnSignOn(oTestBox.idTestBox,
                                         oTestBox.idGenTestBox,
                                         sTestBoxAddr      = self._sTestBoxAddr,
                                         sOs               = sOs,
                                         sOsVersion        = sOsVersion,
                                         sCpuVendor        = sCpuVendor,
                                         sCpuArch          = sCpuArch,
                                         sCpuName          = sCpuName,
                                         lCpuRevision      = lCpuRevision,
                                         cCpus             = cCpus,
                                         fCpuHwVirt        = fCpuHwVirt,
                                         fCpuNestedPaging  = fCpuNestedPaging,
                                         fCpu64BitGuest    = fCpu64BitGuest,
                                         fChipsetIoMmu     = fChipsetIoMmu,
                                         cMbMemory         = cMbMemory,
                                         cMbScratch        = cMbScratch,
                                         sReport           = sReport,
                                         iTestBoxScriptRev = iTestBoxScriptRev,
                                         iPythonHexVersion = iPythonHexVersion);

        #
        # Update the testbox status, making sure there is a status.
        #
        oStatusLogic = TestBoxStatusLogic(oDb);
        oStatusData  = oStatusLogic.tryFetchStatus(oTestBox.idTestBox);
        if oStatusData is not None:
            self._cleanupOldTest(oDb, oStatusData);
        else:
            oStatusLogic.insertIdleStatus(oTestBox.idTestBox, oTestBox.idGenTestBox, fCommit = True);

        #
        # ACK the request.
        #
        dResponse = \
        {
            constants.tbresp.ALL_PARAM_RESULT:  constants.tbresp.STATUS_ACK,
            constants.tbresp.SIGNON_PARAM_ID:   oTestBox.idTestBox,
            constants.tbresp.SIGNON_PARAM_NAME: oTestBox.sName,
        }
        return self._writeResponse(dResponse);