kubevirt / kubevirt

Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
https://kubevirt.io
Apache License 2.0
5.61k stars 1.34k forks source link

Support NoVNC clipboard copy paste feature. #10306

Closed a180285 closed 8 months ago

a180285 commented 1 year ago

I use noVNC html version to connect to kubevirt VM.

And when I connect to Windows VM. Is there any way to support noVNC copy paste feature?

victortoso commented 1 year ago

QEMU VNC's server supports clipboard since v6.1.0 and with libvirt that should be possible since v8.4.0.

As far as I understand, based on a quick read of Gerd's qemu-cut-paste, QEMU will use SPICE's guest-agent (spice-vdagent) for the actual clipboard delivery to the Guest. This should work fine with a Windows VM, but user's will need to install it.

So, to sum up:

  1. Add a libvirt change to enable QEMU passing clipboard content from VNC server to the Guest
  2. Installing SPICE guest agent in the Guest
  3. Using a VNC client that supports copy paste, I'm not at all familiar with noVNC but I believe you that it has this feature.

I can make the patches and test this when time allows it.

kubevirt-bot commented 11 months ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 10 months ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

oreillymj commented 10 months ago

Hi @victortoso ,

I'm wondering was there ever any progress made on this issue. I'm specifically interested in Add a libvirt change to enable QEMU passing clipboard content from VNC server to the Guest

Is that a code change or libvirt config?

a180285 commented 10 months ago

BTW, linux guest copy paste is also welcome. We just use send key as a workaround.

If there is any native support. It's much better.

victortoso commented 10 months ago

I'm wondering was there ever any progress made on this issue.

@oreillymj, No, but thanks for the ping. I'll give it a try this week.

Is that a code change or libvirt config?

Libvirt needs extra configuration, yes. Should be something like

  <channel type='qemu-vdagent'>
    <target type='virtio' name='com.redhat.spice.0'/>
    <source>
      <clipboard copypaste='yes'/>
      <mouse mode='client'/>
    </source>
  </channel>

Some more info in the commit libvirt@05b09f03

victortoso commented 10 months ago

If there is any native support. It's much better.

@a180285 , what do you define as native support?

victortoso commented 10 months ago

So, https://github.com/kubevirt/kubevirt/pull/10971 implements the necessary bits in KubeVirt to allow for vnc clipboard to work. The problem is that QEMU does not support live migration of the qemu-vdagent channel, see qemu!1380.

For the moment, I'm marking the PR as Draft and we should wait for QEMU developers to add support for migration.

victortoso commented 10 months ago

Hi, I plan to iterate over #10971 again. There are a couple of features in KubeVirt that causes the VM to be not migratable, so there is room for this feature I think. It'll need to be disabled by default.

In the meanwhile, I tested this with sidecars and it works as well. If you are trying sidecars for the first time, please give it a look to this https://github.com/kubevirt/user-guide/pull/751 where @dharmit is including related documentation to the user-guide. You can also give suggestions/feedback :)

  1. Enable Sidecar featureGates
  2. Add this configmap: clipboard-configmap.yam, it adds the necessary changes to libvirt
  3. Add the following annotation to your VMI
metadata:
  annotations:
    hooks.kubevirt.io/hookSidecars: '[{"args": ["--version", "v1alpha3"], "image":"kubevirt/sidecar-shim:20240108_99b6c4bdb",
          "configMap": {"name": "clipboard-configmap","key": "my_script.sh", "hookPath": "/usr/bin/onDefineDomain"}}]'
victortoso commented 9 months ago

KubeVirt's VNC talks with QEMU VNC server and the support for clipboard there relies on SPICE guest agent to deliver the clipboard data to the Guest. Relying on SPICE is not something we would like to encourage our users to do.

I'd suggest closing the issue as there is nothing we can do in KubeVirt to solve it. Users can, from KubeVirt v1.2.0 and forward, use the sidecar suggestion in my previous comment if they want.

fabiand commented 9 months ago

Something to add is: Or teach qemu-ga to support this clippboard protocol as well.

kubevirt-bot commented 8 months ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot commented 8 months ago

@kubevirt-bot: Closing this issue.

In response to [this](https://github.com/kubevirt/kubevirt/issues/10306#issuecomment-1951342304): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.