update vfkit vendored code
upstream reversed width and height and now we get an unusable gui [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
parent
cc8c28eb7c
commit
59e0919bc7
2
go.mod
2
go.mod
|
|
@ -23,7 +23,7 @@ require (
|
|||
github.com/containers/storage v1.50.2
|
||||
github.com/coreos/go-systemd/v22 v22.5.0
|
||||
github.com/coreos/stream-metadata-go v0.4.3
|
||||
github.com/crc-org/vfkit v0.1.1
|
||||
github.com/crc-org/vfkit v0.1.2-0.20230829083117-09e62065eb6e
|
||||
github.com/cyphar/filepath-securejoin v0.2.4
|
||||
github.com/digitalocean/go-qemu v0.0.0-20230711162256-2e3d0186973e
|
||||
github.com/docker/distribution v2.8.2+incompatible
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -299,8 +299,8 @@ github.com/coreos/stream-metadata-go v0.4.3/go.mod h1:fMObQqQm8Ku91G04btKzEH3Asd
|
|||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/crc-org/vfkit v0.1.1 h1:F0QXj9ik1mhVq2R8FmWFhQH8SuFGYP5Xu2KF7cTvALs=
|
||||
github.com/crc-org/vfkit v0.1.1/go.mod h1:vjZiHDacUi0iLosvwyLvqJvJXQhByzlLQbMkdIfCQWk=
|
||||
github.com/crc-org/vfkit v0.1.2-0.20230829083117-09e62065eb6e h1:UlIzed038y+BSh8GTg3yuL1i8309mrs3Gth9s26AdT8=
|
||||
github.com/crc-org/vfkit v0.1.2-0.20230829083117-09e62065eb6e/go.mod h1:RJbirUrdvb3qyOxjySBeOfuc9wgbJrZxJP2eNcxDWGs=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ func getIgnitionVsockDevice(path string) (vfConfig.VirtioDevice, error) {
|
|||
|
||||
func VirtIOFsToVFKitVirtIODevice(fs machine.VirtIoFs) vfConfig.VirtioFs {
|
||||
return vfConfig.VirtioFs{
|
||||
DirectorySharingConfig: vfConfig.DirectorySharingConfig{
|
||||
MountTag: fs.Tag,
|
||||
},
|
||||
SharedDir: fs.Source,
|
||||
MountTag: fs.Tag,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const (
|
|||
vfGpu vmComponentKind = "virtiogpu"
|
||||
vfInput vmComponentKind = "virtioinput"
|
||||
usbMassStorage vmComponentKind = "usbmassstorage"
|
||||
rosetta vmComponentKind = "rosetta"
|
||||
)
|
||||
|
||||
type jsonKind struct {
|
||||
|
|
@ -112,6 +113,10 @@ func unmarshalDevice(rawMsg json.RawMessage) (VirtioDevice, error) {
|
|||
var newDevice VirtioFs
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
dev = &newDevice
|
||||
case rosetta:
|
||||
var newDevice RosettaShare
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
dev = &newDevice
|
||||
case vfRng:
|
||||
var newDevice VirtioRng
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
|
|
@ -253,6 +258,17 @@ func (dev *VirtioFs) MarshalJSON() ([]byte, error) {
|
|||
})
|
||||
}
|
||||
|
||||
func (dev *RosettaShare) MarshalJSON() ([]byte, error) {
|
||||
type devWithKind struct {
|
||||
jsonKind
|
||||
RosettaShare
|
||||
}
|
||||
return json.Marshal(devWithKind{
|
||||
jsonKind: kind(rosetta),
|
||||
RosettaShare: *dev,
|
||||
})
|
||||
}
|
||||
|
||||
func (dev *VirtioRng) MarshalJSON() ([]byte, error) {
|
||||
type devWithKind struct {
|
||||
jsonKind
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ const (
|
|||
VirtioInputKeyboardDevice = "keyboard"
|
||||
|
||||
// Options for VirtioGPUResolution
|
||||
VirtioGPUResolutionHeight = "height"
|
||||
VirtioGPUResolutionWidth = "width"
|
||||
VirtioGPUResolutionHeight = "height"
|
||||
|
||||
// Default VirtioGPU Resolution
|
||||
defaultVirtioGPUResolutionHeight = 800
|
||||
defaultVirtioGPUResolutionWidth = 600
|
||||
defaultVirtioGPUResolutionWidth = 800
|
||||
defaultVirtioGPUResolutionHeight = 600
|
||||
)
|
||||
|
||||
// VirtioInput configures an input device, such as a keyboard or pointing device
|
||||
|
|
@ -32,8 +32,8 @@ type VirtioInput struct {
|
|||
}
|
||||
|
||||
type VirtioGPUResolution struct {
|
||||
Height int `json:"height"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
// VirtioGPU configures a GPU device, such as the host computer's display
|
||||
|
|
@ -61,10 +61,20 @@ type VirtioBlk struct {
|
|||
DeviceIdentifier string
|
||||
}
|
||||
|
||||
type DirectorySharingConfig struct {
|
||||
MountTag string
|
||||
}
|
||||
|
||||
// VirtioFs configures directory sharing between the guest and the host.
|
||||
type VirtioFs struct {
|
||||
DirectorySharingConfig
|
||||
SharedDir string
|
||||
MountTag string
|
||||
}
|
||||
|
||||
// RosettaShare configures rosetta support in the guest to run Intel binaries on Apple CPUs
|
||||
type RosettaShare struct {
|
||||
DirectorySharingConfig
|
||||
InstallRosetta bool
|
||||
}
|
||||
|
||||
// virtioRng configures a random number generator (RNG) device.
|
||||
|
|
@ -131,6 +141,8 @@ func deviceFromCmdLine(deviceOpts string) (VirtioDevice, error) {
|
|||
}
|
||||
var dev VirtioDevice
|
||||
switch opts[0] {
|
||||
case "rosetta":
|
||||
dev = &RosettaShare{}
|
||||
case "virtio-blk":
|
||||
dev = virtioBlkNewEmpty()
|
||||
case "virtio-fs":
|
||||
|
|
@ -268,15 +280,15 @@ func VirtioGPUNew() (VirtioDevice, error) {
|
|||
return &VirtioGPU{
|
||||
UsesGUI: false,
|
||||
VirtioGPUResolution: VirtioGPUResolution{
|
||||
Height: defaultVirtioGPUResolutionHeight,
|
||||
Width: defaultVirtioGPUResolutionWidth,
|
||||
Height: defaultVirtioGPUResolutionHeight,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (dev *VirtioGPU) validate() error {
|
||||
if dev.Height < 1 || dev.Width < 1 {
|
||||
return fmt.Errorf("Invalid dimensions for virtio-gpu device resolution: %dx%d", dev.Height, dev.Width)
|
||||
return fmt.Errorf("Invalid dimensions for virtio-gpu device resolution: %dx%d", dev.Width, dev.Height)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -287,7 +299,7 @@ func (dev *VirtioGPU) ToCmdLine() ([]string, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return []string{"--device", fmt.Sprintf("virtio-gpu,height=%d,width=%d", dev.Height, dev.Width)}, nil
|
||||
return []string{"--device", fmt.Sprintf("virtio-gpu,width=%d,height=%d", dev.Width, dev.Height)}, nil
|
||||
}
|
||||
|
||||
func (dev *VirtioGPU) FromOptions(options []option) error {
|
||||
|
|
@ -545,8 +557,10 @@ func (dev *VirtioVsock) FromOptions(options []option) error {
|
|||
// mounted in the VM using `mount -t virtiofs mountTag /some/dir`
|
||||
func VirtioFsNew(sharedDir string, mountTag string) (VirtioDevice, error) {
|
||||
return &VirtioFs{
|
||||
DirectorySharingConfig: DirectorySharingConfig{
|
||||
MountTag: mountTag,
|
||||
},
|
||||
SharedDir: sharedDir,
|
||||
MountTag: mountTag,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -575,6 +589,46 @@ func (dev *VirtioFs) FromOptions(options []option) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// RosettaShare creates a new rosetta share for running x86_64 binaries on M1 machines.
|
||||
// It will share a directory containing the linux rosetta binaries with the
|
||||
// virtual machine. This directory can be mounted in the VM using `mount -t
|
||||
// virtiofs mountTag /some/dir`
|
||||
func RosettaShareNew(mountTag string) (VirtioDevice, error) {
|
||||
return &RosettaShare{
|
||||
DirectorySharingConfig: DirectorySharingConfig{
|
||||
MountTag: mountTag,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (dev *RosettaShare) ToCmdLine() ([]string, error) {
|
||||
if dev.MountTag == "" {
|
||||
return nil, fmt.Errorf("rosetta shares require a mount tag to be specified")
|
||||
}
|
||||
builder := strings.Builder{}
|
||||
builder.WriteString("rosetta")
|
||||
fmt.Fprintf(&builder, ",mountTag=%s", dev.MountTag)
|
||||
if dev.InstallRosetta {
|
||||
builder.WriteString(",install")
|
||||
}
|
||||
|
||||
return []string{"--device", builder.String()}, nil
|
||||
}
|
||||
|
||||
func (dev *RosettaShare) FromOptions(options []option) error {
|
||||
for _, option := range options {
|
||||
switch option.key {
|
||||
case "mountTag":
|
||||
dev.MountTag = option.value
|
||||
case "install":
|
||||
dev.InstallRosetta = true
|
||||
default:
|
||||
return fmt.Errorf("Unknown option for rosetta share: %s", option.key)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type USBMassStorage struct {
|
||||
StorageConfig
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ github.com/coreos/stream-metadata-go/release
|
|||
github.com/coreos/stream-metadata-go/release/rhcos
|
||||
github.com/coreos/stream-metadata-go/stream
|
||||
github.com/coreos/stream-metadata-go/stream/rhcos
|
||||
# github.com/crc-org/vfkit v0.1.1
|
||||
# github.com/crc-org/vfkit v0.1.2-0.20230829083117-09e62065eb6e
|
||||
## explicit; go 1.18
|
||||
github.com/crc-org/vfkit/pkg/cmdline
|
||||
github.com/crc-org/vfkit/pkg/config
|
||||
|
|
|
|||
Loading…
Reference in New Issue