gnome-boxes: Introducing shared folders

In this blog post I’ll talk a little about the motivation behind shared folders in gnome-boxes and the challenges encountered while implementing it. I will also make sure to post a few UI pictures, alongside a very short guide for those of you eager to test this fresh out of the oven feature.

1. Motivation

Being able to share a directory between the host machine and a guest machine is, needless to say, a very convenient way of accessing files from one another. Thanks to the SPICE developers, an API is available which is capable of doing just that. (the only conditions are that the guest machine must have a  SPICE display and the spice-webdavd service installed). Considering this, the decision of further implementing shared folders in gnome-boxes is certainly not one to think about twice.

    2. Challenges

The first challenge was to implement *multiple* shared folders, considering that the underlying library only supports a *single* shared folder. After many discussions, we followed Marc-Andre Lureau’s suggestion of simply creating symlinks for every shared folder inside a config directory, which is the one eventually shared trough SPICE.

The second challenge was assuring the persistence of shared folders. Once the user has shared a directory, it must remain shared even after restarting the guest machine, GNOME-Boxes or the host machine. Following Felipe Borges’s suggestion, I used Gsettings and Variants, which is a great way of accomplishing tasks like this.

3. Short guide and UI pictures

Since this feature is meant to be as out-of-the-box as possible, the guide is more of a demonstration rather than a tutorial. Enjoy!

 

  • 1st step: Install the spice-webdavd service in the guest machine.

spice-webdavd for Windows

spice-webdavd for Linux

The Linux version can also be installed from the official repositories.

 

  • 2nd step: Play with the new Properties ->  ‘Devices & Shares’ section, in GNOME-Boxes.

Make use of the newly added UI in order to choose which folders belonging to the host machine need to be shared with the guest machine.

Note: if no shared folders are selected, the Public folder is shared by default.

Screenshot from 2017-06-15 13-20-06

  • 3rd step: Access the shared folders from inside the guest machine

Screenshot from 2017-06-15 16-06-15

In case the “Spice client folder” device doesn’t show up at first, make sure to refresh the file manager.

  • 4th step: Have some fun !

Screenshot from 2017-06-15 16-11-21

 

 

A big thank you to everybody who has helped me implement this feature: Zeeshan Ali, Felipe Borges, Victor Toso, Fabiano Fidencio and Cristophe Fergeau

Advertisements

10 thoughts on “gnome-boxes: Introducing shared folders

  1. spice-webdavd has never worked reliably on windows, at least for me (it would crash immediately while starting the service), and last I checked it hadn’t seen any updates in a long time; was it updated recently to fix the crash?
    Otherwise you can’t really claim the feature, if windows support is not there.

    Like

    1. Giovani, which windows and spice-webdavd are you using?

      I remember Lukáš did some work on webdav while I was still working on SPICE and it used to work (at that time).

      Maybe you re hitting https://bugzilla.gnome.org/show_bug.cgi?id=781979 … would you mind confirming this (in the bugzilla) or open a new bug in case you’re seeing something different?

      Buona Giornata!

      Like

  2. My gnome-boxes (3.24.0, with libvirt 3.2.1 and spice-webdavd 2.1) does not show the “Folder Sharing” section in the properties page. Am I doing something wrong?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s