File openstack-neutron-vsphere.spec of Package openstack-neutron-vsphere

#
# spec file for package openstack-neutron-vsphere
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global sname networking-vsphere
%define version_unconverted 2.0.1.dev133

Name:           openstack-neutron-vsphere
Version:        2.0.1~dev133
Release:        0
Summary:        OVSvApp and DVS VMware vSphere drivers for Neutron
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/%{sname}
Source0:        https://tarballs.openstack.org/networking-vsphere/networking-vsphere-stable-pike.tar.gz
Source1:        openstack-neutron-dvs-agent.service
Source2:        openstack-neutron-ovsvapp-agent.service
Source3:        openstack-neutron-ovsvapp-agent-monitor.service
# This patch fixes an import error in the DVS agent. Should be removed
# after the upstream patch is merged in master and backported to stable/pike.
# (https://review.openstack.org/573141)
Patch1:         0001-Fix-agent-model.patch
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 1.6
Requires:       python-%{sname} = %{version}-%{release}
%{?systemd_requires}
BuildArch:      noarch

%description
Neutron ML2 drivers and L2 agents for OVSvApp - a Neutron supported
solution for vSphere deployments in the form of a service VM called
OVSvApp VM which steers the ESX tenant VMs' traffic through it.

System package - %{name}
Python package - python-%{sname}
DVS L2 agent package - %{name}-dvs-agent
OVSvApp agent package - %{name}-ovsvapp-agent

%package -n     python-%{sname}
Summary:        OVSvApp and DVS Drivers - Python libraries
Group:          Development/Languages/Python
Requires:       python-Babel >= 2.3.4
Requires:       python-neutron
Requires:       python-neutron-lib >= 1.9.0
Requires:       python-nova
Requires:       python-oslo.vmware >= 2.17.0
Requires:       python-ovsdbapp >= 0.4.0

%description -n python-%{sname}
The OVSvApp solution comprises of a service VM called OVSvApp VM hosted on each
ESXi hypervisor within a cluster and two vSphere Distributed Switches (VDS).
Two ML2 mechanism drivers are provided for Neutron - one for OVSvApp and
another one for DVS.

This package contains the Python libraries.

%package dvs-agent
Summary:        DVS L2 agent for %{name} plugin
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       openstack-neutron

%description dvs-agent
Contains the DVS L2 agent service for %{name}

%package ovsvapp-agent
Summary:        OVSvApp agents for %{name} plugin
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       openstack-neutron
Requires:       openvswitch

%description ovsvapp-agent
Contains the OVSvApp agent services for %{name}

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML
BuildRequires:  python-Sphinx
BuildRequires:  python-oslosphinx >= 2.5.0

%description doc
This package contains extra documentation for %{name}.

%package test
Summary:        Testsuite for the OVSvApp VMware
Group:          System/Management
BuildRequires:  openstack-neutron-test
BuildRequires:  python-Babel >= 2.3.4
BuildRequires:  python-kombu >= 3.0.25
BuildRequires:  python-mock >= 2.0
BuildRequires:  python-neutron
BuildRequires:  python-nova
BuildRequires:  python-oslo.vmware >= 2.11.0
BuildRequires:  python-oslotest >= 1.10.0
BuildRequires:  python-testrepository >= 0.0.18
BuildRequires:  python-testresources >= 0.2.4
BuildRequires:  python-testscenarios >= 0.4
BuildRequires:  python-testtools >= 1.4.0
Requires:       openstack-neutron-test
Requires:       python-%{sname} = %{version}-%{release}
Requires:       python-kombu >= 4.0.0
Requires:       python-mock >= 2.0
Requires:       python-oslotest >= 1.10.0
Requires:       python-testrepository >= 0.0.18
Requires:       python-testresources >= 0.2.4
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 1.4.0

%description test
The testsuite for the VMware vSphere ML2 drivers for OpenStack Neutron

%prep
%autosetup -p1 -n %{sname}-%{version_unconverted}
%py_req_cleanup

