On 21/09/16 19:17, Maxim Nestratov wrote:

      
20 ÓÅÎÔ. 2016 Ç., × 23:52, John Ferlan <jferlan@redhat.com> ÎÁÐÉÓÁÌ(Á):



On 09/15/2016 03:32 AM, Olga Krishtal wrote:
Hi everyone, we would like to propose the first implementation of fspool
with directory backend.

Filesystem pools is a facility to manage filesystems resources similar
to how storage pools manages volume resources. Furthermore new API follows
storage API closely where it makes sense. Uploading/downloading operations
are not defined yet as it is not obvious how to make it properly. I guess
we can use some kind of tar to make a stream from a filesystem. Please share
you thoughts on this particular issue.

So how do you differentiate between with the existing <pool type="fs">
Pool type=fs still provides volumes, i. e. block devices rather than filesystem, though this storage pool can mount file systems resided on a source block device. 

http://libvirt.org/storage.html#StorageBackendFS

Sure the existing fs pool requires/uses a source block device as the
source path and this new variant doesn't require that source but seems
to use some item in order to dictate how to "define" the source on the
fly. Currently only a "DIR" is created - so how does that differ from a
"dir" pool.

Same here, storage "dir" provides files, which are in fact block devices for guests. While filesystem pool "dir" provides guests with file systems. 


I think it'll be confusing to have and differentiate fspool and pool
commands.
Some time ago, we wrote the proposal description and asked for everyone's advice and opinion.
The aim of fspool is to provide filesystems, not volumes. The simplest type of fspool is directory pool and
it do has a lot in common with storage_backend_fs. However,š in the proposal description we said that
the plan is to use other backends:š eg, storage volumes from storage pool as the source of fs, zfs, etc.
šThe final api for fspool will be significantly different, because of the other backends needs.
I didn't dig through all the patches, but from the few I did look at it
seems as though all that's done is to rip out the guts of stuff not
desired from the storage pool driver and replace it with this new code
attributing all the work to the new author/copyright. IOW: Lots of
places where StoragePool appears to be exactly the same as the FSPool.

I think you need to find a different means to do what you want. It's not
100% what the end goal is.I did download/git am the patches and scan a few patches...
 * In patch 2 you've totally missed how to modify libvirt_public.syms
 * In patch 3, the build breaks in "conf/fs_conf" since the "if { if {}
}" aren't done properly in virFSPoolDefFormatBuf.
 * In patch 5 the remote_protocol_structs fails check/syntax-check... I
stopped there in my build each patch test.
According to the guide I have to do:
make checkšandšmake syntax-check for every patch
And it was done.š
At libvirt_public.syms I will look one more time.
John


        
The patchset provides 'dir' backend which simply expose directories in some
directory in host filesystem. The virsh commands are provided too. So it is
ready to play with, just replace 'pool' in xml descriptions and virsh commands
to 'fspool' and 'volume' to 'item'.
Examle and usage:
Define:
virsh -c qemu:///system fspool-define-as fs_pool_name dir --target /path/on/host
Build
virsh -c qemu:///system fspool-build fs_pool_name
Start
virsh -c qemu:///system fspool-start fs_pool_name
Look inside
virsh -c qemu:///system fspool-list (--all) fspool_name

Fspool called POOL, on the host fs uses /fs_driver to hold items.
 virsh -c qemu:///system fspool-dumpxml POOL
 <fspool type='dir'>
   <name>POOL</name>
   <uuid>c57c9d7c-b1d5-4c45-ba9c-67f03d4da160</uuid>
   <capacity unit='bytes'>733722615808</capacity>
   <allocation unit='bytes'>1331486720</allocation>
   <available unit='bytes'>534810800128</available>
   <source>
   </source>
   <target>
     <path>/fs_driver</path>
     <permissions>
       <mode>0755</mode>
       <owner>0</owner>
       <group>0</group>
     </permissions>
   </target>
 </fspool>

virsh -c qemu:///system fspool-info POOL
Name:           POOL
UUID:           c57c9d7c-b1d5-4c45-ba9c-67f03d4da160
State:          running
Persistent:     yes
Autostart:      no autostart
Capacity:       683.33 GiB
Allocation:     1.24 GiB
Available:      498.08 GiB

virsh -c qemu+unix:///system item-list POOL
 Name                 Path
------------------------------------------------------------------------------
item1                /fs_driver/item1
item10               /fs_driver/item10
item11               /fs_driver/item11
item12               /fs_driver/item12
item15               /fs_driver/item15

Fspool of directory type is some directory on host fs that holds items (subdirs).
Example of usage for items:
virsh -c vz+unix:///system item-create-as POOL item1 1g - create item
virsh -c qemu+unix:///system item-dumpxml item1 POOL
<fsitem>
   <name>item1</name>
   <key>/fs_driver/item1</key>
   <source>
   </source>
   <capacity unit='bytes'>0</capacity>
   <allocation unit='bytes'>0</allocation>
   <target>
     <format type='dir'/>
   </target>
 </fsitem>

virsh -c qemu+unix:///system item-info item1 POOL
Name:           item1
Type:           dir
Capacity:       683.33 GiB
Allocation:     634.87 MiB
Autostart:      no autostart
Capacity:       683.33 GiB
Allocation:     1.24 GiB
Available:      498.08 GiB
virsh -c qemu+unix:///system item-list POOL
 Name                 Path
