LVM分布式服务clvmd分析

上层接口

LVM命令与clvmd之间使用本地套接字进行通信。

  • 报文结构
$ cat daemons/clvmd/clvm.h
...

struct clvm_header {
	uint8_t  cmd;	        /* See below */
	uint8_t  flags;	        /* See below */
	uint16_t xid;	        /* Transaction ID */
	uint32_t clientid;	/* Only used in Daemon->Daemon comms */
	int32_t  status;	/* For replies, whether request succeeded */
	uint32_t arglen;	/* Length of argument below.
				   If >1500 then it will be passed
				   around the cluster in the system LV */
	char node[1];		/* Actually a NUL-terminated string, node name.
				   If this is empty then the command is
				   forwarded to all cluster nodes unless
				   FLAG_LOCAL or FLAG_REMOTE is also set. */
	char args[1];		/* Arguments for the command follow the
				   node name, This member is only
				   valid if the node name is empty */
} __attribute__ ((packed));

...
  • 标志
...

/* Flags */
#define CLVMD_FLAG_LOCAL	1	/* Only do this on the local node */
#define CLVMD_FLAG_SYSTEMLV	2	/* Data in system LV under my node name */
#define CLVMD_FLAG_NODEERRS	4	/* Reply has errors in node-specific portion */
#define CLVMD_FLAG_REMOTE	8	/* Do this on all nodes except for the local node */


...
  • 套接字路径
...

/* Name of the local socket to communicate between lvm and clvmd */
#define CLVMD_SOCKNAME		DEFAULT_RUN_DIR "/clvmd.sock"


...
  • 命令和响应
...

/* Internal commands & replies */
#define CLVMD_CMD_REPLY    1
#define CLVMD_CMD_VERSION  2	/* Send version around cluster when we start */
#define CLVMD_CMD_GOAWAY   3	/* Die if received this - we are running
				   an incompatible version */
#define CLVMD_CMD_TEST     4	/* Just for mucking about */

#define CLVMD_CMD_LOCK              30
#define CLVMD_CMD_UNLOCK            31


/* Lock/Unlock commands */
#define CLVMD_CMD_LOCK_LV           50
#define CLVMD_CMD_LOCK_VG           51
#define CLVMD_CMD_LOCK_QUERY	    52

/* Misc functions */
#define CLVMD_CMD_REFRESH	    40
#define CLVMD_CMD_GET_CLUSTERNAME   41
#define CLVMD_CMD_SET_DEBUG	    42
#define CLVMD_CMD_VG_BACKUP	    43
#define CLVMD_CMD_RESTART	    44
#define CLVMD_CMD_SYNC_NAMES	    45

...
  • 执行范围
...

/* Used internally by some callers, but not part of the protocol.*/
#ifndef NODE_ALL
#  define NODE_ALL	"*"
#  define NODE_LOCAL	"."
#  define NODE_REMOTE	"^"
#endif

...

底层接口

  • CoroSync
  • OpenAIS
  • CMan
  • 单节点

转载于:https://my.oschina.net/LastRitter/blog/1535843

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值