Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor doc improvements. #141

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/out

**/.DS_Store
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
vfkit - Simple command line tool to start VMs through virtualization framework
vfkit - Simple command line tool to start VMs through the macOS Virtualization framework
====

### Introduction

vfkit offers a command-line interface to start virtual machines using virtualization framework.
vfkit offers a command-line interface to start virtual machines using the [macOS Virtualization framework](https://developer.apple.com/documentation/virtualization).
It also provides a `github.com/crc-org/vfkit/pkg/config` go package.
This package provides a native go API to generate the vfkit command line.
This package provides a native Go API to generate the vfkit command line.


### Installation
Expand Down
4 changes: 2 additions & 2 deletions cmd/vfkit/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ var opts = &cmdline.Options{}

var rootCmd = &cobra.Command{
Use: "vfkit",
Short: "vfkit is a simple hypervisor using Apple's virtualization framework",
Long: `A hypervisor written in Go using Apple's virtualization framework to run linux virtual machines.
Short: "vfkit is a simple hypervisor using Apple's Virtualization framework",
Long: `A hypervisor written in Go using Apple's Virtualization framework to run Linux virtual machines.
Complete documentation is available at https://github.com/crc-org/vfkit`,
RunE: func(_ *cobra.Command, _ []string) error {
if len(opts.LogLevel) > 0 {
Expand Down
9 changes: 4 additions & 5 deletions doc/missing-vz-api.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Missing API
# Missing APIs

This document contains a non-exhaustive list of API which are not used/supported by `vfkit`, but which would be useful to have.
This document is a non-exhaustive list of unimplemented APIs, which may be worth adding to `vfkit`.

## non-vz API
## non-vz APIs

- start vfkit process (integrating with https://pkg.go.dev/os/exec )
- get VM IP address [https://github.com/code-ready/crc/blob/0d76300c1a618598c209bab32a8deb4ca6c2d8c6/pkg/drivers/vfkit/network_darwin.go#L54-L59]

## [vz](https://pkg.go.dev/github.com/Code-Hex/vz/v2) API
## [vz](https://pkg.go.dev/github.com/Code-Hex/vz/v3) APIs
```
func vz.CreateDiskImage(pathname string, size int64) error
func vz.VirtualMachineConfigurationMaximumAllowedCPUCount() uint
Expand Down Expand Up @@ -37,4 +37,3 @@ This document contains a non-exhaustive list of API which are not used/supported
type VirtualMachineConfiguration
func (v *VirtualMachineConfiguration) vz.SetMemoryBalloonDevicesVirtualMachineConfiguration(cs []MemoryBalloonDeviceConfiguration)
```

18 changes: 9 additions & 9 deletions doc/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ UEFI boot and graphical user interface support are only available on macOS 13 or
You can get vfkit either by downloading it from [its release page](https://github.com/crc-org/vfkit/releases), or get it from [brew](https://brew.sh/):
```
# Only the first time
$ brew tap cfergeau/crc
brew tap cfergeau/crc

$ brew install vfkit
brew install vfkit
```


Expand All @@ -32,14 +32,14 @@ VirtualBox images cannot be used by vfkit.
For example, Fedora images can be downloaded with:
```
# For Apple silicon Macs
$ curl -L -O https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/aarch64/images/Fedora-Cloud-Base-38-1.6.aarch64.raw.xz
$ xz -d ./Fedora-Cloud-Base-38-1.6.aarch64.raw.xz
$ mv Fedora-Cloud-Base-38-1.6.aarch64.raw vfkit-test-image.raw
curl -L -O https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/aarch64/images/Fedora-Cloud-Base-38-1.6.aarch64.raw.xz
xz -d ./Fedora-Cloud-Base-38-1.6.aarch64.raw.xz
mv Fedora-Cloud-Base-38-1.6.aarch64.raw vfkit-test-image.raw

# For Intel Macs
$ curl -L https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.raw.xz
$ xz -d ./Fedora-Cloud-Base-38-1.6.x86_64.raw.xz
$ mv Fedora-Cloud-Base-38-1.6.x86_64.raw vfkit-test-image.raw
curl -L https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.raw.xz
xz -d ./Fedora-Cloud-Base-38-1.6.x86_64.raw.xz
mv Fedora-Cloud-Base-38-1.6.x86_64.raw vfkit-test-image.raw
```


Expand All @@ -49,7 +49,7 @@ $ mv Fedora-Cloud-Base-38-1.6.x86_64.raw vfkit-test-image.raw
Now that we have a disk image, we can start a virtual machine with 2 virtual CPUs and 2GiB of RAM:

```
$ vfkit \
vfkit \
--cpus 2 --memory 2048 \
--bootloader efi,variable-store=efi-variable-store,create \
--device virtio-blk,path=vfkit-test-image.raw
Expand Down
12 changes: 6 additions & 6 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Set the log-level for VFKit. Supported values are `debug`, `info`, and `error`.

- `--restful-URI`

The URI (address) of the restful service. The default is `tcp://localhost:8081`. Valid schemes are
The URI (address) of the RESTful service. The default is `tcp://localhost:8081`. Valid schemes are
`tcp`, `none`, or `unix`. In the case of unix, the "host" portion would be a path to where the unix domain
socket will be stored. A scheme of `none` disables the restful service.
socket will be stored. A scheme of `none` disables the RESTful service.

### Virtual Machine Resources

Expand Down Expand Up @@ -132,7 +132,7 @@ However, APFS, the default macOS filesystem has support for sparse files and cop
A sparse raw image can be created/expanded using the `truncate` command or
using
[`truncate(2)`](https://manpagez.com/man/2/truncate/).
For example, an empty 1GiB disk can be created with `truncate --size 1G
For example, an empty 1GiB disk can be created with `truncate -s 1G
vfkit.img`. Such an image will only use disk space when content is written to
it. It initially only uses a few bytes of actual disk space even if it's size
is 1G.
Expand Down Expand Up @@ -385,11 +385,11 @@ None
`--device virtio-input,pointing`


## Restful Service
## RESTful Service

### Get VM state

Used to obtain the state of the virtual machine that is being run by VFKit.
Used to obtain the state of the virtual machine that is being run by vfkit.

GET `/vm/state`
Response: { "state": string, "canStart": bool, "canPause": bool, "canResume": bool, "canStop": bool, "canHardStop": bool }
Expand Down Expand Up @@ -427,7 +427,7 @@ In order to tell vfkit that you want to start a graphical application window, yo

### Usage

Proper use of this flag may look similar to the following section of a command:
Proper use of this flag may look similar to the following section of a command:
```bash
--device virtio-input,keyboard --device virtio-input,pointing --device virtio-gpu,width=1920,height=1080 --gui
```
6 changes: 3 additions & 3 deletions pkg/cmdline/cmdline.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type Options struct {
const DefaultRestfulURI = "none://"

func AddFlags(cmd *cobra.Command, opts *Options) {
cmd.Flags().StringVarP(&opts.VmlinuzPath, "kernel", "k", "", "path to the virtual machine linux kernel")
cmd.Flags().StringVarP(&opts.KernelCmdline, "kernel-cmdline", "C", "", "linux kernel command line")
cmd.Flags().StringVarP(&opts.VmlinuzPath, "kernel", "k", "", "path to the virtual machine Linux kernel")
cmd.Flags().StringVarP(&opts.KernelCmdline, "kernel-cmdline", "C", "", "Linux kernel command line")
cmd.Flags().StringVarP(&opts.InitrdPath, "initrd", "i", "", "path to the virtual machine initrd")

cmd.Flags().VarP(&opts.Bootloader, "bootloader", "b", "bootloader configuration")
Expand All @@ -48,6 +48,6 @@ func AddFlags(cmd *cobra.Command, opts *Options) {
cmd.Flags().StringArrayVarP(&opts.Devices, "device", "d", []string{}, "devices")

cmd.Flags().StringVar(&opts.LogLevel, "log-level", "", "set log level")
cmd.Flags().StringVar(&opts.RestfulURI, "restful-uri", DefaultRestfulURI, "URI address for RestFul services")
cmd.Flags().StringVar(&opts.RestfulURI, "restful-uri", DefaultRestfulURI, "URI address for RESTful services")

}
2 changes: 1 addition & 1 deletion pkg/config/bootloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (bootloader *LinuxBootloader) FromOptions(options []option) error {
case "initrd":
bootloader.InitrdPath = option.value
default:
return fmt.Errorf("unknown option for linux bootloaders: %s", option.key)
return fmt.Errorf("unknown option for Linux bootloaders: %s", option.key)
}
}
return nil
Expand Down