Skip to content

Commit ab63fcd

Browse files
cfergeaupraveenkumar
authored andcommitted
macos: Remove no longer needed code
After the switch to UEFI, we can remove all the code related to externally-provided kernel/initramfs/kernel command line.
1 parent 896d7f4 commit ab63fcd

File tree

10 files changed

+2
-81
lines changed

10 files changed

+2
-81
lines changed

pkg/crc/machine/bundle/copier_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ func createDummyBundleFiles(t *testing.T, bundle *CrcBundleInfo) {
6363
bundle.GetKubeConfigPath(),
6464
bundle.GetSSHKeyPath(),
6565
bundle.GetDiskImagePath(),
66-
bundle.GetKernelPath(),
67-
bundle.GetInitramfsPath(),
6866
}
6967

7068
for _, file := range files {

pkg/crc/machine/bundle/metadata.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ type Node struct {
5656
Kind []string `json:"kind"`
5757
Hostname string `json:"hostname"`
5858
DiskImage string `json:"diskImage"`
59-
KernelCmdLine string `json:"kernelCmdLine,omitempty"`
60-
Initramfs string `json:"initramfs,omitempty"`
61-
Kernel string `json:"kernel,omitempty"`
6259
InternalIP string `json:"internalIP"`
6360
PodmanVersion string `json:"podmanVersion,omitempty"`
6461
}
@@ -145,24 +142,6 @@ func (bundle *CrcBundleInfo) GetSSHKeyPath() string {
145142
return bundle.resolvePath(bundle.ClusterInfo.SSHPrivateKeyFile)
146143
}
147144

148-
func (bundle *CrcBundleInfo) GetKernelPath() string {
149-
if bundle.Nodes[0].Kernel == "" {
150-
return ""
151-
}
152-
return bundle.resolvePath(bundle.Nodes[0].Kernel)
153-
}
154-
155-
func (bundle *CrcBundleInfo) GetInitramfsPath() string {
156-
if bundle.Nodes[0].Initramfs == "" {
157-
return ""
158-
}
159-
return bundle.resolvePath(bundle.Nodes[0].Initramfs)
160-
}
161-
162-
func (bundle *CrcBundleInfo) GetKernelCommandLine() string {
163-
return bundle.Nodes[0].KernelCmdLine
164-
}
165-
166145
func (bundle *CrcBundleInfo) GetBundleBuildTime() (time.Time, error) {
167146
return time.Parse(time.RFC3339, strings.TrimSpace(bundle.BuildInfo.BuildTime))
168147
}
@@ -200,8 +179,6 @@ func (bundle *CrcBundleInfo) verify() error {
200179
files := []string{
201180
bundle.GetSSHKeyPath(),
202181
bundle.GetDiskImagePath(),
203-
bundle.GetKernelPath(),
204-
bundle.GetInitramfsPath(),
205182
bundle.GetOcPath(),
206183
bundle.GetKubeConfigPath()}
207184

pkg/crc/machine/config/config.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ type MachineConfig struct {
1919
SharedDirPassword string
2020
SharedDirUsername string
2121

22-
// macOS specific configuration
23-
KernelCmdLine string
24-
Initramfs string
25-
Kernel string
26-
2722
// Experimental features
2823
NetworkMode network.Mode
2924
}

pkg/crc/machine/driver_darwin.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"errors"
66

7-
"github.com/crc-org/crc/v2/pkg/crc/logging"
87
"github.com/crc-org/crc/v2/pkg/crc/machine/config"
98
"github.com/crc-org/crc/v2/pkg/crc/machine/vfkit"
109
machineVf "github.com/crc-org/crc/v2/pkg/drivers/vfkit"
@@ -37,34 +36,6 @@ func updateDriverConfig(host *host.Host, driver *machineVf.Driver) error {
3736
return host.UpdateConfig(driverData)
3837
}
3938

40-
func updateKernelArgs(vm *virtualMachine) error {
41-
logging.Info("Updating kernel args...")
42-
sshRunner, err := vm.SSHRunner()
43-
if err != nil {
44-
return err
45-
}
46-
defer sshRunner.Close()
47-
48-
stdout, stderr, err := sshRunner.RunPrivileged("Get kernel args", `-- sh -c 'rpm-ostree kargs'`)
49-
if err != nil {
50-
logging.Errorf("Failed to get kernel args: %v - %s", err, stderr)
51-
return err
52-
}
53-
logging.Debugf("Kernel args: %s", stdout)
54-
55-
vfkitDriver, err := loadDriverConfig(vm.Host)
56-
if err != nil {
57-
return err
58-
}
59-
logging.Debugf("Current Kernel args: %s", vfkitDriver.Cmdline)
60-
vfkitDriver.Cmdline = stdout
61-
62-
if err := updateDriverConfig(vm.Host, vfkitDriver); err != nil {
63-
return err
64-
}
65-
return vm.api.Save(vm.Host)
66-
}
67-
6839
func updateDriverStruct(_ *host.Host, _ *machineVf.Driver) error {
6940
return drivers.ErrNotImplemented
7041
}

pkg/crc/machine/driver_linux.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ func updateDriverConfig(host *host.Host, driver *machineLibvirt.Driver) error {
3939
return host.UpdateConfig(driverData)
4040
}
4141

42-
func updateKernelArgs(_ *virtualMachine) error {
43-
return nil
44-
}
45-
4642
/*
4743
func (r *RPCServerDriver) SetConfigRaw(data []byte, _ *struct{}) error {
4844
return json.Unmarshal(data, &r.ActualDriver)

pkg/crc/machine/driver_windows.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ func updateDriverConfig(host *host.Host, driver *machineHyperv.Driver) error {
3434
return host.UpdateConfig(driverData)
3535
}
3636

37-
func updateKernelArgs(_ *virtualMachine) error {
38-
return nil
39-
}
40-
4137
func updateDriverStruct(host *host.Host, driver *machineHyperv.Driver) error {
4238
host.Driver = driver
4339
return nil

pkg/crc/machine/start.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)
317317
ImageSourcePath: crcBundleMetadata.GetDiskImagePath(),
318318
ImageFormat: crcBundleMetadata.GetDiskImageFormat(),
319319
SSHKeyPath: crcBundleMetadata.GetSSHKeyPath(),
320-
KernelCmdLine: crcBundleMetadata.GetKernelCommandLine(),
321-
Initramfs: crcBundleMetadata.GetInitramfsPath(),
322-
Kernel: crcBundleMetadata.GetKernelPath(),
323320
SharedDirs: sharedDirs,
324321
SharedDirPassword: startConfig.SharedDirPassword,
325322
SharedDirUsername: startConfig.SharedDirUsername,

pkg/crc/machine/stop.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ func (client *client) Stop() (state.State, error) {
2323
logging.Debugf("%v", err)
2424
}
2525
}
26-
if err := updateKernelArgs(vm); err != nil {
27-
logging.Debugf("%v", err)
28-
}
2926
logging.Info("Stopping the instance, this may take a few minutes...")
3027
if err := vm.Stop(); err != nil {
3128
status, stateErr := vm.State()

pkg/crc/machine/vfkit/driver_darwin.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ func CreateHost(machineConfig config.MachineConfig) *vfkit.Driver {
1515

1616
config.InitVMDriverFromMachineConfig(machineConfig, vfDriver.VMDriver)
1717

18-
vfDriver.Cmdline = machineConfig.KernelCmdLine
19-
vfDriver.VmlinuzPath = machineConfig.Kernel
20-
vfDriver.InitrdPath = machineConfig.Initramfs
2118
vfDriver.VfkitPath = ExecutablePath()
2219

2320
vfDriver.VirtioNet = machineConfig.NetworkMode == network.SystemNetworkingMode

pkg/drivers/vfkit/driver_darwin.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ import (
4040

4141
type Driver struct {
4242
*drivers.VMDriver
43-
VmlinuzPath string
44-
Cmdline string
45-
InitrdPath string
46-
VfkitPath string
47-
VirtioNet bool
43+
VfkitPath string
44+
VirtioNet bool
4845

4946
VsockPath string
5047
DaemonVsockPort uint

0 commit comments

Comments
 (0)