Closed renzhengeek closed 8 years ago
53 static int detect_cluster_name(void) 54 { 55 cmap_handle_t handle; 56 char *str = NULL; 57 int rv, err = -1; 58 59 rv = cmap_initialize(&handle); 60 if (rv != CS_OK) { 61 log_error("cmap_initialize error %d", rv); 62 return -1; 63 } 64 65 rv = cmap_get_string(handle, "totem.cluster_name", &str); 66 if (rv != CS_OK) { 67 log_error("cmap_get_string totem.cluster_name error %d", rv); 68 goto out; 69 } else 70 err = 0; 71 72 log_debug("cmap totem.cluster_name = '%s'", str); 73 74 strncpy(cluster_name, str, DLM_LOCKSPACE_LEN); 75 out: 76 if (str) 77 free(str); 78 cmap_finalize(handle); 79 return err; 80 }
eric1212:~ # ll /sys/fs/
total 0
drwxr-xr-x 4 root root 0 Dec 21 15:25 btrfs
drwxr-xr-x 11 root root 260 Dec 21 15:24 cgroup
drwxr-xr-x 2 root root 0 Dec 21 15:24 pstore
eric1212:~ # cat /sys/kernel/config/dlm/cluster/
buffer_size comms/ new_rsb_count recover_callbacks rsbtbl_size spaces/ timewarn_cs waitwarn_us
cluster_name log_debug protocol recover_timer scan_secs tcp_port toss_secs
eric1212:~ # cat /sys/kernel/config/dlm/cluster/cluster_name
cluster
eric1212:~ # mkfs.ocfs2 /dev/sdb
mkfs.ocfs2 1.8.2
Cluster stack: pcmk
Cluster name: cluster
Stack Flags: 0x0
NOTE: Feature extended slot map may be enabled
Overwriting existing ocfs2 partition.
Proceed (y/N): n
Aborting operation.
eric1212:~ # ll /sys/fs/
btrfs/ cgroup/ o2cb/ ocfs2/ pstore/
eric1212:~ # ll /sys/fs/ocfs2/
total 0
-r--r--r-- 1 root root 4096 Dec 21 15:41 active_cluster_plugin
-rw-r--r-- 1 root root 4096 Dec 21 15:40 cluster_stack
-r--r--r-- 1 root root 4096 Dec 21 15:41 loaded_cluster_plugins
-r--r--r-- 1 root root 4096 Dec 21 15:41 max_locking_protocol
it's ocfs2_stackglue.ko!
/home/eric/libdlm-4.0.2/dlm_controldaction.c: 863 if (opt(enable_fscontrol_ind)) { 864 /* deprecated */ 865 set_configfs_cluster("recover_callbacks", NULL, 0); 866 } else { 867 set_configfs_cluster("recover_callbacks", NULL, 1); 868 869 detect_cluster_name(); 870 871 if (cluster_name[0]) { 872 set_configfs_cluster("cluster_name", cluster_name, 0); 873 } else { 874 log_error("no cluster name"); 875 return -1; 876 } 877 } 878 return 0; 879 }