Skip to content

Commit

Permalink
Patch up origin fields if deleted filesystem was an origin
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed Sep 9, 2024
1 parent 50de40f commit 21d5fd9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/engine/strat_engine/thinpool/thinpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,11 @@ impl<B> ThinPool<B> {

let (mut removed, mut updated_origins) = (Vec::new(), Vec::new());
for &uuid in fs_uuids {
if let Some(uuid) = self.destroy_filesystem(pool_name, uuid)? {
if let Some((_, fs)) = self.get_filesystem_by_uuid(uuid) {
let fs_origin = fs.origin();
let uuid = self
.destroy_filesystem(pool_name, uuid)?
.expect("just looked up");
removed.push(uuid);

for (sn_uuid, _) in snapshots.remove(&uuid).unwrap_or_else(Vec::new) {
Expand All @@ -828,8 +832,8 @@ impl<B> ThinPool<B> {
// removal.
if let Some((_, sn)) = self.get_mut_filesystem_by_uuid(sn_uuid) {
assert!(
sn.set_origin(None),
"A snapshot can only have one origin, so it can be in snapshots.values() only once, so its origin value can be unset only once"
sn.set_origin(fs_origin),
"A snapshot can only have one origin, so it can be in snapshots.values() only once, so its origin value can be set only once"
);
updated_origins.push(sn_uuid);

Expand Down

0 comments on commit 21d5fd9

Please sign in to comment.