tweaks to metadata constructor, and some updated features.
This commit is contained in:
parent
172353d1a5
commit
055b237126
@ -1,6 +1,6 @@
|
||||
Given(/^valid metadata$/) do
|
||||
in_current_dir do
|
||||
write_valid_xml(xml_file)
|
||||
system("thinp_xml create --nr-thins uniform[4..9] --nr-mappings uniform[1000..10000] > #{xml_file}")
|
||||
end
|
||||
|
||||
run_simple("dd if=/dev/zero of=#{dev_file} bs=4k count=1024")
|
||||
|
@ -1,3 +1,7 @@
|
||||
Before do
|
||||
@aruba_timeout_seconds = 10
|
||||
end
|
||||
|
||||
module ThinpWorld
|
||||
def tools_version
|
||||
"0.1.5+"
|
||||
@ -21,8 +25,8 @@ module ThinpWorld
|
||||
File.open(path, "w+") do |f|
|
||||
f.write <<EOF
|
||||
<superblock uuid="" time="0" transaction="0" data_block_size="128" nr_data_blocks="1000">
|
||||
<device dev_id="0" mapped_blocks="2" transaction="0" creation_time="0" snap_time="0">
|
||||
<range_mapping origin_begin="0" data_begin="0" length="2" time="0"/>
|
||||
<device dev_id="0" mapped_blocks="100" transaction="0" creation_time="0" snap_time="0">
|
||||
<range_mapping origin_begin="25" data_begin="0" length="100" time="0"/>
|
||||
</device>
|
||||
</superblock>
|
||||
EOF
|
||||
|
@ -48,6 +48,7 @@ Feature: thin_rmap
|
||||
When I run `thin_rmap --unleash-the-hedeghogs`
|
||||
Then it should fail
|
||||
|
||||
@announce
|
||||
Scenario: Valid region format should pass
|
||||
Given valid metadata
|
||||
When I run thin_rmap with --region 23..7890
|
||||
|
@ -34,7 +34,7 @@ using namespace base;
|
||||
using namespace thin_provisioning;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
#if 0
|
||||
|
||||
namespace {
|
||||
using namespace superblock_detail;
|
||||
|
||||
@ -108,11 +108,18 @@ metadata::metadata(std::string const &dev_path, open_type ot,
|
||||
tm_->set_sm(metadata_sm_);
|
||||
|
||||
data_sm_ = open_disk_sm(tm_, static_cast<void *>(&sb_.data_space_map_root_));
|
||||
details_ = device_tree::ptr(new device_tree(tm_, sb_.device_details_root_, device_tree_detail::device_details_traits::ref_counter()));
|
||||
mappings_top_level_ = dev_tree::ptr(new dev_tree(tm_, sb_.data_mapping_root_,
|
||||
mapping_tree_detail::mtree_ref_counter(tm_)));
|
||||
mappings_ = mapping_tree::ptr(new mapping_tree(tm_, sb_.data_mapping_root_,
|
||||
mapping_tree_detail::block_time_ref_counter(data_sm_)));
|
||||
|
||||
details_ = device_tree::ptr(
|
||||
new device_tree(tm_, sb_.device_details_root_,
|
||||
device_tree_detail::device_details_traits::ref_counter()));
|
||||
|
||||
mappings_top_level_ = dev_tree::ptr(
|
||||
new dev_tree(tm_, sb_.data_mapping_root_,
|
||||
mapping_tree_detail::mtree_ref_counter(tm_)));
|
||||
|
||||
mappings_ = mapping_tree::ptr(
|
||||
new mapping_tree(tm_, sb_.data_mapping_root_,
|
||||
mapping_tree_detail::block_time_ref_counter(data_sm_)));
|
||||
break;
|
||||
|
||||
case CREATE:
|
||||
@ -142,10 +149,11 @@ metadata::metadata(std::string const &dev_path, open_type ot,
|
||||
}
|
||||
}
|
||||
|
||||
metadata::metadata(std::string const &dev_path, block_address metadata_snap)
|
||||
metadata::metadata(std::string const &dev_path)
|
||||
{
|
||||
tm_ = open_tm(open_bm(dev_path, false));
|
||||
sb_ = read_superblock(tm_->get_bm(), metadata_snap);
|
||||
sb_ = read_superblock(tm_->get_bm());
|
||||
|
||||
// We don't open the metadata sm for a held root
|
||||
//metadata_sm_ = open_metadata_sm(tm_, &sb_.metadata_space_map_root_);
|
||||
tm_->set_sm(metadata_sm_);
|
||||
@ -227,4 +235,3 @@ metadata::commit()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
#endif
|
||||
|
@ -65,7 +65,7 @@ namespace thin_provisioning {
|
||||
sector_t data_block_size = 128,
|
||||
block_address nr_data_blocks = 0); // Only used if CREATE
|
||||
|
||||
metadata(std::string const &dev_path, block_address metadata_snap);
|
||||
metadata(std::string const &dev_path);
|
||||
|
||||
// ... use these instead ...
|
||||
metadata(block_manager<>::ptr bm, open_type ot,
|
||||
|
Loading…
Reference in New Issue
Block a user