示例#1
0
def moveContainer(name):
    input = request.get_json(silent=True)
    validation = doValidateCloneMove(input)
    if validation:
        return response.reply(message=validation.message, status=403)

    input['name'] = name
    try:
        container = LXCContainer(input)
        return response.replySuccess(container.move())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
示例#2
0
def createContainerSnapshot(name, container):
    input = request.get_json(silent=True)
    validation = doValidateCloneMove(input)
    if validation:
        return response.reply(message=validation.message, status=403)

    input['name'] = name
    input['container'] = container
    try:
        snapshot = LXCSnapshot(input)
        return response.replySuccess(snapshot.snapshotCreateContainer(), message='Container {} created from {} snapshot successfully.'.format(input['newContainer'], name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())