コード例 #1
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def CreateLab(configLab):
    res = StatusVLAB()
    res.Messages = []
    res.StatusOK = True

    xcp = XCPMethods(logging=res, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return
    xcp.ReadConfs()

    xvp = XVPMethods(logging=res, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()

    if configLab.Action.lower() == "create":
        _createLab(xcp, xvp, configLab)
    elif configLab.Action.lower() == "delete":
        _deleteLab(xcp, xvp, configLab)
    else:
        res.Messages.append("ERROR: Action is wrong!!! Action is 'create' or 'delete'")
        res.StatusOK = False

    xvp.SQLConnect.commit()
    xvp.SQLConnect.close()
    xcp.xapi.logout()

    return res
コード例 #2
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def CreateLab(configLab):
    res = StatusVLAB()
    res.Messages = []
    res.StatusOK = True

    xcp = XCPMethods(logging=res, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return
    xcp.ReadConfs()

    xvp = XVPMethods(logging=res, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()

    if configLab.Action.lower() == "create":
        _createLab(xcp, xvp, configLab)
    elif configLab.Action.lower() == "delete":
        _deleteLab(xcp, xvp, configLab)
    else:
        res.Messages.append(
            "ERROR: Action is wrong!!! Action is 'create' or 'delete'")
        res.StatusOK = False

    xvp.SQLConnect.commit()
    xvp.SQLConnect.close()
    xcp.xapi.logout()

    return res
コード例 #3
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def ChangeStateVM(uuid, state):
    res = StatusVLAB()
    res.Messages = []
    res.StatusOK = True

    xcp = XCPMethods(logging=res, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    if not xcp.ChangeStateVM(uuid, state):
        res.StatusOK = False

    return res
コード例 #4
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def ChangeStateVM(uuid, state):
    res = StatusVLAB()
    res.Messages = []
    res.StatusOK = True

    xcp = XCPMethods(logging=res, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    if not xcp.ChangeStateVM(uuid, state):
        res.StatusOK = False

    return res