Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Implement Create/Destroy SnapshotStep #2140

Merged
merged 5 commits into from
Aug 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions chroma_core/models/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,11 +1785,34 @@ class NoNidsPresent(Exception):
pass


class CreateSnapshotStep(Step):
def run(self, kwargs):
args = {"fsname": kwargs["fsname"], "name": kwargs["name"]}
if "comment" in kwargs:
args["comment"] = kwargs["comment"]
self.invoke_rust_agent_expect_result(
kwargs["host"], "snapshot_create", args,
)


class DestroySnapshotStep(Step):
def run(self, kwargs):
self.invoke_rust_agent_expect_result(
kwargs["host"],
"snapshot_destroy",
{"fsname": kwargs["fsname"], "name": kwargs["name"], "force": kwargs["force"]},
)


class MountSnapshotStep(Step):
def run(self, kwargs):
self.invoke_rust_agent_expect_result(kwargs["host"], "snapshot_mount", [kwargs["fsname"], kwargs["name"]])
self.invoke_rust_agent_expect_result(
kwargs["host"], "snapshot_mount", {"fsname": kwargs["fsname"], "name": kwargs["name"]}
)


class UnmountSnapshotStep(Step):
def run(self, kwargs):
self.invoke_rust_agent_expect_result(kwargs["host"], "snapshot_unmount", [kwargs["fsname"], kwargs["name"]])
self.invoke_rust_agent_expect_result(
kwargs["host"], "snapshot_unmount", {"fsname": kwargs["fsname"], "name": kwargs["name"]}
)