Skip to content

Commit

Permalink
Add --all option to checkpointctl show
Browse files Browse the repository at this point in the history
This patch adds '--all' option to checkpointctl chow command.
The extended output for the same would look like:

checkpointctl show checkpoint.tar.gz --all

Displaying container checkpoint data from /tmp/checkpointctl1209302006

+----------------+--------------------------------+--------------+---------+---------------------------+--------+------------+-------------------+
|   CONTAINER    |             IMAGE              |      ID      | RUNTIME |          CREATED          | ENGINE | CHKPT SIZE | ROOT FS DIFF SIZE |
+----------------+--------------------------------+--------------+---------+---------------------------+--------+------------+-------------------+
| cool_heyrovsky | docker.io/library/httpd:latest | 7fb253cbd7c0 | crun    | 2023-04-14T04:46:00+05:30 | Podman | 5.3 MiB    | 2.0 KiB           |
+----------------+--------------------------------+--------------+---------+---------------------------+--------+------------+-------------------+

Overview of Mounts
+--------------------+--------+---------------------------+
|    DESTINATION     |  TYPE  |          SOURCE           |
+--------------------+--------+---------------------------+
| /proc              | proc   | proc                      |
| /dev               | tmpfs  | tmpfs                     |
| /sys               | sysfs  | sysfs                     |
| /dev/pts           | devpts | devpts                    |
| /dev/mqueue        | mqueue | mqueue                    |
| /etc/hostname      | bind   | ../userdata/hostname      |
| /run/.containerenv | bind   | ../userdata/.containerenv |
| /etc/resolv.conf   | bind   | ../userdata/resolv.conf   |
| /etc/hosts         | bind   | ../userdata/hosts         |
| /dev/shm           | bind   | ../userdata/shm           |
| /sys/fs/cgroup     | cgroup | cgroup                    |
+--------------------+--------+---------------------------+

CRIU dump statistics
+---------------+-------------+--------------+---------------+---------------+---------------+
| FREEZING TIME | FROZEN TIME | MEMDUMP TIME | MEMWRITE TIME | PAGES SCANNED | PAGES WRITTEN |
+---------------+-------------+--------------+---------------+---------------+---------------+
| 5333 us       | 200318 us   | 111941 us    | 75612 us      |        239777 |         45512 |
+---------------+-------------+--------------+---------------+---------------+---------------+

Signed-off-by: Sankalp Acharya <[email protected]>
  • Loading branch information
sankalp-12 committed Apr 18, 2023
1 parent 59e02b2 commit 6fd6177
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion checkpointctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (
printStats bool
showMounts bool
fullPaths bool
showAll bool
)

func main() {
Expand Down Expand Up @@ -62,13 +63,23 @@ func setupShow() *cobra.Command {
false,
"Display mounts with full paths",
)
flags.BoolVar(
&showAll,
"all",
false,
"Display all additional information about the checkpoints",
)

return cmd
}

func show(cmd *cobra.Command, args []string) error {
if showAll {
printStats = true
showMounts = true
}
if fullPaths && !showMounts {
return fmt.Errorf("Cannot use --full-paths without --mounts option")
return fmt.Errorf("Cannot use --full-paths without --mounts/-all option")
}

input := args[0]
Expand Down
2 changes: 1 addition & 1 deletion test/checkpointctl.bats
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function teardown() {
( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . )
checkpointctl show "$TEST_TMP_DIR2"/test.tar --full-paths
[ "$status" -eq 1 ]
[[ ${lines[0]} == *"Error: Cannot use --full-paths without --mounts option"* ]]
[[ ${lines[0]} == *"Error: Cannot use --full-paths without --mounts/-all option"* ]]
}

@test "Run checkpointctl show with tar file with valid config.dump and valid spec.dump (CRI-O) and no checkpoint directory" {
Expand Down

0 comments on commit 6fd6177

Please sign in to comment.