예제 #1
0
    def rollback_snapshot(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        spath = self._normalize_install_path(cmd.snapshotPath)

        image = spath.split("@")[0]
        snap =  spath.split("@")[1]
        snaps = lichbd.lichbd_snap_list(image)
        afters = snaps[(snaps.index(snap) + 1):]

        rsp = AgentResponse()

        if (len(afters) > 0):
            afters.reverse()
            rsp.success = False
            rsp.error = 'need del snapshots: %s, only can rollback to last one' % (afters)
        else:
            lichbd.lichbd_snap_rollback(spath)
            self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)
예제 #2
0
    def rollback_snapshot(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        spath = self._normalize_install_path(cmd.snapshotPath)

        image = spath.split("@")[0]
        snap =  spath.split("@")[1]
        snaps = lichbd.lichbd_snap_list(image)
        afters = snaps[(snaps.index(snap) + 1):]

        rsp = AgentResponse()

        if (len(afters) > 0):
            afters.reverse()
            rsp.success = False
            rsp.error = 'If you want to rollback the current snapshot, please delete all the later snapshots manually.[%s]' % (afters)
        else:
            lichbd.lichbd_snap_rollback(spath)
            self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)
예제 #3
0
    def rollback_snapshot(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        spath = self._normalize_install_path(cmd.snapshotPath)

        image = spath.split("@")[0]
        snap =  spath.split("@")[1]
        snaps = lichbd.lichbd_snap_list(image)
        afters = snaps[(snaps.index(snap) + 1):]

        rsp = AgentResponse()

        if (len(afters) > 0):
            afters.reverse()
            rsp.success = False
            rsp.error = 'If you want to rollback the current snapshot, please delete all the later snapshots manually.[%s]' % (afters)
        else:
            lichbd.lichbd_snap_rollback(spath)
            self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)