Skip to content

file copy&paste using webdav

Jakub Janků requested to merge jjanku/spice-protocol:webdav-cb into master

The change to spice protocol is minimal — it is the mere addition of VD_AGENT_CLIPBOARD_FILE_LIST.

Some words regarding the design:

  • the goal was to reuse the existing capabilities — clipboard messages and webdav
  • it currently works only in one direction — client → guest
  • in comparison to regular spice file transfer (using drag&drop)
    • it is slightly slower
    • it enables copying of directories
    • the file can be copied anywhere (not just to the default Downloads directory), it's up to the user
  • separate webdav channel (with the name org.spice-space.webdav.cb.0) and separate phodav server is used
  • mechanism
    • client
      • spice-gtk creates a "virtual" directory in phodav server for each file that is copied to the clipboard and requested by the guest
      • path to the shared file is sent to the vdagent using the present clipboard mechanism
    • guest
      • spice-webdavd (part of phodav project) provides the actual connection to the phodav server running in client as a part of spice-gtk
      • gvfs and gvfs-fuse enable access to the server to normal apps as if it was a local filesystem
      • spice-vdagent is responsible for translating the path in phodav server to the path in the local filesystem (gvfs-fuse) and for setting the actual clipboard data
  • other spice-vdagent-like tools (VirtualBox guest additions, vmware's open-vm-tools) take the approach of copying the files to the guest (and blocking during the transfer operation), the webdav approach has:
    • advantages
      • no need for blocking, the sharing is instantaneous
      • you can edit files stored in client from guest
    • disadvantages
      • it's more prone to errors and data loss, I'd say
        • e.g. if you accidentally close the client while editing a file — perhaps there should be a way of restoring the list of shared files (on the other hand, if you copy the file to the guest, it simply stays there)

Other components are marked as WIP, but it should be in a functioning state (at least partially anyway). If you want to give it a try, add a spice channel with the org.spice-space.webdav.cb.0 name and run spice-webdavd in the guest.

See MRs for the other components for more details:


v2

  • re-use existing webdav channel
    • the phodav server structure now looks the following way:
/
├── {shared-dir}
└── .spice-clipboard
    ├── {uuid1}
    │   └── {shared-file1}
    └── {uuid2}
        └── {shared-file2}

where {shared-dir} corresponds to the SpiceSession's property


v3

  • support cutting, update the comment accordingly
Edited by Jakub Janků

Merge request reports