Skip to content

Commit

Permalink
Rework CLI interface with structopt
Browse files Browse the repository at this point in the history
* Have structs for args to modularize arg handling

* Improve argument docs

* Improve error messages on faulty args

* Colorize help output

* Rename `--disable-hugepages` to `--no-thp`
    * Corresponds to QEMU's `-redhat-disable-THP`
    * Remove `HERMIT_HUGEPAGES`

* Replace `--mergeable` with `--ksm`
    * Corresponds to QEMU's `-redhat-disable-KSM`
    * Remove `HERMIT_MERGEABLE`

* Remove `HERMIT_VERBOSE`

* Rename `-c, --cpus` to `-c, --cpu-count`
    * Rename `HERMIT_CPUS` to `HERMIT_CPU_COUNT`

* Rename `-s, --gdb_port` to `-s, --gdb-port`

* Rename `-m, --memsize` to `-m, --memory-size`
    * Rename `HERMIT_MEM` to `HERMIT_MEMORY_SIZE`

* Disable `--nic` since networking is currently not supported

```
uhyve 0.0.29
Stefan Lankes <slankes@eonerc.rwth-aachen.de>, Martin Kröning <mkroening@posteo.net>, Jens Breitbart
<jbreitbart@gmail.com>, Jonathan Klimt <jonathan.klimt@eonerc.rwth-aachen.de>
A minimal hypervisor for RustyHermit

USAGE:
    uhyve [OPTIONS] <KERNEL> [KERNEL_ARGS]...

ARGS:
    <KERNEL>
            The kernel to execute

    <KERNEL_ARGS>...
            Arguments to forward to the kernel

OPTIONS:
    -h, --help
            Print help information

    -s, --gdb-port <GDB_PORT>
            GDB server port

            Starts a GDB server on the provided port and waits for a connection.

            [env: HERMIT_GDB_PORT=]

    -v, --verbose
            Print kernel messages

    -V, --version
            Print version information

MEMORY:
        --ksm
            Kernel Samepage Merging

            Advise the kernel to enable Kernel Samepage Merging [KSM] on the virtual RAM.

            [KSM]: https://www.kernel.org/doc/html/latest/admin-guide/mm/ksm.html

    -m, --memory-size <MEMORY_SIZE>
            Guest RAM size

            [env: HERMIT_MEMORY_SIZE=]
            [default: "64.00 MiB"]

        --no-thp
            No Transparent Hugepages

            Don't advise the kernel to enable Transparent Hugepages [THP] on the virtual RAM.

            [THP]: https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html

CPU:
    -a, --affinity <CPUs>
            Bind guest vCPUs to host cpus

            A list of host CPU numbers onto which the guest vCPUs should be bound to obtain
            performance benefits. List items may be single numbers or inclusive ranges. List items
            may be separated with commas or spaces.

            # Examples

            * `--affinity "0 1 2"`

            * `--affinity 0-1,2`

    -c, --cpu-count <CPU_COUNT>
            Number of guest CPUs

            [env: HERMIT_CPU_COUNT=]
            [default: 1]
```

```
uhyve 0.0.29
Stefan Lankes <slankes@eonerc.rwth-aachen.de>
Martin Kröning <mkroening@posteo.net>
Jens Breitbart <jbreitbart@gmail.com>
Jonathan Klimt <jonathan.klimt@eonerc.rwth-aachen.de>

USAGE:
    uhyve [FLAGS] [OPTIONS] <KERNEL> [ARGUMENTS]...

FLAGS:
        --disable-hugepages
            Disable the usage of huge pages

        --mergeable
            Enable kernel feature to merge same pages

    -v, --verbose
            Print also kernel messages

    -h, --help
            Prints help information

    -V, --version
            Prints version information

OPTIONS:
    -c, --cpus <CPUS>
            Number of guest processors [env: HERMIT_CPUS=]

    -a, --affinity <cpulist>
            A list of CPUs delimited by commas onto which
            					 the virtual CPUs should be bound. This may improve
            					performance.

    -s, --gdb_port <GDB_PORT>
            Enables GDB-Stub on given port [env: HERMIT_GDB_PORT=]

    -m, --memsize <MEM>
            Memory size of the guest [env: HERMIT_MEM=]

        --nic <NETIF>
            Name of the network interface [env: HERMIT_NETIF=]

ARGS:
    <KERNEL>
            Sets path to the kernel

    <ARGUMENTS>...
            Arguments of the unikernel
```
  • Loading branch information
mkroening committed Jan 21, 2022
1 parent 80f9c2a commit 0384c1d
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 292 deletions.
102 changes: 82 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ xhypervisor = { git = "https://github.com/RWTH-OS/xhypervisor.git", branch = "aa
[dependencies]
bitflags = "1.3"
byteorder = "1.4"
byte-unit = "4.0"
clap = "2.34"
byte-unit = { version = "4.0", default-features = false, features = ["std"] }
clap = { version = "3", features = ["derive", "env"] }
core_affinity = "0.5"
either = "1.6"
env_logger = "0.9"
Expand All @@ -57,6 +57,7 @@ goblin = { version = "0.4", default-features = false, features = ["elf64", "elf3
lazy_static = "1.4"
libc = "0.2"
log = "0.4"
mac_address = "1.1"
rustc-serialize = "0.3"
thiserror = "1.0"

Expand All @@ -66,7 +67,6 @@ rftrace-frontend = { version = "0.1", optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
kvm-bindings = "0.5"
kvm-ioctls = "0.10"
mac_address = "1.1"
nix = "0.23"
tun-tap = { version = "0.1", default-features = false }
virtio-bindings = { version = "0.1", features = ["virtio-v4_14_0"] }
Expand Down
Loading

0 comments on commit 0384c1d

Please sign in to comment.