lib/VolumeManager/LVM/lvm2disk.rb in manageiq-smartstate-0.1.4 vs lib/VolumeManager/LVM/lvm2disk.rb in manageiq-smartstate-0.1.5
- old
+ new
@@ -41,12 +41,19 @@
if logicalVolume.thin?
device_id = logicalVolume.thin_segment.device_id
thin_pool = logicalVolume.thin_pool_volume
data_blks = thin_pool.metadata_volume.superblock.device_to_data(device_id, pos, len)
- data_blks.each do |offset, len|
- thin_pool.data_volume.disk.seek offset
- retStr << thin_pool.data_volume.disk.read(len)
+
+ data_blks.each do |_device_blk, data_blk, blk_offset, blk_len|
+ if data_blk.nil?
+ # fill in unallactored data
+ retStr << Array.new(blk_len, 0).pack("C*")
+
+ else
+ thin_pool.data_volume.disk.seek(blk_offset)
+ retStr << thin_pool.data_volume.disk.read(blk_len)
+ end
end
return retStr
end