From d0baf34139c5b80add70845928add008b1d832c7 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 27 Jun 2013 15:36:50 +0200 Subject: [PATCH] create_xml_data: adjust filed order to thin_dumo format; fix nr_data_blocks --- thin-provisioning/create_xml_data | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 6ef50d0..a49eec5 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -100,11 +100,11 @@ def end_device end def single_mapping(from, to) - " \n" + " \n" end def range_mapping(from, to, length) - " \n" + " \n" end def blocks(opts) @@ -116,11 +116,17 @@ def this_blocks(opts) end def xml_metadata(opts, units) - to = 0 + nr_data_blocks, to = 0, 0 + blks = [] - puts begin_superblock(opts[:blocksize], 2 * opts[:thins] * blocks(opts)) + 0.step(opts[:thins] - 1) do + blks << this_blocks(opts) + nr_data_blocks += blks[-1] + end + + puts begin_superblock(opts[:blocksize], nr_data_blocks) 0.step(opts[:thins] - 1) do |dev_id| - b = this_blocks(opts) + b = blks.shift puts begin_device(dev_id, b) if opts[:range] puts range_mapping(0, to, b)