[Spice-devel] Suggestions for Test-Shared-Folder based on webdav

Cody Chan int64ago at gmail.com
Mon Apr 7 21:41:37 PDT 2014


Thx for Marc-André's patient guidance :)
http://lists.freedesktop.org/archives/spice-devel/2014-February/016256.html
http://www.spinics.net/lists/spice-devel/msg07524.html

Shared Folder is a new feature of spice, need more geeks to  test and patch
Here're suggestions of a quick start to test it.

The preview: http://int64ago-temp.qiniudn.com/preview.png

The environment of my host : Fedora20_x86_64(Clean Install)

[0x01] Preinstall dependences:
$yum -y install git gcc gcc-c++ wget libusb-devel glib-devel autoconf
automake libtool glib2-devel pixman-devel celt051-devel usbredir-devel
 libcacard-devel  libpng-devel zlib-devel libogg-devel alsa-lib-devel
openssl-devel libXrandr-devel libXfixes-devel libjpeg-devel
cyrus-sasl-devel virt-install yajl-devel device-mapper-devel
libpciaccess-devel libnl-devel libxml2-devel python-devel
libfdt-devel python-devel gnulib-devel perl-podlators xhtml1-dtds
gtk+-devel gtk2-devel gtk3-devel intltool openssl-devel
pulseaudio-libs-devel  gobject-introspection-devel libjpeg-turbo-devel
zlib-devel cyrus-sasl-devel gtk-doc libsoup-devel gstreamer-devel
gstreamer-plugins-base-devel perl-CPAN vala-tools vala-devel
gnome-common

Install Text::CSV module for perl:
$perl -MCPAN -e shell
In the shell: install Text::CSV

Install pyparsing module for python:
$easy_install pyparsing

[0x02] Make CA
$mkdir -p /etc/pki/libvirt-spice
$cd /etc/pki/libvirt-spice
$openssl genrsa -des3 -out ca-key.pem 1024
$openssl req -new -x509 -days 1095 -key ca-key.pem -out ca-cert.pem
-utf8 -subj "/C=IL/L=Raanana/O=Red Hat/CN=my CA"
$openssl genrsa -out server-key.pem 1024
$openssl req -new -key server-key.pem -out server-key.csr -utf8 -subj
"/C=IL/L=Raanana/O=Red Hat/CN=my server"
$openssl x509 -req -days 1095 -in server-key.csr -CA ca-cert.pem
-CAkey ca-key.pem -set_serial 01 -out server-cert.pem
$openssl rsa -in server-key.pem -out server-key.pem.insecure
$mv server-key.pem server-key.pem.secure
$mv server-key.pem.insecure server-key.pem
$cp ca-cert.pem /etc/pki/CA/cacert.pem
$mkdir -p /etc/pki/libvirt/private
$cp server-cert.pem /etc/pki/libvirt/servercert.pem
$cp server-key.pem /etc/pki/libvirt/private/serverkey.pem

[0x03] NetWork(Not Necessary)
$cd /etc/sysconfig/network-scripts
$cat ifcfg-br0
TYPE=Bridge
NM_CONTROLLED="no"
BOOTPROTO=dhcp
DEVICE="br0"
ONBOOT=yes
$cat ifcfg-p33p1(Depends)
TYPE="Ethernet"
BRIDGE="br0"
DEVICE="p33p1"
ONBOOT="yes"
NM_CONTROLLED="no"

[0x04] Build from upstream
The followings from git upstream:
spice-protocol, spice, qemu, libvirt-python, libvirt, phodav, spice-gtk

spice-protocol:
$./autogen.sh
$make
$make install
$cp /usr/local/share/pkgconfig/spice-protocol.pc /usr/share/pkgconfig/

spice:
$./autogen.sh --enable-smartcard
$make
$make install
$cp /usr/local/lib/pkgconfig/spice-server.pc /usr/share/pkgconfig/
$ln -sf /usr/local/lib/libspice-server.so.1.8.0 /lib64/libspice-server.so.1

qemu:
$./configure --target-list=x86_64-softmmu --enable-spice
--enable-usb-redir --enable-vhost-net --enable-kvm --enable-vnc
$make
$make install
$ln -sf /usr/local/bin/qemu-system-x86_64 /usr/bin/qemu-kvm

libvirt:
$./autogen.sh --system
$make
$make install
if fail when do "virsh --version" and get error message about "not
found libvirt-sock",
find libvirt-sock and link to /var/run/libvirt/libvirt-sock
$ln -sf /path/of/libvirt-sock  /var/run/libvirt/libvirt-sock

libvirt-python:
python setup.py install

phodav:
$./autogen.sh
$make
$make install

spice-gtk:
$./autogen.sh
make sure phodav flag is 'yes' after autogen.sh:
PhoDAV:                   yes
$make
$make install

[0x05] Create Guest
a)for windows guest(Depends):
$virt-install --connect qemu:///system -n vm_win7 -r 1024 --vcpus=1
--disk path=/var/lib/libvirt/images/vm_win7.img,size=15 -c ./win7.iso
--graphics spice,port=5930,listen=0.0.0.0 --noautoconsole --os-type
windows --accelerate --network=bridge:br0 --hvm
After installation:
$virsh destroy vm_win7
$virsh edit vm_win7
add the following section in <devices>...</devices>:
<channel type='spiceport'>
        <source channel='org.spice-space.webdav.0'/>
        <target type='virtio' name='org.spice-space.webdav.0'/>
</channel>
$spicy -h xxxx -p xxx --spice-shared-dir=/path/you/want/to/share
Install http://elmarco.fedorapeople.org/spice-webdavd-x86-0.1.24.msi for guest
And run map-drive.bat from Program Files/Spice webdav/

b)for linux guest(Depends):
It's similar with windows guest, but you should build webdav-agent by yourself:
git clone phodav from upstream
$yum -y install gnome-common  gcc gcc-c++ automake autoconf libtool
intltool gtk-doc glib2-devel libsoup-devel libxml-devel
$./autogen.sh
$make
$make install
After these:
$spice-webdavd -p 8000


After a) and b), you will see shared folder in nautilus network places

Enjoy and test


More information about the Spice-devel mailing list