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)
def create(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) path = self._normalize_install_path(cmd.installPath) size_M = sizeunit.Byte.toMegaByte(cmd.size) + 1 size = "%dM" % (size_M) _pool = os.path.dirname(path) if not lichbd.lichbd_file_exist(_pool): lichbd.lichbd_mkpool(_pool) lichbd.lichbd_create_raw(path, size) rsp = AgentResponse() self._set_capacity_to_response(rsp) return jsonobject.dumps(rsp)
def _1(): if lichbd.lichbd_file_exist(tmp_lichbd_file): lichbd.lichbd_rm(tmp_lichbd_file) lichbd.lichbd_rm(lichbd_file)