Make audio and clipboard sharing opt-in (#486)

This commit is contained in:
edi-oai
2026-09-08 10:24:42 +01:00
committed by GitHub
parent d8caf2d33c
commit 792324b35b
5 changed files with 20 additions and 16 deletions
+8 -4
View File
@@ -766,13 +766,17 @@ components:
type: boolean
description: Enable nested virtualization
default: false
noAudio:
audio:
type: boolean
description: Whether to disable audio pass-through to the host
description: |
Whether to enable audio pass-through to the host for a Tart VM.
Disabled by default. This field cannot be changed after the VM is created.
default: false
noClipboard:
clipboard:
type: boolean
description: Whether to disable clipboard sharing between host and guest
description: |
Whether to enable clipboard sharing between host and guest for a Tart VM.
Disabled by default. This field cannot be changed after the VM is created.
default: false
username:
type: string
+6 -6
View File
@@ -28,8 +28,8 @@ var netSoftnetBlock []string
var netBridged string
var headless bool
var nested bool
var noAudio bool
var noClipboard bool
var audio bool
var clipboard bool
var suspendable bool
var username string
var password string
@@ -72,8 +72,8 @@ func newCreateVMCommand() *cobra.Command {
command.Flags().StringVar(&netBridged, "net-bridged", "", "whether to use Bridged network mode")
command.Flags().BoolVar(&headless, "headless", true, "whether to run without graphics")
command.Flags().BoolVar(&nested, "nested", false, "enable nested virtualization")
command.Flags().BoolVar(&noAudio, "no-audio", false, "disable audio pass-through to the host")
command.Flags().BoolVar(&noClipboard, "no-clipboard", false, "disable clipboard sharing between host and guest")
command.Flags().BoolVar(&audio, "audio", false, "enable audio pass-through to the host")
command.Flags().BoolVar(&clipboard, "clipboard", false, "enable clipboard sharing between host and guest")
command.Flags().BoolVar(&suspendable, "suspendable", false, "treat the VM as suspendable, "+
"disabling certain devices for suspendability support and issuing \"tart suspend\" instead of \"tart stop\" "+
"when VM's specification is updated, thus preserving the VM's state between specification generations")
@@ -160,8 +160,8 @@ func runCreateVM(cmd *cobra.Command, args []string) error {
NetBridged: netBridged,
Headless: headless,
Nested: nested,
NoAudio: noAudio,
NoClipboard: noClipboard,
Audio: audio,
Clipboard: clipboard,
Username: username,
Password: password,
RandomSerial: randomSerial,
+2 -2
View File
@@ -98,8 +98,8 @@ func runGetVM(cmd *cobra.Command, args []string) error {
table.AddRow("Bridged networking interface", nonEmptyOrNone(vm.NetBridged))
table.AddRow("Headless mode", vm.Headless)
table.AddRow("Nested virtualization", vm.Nested)
table.AddRow("Audio disabled", vm.NoAudio)
table.AddRow("Clipboard sharing disabled", vm.NoClipboard)
table.AddRow("Audio enabled", vm.Audio)
table.AddRow("Clipboard sharing enabled", vm.Clipboard)
table.AddRow("Status", vm.Status)
table.AddRow("Status message", vm.StatusMessage)
table.AddRow("Assigned worker", nonEmptyOrNone(vm.Worker))
+2 -2
View File
@@ -364,11 +364,11 @@ func (vm *VM) run(ctx context.Context, eventStreamer *client.EventStreamer) {
runArgs = append(runArgs, "--nested")
}
if resource.NoAudio {
if !resource.Audio {
runArgs = append(runArgs, "--no-audio")
}
if resource.NoClipboard {
if !resource.Clipboard {
runArgs = append(runArgs, "--no-clipboard")
}
+2 -2
View File
@@ -36,8 +36,8 @@ type VM struct {
NetBridged string `json:"net-bridged,omitempty"`
Headless bool `json:"headless,omitempty"`
Nested bool `json:"nested,omitempty"`
NoAudio bool `json:"noAudio,omitempty"`
NoClipboard bool `json:"noClipboard,omitempty"`
Audio bool `json:"audio,omitempty"`
Clipboard bool `json:"clipboard,omitempty"`
VMSpec
VMSpecReadOnly