[PATCH] spec: Enable ch driver

Praveen K Paladugu posted 1 patch 1 year, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
libvirt.spec.in | 51 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
[PATCH] spec: Enable ch driver
Posted by Praveen K Paladugu 1 year, 1 month ago
Enabling building and packaging ch driver in the spec file.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
---
 libvirt.spec.in | 51 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 3 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 3d5164b534..303d7cb34a 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -35,6 +35,7 @@
 %define with_lxc           0%{!?_without_lxc:1}
 %define with_libxl         0%{!?_without_libxl:1}
 %define with_vbox          0%{!?_without_vbox:1}
+%define with_ch            0%{!?_without_ch:1}
 
 %ifarch %{arches_qemu_kvm}
     %define with_qemu_kvm      %{with_qemu}
@@ -1026,6 +1027,20 @@ Server side daemon and driver required to manage the virtualization
 capabilities of VirtualBox
     %endif
 
+    %if %{with_ch}
+%package daemon-driver-ch
+Summary: Cloud-Hypervisor driver plugin for libvirtd daemon
+Requires: libvirt-daemon-common = %{version}-%{release}
+Requires: libvirt-daemon-log = %{version}-%{release}
+Requires: libvirt-libs = %{version}-%{release}
+
+%description daemon-driver-ch
+The ch driver plugin for the libvirtd daemon, providing
+an implementation of the hypervisor driver APIs by
+Cloud-Hypervisor
+    %endif
+
+
 %package client
 Summary: Client side utilities of the libvirt library
 Requires: libvirt-libs = %{version}-%{release}
@@ -1188,9 +1203,15 @@ exit 1
 %endif
 
 %if %{with_esx}
-    %define arg_esx -Ddriver_esx=enabled -Dcurl=enabled
+    %define arg_esx -Ddriver_esx=enabled
+%else
+    %define arg_esx -Ddriver_esx=disabled
+%endif
+
+%if %{with_esx} || %{with_ch}
+    %define arg_curl -Dcurl=enabled
 %else
-    %define arg_esx -Ddriver_esx=disabled -Dcurl=disabled
+    %define arg_curl -Dcurl=disabled
 %endif
 
 %if %{with_hyperv}
@@ -1205,6 +1226,12 @@ exit 1
     %define arg_vmware -Ddriver_vmware=disabled
 %endif
 
+%if %{with_ch}
+    %define arg_ch -Ddriver_ch=enabled
+%else
+    %define arg_ch -Ddriver_ch=disabled
+%endif
+
 %if %{with_storage_rbd}
     %define arg_storage_rbd -Dstorage_rbd=enabled
 %else
@@ -1335,11 +1362,12 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
            -Ddriver_remote=enabled \
            -Ddriver_test=enabled \
            %{?arg_esx} \
+           %{?arg_curl} \
            %{?arg_hyperv} \
            %{?arg_vmware} \
+           %{?arg_ch} \
            -Ddriver_vz=disabled \
            -Ddriver_bhyve=disabled \
-           -Ddriver_ch=disabled \
            %{?arg_remote_mode} \
            -Ddriver_interface=enabled \
            -Ddriver_network=enabled \
@@ -1541,6 +1569,10 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl
 rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug
 rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
     %endif
+    %if ! %{with_ch}
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_ch.aug
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_ch.aug
+    %endif
 
 # Copied into libvirt-docs subpackage eventually
 mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
@@ -2405,6 +2437,19 @@ exit 0
 %attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper
     %endif
 
+    %if %{with_ch}
+%files daemon-driver-ch
+%attr(0755, root, root) %{_sbindir}/virtchd
+%config(noreplace) %{_sysconfdir}/libvirt/virtchd.conf
+%{_datadir}/augeas/lenses/virtchd.aug
+%{_datadir}/augeas/lenses/tests/test_virtchd.aug
+%{_unitdir}/virtchd-admin.socket
+%{_unitdir}/virtchd-ro.socket
+%{_unitdir}/virtchd.service
+%{_unitdir}/virtchd.socket
+%{_libdir}/libvirt/connection-driver/libvirt_driver_ch.so
+    %endif
+
 %files client
 %{_mandir}/man1/virsh.1*
 %{_mandir}/man1/virt-xml-validate.1*
-- 
2.47.0
Re: [PATCH] spec: Enable ch driver
Posted by Daniel P. Berrangé 1 year ago
On Fri, Dec 20, 2024 at 03:08:02PM -0600, Praveen K Paladugu wrote:
> Enabling building and packaging ch driver in the spec file.
> 
> Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
> ---
>  libvirt.spec.in | 51 ++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 48 insertions(+), 3 deletions(-)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index 3d5164b534..303d7cb34a 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -35,6 +35,7 @@
>  %define with_lxc           0%{!?_without_lxc:1}
>  %define with_libxl         0%{!?_without_libxl:1}
>  %define with_vbox          0%{!?_without_vbox:1}
> +%define with_ch            0%{!?_without_ch:1}
>  
>  %ifarch %{arches_qemu_kvm}
>      %define with_qemu_kvm      %{with_qemu}
> @@ -1026,6 +1027,20 @@ Server side daemon and driver required to manage the virtualization
>  capabilities of VirtualBox
>      %endif

