[libvirt] [PATCH] virfile: Detect ceph as shared FS

Michal Privoznik mprivozn at redhat.com
Mon Jan 28 14:08:06 UTC 2019


On 1/28/19 2:30 PM, Erik Skultety wrote:
> On Fri, Jan 25, 2019 at 04:35:42PM +0100, Michal Privoznik wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1665553
>>
>> Ceph can be mounted just like any other filesystem and in fact is
>> a shared and cluster filesystem.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>   src/util/virfile.c            | 9 ++++++++-
>>   src/util/virfile.h            | 1 +
>>   src/util/virstoragefile.c     | 3 ++-
>>   tests/virfiledata/mounts3.txt | 2 ++
>>   tests/virfilemock.c           | 5 +++++
>>   tests/virfiletest.c           | 1 +
>>   6 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/util/virfile.c b/src/util/virfile.c
>> index 263c92667c..271bf5e796 100644
>> --- a/src/util/virfile.c
>> +++ b/src/util/virfile.c
>> @@ -3465,6 +3465,9 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
>>   # ifndef FUSE_SUPER_MAGIC
>>   #  define FUSE_SUPER_MAGIC 0x65735546
>>   # endif
>> +# ifndef CEPH_SUPER_MAGIC
>> +#  define CEPH_SUPER_MAGIC 0x00C36400
> 
> So, this truly is magic, as it's not exported from anywhere and it's hardcoded
> in the kernel sources you showed me, so maybe a small comment into the commit
> message where it comes from so that I won't have to ask you next time :P.

Okay.

> 
> I'll try to cook up a kernel patch against magic.h
> 

Problem is that magic.h is not automatically generated. At least the 
part that contains the list of filesystems. There is plenty missing.

>> diff --git a/tests/virfiledata/mounts3.txt b/tests/virfiledata/mounts3.txt
>> index 134c6e8f81..68eded048c 100644
>> --- a/tests/virfiledata/mounts3.txt
>> +++ b/tests/virfiledata/mounts3.txt
>> @@ -33,3 +33,5 @@ host:/nfs /nfs nfs4 rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,
>>   dev /nfs/blah devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=4093060,mode=755 0 0
>>   host:/gv0 /gluster fuse.glusterfs rw 0 0
>>   root at host:/tmp/mkdir /gluster/sshfs fuse.sshfs rw 0 0
>> +192.168.0.1:/ceph/data /ceph ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
>> +192.168.0.1,192.168.0.2,192.168.0.3:/ceph/data2 /ceph/multi ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
> 
> Are all of ^these addresses needed for the purposes of the test, wouldn't 1 be
> enough? Just curious.

Actually, I forgot to add the second test case:

DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/ceph/multi/file", true);

> Reviewed-by: Erik Skultety <eskultet at redhat.com>

Pushed, thanks.

Michal




More information about the libvir-list mailing list