drbd 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/drbd.rb +25 -4
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.6
data/lib/drbd.rb CHANGED
@@ -19,12 +19,18 @@ class DRBD
19
19
  end
20
20
 
21
21
  def load_resources!
22
- @resources = Resource.load_config(IO.popen("ssh #{@host} \"#{@command} dump-xml\""), self)
22
+ io = IO.popen("ssh #{@host} \"#{@command} dump-xml\"")
23
+ xml = io.readlines.join("\n")
24
+ io.close
25
+ @resources = Resource.load_config(xml, self)
23
26
  end
24
27
 
25
28
  def load_status!
26
- raw_xml = IO.popen("ssh #{@host} \"#{@command} status\"")
27
- statuses = Status.new(raw_xml).resources
29
+ io = IO.popen("ssh #{@host} \"#{@command} status\"")
30
+ xml = io.readlines.join("\n")
31
+ io.close
32
+
33
+ statuses = Status.new(xml).resources
28
34
  set_resources_status statuses
29
35
  end
30
36
 
@@ -116,6 +122,21 @@ class DRBD
116
122
  nil
117
123
  end
118
124
 
125
+ def disconnect!
126
+ args = "disconnect #{self.name}"
127
+ command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
128
+ system(command)
129
+ drbd.load_status!
130
+ nil
131
+ end
132
+
133
+ def resize!
134
+ args = "-- --assume-peer-has-space resize #{self.name}"
135
+ command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
136
+ system(command)
137
+ drbd.load_status!
138
+ end
139
+
119
140
  def attach!
120
141
  args = "attach #{self.name}"
121
142
  command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
@@ -150,7 +171,7 @@ class DRBD
150
171
 
151
172
  def init_metadata!
152
173
  if self.down?
153
- args = "-- --force create-md r0#{self.name}"
174
+ args = "-- --force create-md #{self.name}"
154
175
  command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
155
176
  system(command)
156
177
  return true
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: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 6
10
+ version: 0.1.6
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-24 00:00:00 +01:00
18
+ date: 2011-01-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency