Skip to content

Commit 87594ce

Browse files
committed
[WIP] Temporary code changes to make crc use krunkit instead of vfkit on macOS
1 parent 11140c5 commit 87594ce

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

cmd/crc/cmd/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func createNewVirtualNetworkConfig(providedConfig *crcConfig.Config) types.Confi
7777
virtualNetworkConfig := types.Configuration{
7878
Debug: false, // never log packets
7979
CaptureFile: os.Getenv("CRC_DAEMON_PCAP_FILE"),
80-
MTU: 4000, // Large packets slightly improve the performance. Less small packets.
80+
MTU: 1500,
8181
Subnet: "192.168.127.0/24",
8282
GatewayIP: constants.VSockGateway,
8383
GatewayMacAddress: "5a:94:ef:e4:0c:dd",

pkg/crc/cache/cache.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func getVersionGeneric(executablePath string, args ...string) (string, error) {
5959
logging.Debugf("failed to run executable %s: %v", executablePath, err)
6060
return "", err
6161
}
62+
if executablePath == "/usr/local/bin/krunkit" {
63+
return strings.TrimSpace(strings.TrimPrefix(stdOut, "krunkit ")), nil
64+
}
6265
parsedOutput := strings.Split(stdOut, ":")
6366
if len(parsedOutput) < 2 {
6467
logging.Debugf("failed to parse version information for %s: %s", executablePath, stdOut)

pkg/crc/cache/cache_darwin.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package cache
22

33
import (
4-
"strings"
5-
64
"github.com/crc-org/crc/v2/pkg/crc/machine/vfkit"
75
)
86

@@ -11,9 +9,5 @@ func NewVfkitCache() *Cache {
119
}
1210

1311
func getVfkitVersion(executablePath string) (string, error) {
14-
version, err := getVersionGeneric(executablePath, "-v")
15-
if err != nil {
16-
return version, err
17-
}
18-
return strings.TrimPrefix(version, "v"), nil
12+
return getVersionGeneric(executablePath, "-V")
1913
}

pkg/crc/constants/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ func GetDefaultBundleSignedHashURL(preset crcpreset.Preset) string {
143143
}
144144

145145
func ResolveHelperPath(executableName string) string {
146+
if executableName == "krunkit" {
147+
return "/usr/local/bin/krunkit"
148+
}
146149
if version.IsInstaller() {
147150
return filepath.Join(version.InstallPath(), executableName)
148151
}

pkg/crc/machine/vfkit/constants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
const (
12-
VfkitVersion = "0.6.1"
13-
vfkitCommand = "vfkit"
12+
VfkitVersion = "1.1.1"
13+
vfkitCommand = "krunkit"
1414
)
1515

1616
var (

pkg/drivers/vfkit/driver_darwin.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,16 @@ func (d *Driver) Start() error {
275275
// when loading a VM created by a crc version predating this commit,
276276
// d.QemuGAVsockPort will be missing from ~/.crc/machines/crc/config.json
277277
// In such a case, assume the VM will not support time sync
278-
if d.QemuGAVsockPort != 0 {
279-
timesync, err := config.TimeSyncNew(d.QemuGAVsockPort)
280-
if err != nil {
281-
return err
282-
}
283-
err = vm.AddDevice(timesync)
284-
if err != nil {
285-
return err
286-
}
287-
}
278+
// if d.QemuGAVsockPort != 0 {
279+
// timesync, err := config.TimeSyncNew(d.QemuGAVsockPort)
280+
// if err != nil {
281+
// return err
282+
// }
283+
// err = vm.AddDevice(timesync)
284+
// if err != nil {
285+
// return err
286+
// }
287+
// }
288288

289289
args, err := vm.ToCmdLine()
290290
if err != nil {
@@ -443,15 +443,15 @@ func (d *Driver) findVfkitProcess() (*process.Process, error) {
443443
return nil, nil
444444
}
445445

446-
name, err := p.Name()
447-
if err != nil {
448-
return nil, err
449-
}
450-
if !strings.HasPrefix(name, "vfkit") {
451-
// return InvalidExecutable error?
452-
log.Debugf("pid %d is stale, and is being used by %s", pid, name)
453-
return nil, nil
454-
}
446+
// name, err := p.Name()
447+
// if err != nil {
448+
// return nil, err
449+
// }
450+
// if !strings.HasPrefix(name, "vfkit") {
451+
// // return InvalidExecutable error?
452+
// log.Debugf("pid %d is stale, and is being used by %s", pid, name)
453+
// return nil, nil
454+
// }
455455

456456
return p, nil
457457
}

vendor/github.com/crc-org/vfkit/pkg/config/virtio.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)