diff --git a/block/meson.build b/block/meson.build index d21990ec95..385ac37732 100644 --- a/block/meson.build +++ b/block/meson.build @@ -78,6 +78,7 @@ foreach m : [ [libnfs, 'nfs', libnfs, 'nfs.c'], [libssh, 'ssh', libssh, 'ssh.c'], [rbd, 'rbd', rbd, 'rbd.c'], + [vitastor, 'vitastor', vitastor, 'vitastor.c'], ] if m[0].found() if enable_modules diff --git a/configure b/configure index c77f7b1020..5f534e8484 100755 --- a/configure +++ b/configure @@ -389,6 +389,7 @@ trace_backends="log" trace_file="trace" spice="$default_feature" rbd="auto" +vitastor="auto" smartcard="$default_feature" u2f="auto" libusb="$default_feature" @@ -1280,6 +1281,10 @@ for opt do ;; --enable-rbd) rbd="enabled" ;; + --disable-vitastor) vitastor="disabled" + ;; + --enable-vitastor) vitastor="enabled" + ;; --disable-xfsctl) xfs="no" ;; --enable-xfsctl) xfs="yes" @@ -1867,6 +1872,7 @@ disabled with --disable-FEATURE, default is enabled if available vhost-vdpa vhost-vdpa kernel backend support spice spice rbd rados block device (rbd) + vitastor vitastor block device libiscsi iscsi support libnfs nfs support smartcard smartcard support (libcacard) @@ -6423,7 +6429,7 @@ NINJA=$ninja $meson setup \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ - -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \ + -Drbd=$rbd -Dvitastor=$vitastor -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \ -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ -Dattr=$attr -Ddefault_devices=$default_devices \ -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ diff --git a/meson.build b/meson.build index c6f4b0cf5e..3dc7f7b463 100644 --- a/meson.build +++ b/meson.build @@ -720,6 +720,26 @@ if not get_option('rbd').auto() or have_block endif endif +vitastor = not_found +if not get_option('vitastor').auto() or have_block + libvitastor_client = cc.find_library('vitastor_client', has_headers: ['vitastor_c.h'], + required: get_option('vitastor'), kwargs: static_kwargs) + if libvitastor_client.found() + if cc.links(''' + #include + int main(void) { + vitastor_c_create_qemu(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + return 0; + }''', dependencies: libvitastor_client) + vitastor = declare_dependency(dependencies: libvitastor_client) + elif get_option('vitastor').enabled() + error('could not link libvitastor_client') + else + warning('could not link libvitastor_client, disabling') + endif + endif +endif + glusterfs = not_found glusterfs_ftruncate_has_stat = false glusterfs_iocb_has_stat = false @@ -1118,6 +1138,7 @@ config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) config_host_data.set('CONFIG_LIBNFS', libnfs.found()) config_host_data.set('CONFIG_RBD', rbd.found()) +config_host_data.set('CONFIG_VITASTOR', vitastor.found()) config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('CONFIG_SECCOMP', seccomp.found()) @@ -2683,6 +2704,7 @@ summary_info += {'libcap-ng support': libcap_ng.found()} # TODO: add back protocol and server version summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} summary_info += {'rbd support': rbd.found()} +summary_info += {'vitastor support': vitastor.found()} summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} summary_info += {'U2F support': u2f.found()} diff --git a/meson_options.txt b/meson_options.txt index 9734019995..bc93963b27 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -80,6 +80,8 @@ option('lzo', type : 'feature', value : 'auto', description: 'lzo compression support') option('rbd', type : 'feature', value : 'auto', description: 'Ceph block device driver') +option('vitastor', type : 'feature', value : 'auto', + description: 'Vitastor block device driver') option('gtk', type : 'feature', value : 'auto', description: 'GTK+ user interface') option('sdl', type : 'feature', value : 'auto', diff --git a/qapi/block-core.json b/qapi/block-core.json index 6d227924d0..d14b29aa43 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2819,7 +2819,7 @@ 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, 'sheepdog', - 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } + 'ssh', 'throttle', 'vdi', 'vhdx', 'vitastor', 'vmdk', 'vpc', 'vvfat' ] } ## # @BlockdevOptionsFile: @@ -3671,6 +3671,28 @@ '*snap-id': 'uint32', '*tag': 'str' } } +## +# @BlockdevOptionsVitastor: +# +# Driver specific block device options for vitastor +# +# @image: Image name +# @inode: Inode number +# @pool: Pool ID +# @size: Desired image size in bytes +# @config-path: Path to Vitastor configuration +# @etcd-host: etcd connection address(es) +# @etcd-prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', + 'data': { '*inode': 'uint64', + '*pool': 'uint64', + '*size': 'uint64', + '*image': 'str', + '*config-path': 'str', + '*etcd-host': 'str', + '*etcd-prefix': 'str' } } + ## # @ReplicationMode: # @@ -4042,6 +4064,7 @@ 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', 'vhdx': 'BlockdevOptionsGenericFormat', + 'vitastor': 'BlockdevOptionsVitastor', 'vmdk': 'BlockdevOptionsGenericCOWFormat', 'vpc': 'BlockdevOptionsGenericFormat', 'vvfat': 'BlockdevOptionsVVFAT' @@ -4426,6 +4449,17 @@ 'size': 'size', '*cluster-size' : 'size' } } +## +# @BlockdevCreateOptionsVitastor: +# +# Driver specific image creation options for Vitastor. +# +# @size: Size of the virtual disk in bytes +## +{ 'struct': 'BlockdevCreateOptionsVitastor', + 'data': { 'location': 'BlockdevOptionsVitastor', + 'size': 'size' } } + ## # @BlockdevVmdkSubformat: # @@ -4691,6 +4725,7 @@ 'ssh': 'BlockdevCreateOptionsSsh', 'vdi': 'BlockdevCreateOptionsVdi', 'vhdx': 'BlockdevCreateOptionsVhdx', + 'vitastor': 'BlockdevCreateOptionsVitastor', 'vmdk': 'BlockdevCreateOptionsVmdk', 'vpc': 'BlockdevCreateOptionsVpc' } }