drbd 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +89 -57
- data/VERSION +1 -1
- data/lib/drbd.rb +2 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -23,63 +23,95 @@ Ruby wrapper for DRBD
|
|
23
23
|
|
24
24
|
|
25
25
|
== How it works
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
r.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
r.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
26
|
+
- simply fetch data from remote host
|
27
|
+
|
28
|
+
<tt>d = Drbd.new("fqdn.domain.tld")</tt>
|
29
|
+
|
30
|
+
you can specify command to be executed
|
31
|
+
|
32
|
+
<tt>d = Drbd.new("fqdn.domain.tld", :command => 'sudo /sbin/drbdadm')</tt>
|
33
|
+
|
34
|
+
- obtain array of configured configured resources
|
35
|
+
|
36
|
+
<tt>r = d.resources.first</tt>
|
37
|
+
|
38
|
+
- get resource name
|
39
|
+
|
40
|
+
<tt>r.name</tt>
|
41
|
+
|
42
|
+
- get resource protocol
|
43
|
+
|
44
|
+
<tt>r.protocol</tt>
|
45
|
+
|
46
|
+
- get hosts for resource
|
47
|
+
|
48
|
+
<tt>r.hosts</tt>
|
49
|
+
|
50
|
+
- get status for resource
|
51
|
+
|
52
|
+
<tt>r.status</tt>
|
53
|
+
|
54
|
+
- get node addresses
|
55
|
+
|
56
|
+
<tt>r.hosts.map{|h| h.address }</tt>
|
57
|
+
|
58
|
+
- get status
|
59
|
+
|
60
|
+
resource status is hash with keys:
|
61
|
+
|
62
|
+
[:cs, :resynced_percent, :minor, :ro1, :ds1, :ro2, :ds2, :name]
|
63
|
+
|
64
|
+
<tt>r.status</tt>
|
65
|
+
|
66
|
+
- find resource by name
|
67
|
+
|
68
|
+
<tt>r = d.find_resource_by_name("r0")</tt>
|
69
|
+
|
70
|
+
- find resource by backing disk
|
71
|
+
|
72
|
+
<tt>r = d.find_resource_by_disk("/dev/volgroup-logvolume--name")</tt>
|
73
|
+
|
74
|
+
- true if both of devices are UpToDate
|
75
|
+
|
76
|
+
<tt>r.consinstent?</tt>
|
77
|
+
|
78
|
+
- true if resynced_percent is present in status
|
79
|
+
|
80
|
+
<tt>r.resync_running?</tt>
|
81
|
+
|
82
|
+
- true if resource status is "Connected"
|
83
|
+
|
84
|
+
<tt>r.up?</tt>
|
85
|
+
|
86
|
+
- true if resource status is "Unconfigured"
|
87
|
+
|
88
|
+
<tt>r.down?</tt>
|
89
|
+
|
90
|
+
- stateless perform drbdadm up on resource (use at your own risk!)
|
91
|
+
|
92
|
+
<tt>r.up!</tt>
|
93
|
+
|
94
|
+
- stateless perform drbdadm down on resource (use at your own risk!)
|
95
|
+
|
96
|
+
<tt>r.down!</tt>
|
97
|
+
|
98
|
+
- stateless perform forced drbdadm create-md on resource (use at your own risk!)
|
99
|
+
|
100
|
+
if resource is not down, returns false and does nothing
|
101
|
+
|
102
|
+
<tt>r.init_metadata</tt>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
- back-reference to the DRBD object
|
107
|
+
|
108
|
+
<tt>r.drbd</tt>
|
109
|
+
|
110
|
+
- uptate status of all resources
|
111
|
+
|
112
|
+
<tt>r.drbd.load_status!</tt>
|
113
|
+
|
114
|
+
<tt>d.load_status!</tt>
|
83
115
|
|
84
116
|
== TODO
|
85
117
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/drbd.rb
CHANGED
@@ -97,6 +97,7 @@ class DRBD
|
|
97
97
|
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
98
98
|
system(command)
|
99
99
|
drbd.load_status!
|
100
|
+
nil
|
100
101
|
end
|
101
102
|
|
102
103
|
def down!
|
@@ -104,6 +105,7 @@ class DRBD
|
|
104
105
|
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
105
106
|
system(command)
|
106
107
|
drbd.load_status!
|
108
|
+
nil
|
107
109
|
end
|
108
110
|
|
109
111
|
def init_metadata!
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drbd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Kliment
|