drbd 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/drbd.rb +52 -7
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/drbd.rb
CHANGED
@@ -84,14 +84,54 @@ class DRBD
|
|
84
84
|
status[:ds1] == "UpToDate" && status[:ds2] == "UpToDate" && status[:resynced_percent] == nil
|
85
85
|
end
|
86
86
|
|
87
|
-
def
|
88
|
-
status[:cs] == "Connected"
|
87
|
+
def connected?
|
88
|
+
status[:cs] == "Connected"
|
89
89
|
end
|
90
90
|
|
91
91
|
def down?
|
92
|
-
status[:cs] == "Unconfigured"
|
92
|
+
status[:cs] == "Unconfigured" || status.nil?
|
93
93
|
end
|
94
|
+
|
95
|
+
def primary?
|
96
|
+
stauts[:ro0] == "Primary"
|
97
|
+
end
|
98
|
+
|
99
|
+
def primary!
|
100
|
+
args = "-- --overwrite-data-of-peer primary #{self.name}"
|
101
|
+
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
102
|
+
system(command)
|
103
|
+
drbd.load_status!
|
104
|
+
nil
|
105
|
+
end
|
106
|
+
|
107
|
+
def role
|
108
|
+
status[:ro1]
|
109
|
+
end
|
110
|
+
|
111
|
+
def connect!
|
112
|
+
args = "connect #{self.name}"
|
113
|
+
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
114
|
+
system(command)
|
115
|
+
drbd.load_status!
|
116
|
+
nil
|
117
|
+
end
|
94
118
|
|
119
|
+
def attach!
|
120
|
+
args = "attach #{self.name}"
|
121
|
+
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
122
|
+
system(command)
|
123
|
+
drbd.load_status!
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
127
|
+
def detach!
|
128
|
+
args = "detach #{self.name}"
|
129
|
+
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
130
|
+
system(command)
|
131
|
+
drbd.load_status!
|
132
|
+
nil
|
133
|
+
end
|
134
|
+
|
95
135
|
def up!
|
96
136
|
args = "up #{self.name}"
|
97
137
|
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
@@ -110,8 +150,8 @@ class DRBD
|
|
110
150
|
|
111
151
|
def init_metadata!
|
112
152
|
if self.down?
|
113
|
-
|
114
|
-
command = "ssh #{drbd.host} \"
|
153
|
+
args = "-- --force create-md r0#{self.name}"
|
154
|
+
command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
|
115
155
|
system(command)
|
116
156
|
return true
|
117
157
|
else
|
@@ -123,9 +163,14 @@ class DRBD
|
|
123
163
|
def local_host
|
124
164
|
hosts.select{|h| h.name == drbd.host}.first
|
125
165
|
end
|
126
|
-
|
166
|
+
|
167
|
+
def local_disk
|
168
|
+
return nil if local_host == nil
|
169
|
+
local_host.disk
|
170
|
+
end
|
171
|
+
|
127
172
|
def local_minor
|
128
|
-
|
173
|
+
return nil if local_host == nil
|
129
174
|
local_host.minor
|
130
175
|
end
|
131
176
|
|
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: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Kliment
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|