manageiq-smartstate 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7517619212a1f03fe002e07ba30b6b9200d0ee0
4
- data.tar.gz: 2b3f9a8d7e73784afff2d978b0529d10a58f71ac
3
+ metadata.gz: e0bcd345041b6da4e617fb7868b70329ddfb7356
4
+ data.tar.gz: ce9e91d3de3fd48f62958cb2dbbd5a09b3c69e34
5
5
  SHA512:
6
- metadata.gz: 1eaf8995f28876c937a0ec6c589724ce274fbf3db0201b13400f60c811b1f315f6fc0be362930527feb679802fc4b5ba34d55035fab13e28da693d987e003d1b
7
- data.tar.gz: 427440dc548f556aa9e113773c235dbe73ea68e6a2428868f170b2b5d1b67a0310e5cd23906ea101da8e5ab351bc63a7b9c5c4c8f4f0a39a427359b159847471
6
+ metadata.gz: c959e61448233d5726894b88a95913990b752f4dd5eea54c03bed11f1d515871177478715df62b0ccfe19b437bb722595f8911fa4aeff3ccf1a8a4c4e881b36b
7
+ data.tar.gz: e6414d9c2d70ec3a3cb4f71db61fc2b6222c3ed02712ac3f9ce40a9f3db495470fd92589bc5b4c4f05eaa7747c6fbcc07f3c225ba527b1307e32354fc6876278
@@ -67,7 +67,7 @@ class MiqAzureVm < MiqVm
67
67
  if @uri
68
68
  d = MiqDiskCache.new(AzureBlobDisk.new(sa_svc, @uri, d_info), 100, 128)
69
69
  else
70
- d = MiqDiskCache.new(AzureManagedDisk.new(snap_svc, @snap_name, d_info), 100, 128)
70
+ d = MiqDiskCache.new(AzureManagedDisk.new(snap_svc, @snap_name, d_info), 200, 512)
71
71
  end
72
72
  rescue => err
73
73
  $log.error("#{err}: Couldn't open disk file: #{df}")
@@ -43,9 +43,16 @@ module Lvm2DiskIO
43
43
  device_id = logicalVolume.thin_segment.device_id
44
44
  thin_pool = logicalVolume.thin_pool_volume
45
45
  data_blks = thin_pool.metadata_volume.superblock.device_to_data(device_id, pos, len)
46
- data_blks.each do |offset, len|
47
- thin_pool.data_volume.disk.seek offset
48
- retStr << thin_pool.data_volume.disk.read(len)
46
+
47
+ data_blks.each do |_device_blk, data_blk, blk_offset, blk_len|
48
+ if data_blk.nil?
49
+ # fill in unallactored data
50
+ retStr << Array.new(blk_len, 0).pack("C*")
51
+
52
+ else
53
+ thin_pool.data_volume.disk.seek(blk_offset)
54
+ retStr << thin_pool.data_volume.disk.read(blk_len)
55
+ end
49
56
  end
50
57
 
51
58
  return retStr
@@ -18,6 +18,20 @@ module Lvm2Thin
18
18
  end
19
19
  end
20
20
 
21
+ def total_blocks
22
+ @total_blocks ||= begin
23
+ t = 0
24
+ entries.each do |entry|
25
+ t += entry.kind_of?(DataMap) ? entry.total_blocks : 1
26
+ end
27
+ t
28
+ end
29
+ end
30
+
31
+ def block?(blk)
32
+ blk < total_blocks
33
+ end
34
+
21
35
  def data_block(device_block)
22
36
  device_blocks.reverse.each do |map_device_block|
23
37
  if map_device_block <= device_block
@@ -79,35 +79,52 @@ module Lvm2Thin
79
79
  device_address % data_block_size
80
80
  end
81
81
 
82
- # return array of tuples containing data volume addresses and lengths to
83
- # read from them to read the specified device offset & length
82
+ # Return array of tuples device block ids, data block ids, addresses, and lengths to
83
+ # read from them to read the specified device offset & length.
84
+ #
85
+ # Note: data blocks may not amount to total requested length (if requesting
86
+ # data from unallocated space).
87
+ #
88
+ # @see DataMap#block?
84
89
  def device_to_data(device_id, pos, len)
85
- dev_blk = device_block(pos)
86
- dev_off = device_block_offset(pos)
90
+ dev_blk = device_block(pos)
91
+ dev_off = device_block_offset(pos)
92
+ data_map = data_mapping.map_for(device_id)
87
93
 
88
94
  total_len = 0
89
95
  data_blks = []
90
96
 
91
97
  num_data_blks = (len / data_block_size).to_i + 1
92
98
  0.upto(num_data_blks - 1) do |i|
93
- data_blk = data_mapping.map_for(device_id).data_block(dev_blk + i)
99
+ current_blk = dev_blk + i
100
+ blk_len = 0
94
101
 
95
- blk_start = data_blk * data_block_size
96
- blk_len = 0
102
+ if data_map.block?(current_blk)
103
+ data_blk = data_map.data_block(current_blk)
104
+ blk_start = data_blk * data_block_size
97
105
 
98
- if i == 0
99
- blk_start += dev_off
100
- blk_len = data_block_size - dev_off - 1
106
+ if i.zero?
107
+ blk_start += dev_off
108
+ blk_len = data_block_size - dev_off - 1
101
109
 
102
- elsif i == num_data_blks - 1
103
- blk_len = len - total_len
110
+ elsif i == num_data_blks - 1
111
+ blk_len = len - total_len
104
112
 
113
+ else
114
+ blk_len = data_block_size
115
+ end
116
+
117
+ data_blks << [current_blk, data_blk, blk_start, blk_len]
118
+
119
+ # Missing block may be caused by trying to read beyond end of
120
+ # LVM device (too large pos or len):
105
121
  else
106
- blk_len = data_block_size
122
+ remaining = (len - total_len)
123
+ blk_len = remaining > data_block_size ? data_block_size : remaining
124
+ data_blks << [current_blk, nil, nil, blk_len]
107
125
  end
108
126
 
109
127
  total_len += blk_len
110
- data_blks << [blk_start, blk_len]
111
128
  end
112
129
 
113
130
  data_blks
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module Smartstate
3
- VERSION = "0.1.4".freeze
3
+ VERSION = "0.1.5".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-smartstate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure-armrest