Skip to content

Commit

Permalink
doc: Add steps to use vm-states subcommand
Browse files Browse the repository at this point in the history
Add steps on how to use the new subcommand to print
vmstate in human readable format.
Improve readability of subcommand sections.

Signed-off-by: Sudan Landge <sudanl@amazon.com>
  • Loading branch information
Sudan Landge committed Oct 28, 2023
1 parent 420552e commit 0582e67
Showing 1 changed file with 108 additions and 88 deletions.
196 changes: 108 additions & 88 deletions docs/snapshotting/snapshot-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,104 +16,124 @@ Firecracker snapshot consists of 2 files:

#### `rebase` subcommand

This command is used to merge a `diff` snapshot memory file on
top of a base memory file.

**Note**
You can also use `rebase-snap` tool for this.

Arguments:

- `MEMORY_PATH` - path to the `memory` file
- `DIFF_PATH` - path to the `diff` file

Usage:

```bash
snapshot-editor edit-memory rebase \
--memory-path <MEMORY_PATH> \
--diff-path <DIFF_PATH>
```

Example:

```bash
snapshot-editor edit-memory rebase \
--memory-path ./memory_file \
--diff-path ./diff_file
```
> This command is used to merge a `diff` snapshot memory file on
> top of a base memory file.
>
> **Note**
> You can also use `rebase-snap` tool for this.
>
> Arguments:
>
> - `MEMORY_PATH` - path to the `memory` file
> - `DIFF_PATH` - path to the `diff` file
>
> Usage:
>
> ```bash
> snapshot-editor edit-memory rebase \
> --memory-path <MEMORY_PATH> \
> --diff-path <DIFF_PATH>
> ```
>
> Example:
>
> ```bash
> snapshot-editor edit-memory rebase \
> --memory-path ./memory_file \
> --diff-path ./diff_file
> ```
### `edit-vmstate` command

#### `remove-regs` subcommand (aarch64 only)

This command is used to remove specified registers from vcpu states inside
vmstate snapshot file.

Arguments:

- `VMSTATE_PATH` - path to the `vmstate` file
- `OUTPUT_PATH` - path to the file where the output will be placed
- `[REGS]` - set of u32 values representing registers ids as they are defined
in KVM. Can be both in decimal and in hex formats.

Usage:

```bash
snapshot-editor edit-vmstate remove-regs \
--vmstate-path <VMSTATE_PATH> \
--output-path <OUTPUT_PATH> \
[REGS]...
```

Example:

```bash
./snapshot-editor edit-vmstate remove-regs \
--vmstate-path ./vmstate_file \
--output-path ./new_vmstate_file \
0x1 0x2
```
> This command is used to remove specified registers from vcpu states inside
> vmstate snapshot file.
>
> Arguments:
>
> - `VMSTATE_PATH` - path to the `vmstate` file
> - `OUTPUT_PATH` - path to the file where the output will be placed
> - `[REGS]` - set of u32 values representing registers ids as they are defined
> in KVM. Can be both in decimal and in hex formats.
>
> Usage:
>
> ```bash
> snapshot-editor edit-vmstate remove-regs \
> --vmstate-path <VMSTATE_PATH> \
> --output-path <OUTPUT_PATH> \
> [REGS]...
> ```
>
> Example:
>
> ```bash
> ./snapshot-editor edit-vmstate remove-regs \
> --vmstate-path ./vmstate_file \
> --output-path ./new_vmstate_file \
> 0x1 0x2
> ```
### `info-vmstate` command

#### `version` subcommand

This command is used to print version of the provided
vmstate file.

Arguments:

- `VMSTATE_PATH` - path to the `vmstate` file

Usage:

```bash
snapshot-editor info-vmstate version --vmstate-path <VMSTATE_PATH>
```

Example:

```bash
./snapshot-editor info-vmstate version --vmstate-path ./vmstate_file
```
> This command is used to print version of the provided
> vmstate file.
>
> Arguments:
>
> - `VMSTATE_PATH` - path to the `vmstate` file
>
> Usage:
>
> ```bash
> snapshot-editor info-vmstate version --vmstate-path <VMSTATE_PATH>
> ```
>
> Example:
>
> ```bash
> ./snapshot-editor info-vmstate version --vmstate-path ./vmstate_file
> ```
#### `vcpu-states` subcommand (aarch64 only)

This command is used to print the vCPU states inside vmstate snapshot file.

Arguments:

- `VMSTATE_PATH` - path to the `vmstate` file

Usage:

```bash
snapshot-editor info-vmstate vcpu-states --vmstate-path <VMSTATE_PATH>
```

Example:

```bash
./snapshot-editor info-vmstate vcpu-states --vmstate-path ./vmstate_file
```
> This command is used to print the vCPU states inside vmstate snapshot file.
>
> Arguments:
>
> - `VMSTATE_PATH` - path to the `vmstate` file
>
> Usage:
>
> ```bash
> snapshot-editor info-vmstate vcpu-states --vmstate-path <VMSTATE_PATH>
> ```
>
> Example:
>
> ```bash
> ./snapshot-editor info-vmstate vcpu-states --vmstate-path ./vmstate_file
> ```
#### `vm-state` subcommand

> This command is used to print the vmstate of snapshot file in readable format thus,making it easier to compare vmstate of 2 snapshots.
>
> Arguments:
>
> - `VMSTATE_PATH` - path to the `vmstate` file
>
> Usage:
>
> ```bash
> snapshot-editor info-vmstate vm-state --vmstate-path <VMSTATE_PATH>
> ```
>
> Example:
>
> ```bash
> ./snapshot-editor info-vmstate vm-state --vmstate-path ./vmstate_file
> ```

0 comments on commit 0582e67

Please sign in to comment.