lvmsync 1.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/lvmsync +6 -4
- data/lib/lvm/helpers.rb +1 -1
- data/lib/lvm/snapshot.rb +1 -1
- data/lib/lvm/thin_snapshot.rb +1 -1
- data/lib/lvm/vg_config.rb +2 -2
- data/lib/vgcfgbackup.treetop +1 -1
- metadata +4 -4
data/bin/lvmsync
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
require 'optparse'
|
21
21
|
require 'lvm'
|
22
22
|
|
23
|
-
PROTOCOL_VERSION = "lvmsync PROTO[
|
23
|
+
PROTOCOL_VERSION = "lvmsync PROTO[3]"
|
24
24
|
|
25
25
|
include LVM::Helpers
|
26
26
|
|
@@ -112,13 +112,15 @@ def process_dumpdata(instream, destdev, snapback = nil)
|
|
112
112
|
exit 1
|
113
113
|
end
|
114
114
|
|
115
|
+
snapback.puts handshake if snapback
|
116
|
+
|
115
117
|
File.open(destdev, 'w+') do |dest|
|
116
118
|
while header = instream.read(12)
|
117
119
|
offset, chunksize = header.unpack("QN")
|
118
120
|
offset = ntohq(offset)
|
119
121
|
|
120
122
|
begin
|
121
|
-
dest.seek offset
|
123
|
+
dest.seek offset
|
122
124
|
rescue Errno::EINVAL
|
123
125
|
# In certain rare circumstances, we want to transfer a block
|
124
126
|
# device where the destination is smaller than the source (DRBD
|
@@ -136,7 +138,7 @@ def process_dumpdata(instream, destdev, snapback = nil)
|
|
136
138
|
if snapback
|
137
139
|
snapback.write(header)
|
138
140
|
snapback.write dest.read(chunksize)
|
139
|
-
dest.seek offset
|
141
|
+
dest.seek offset
|
140
142
|
end
|
141
143
|
dest.write instream.read(chunksize)
|
142
144
|
end
|
@@ -186,7 +188,7 @@ def run_client(opts)
|
|
186
188
|
server_cmd = if desthost
|
187
189
|
"ssh #{desthost} lvmsync --apply - #{snapback} #{destdev}"
|
188
190
|
else
|
189
|
-
"
|
191
|
+
"#{$0} --apply - #{snapback} #{destdev}"
|
190
192
|
end
|
191
193
|
|
192
194
|
outfd = IO.popen(server_cmd, 'w')
|
data/lib/lvm/helpers.rb
CHANGED
@@ -9,7 +9,7 @@ module LVM::Helpers
|
|
9
9
|
def htonq val
|
10
10
|
# This won't work on a nUxi byte-order machine, but if you have one of
|
11
11
|
# those, I'm guessing you've got bigger problems
|
12
|
-
big_endian? ? ([val].pack("Q").reverse.unpack("Q").first)
|
12
|
+
big_endian? ? val : ([val].pack("Q").reverse.unpack("Q").first)
|
13
13
|
end
|
14
14
|
|
15
15
|
def ntohq val
|
data/lib/lvm/snapshot.rb
CHANGED
data/lib/lvm/thin_snapshot.rb
CHANGED
@@ -172,7 +172,7 @@ class LVM::ThinSnapshot
|
|
172
172
|
len = r.attribute('length').value.to_i
|
173
173
|
ori = r.attribute('origin_begin').value.to_i
|
174
174
|
dat = r.attribute('data_begin').value.to_i
|
175
|
-
h2[(
|
175
|
+
h2[(ori..ori+len-1)] = (dat..dat+len-1)
|
176
176
|
end
|
177
177
|
|
178
178
|
h2
|
data/lib/lvm/vg_config.rb
CHANGED
@@ -63,10 +63,10 @@ class LVM::VGConfig
|
|
63
63
|
stdin_fd.close
|
64
64
|
stdout = stdout_fd.read
|
65
65
|
stderr = stderr_fd.read
|
66
|
-
exit_status = wait_thr.value
|
66
|
+
exit_status = wait_thr.value if wait_thr
|
67
67
|
end
|
68
68
|
|
69
|
-
if exit_status.exitstatus != 0
|
69
|
+
if (exit_status or $?).exitstatus != 0
|
70
70
|
raise RuntimeError,
|
71
71
|
"Failed to run vgcfgbackup: #{stdout}\n#{stderr}"
|
72
72
|
end
|
data/lib/vgcfgbackup.treetop
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lvmsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: git-version-bump
|
@@ -221,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
segments:
|
223
223
|
- 0
|
224
|
-
hash:
|
224
|
+
hash: -2530308162516167436
|
225
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
226
|
none: false
|
227
227
|
requirements:
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
version: '0'
|
231
231
|
segments:
|
232
232
|
- 0
|
233
|
-
hash:
|
233
|
+
hash: -2530308162516167436
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
236
|
rubygems_version: 1.8.23
|