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

vm: revert to qemu as default #528

Merged
merged 1 commit into from
Dec 21, 2022
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
20 changes: 13 additions & 7 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,9 @@ func init() {

defaultMountType := "9p"
defaultVMType := "qemu"
if util.MacOS13OrNewer() {
defaultVMType = "vz"
defaultMountType = "virtiofs"
}

mounts := strings.Join([]string{defaultMountType, "sshfs"}, ", ")
types := strings.Join([]string{defaultVMType, "qemu"}, ", ")
mounts := strings.Join([]string{defaultMountType, "sshfs", "virtiofs"}, ", ")
types := strings.Join([]string{defaultVMType, "vz"}, ", ")

root.Cmd().AddCommand(startCmd)
startCmd.Flags().StringVarP(&startCmdArgs.Runtime, "runtime", "r", docker.Name, "container runtime ("+runtimes+")")
Expand Down Expand Up @@ -171,7 +167,7 @@ func init() {

// dns
startCmd.Flags().IPSliceVarP(&startCmdArgs.Network.DNSResolvers, "dns", "n", nil, "DNS resolvers for the VM")
startCmd.Flags().StringSliceVar(&startCmdArgs.Flags.DNSHosts, "dns-host", nil, "Custom DNS names to provide to resolver")
startCmd.Flags().StringSliceVar(&startCmdArgs.Flags.DNSHosts, "dns-host", nil, "custom DNS names to provide to resolver")
}

func dnsHostsFromFlag(hosts []string) map[string]string {
Expand Down Expand Up @@ -241,6 +237,16 @@ func prepareConfig(cmd *cobra.Command) {
// convert mount type for qemu
if startCmdArgs.VMType != "vz" && startCmdArgs.MountType == "virtiofs" {
startCmdArgs.MountType = "9p"
if cmd.Flag("mount-type").Changed {
log.Warnln("virtiofs is only available for 'vz' vmType, using 9p")
}
}
// convert mount type for vz
if startCmdArgs.VMType == "vz" && startCmdArgs.MountType == "9p" {
startCmdArgs.MountType = "virtiofs"
if cmd.Flag("mount-type").Changed {
log.Warnln("9p is only available for 'qemu' vmType, using virtiofs")
}
}
}
// if there is no existing settings
Expand Down
6 changes: 3 additions & 3 deletions embedded/defaults/colima.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ docker: {}
#
# vz is macOS virtualization framework and requires macOS 13
#
# Default: vz (for macOS 13), qemu (for non-macOS 13)
vmType: "vz"
# Default: qemu
vmType: qemu

# Volume mount driver for the virtual machine (virtiofs, 9p, sshfs).
#
Expand All @@ -117,7 +117,7 @@ vmType: "vz"
# of concurrent reads or writes).
#
# Default: virtiofs (for vz), 9p (for qemu)
mountType: sshfs
mountType: 9p

# The CPU type for the virtual machine (requires vmType `qemu`).
# Options available for host emulation can be checked with: `qemu-system-$(arch) -cpu help`.
Expand Down
2 changes: 1 addition & 1 deletion environment/vm/lima/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func newConf(ctx context.Context, conf config.Config) (l Config, err error) {
}

switch strings.ToLower(conf.MountType) {
case "", "ssh", "sshfs", "reversessh", "reverse-ssh", "reversesshfs", REVSSHFS:
case "ssh", "sshfs", "reversessh", "reverse-ssh", "reversesshfs", REVSSHFS:
l.MountType = REVSSHFS
default:
if l.VMType == VZ {
Expand Down