------------------------------------------------------------------------------
 item1                /fs_driver/item1
 item10               /fs_driver/item10
 item11               /fs_driver/item11
 item12               /fs_driver/item12
 item15               /fs_driver/item15

v2:
- renamed Fs to FS
- in configure.ac script macro m4 is used
- updates docs
- created simple tests
- updated virsh.pod
- added information  abot fspool in fotmatfs.html

Olga Krishtal (8):
 fspool: introduce filesystem pools API
 fspool: usual driver based implementation of filesystem pools API
 fspools: configuration and internal representation
 fspools: acl support for filesystem pools
 remote: filesystem pools driver implementation
 fspool: default implementation of filesystem pools
 virsh: filesystem pools commands
 fspools: docs and tests for fspool directory backend

configure.ac                                       |   38 +
daemon/Makefile.am                                 |    4 +
daemon/libvirtd.c                                  |   10 +
daemon/remote.c                                    |   35 +
docs/formatfs.html.in                              |  208 ++
docs/fspool.html.in                                |   41 +
docs/schemas/fsitem.rng                            |   66 +
docs/schemas/fspool.rng                            |   82 +
docs/sitemap.html.in                               |    4 +
include/libvirt/libvirt-fs.h                       |  260 +++
include/libvirt/libvirt.h                          |    1 +
include/libvirt/virterror.h                        |    8 +
m4/virt-driver-fspool.m4                           |   52 +
po/POTFILES.in                                     |    6 +
src/Makefile.am                                    |   46 +
src/access/viraccessdriver.h                       |   12 +
src/access/viraccessdrivernop.c                    |   19 +
src/access/viraccessdriverpolkit.c                 |   47 +
src/access/viraccessdriverstack.c                  |   49 +
src/access/viraccessmanager.c                      |   31 +
src/access/viraccessmanager.h                      |   11 +
src/access/viraccessperm.c                         |   15 +-
src/access/viraccessperm.h                         |  124 ++
src/check-driverimpls.pl                           |    2 +
src/conf/fs_conf.c                                 | 1637 ++++++++++++++++
src/conf/fs_conf.h                                 |  323 +++
src/datatypes.c                                    |  154 ++
src/datatypes.h                                    |   94 +
src/driver-fs.h                                    |  192 ++
src/driver.h                                       |    3 +
src/fs/fs_backend.h                                |  107 +
src/fs/fs_backend_dir.c                            |  355 ++++
src/fs/fs_backend_dir.h                            |    8 +
src/fs/fs_driver.c                                 | 2058 ++++++++++++++++++++
src/fs/fs_driver.h                                 |   10 +
src/libvirt-fs.c                                   | 1556 +++++++++++++++
src/libvirt.c                                      |   28 +
src/libvirt_private.syms                           |   53 +
src/libvirt_public.syms                            |   42 +
src/remote/remote_driver.c                         |   66 +
src/remote/remote_protocol.x                       |  466 ++++-
src/remote_protocol-structs                        |  165 ++
src/rpc/gendispatch.pl                             |   23 +-
src/util/virerror.c                                |   37 +
tests/Makefile.am                                  |   12 +
tests/fsitemxml2xmlin/item.xml                     |   13 +
tests/fsitemxml2xmlout/item.xml                    |   13 +
tests/fsitemxml2xmltest.c                          |  105 +
.../dir-missing-target-path-invalid.xml            |   12 +
tests/fspoolxml2xmlin/fspool-dir.xml               |   16 +
tests/fspoolxml2xmlout/fspool-dir.xml              |   16 +
tests/fspoolxml2xmltest.c                          |   81 +
tools/Makefile.am                                  |    2 +
tools/virsh-fsitem.c                               | 1292 ++++++++++++
tools/virsh-fsitem.h                               |   39 +
tools/virsh-fspool.c                               | 1586 +++++++++++++++
tools/virsh-fspool.h                               |   38 +
tools/virsh.c                                      |    4 +
tools/virsh.h                                      |    9 +
tools/virsh.pod                                    |  252 ++-
60 files changed, 12028 insertions(+), 10 deletions(-)
create mode 100644 docs/formatfs.html.in
create mode 100644 docs/fspool.html.in
create mode 100644 docs/schemas/fsitem.rng
create mode 100644 docs/schemas/fspool.rng
create mode 100644 include/libvirt/libvirt-fs.h
create mode 100644 m4/virt-driver-fspool.m4
create mode 100644 src/conf/fs_conf.c
create mode 100644 src/conf/fs_conf.h
create mode 100644 src/driver-fs.h
create mode 100644 src/fs/fs_backend.h
create mode 100644 src/fs/fs_backend_dir.c
create mode 100644 src/fs/fs_backend_dir.h
create mode 100644 src/fs/fs_driver.c
create mode 100644 src/fs/fs_driver.h
create mode 100644 src/libvirt-fs.c
create mode 100644 tests/fsitemxml2xmlin/item.xml
create mode 100644 tests/fsitemxml2xmlout/item.xml
create mode 100644 tests/fsitemxml2xmltest.c
create mode 100644 tests/fspoolschemadata/dir-missing-target-path-invalid.xml
create mode 100644 tests/fspoolxml2xmlin/fspool-dir.xml
create mode 100644 tests/fspoolxml2xmlout/fspool-dir.xml
create mode 100644 tests/fspoolxml2xmltest.c
create mode 100644 tools/virsh-fsitem.c
create mode 100644 tools/virsh-fsitem.h
create mode 100644 tools/virsh-fspool.c
create mode 100644 tools/virsh-fspool.h