Skip to content

Commit

Permalink
vm: revert to qemu as default (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
abiosoft authored Dec 21, 2022
1 parent a7a5993 commit fc2ffc3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
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

0 comments on commit fc2ffc3

Please sign in to comment.