Higher up against the main libvirt package you'll need

  %if %{with_ch}
  Requires: libvirt-daemon-driver-ch = %{version}-%{release}
  %endif

just look for the place we do this for libvirt-daemon-driver-qemu

TL;DR: 'libvirt' is supposed to depend on all enabled drivers.

>  
> +    %if %{with_ch}
> +%package daemon-driver-ch
> +Summary: Cloud-Hypervisor driver plugin for libvirtd daemon
> +Requires: libvirt-daemon-common = %{version}-%{release}
> +Requires: libvirt-daemon-log = %{version}-%{release}
> +Requires: libvirt-libs = %{version}-%{release}
> +
> +%description daemon-driver-ch
> +The ch driver plugin for the libvirtd daemon, providing
> +an implementation of the hypervisor driver APIs by
> +Cloud-Hypervisor
> +    %endif
> +
> +
>  %package client
>  Summary: Client side utilities of the libvirt library
>  Requires: libvirt-libs = %{version}-%{release}
> @@ -1188,9 +1203,15 @@ exit 1
>  %endif
>  
>  %if %{with_esx}
> -    %define arg_esx -Ddriver_esx=enabled -Dcurl=enabled
> +    %define arg_esx -Ddriver_esx=enabled
> +%else
> +    %define arg_esx -Ddriver_esx=disabled
> +%endif
> +
> +%if %{with_esx} || %{with_ch}
> +    %define arg_curl -Dcurl=enabled
>  %else
> -    %define arg_esx -Ddriver_esx=disabled -Dcurl=disabled
> +    %define arg_curl -Dcurl=disabled
>  %endif
>  
>  %if %{with_hyperv}
> @@ -1205,6 +1226,12 @@ exit 1
>      %define arg_vmware -Ddriver_vmware=disabled
>  %endif
>  
> +%if %{with_ch}
> +    %define arg_ch -Ddriver_ch=enabled
> +%else
> +    %define arg_ch -Ddriver_ch=disabled
> +%endif
> +
>  %if %{with_storage_rbd}
>      %define arg_storage_rbd -Dstorage_rbd=enabled
>  %else
> @@ -1335,11 +1362,12 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
>             -Ddriver_remote=enabled \
>             -Ddriver_test=enabled \
>             %{?arg_esx} \
> +           %{?arg_curl} \
>             %{?arg_hyperv} \
>             %{?arg_vmware} \
> +           %{?arg_ch} \
>             -Ddriver_vz=disabled \
>             -Ddriver_bhyve=disabled \
> -           -Ddriver_ch=disabled \
>             %{?arg_remote_mode} \
>             -Ddriver_interface=enabled \
>             -Ddriver_network=enabled \
> @@ -1541,6 +1569,10 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl
>  rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug
>  rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
>      %endif
> +    %if ! %{with_ch}
> +rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_ch.aug
> +rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_ch.aug
> +    %endif
>  
>  # Copied into libvirt-docs subpackage eventually
>  mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
> @@ -2405,6 +2437,19 @@ exit 0
>  %attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper
>      %endif

IN this gap you'll need

%pre daemon-driver-ch
...
%posttrans daemon-driver-ch
...
%preun daemon-driver-ch
...

to handle setup for the unit files for the CH driver.
Again you can largely just copy what's done with the
QEMU driver systemd rules

>  
> +    %if %{with_ch}
> +%files daemon-driver-ch
> +%attr(0755, root, root) %{_sbindir}/virtchd
> +%config(noreplace) %{_sysconfdir}/libvirt/virtchd.conf
> +%{_datadir}/augeas/lenses/virtchd.aug
> +%{_datadir}/augeas/lenses/tests/test_virtchd.aug
> +%{_unitdir}/virtchd-admin.socket
> +%{_unitdir}/virtchd-ro.socket
> +%{_unitdir}/virtchd.service
> +%{_unitdir}/virtchd.socket
> +%{_libdir}/libvirt/connection-driver/libvirt_driver_ch.so
> +    %endif
> +
>  %files client
>  %{_mandir}/man1/virsh.1*
>  %{_mandir}/man1/virt-xml-validate.1*
> -- 
> 2.47.0
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH] spec: Enable ch driver
Posted by Praveen K Paladugu 1 year ago

