def commit_image(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) spath = self._normalize_install_path(cmd.snapshotPath) dpath = self._normalize_install_path(cmd.dstPath) lichbd.lichbd_snap_protect(spath) lichbd.lichbd_snap_clone(spath, dpath) rsp = CpRsp() rsp.size = self._get_file_size(dpath) self._set_capacity_to_response(rsp) return jsonobject.dumps(rsp)
def clone(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) src_path = self._normalize_install_path(cmd.srcPath) dst_path = self._normalize_install_path(cmd.dstPath) _pool = os.path.dirname(dst_path) if not lichbd.lichbd_pool_exist(_pool): lichbd.lichbd_mkpool(_pool) lichbd.lichbd_snap_clone(src_path, dst_path) rsp = AgentResponse() self._set_capacity_to_response(rsp) return jsonobject.dumps(rsp)
def clone(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) src_path = self._normalize_install_path(cmd.srcPath) dst_path = self._normalize_install_path(cmd.dstPath) _pool = os.path.dirname(dst_path) if not lichbd.lichbd_file_exist(_pool): lichbd.lichbd_mkpool(_pool) lichbd.lichbd_snap_clone(src_path, dst_path) rsp = AgentResponse() self._set_capacity_to_response(rsp) return jsonobject.dumps(rsp)