From 4bc41aed9d9593dd408b5cffeeaad0961a9050cc Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 2 Dec 2021 01:47:16 +0300 Subject: [PATCH] Add patches for QEMU 6.0 and for 6.0 RPM spec --- patches/qemu-6.0-vitastor.patch | 188 ++++++++++++++++++++++++++++++++ rpm/qemu-kvm-6.0-el8.spec.patch | 103 +++++++++++++++++ 2 files changed, 291 insertions(+) create mode 100644 patches/qemu-6.0-vitastor.patch create mode 100644 rpm/qemu-kvm-6.0-el8.spec.patch diff --git a/patches/qemu-6.0-vitastor.patch b/patches/qemu-6.0-vitastor.patch new file mode 100644 index 00000000..c8c31acf --- /dev/null +++ b/patches/qemu-6.0-vitastor.patch @@ -0,0 +1,188 @@ +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' + } } diff --git a/rpm/qemu-kvm-6.0-el8.spec.patch b/rpm/qemu-kvm-6.0-el8.spec.patch new file mode 100644 index 00000000..9135cff2 --- /dev/null +++ b/rpm/qemu-kvm-6.0-el8.spec.patch @@ -0,0 +1,103 @@ +--- qemu-kvm_6.0.spec.orig 2021-10-22 13:22:07.000000000 +0000 ++++ qemu-kvm_6.0.spec 2021-12-01 22:43:26.095508618 +0000 +@@ -67,6 +67,7 @@ Requires: %{name}-hw-usbredir = %{epoch} + %endif \ + Requires: %{name}-block-iscsi = %{epoch}:%{version}-%{release} \ + Requires: %{name}-block-rbd = %{epoch}:%{version}-%{release} \ ++Requires: %{name}-block-vitastor = %{epoch}:%{version}-%{release}\ + Requires: %{name}-block-ssh = %{epoch}:%{version}-%{release} + + # Macro to properly setup RHEL/RHEV conflict handling +@@ -77,7 +78,7 @@ Obsoletes: %1-rhev <= %{epoch}:%{version + Summary: QEMU is a machine emulator and virtualizer + Name: qemu-kvm + Version: 6.0.0 +-Release: 33%{?dist} ++Release: 33.vitastor%{?dist} + # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped + Epoch: 15 + License: GPLv2 and GPLv2+ and CC-BY +@@ -112,6 +113,7 @@ Source33: qemu-pr-helper.socket + Source34: 81-kvm-rhel.rules + Source35: udev-kvm-check.c + Source36: README.tests ++Source37: qemu-vitastor.c + + + Patch0001: 0001-redhat-Adding-slirp-to-the-exploded-tree.patch +@@ -342,6 +344,7 @@ Patch109: kvm-virtio-balloon-Fix-page-po + Patch110: kvm-virtio-net-fix-use-after-unmap-free-for-sg.patch + # For bz#1999141 - migration fails with: "qemu-kvm: get_pci_config_device: Bad config data: i=0x9a read: 3 device: 2 cmask: ff wmask: 0 w1cmask:0" + Patch111: kvm-Fix-virtio-net-pci-vectors-compat.patch ++Patch112: qemu-6.0-vitastor.patch + + BuildRequires: wget + BuildRequires: rpm-build +@@ -379,6 +382,7 @@ BuildRequires: libcurl-devel + BuildRequires: libssh-devel + BuildRequires: librados-devel + BuildRequires: librbd-devel ++BuildRequires: vitastor-client-devel + %if %{have_gluster} + # For gluster block driver + BuildRequires: glusterfs-api-devel +@@ -625,6 +629,14 @@ Install this package if you want to acce + using the rbd protocol. + + ++%package block-vitastor ++Summary: QEMU Vitastor block driver ++Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} ++ ++%description block-vitastor ++This package provides the additional Vitastor block driver for QEMU. ++ ++ + %package block-ssh + Summary: QEMU SSH block driver + Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} +@@ -678,6 +690,7 @@ This package provides usbredir support. + rm -fr slirp + mkdir slirp + %autopatch -p1 ++cp %{SOURCE37} ./block/vitastor.c + + %global qemu_kvm_build qemu_kvm_build + %global qemu_kiwi_build qemu_kiwi_src/build +@@ -701,7 +714,7 @@ mkdir -p %{qemu_kvm_build} + # --build-id option is used for giving info to the debug packages. + buildldflags="VL_LDFLAGS=-Wl,--build-id" + +-%global block_drivers_list qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle ++%global block_drivers_list qcow2,raw,file,host_device,nbd,iscsi,rbd,vitastor,blkdebug,luks,null-co,nvme,copy-on-read,throttle + + %if 0%{have_gluster} + %global block_drivers_list %{block_drivers_list},gluster +@@ -894,6 +907,7 @@ pushd %{qemu_kvm_build} + %endif + --enable-pie \ + --enable-rbd \ ++ --enable-vitastor \ + %if 0%{have_librdma} + --enable-rdma \ + %endif +@@ -977,9 +991,7 @@ find ../default-configs -name "*-rh-devi + --firmwarepath=%{_prefix}/share/qemu-firmware \ + --meson="%{__meson}" \ + --target-list="%{buildarch}" \ +- --block-drv-rw-whitelist=%{block_drivers_list} \ + --audio-drv-list= \ +- --block-drv-ro-whitelist=vmdk,vhdx,vpc,https,ssh \ + --with-coroutine=ucontext \ + --with-git=git \ + --tls-priority=@QEMU,SYSTEM \ +@@ -1584,6 +1596,9 @@ sh %{_sysconfdir}/sysconfig/modules/kvm. + %files block-rbd + %{_libdir}/qemu-kvm/block-rbd.so + ++%files block-vitastor ++%{_libdir}/qemu-kvm/block-vitastor.so ++ + %files block-ssh + %{_libdir}/qemu-kvm/block-ssh.so +