%build
%{py2_build}
python2 setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py2_install}
mv %{buildroot}%{_prefix}%{_sysconfdir} %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-neutron-dvs-agent.service
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/openstack-neutron-ovsvapp-agent.service
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-neutron-ovsvapp-agent-monitor.service
chmod +x %{buildroot}%{python2_sitelib}/networking_vsphere/monitor/ovsvapp-agent-monitor.sh
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcopenstack-neutron-dvs-agent
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcopenstack-neutron-ovsvapp-agent
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcopenstack-neutron-ovsvapp-agent-monitor
# Copy the drivers provided from python-networking-vsphere for
# Nova. Apparently VMWare drivers are out of the Nova tree, and
# maintained outside Nova, so we need to copy the provided driver.
mkdir -p %{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vc_driver.py* \
      %{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vmops.py* \
      %{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
%fdupes %{buildroot}%{python2_sitelib}

## %check
## python setup.py testr

%pre dvs-agent
%service_add_pre openstack-neutron-dvs-agent.service

%post dvs-agent
%service_add_post openstack-neutron-dvs-agent.service

%preun dvs-agent
%stop_on_removal openstack-neutron-dvs-agent.service
%service_del_preun openstack-neutron-dvs-agent.service

%postun dvs-agent
%restart_on_update openstack-neutron-dvs-agent.service
%service_del_postun openstack-neutron-dvs-agent.service

%pre ovsvapp-agent
%service_add_pre openstack-neutron-ovsvapp-agent.service
%service_add_pre openstack-neutron-ovsvapp-agent-monitor.service

%post ovsvapp-agent
%service_add_post openstack-neutron-ovsvapp-agent.service
%service_add_post openstack-neutron-ovsvapp-agent-monitor.service

%preun ovsvapp-agent
%stop_on_removal openstack-neutron-ovsvapp-agent-monitor.service
%stop_on_removal openstack-neutron-ovsvapp-agent.service
%service_del_preun openstack-neutron-ovsvapp-agent-monitor.service
%service_del_preun openstack-neutron-ovsvapp-agent.service

%postun ovsvapp-agent
%restart_on_update openstack-neutron-ovsvapp-agent-monitor.service
%restart_on_update openstack-neutron-ovsvapp-agent.service
%service_del_postun openstack-neutron-ovsvapp-agent-monitor.service
%service_del_postun openstack-neutron-ovsvapp-agent.service

%files
%dir %{_sysconfdir}/neutron
%dir %{_sysconfdir}/neutron/plugins
%dir %{_sysconfdir}/neutron/plugins/ml2
%config(noreplace) %{_sysconfdir}/neutron/ml2_conf_vmware_dvs.ini
%config(noreplace) %{_sysconfdir}/neutron/plugins/ml2/ovsvapp_agent.ini
%{_bindir}/neutron-dvs-agent
%{_bindir}/neutron-ovsvapp-agent
%{_bindir}/neutron-ovsvapp-agent-monitor
%{_bindir}/neutron-ovsvapp-db-manage
%{_bindir}/ovsvapp-manage-dvpg
%{_bindir}/ovsvapp-manage-dvs

# Patch no longer required in nova stable/newton
%exclude %{_prefix}%{_localstatedir}/tmp/nova.patch

%files -n python-%{sname}
%doc README.rst
%license LICENSE
%{python2_sitelib}/networking_vsphere
%{python2_sitelib}/networking_vsphere-*.egg-info
%{python2_sitelib}/nova/virt/vmwareapi/*
# Part of test subpackage
%exclude %{python2_sitelib}/networking_vsphere/tests

%files dvs-agent
%{_unitdir}/openstack-neutron-dvs-agent.service
%{_sbindir}/rcopenstack-neutron-dvs-agent

%files ovsvapp-agent
%{_unitdir}/openstack-neutron-ovsvapp-agent.service
%{_unitdir}/openstack-neutron-ovsvapp-agent-monitor.service
%{_sbindir}/rcopenstack-neutron-ovsvapp-agent
%{_sbindir}/rcopenstack-neutron-ovsvapp-agent-monitor

%files doc
%license LICENSE
%doc doc/build/html

%files test
%{python2_sitelib}/networking_vsphere/tests

%changelog
openSUSE Build Service is sponsored by