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

#
# spec file for package openstack-neutron-vsphere
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           openstack-neutron-vsphere
Version:        2.0.1~dev163
Release:        0
Summary:        OVSvApp and DVS VMware vSphere drivers for Neutron
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/networking-vsphere
Source0:        networking-vsphere-stable-rocky.tar.gz
Source1:        openstack-neutron-dvs-agent.service
Source2:        openstack-neutron-ovsvapp-agent.service
Source3:        openstack-neutron-ovsvapp-agent-monitor.service
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 2.0.0
Requires:       python-networking-vsphere = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(preun): systemd
%endif

%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.

%package -n     python-networking-vsphere
Summary:        OVSvApp and DVS Drivers - Python libraries
Group:          Development/Languages/Python
Requires:       python-Babel >= 2.3.4
Requires:       python-neutron
Requires:       python-nova
Requires:       python-oslo.vmware >= 2.17.0
Requires:       python-ovsdbapp >= 0.10.0

%description -n python-networking-vsphere
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}-%{release}

%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}-%{release}
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

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

%package test
Summary:        Testsuite for the OVSvApp VMware
Group:          System/Management
BuildRequires:  python-Babel >= 2.3.4
BuildRequires:  python-kombu
BuildRequires:  python-mock
BuildRequires:  python-neutron
BuildRequires:  python-nova
BuildRequires:  python-oslo.vmware >= 2.17.0
BuildRequires:  python-oslotest
BuildRequires:  python-ovsdbapp >= 0.10.0
BuildRequires:  python-testrepository
BuildRequires:  python-testresources
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools
Requires:       %{name} = %{version}-%{release}
Requires:       python-kombu
Requires:       python-mock
Requires:       python-oslotest
Requires:       python-testrepository
Requires:       python-testresources
Requires:       python-testscenarios
Requires:       python-testtools

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

%prep
%autosetup -p1 -n networking-vsphere-2.0.1.dev163
%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}
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
# 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
# python2 setup.py testr

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

%preun dvs-agent
%systemd_preun openstack-neutron-dvs-agent.service

%postun dvs-agent
%systemd_postun_with_restart openstack-neutron-dvs-agent.service

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

%preun ovsvapp-agent
%systemd_preun openstack-neutron-ovsvapp-agent-monitor.service
%systemd_preun openstack-neutron-ovsvapp-agent.service

%postun ovsvapp-agent
%systemd_postun_with_restart openstack-neutron-ovsvapp-agent-monitor.service
%systemd_postun_with_restart 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
# Patch no longer required in nova stable/newton
%exclude %{_prefix}%{_localstatedir}/tmp/nova.patch
%{_bindir}/ovsvapp-manage-dvpg
%{_bindir}/ovsvapp-manage-dvs

%files -n python-networking-vsphere
%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
%{_bindir}/neutron-dvs-agent

%files ovsvapp-agent
%{_unitdir}/openstack-neutron-ovsvapp-agent.service
%{_unitdir}/openstack-neutron-ovsvapp-agent-monitor.service
%{_bindir}/neutron-ovsvapp-agent
%{_bindir}/neutron-ovsvapp-agent-monitor
%{_bindir}/neutron-ovsvapp-db-manage

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

%files test
%{python2_sitelib}/networking_vsphere/tests

%changelog
openSUSE Build Service is sponsored by