Skip to content

Commit

Permalink
Add origin field to StratFilesystem
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Dec 12, 2023
1 parent 7ffe13a commit 47c514e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/engine/strat_engine/serde_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ pub struct FilesystemSave {
pub created: u64, // Unix timestamp
#[serde(skip_serializing_if = "Option::is_none")]
pub fs_size_limit: Option<Sectors>,
#[serde(skip_serializing_if = "Option::is_none")]
pub origin: Option<FilesystemUuid>,
}
6 changes: 6 additions & 0 deletions src/engine/strat_engine/thinpool/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct StratFilesystem {
created: DateTime<Utc>,
used: Option<Bytes>,
size_limit: Option<Sectors>,
origin: Option<FilesystemUuid>,
}

fn init_used(thin_dev: &ThinDev) -> Option<Bytes> {
Expand Down Expand Up @@ -114,6 +115,7 @@ impl StratFilesystem {
thin_dev,
created: Utc::now(),
size_limit,
origin: None,
},
))
}
Expand All @@ -140,6 +142,7 @@ impl StratFilesystem {
thin_dev,
created,
size_limit: fssave.fs_size_limit,
origin: fssave.origin,
})
}

Expand Down Expand Up @@ -200,6 +203,7 @@ impl StratFilesystem {
snapshot_fs_name: &Name,
snapshot_fs_uuid: FilesystemUuid,
snapshot_thin_id: ThinDevId,
origin_uuid: FilesystemUuid,
) -> StratisResult<StratFilesystem> {
match self.thin_dev.snapshot(
get_dm(),
Expand Down Expand Up @@ -245,6 +249,7 @@ impl StratFilesystem {
thin_dev,
created: Utc::now(),
size_limit: self.size_limit,
origin: Some(origin_uuid),
})
}
Err(e) => Err(StratisError::Msg(format!(
Expand Down Expand Up @@ -366,6 +371,7 @@ impl StratFilesystem {
size: self.thin_dev.size(),
created: self.created.timestamp() as u64,
fs_size_limit: self.size_limit,
origin: self.origin,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/engine/strat_engine/thinpool/thinpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,7 @@ impl ThinPool {
&fs_name,
snapshot_fs_uuid,
snapshot_id,
origin_uuid,
)?,
None => {
return Err(StratisError::Msg(
Expand Down

0 comments on commit 47c514e

Please sign in to comment.