Merge "liblp: Add partitions to the correct group when writing LpMetadata."
This commit is contained in:
commit
4bc53d20af
1 changed files with 9 additions and 0 deletions
|
|
@ -505,6 +505,7 @@ std::unique_ptr<LpMetadata> MetadataBuilder::Export() {
|
||||||
strncpy(out.name, group->name().c_str(), sizeof(out.name));
|
strncpy(out.name, group->name().c_str(), sizeof(out.name));
|
||||||
out.maximum_size = group->maximum_size();
|
out.maximum_size = group->maximum_size();
|
||||||
|
|
||||||
|
group_indices[group->name()] = metadata->groups.size();
|
||||||
metadata->groups.push_back(out);
|
metadata->groups.push_back(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,6 +529,14 @@ std::unique_ptr<LpMetadata> MetadataBuilder::Export() {
|
||||||
part.num_extents = static_cast<uint32_t>(partition->extents().size());
|
part.num_extents = static_cast<uint32_t>(partition->extents().size());
|
||||||
part.attributes = partition->attributes();
|
part.attributes = partition->attributes();
|
||||||
|
|
||||||
|
auto iter = group_indices.find(partition->group_name());
|
||||||
|
if (iter == group_indices.end()) {
|
||||||
|
LERROR << "Partition " << partition->name() << " is a member of unknown group "
|
||||||
|
<< partition->group_name();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
part.group_index = iter->second;
|
||||||
|
|
||||||
for (const auto& extent : partition->extents()) {
|
for (const auto& extent : partition->extents()) {
|
||||||
extent->AddTo(metadata.get());
|
extent->AddTo(metadata.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue