-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make vmware platform common code build on all arches
Even though VMWare doesn't support non-amd64 case, for the imager (and Image Factory), the common stuff should work correctly for any arch the imager is running with (as arm64 imager can generate amd64 VMWare image). See siderolabs/image-factory#164 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
- Loading branch information
Showing
3 changed files
with
41 additions
and
43 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
// Package vmware provides the VMware platform implementation. | ||
package vmware | ||
|
||
import ( | ||
"github.com/siderolabs/go-procfs/procfs" | ||
|
||
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime" | ||
"github.com/siderolabs/talos/pkg/machinery/constants" | ||
) | ||
|
||
// VMware is the concrete type that implements the platform.Platform interface. | ||
type VMware struct{} | ||
|
||
// Name implements the platform.Platform interface. | ||
func (v *VMware) Name() string { | ||
return "vmware" | ||
} | ||
|
||
// Mode implements the platform.Platform interface. | ||
func (v *VMware) Mode() runtime.Mode { | ||
return runtime.ModeCloud | ||
} | ||
|
||
// KernelArgs implements the runtime.Platform interface. | ||
func (v *VMware) KernelArgs(arch string) procfs.Parameters { | ||
switch arch { | ||
case "amd64": | ||
return []*procfs.Parameter{ | ||
procfs.NewParameter(constants.KernelParamConfig).Append(constants.ConfigGuestInfo), | ||
procfs.NewParameter("console").Append("tty0").Append("ttyS0"), | ||
procfs.NewParameter("earlyprintk").Append("ttyS0,115200"), | ||
procfs.NewParameter(constants.KernelParamNetIfnames).Append("0"), | ||
} | ||
default: | ||
return nil // not supported on !amd64 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters