Bug 2060724

Summary: [RFE]Support copy/paste in the VNC console in virt-install
Product: Red Hat Enterprise Linux 9 Reporter: zhoujunqin <juzhou>
Component: virt-managerAssignee: Jonathon Jongsma <jjongsma>
virt-manager sub component: Common QA Contact: Hongzhou Liu <hongzliu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: hongzliu, jjongsma, jsuchane, tyan, tzheng, virt-maint
Version: 9.0Keywords: FutureFeature, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-4.0.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:34:07 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2057768, 2100525    
Bug Blocks: 2064602    

Description zhoujunqin 2022-03-04 06:10:43 UTC
Description of problem:
qemu-kvm has supported copy/paste in the vnc console since qemu-kvm 6.2.0, see:
Bug 1874926 - [RFE] copy/paste support in qemu VNC console
Bug 2057768 - [RFE]Support copy/paste in the VNC console in libvirt

Virt-install should also support this feature.

Version-Release number of selected component (if applicable):
virt-install-3.2.0-14.el9.noarch
libvirt-8.0.0-6.el9.x86_64
qemu-kvm-6.2.0-11.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Check the sub-option 'clipboard.copypaste' is supported by --graphics.

# virt-install  --graphics=?
--graphics options:
  clearxml
...
  clipboard.copypaste
  connected
  defaultMode
  filetransfer.enable
  gl.enable
  gl.rendernode
  image.compression
  keymap
  listen
  listens[0-9]*.address
  listens[0-9]*.network
  listens[0-9]*.socket
  listens[0-9]*.type
  mouse.mode
  password
  passwordValidTo
  port
  streaming.mode
  tlsPort
  type
  websocket
  zlib.compression

2. Install a VNC VM with "--graphics type=vnc,clipboard.copypaste=yes ".
# virt-install --memory 2048 --location /home/iso/RHEL-7.9-20200917.0-Server-x86_64-dvd1.iso --disk /home/test-agent.img,size=10 --graphics type=vnc,clipboard.copypaste=yes
...
Result - Installation starts successfully.


3. Check the XML content for the graphics setting part.
# virsh dumpxml rhel7.9-2
...
    <graphics type='vnc' port='5902' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
...

Actual results:
Sub-option 'clipboard.copypaste' can't be parsed by virt-install command

Expected results:
Enable vnc copy/paste in virt-install and automatically add a 'qemu-vdagent' channel to the XML for VM.

Additional info:
1. Sub-option 'clipboard.copypaste' can be parsed by virt-install command when add "--dry-run --print-xml"
# virt-install --memory 2048 --location /home/iso/RHEL-7.9-20200917.0-Server-x86_64-dvd1.iso --disk /home/test-agent1.img,size=10 --graphics type=vnc,clipboard.copypaste=yes --dry-run --print-xml
...

    <graphics type="vnc" port="-1">
      <clipboard copypaste="yes"/>
    </graphics>
...

Comment 2 Jonathon Jongsma 2022-05-18 19:54:27 UTC
(In reply to zhoujunqin from comment #0)
> Description of problem:
> qemu-kvm has supported copy/paste in the vnc console since qemu-kvm 6.2.0,
> see:
> Bug 1874926 - [RFE] copy/paste support in qemu VNC console
> Bug 2057768 - [RFE]Support copy/paste in the VNC console in libvirt
> 
> Virt-install should also support this feature.
> 
> Version-Release number of selected component (if applicable):
> virt-install-3.2.0-14.el9.noarch
> libvirt-8.0.0-6.el9.x86_64
> qemu-kvm-6.2.0-11.el9.x86_64
> 
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1. Check the sub-option 'clipboard.copypaste' is supported by --graphics.
> 
> # virt-install  --graphics=?
> --graphics options:
>   clearxml
> ...
>   clipboard.copypaste
>   connected
>   defaultMode
>   filetransfer.enable
>   gl.enable
>   gl.rendernode
>   image.compression
>   keymap
>   listen
>   listens[0-9]*.address
>   listens[0-9]*.network
>   listens[0-9]*.socket
>   listens[0-9]*.type
>   mouse.mode
>   password
>   passwordValidTo
>   port
>   streaming.mode
>   tlsPort
>   type
>   websocket
>   zlib.compression

Although it's not clear from this output, several of these options are spice-only, including clipboard.copypaste. Clipboard sharing with VNC is implemented a bit differently in libvirt. There will be no changes to the <graphics> element, but will instead be set on a qemu-vdagent channel element. For example, this is the XML device required to enable this support (assuming a VNC client with clipboard support):

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


We'll need to add support for this new channel type to virt-install. I'll try to submit this upstream soon.

Comment 3 Jonathon Jongsma 2022-05-19 19:33:12 UTC
Proposed some patches upstream

https://listman.redhat.com/archives/virt-tools-list/2022-May/017573.html

Comment 11 errata-xmlrpc 2022-11-15 10:34:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8186