---
title: "使用glusterfs API"
author: "lancelotwjq"
date: "2013-02-21T10:43:15Z"
tags: []
categories: ["开源软件"]
slug: "glusterfs-api"
draft: false
lastmod: "2013-03-25T16:27:36Z"
id: 1810915
url: "https://glusterfs.iteye.com/blog/1810915"
---

**如果是通过rpm安装的glusterfs**

 

在执行 glusterfs/api/example/gfapi.py 之前，需要执行

 

```
ln -s /usr/lib64/libglusterfs.so.0 /usr/lib64/libglusterfs.so
ln -s /usr/lib64/libgfapi.so.0 /usr/lib64/libgfapi.so
ln -s /usr/lib64/libgfxdr.so.0 /usr/lib64/libgfxdr.so
```

 

 运行：python gfapi.py abc /mnt

PASS: wrote 5 bytes  
PASS: read 'fubar'  
PASS: lstat got correct size 5  
FAIL: new path not working after rename  
  (skipping known failure)  
PASS: unlink worked  
PASS: mkdir worked  
PASS: create (in dir) worked  
PASS: directory listing worked  
PASS: unlink (in dir) worked  
FAIL: dir still there after rmdir  
  (skipping known failure)  
PASS: setxattr worked  
PASS: getxattr worked  
PASS: listxattr worked  
2 failures (2 expected)

 

 

 在编译 glusterfs/api/example/glfsxmp.c 之前，需要执行

 

&gt; cd api/example/

&gt; sed -i s/"api\\/"// glfsxmp.c

编译glfsxmp.c

&gt; gcc -o glfsxmp glfsxmp.c -I../src/ -lgfxdr -lgfapi