write the data device size to the xml output
This commit is contained in:
parent
fcd56069df
commit
fa2a5fe650
@ -47,7 +47,8 @@ namespace thin_provisioning {
|
|||||||
virtual void begin_superblock(std::string const &uuid,
|
virtual void begin_superblock(std::string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
uint32_t data_block_size) = 0;
|
uint32_t data_block_size,
|
||||||
|
uint64_t nr_data_blocks) = 0;
|
||||||
virtual void end_superblock() = 0;
|
virtual void end_superblock() = 0;
|
||||||
|
|
||||||
virtual void begin_device(uint32_t dev_id,
|
virtual void begin_device(uint32_t dev_id,
|
||||||
|
@ -35,11 +35,13 @@ namespace {
|
|||||||
void begin_superblock(string const &uuid,
|
void begin_superblock(string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
uint32_t data_block_size) {
|
uint32_t data_block_size,
|
||||||
|
uint64_t nr_data_blocks) {
|
||||||
out_ << "begin superblock: \"" << uuid << "\""
|
out_ << "begin superblock: \"" << uuid << "\""
|
||||||
<< ", " << time
|
<< ", " << time
|
||||||
<< ", " << trans_id
|
<< ", " << trans_id
|
||||||
<< ", " << data_block_size
|
<< ", " << data_block_size
|
||||||
|
<< ", " << nr_data_blocks
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,10 @@ namespace {
|
|||||||
void
|
void
|
||||||
thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
|
thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, bool repair)
|
||||||
{
|
{
|
||||||
e->begin_superblock("", md->sb_.time_, md->sb_.trans_id_, md->sb_.data_block_size_);
|
e->begin_superblock("", md->sb_.time_,
|
||||||
|
md->sb_.trans_id_,
|
||||||
|
md->sb_.data_block_size_,
|
||||||
|
md->data_sm_->get_nr_blocks());
|
||||||
|
|
||||||
details_extractor::ptr de(new details_extractor);
|
details_extractor::ptr de(new details_extractor);
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ namespace {
|
|||||||
virtual void begin_superblock(std::string const &uuid,
|
virtual void begin_superblock(std::string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
uint32_t data_block_size) {
|
uint32_t data_block_size,
|
||||||
|
uint64_t nr_data_blocks) {
|
||||||
in_superblock_ = true;
|
in_superblock_ = true;
|
||||||
|
|
||||||
superblock &sb = md_->sb_;
|
superblock &sb = md_->sb_;
|
||||||
@ -46,6 +47,7 @@ namespace {
|
|||||||
sb.time_ = time;
|
sb.time_ = time;
|
||||||
sb.trans_id_ = trans_id;
|
sb.trans_id_ = trans_id;
|
||||||
sb.data_block_size_ = data_block_size;
|
sb.data_block_size_ = data_block_size;
|
||||||
|
md_->data_sm_->extend(nr_data_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void end_superblock() {
|
virtual void end_superblock() {
|
||||||
|
@ -24,9 +24,14 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <iostream>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
using namespace persistent_data;
|
using namespace persistent_data;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -37,13 +42,11 @@ using namespace thin_provisioning;
|
|||||||
namespace {
|
namespace {
|
||||||
int restore(string const &backup_file, string const &dev) {
|
int restore(string const &backup_file, string const &dev) {
|
||||||
try {
|
try {
|
||||||
// FIXME: hard coded
|
metadata::ptr md(new metadata(dev, metadata::CREATE, 128, 0));
|
||||||
block_address const NR_BLOCKS = 100000;
|
|
||||||
|
|
||||||
metadata::ptr md(new metadata(dev, metadata::CREATE, 128, NR_BLOCKS));
|
|
||||||
emitter::ptr restorer = create_restore_emitter(md);
|
emitter::ptr restorer = create_restore_emitter(md);
|
||||||
ifstream in(backup_file.c_str(), ifstream::in);
|
ifstream in(backup_file.c_str(), ifstream::in);
|
||||||
parse_xml(in, restorer);
|
parse_xml(in, restorer);
|
||||||
|
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
cerr << e.what();
|
cerr << e.what();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -48,12 +48,14 @@ namespace {
|
|||||||
void begin_superblock(string const &uuid,
|
void begin_superblock(string const &uuid,
|
||||||
uint64_t time,
|
uint64_t time,
|
||||||
uint64_t trans_id,
|
uint64_t trans_id,
|
||||||
uint32_t data_block_size) {
|
uint32_t data_block_size,
|
||||||
|
uint64_t nr_data_blocks) {
|
||||||
indent();
|
indent();
|
||||||
out_ << "<superblock uuid=\"" << uuid << "\""
|
out_ << "<superblock uuid=\"" << uuid << "\""
|
||||||
<< " time=\"" << time << "\""
|
<< " time=\"" << time << "\""
|
||||||
<< " transaction=\"" << trans_id << "\""
|
<< " transaction=\"" << trans_id << "\""
|
||||||
<< " data_block_size=\"" << data_block_size << "\">"
|
<< " data_block_size=\"" << data_block_size << "\""
|
||||||
|
<< " nr_data_blocks=\"" << nr_data_blocks << "\">"
|
||||||
<< endl;
|
<< endl;
|
||||||
inc();
|
inc();
|
||||||
}
|
}
|
||||||
@ -176,7 +178,8 @@ namespace {
|
|||||||
e->begin_superblock(get_attr<string>(attr, "uuid"),
|
e->begin_superblock(get_attr<string>(attr, "uuid"),
|
||||||
get_attr<uint64_t>(attr, "time"),
|
get_attr<uint64_t>(attr, "time"),
|
||||||
get_attr<uint64_t>(attr, "transaction"),
|
get_attr<uint64_t>(attr, "transaction"),
|
||||||
get_attr<uint32_t>(attr, "data_block_size"));
|
get_attr<uint32_t>(attr, "data_block_size"),
|
||||||
|
get_attr<uint64_t>(attr, "nr_data_blocks"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_device(emitter *e, attributes const &attr) {
|
void parse_device(emitter *e, attributes const &attr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user