예제 #1
0
def snapshotInfo(name, container):
    print(name)
    try:
        snapshot = LXCSnapshot({'container': container, 'name': name})
        return response.replySuccess(snapshot.snapshotInfo())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #2
0
def createSnapshot(name, container):
    try:
        input = request.get_json(silent=True)
        stateful = False
        if input != None:
            if input.get('stateful') != None:
                stateful = input.get('stateful')

        snapshot = LXCSnapshot({'name': name, 'container': container})
        return response.replySuccess(snapshot.snapshot(stateful), message='Snapshot {} for container {} created successfully.'.format(name, container))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #3
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__())
예제 #4
0
def deleteSnapshot(name, container):
    try:
        snapshot = LXCSnapshot({'name': name, 'container': container})
        return response.replySuccess(snapshot.snapshotDelete(), message='Snapshot {} deleted successfully from container.'.format(name, container))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #5
0
def publishSnapshot(name, container):
    try:
        snapshot = LXCSnapshot({'name': name, 'container': container})
        return response.replySuccess(snapshot.snapshotPublish(), message='Container {} published from {} snapshot successfully.'.format(container, name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #6
0
def restoreSnapshot(name, container):
    try:
        snapshot = LXCSnapshot({'name': name, 'container': container})
        return response.replySuccess(snapshot.snapshotRestore(), message='Container {} restored from  snapshot {} successfully.'.format(container, name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #7
0
def containerSnapshots(container):
    try:
        snapshot = LXCSnapshot({'container': container})
        return response.replySuccess(snapshot.snapshotList())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
예제 #8
0
파일: snapshot.py 프로젝트: one2Ter/lxdui
def publishSnapshot(name, container):
    try:
        snapshot = LXCSnapshot({'name': name, 'container': container})
        return response.replySuccess(snapshot.snapshotPublish())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())