On 1/8/2025 9:57 AM, Daniel P. Berrangé wrote:
> On Fri, Dec 20, 2024 at 03:08:02PM -0600, Praveen K Paladugu wrote:
>> Enabling building and packaging ch driver in the spec file.
>>
>> Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
>> ---
>>   libvirt.spec.in | 51 ++++++++++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 48 insertions(+), 3 deletions(-)
>>
>> diff --git a/libvirt.spec.in b/libvirt.spec.in
>> index 3d5164b534..303d7cb34a 100644
>> --- a/libvirt.spec.in
>> +++ b/libvirt.spec.in
>> @@ -35,6 +35,7 @@
>>   %define with_lxc           0%{!?_without_lxc:1}
>>   %define with_libxl         0%{!?_without_libxl:1}
>>   %define with_vbox          0%{!?_without_vbox:1}
>> +%define with_ch            0%{!?_without_ch:1}
>>   
>>   %ifarch %{arches_qemu_kvm}
>>       %define with_qemu_kvm      %{with_qemu}
>> @@ -1026,6 +1027,20 @@ Server side daemon and driver required to manage the virtualization
>>   capabilities of VirtualBox
>>       %endif
> 
> Higher up against the main libvirt package you'll need
> 
>    %if %{with_ch}
>    Requires: libvirt-daemon-driver-ch = %{version}-%{release}
>    %endif
> 
> just look for the place we do this for libvirt-daemon-driver-qemu
> 
> TL;DR: 'libvirt' is supposed to depend on all enabled drivers.
> 
>>   
Fixed in v2

>> +    %if %{with_ch}
>> +%package daemon-driver-ch
>> +Summary: Cloud-Hypervisor driver plugin for libvirtd daemon
>> +Requires: libvirt-daemon-common = %{version}-%{release}
>> +Requires: libvirt-daemon-log = %{version}-%{release}
>> +Requires: libvirt-libs = %{version}-%{release}
>> +
>> +%description daemon-driver-ch
>> +The ch driver plugin for the libvirtd daemon, providing
>> +an implementation of the hypervisor driver APIs by
>> +Cloud-Hypervisor
>> +    %endif
>> +
>> +
>>   %package client
>>   Summary: Client side utilities of the libvirt library
>>   Requires: libvirt-libs = %{version}-%{release}
>> @@ -1188,9 +1203,15 @@ exit 1
>>   %endif
>>   
>>   %if %{with_esx}
>> -    %define arg_esx -Ddriver_esx=enabled -Dcurl=enabled
>> +    %define arg_esx -Ddriver_esx=enabled
>> +%else
>> +    %define arg_esx -Ddriver_esx=disabled
>> +%endif
>> +
>> +%if %{with_esx} || %{with_ch}
>> +    %define arg_curl -Dcurl=enabled
>>   %else
>> -    %define arg_esx -Ddriver_esx=disabled -Dcurl=disabled
>> +    %define arg_curl -Dcurl=disabled
>>   %endif
>>   
>>   %if %{with_hyperv}
>> @@ -1205,6 +1226,12 @@ exit 1
>>       %define arg_vmware -Ddriver_vmware=disabled
>>   %endif
>>   
>> +%if %{with_ch}
>> +    %define arg_ch -Ddriver_ch=enabled
>> +%else
>> +    %define arg_ch -Ddriver_ch=disabled
>> +%endif
>> +
>>   %if %{with_storage_rbd}
>>       %define arg_storage_rbd -Dstorage_rbd=enabled
>>   %else
>> @@ -1335,11 +1362,12 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
>>              -Ddriver_remote=enabled \
>>              -Ddriver_test=enabled \
>>              %{?arg_esx} \
>> +           %{?arg_curl} \
>>              %{?arg_hyperv} \
>>              %{?arg_vmware} \
>> +           %{?arg_ch} \
>>              -Ddriver_vz=disabled \
>>              -Ddriver_bhyve=disabled \
>> -           -Ddriver_ch=disabled \
>>              %{?arg_remote_mode} \
>>              -Ddriver_interface=enabled \
>>              -Ddriver_network=enabled \
>> @@ -1541,6 +1569,10 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl
>>   rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug
>>   rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
>>       %endif
>> +    %if ! %{with_ch}
>> +rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_ch.aug
>> +rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_ch.aug
>> +    %endif
>>   
>>   # Copied into libvirt-docs subpackage eventually
>>   mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
>> @@ -2405,6 +2437,19 @@ exit 0
>>   %attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper
>>       %endif
> 
> IN this gap you'll need
> 
> %pre daemon-driver-ch
> ...
> %posttrans daemon-driver-ch
> ...
> %preun daemon-driver-ch
> ...
> 
> to handle setup for the unit files for the CH driver.
> Again you can largely just copy what's done with the
> QEMU driver systemd rules
> 

Fixed in v2.
>>   
>> +    %if %{with_ch}
>> +%files daemon-driver-ch
>> +%attr(0755, root, root) %{_sbindir}/virtchd
>> +%config(noreplace) %{_sysconfdir}/libvirt/virtchd.conf
>> +%{_datadir}/augeas/lenses/virtchd.aug
>> +%{_datadir}/augeas/lenses/tests/test_virtchd.aug
>> +%{_unitdir}/virtchd-admin.socket
>> +%{_unitdir}/virtchd-ro.socket
>> +%{_unitdir}/virtchd.service
>> +%{_unitdir}/virtchd.socket
>> +%{_libdir}/libvirt/connection-driver/libvirt_driver_ch.so
>> +    %endif
>> +
>>   %files client
>>   %{_mandir}/man1/virsh.1*
>>   %{_mandir}/man1/virt-xml-validate.1*
>> -- 
>> 2.47.0
>>
> 
> With regards,
> Daniel

-- 
Regards,
Praveen K Paladugu