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 CHANGED
@@ -20,7 +20,7 @@
20
20
  require 'optparse'
21
21
  require 'lvm'
22
22
 
23
- PROTOCOL_VERSION = "lvmsync PROTO[2]"
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 * chunksize
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 * chunksize
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
- "lvmsync --apply - #{snapback} #{destdev}"
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) : val
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
@@ -108,6 +108,6 @@ class LVM::Snapshot
108
108
  end
109
109
 
110
110
  def metadata_device
111
- "/dev/mapper/#{@vg}-#{@lv.gsub('-', '--')}-cow"
111
+ "/dev/mapper/#{@vg.gsub('-', '--')}-#{@lv.gsub('-', '--')}-cow"
112
112
  end
113
113
  end
@@ -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[(dat..dat+len-1)] = (ori..ori+len-1)
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
@@ -8,7 +8,7 @@ grammar VgCfgBackup
8
8
  end
9
9
 
10
10
  rule variable_name
11
- [a-z0-9_-]+ <VariableName>
11
+ [a-zA-Z0-9_.+-]+ <VariableName>
12
12
  end
13
13
 
14
14
  rule group
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: 1.0.2
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-07-04 00:00:00.000000000 Z
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: 2970664606006248824
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: 2970664606006248824
233
+ hash: -2530308162516167436
234
234
  requirements: []
235
235
  rubyforge_project:
236
236
  rubygems_version: 1.8.23