1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Remove python bindings for liblvm2app

This commit is contained in:
David Teigland 2018-06-08 10:33:47 -05:00
parent 669b1295ae
commit ae961a192a
18 changed files with 5 additions and 3681 deletions

View File

@ -28,10 +28,6 @@ ifeq ("@INTL@", "yes")
SUBDIRS += po
endif
ifeq ("@PYTHON_BINDINGS@", "yes")
SUBDIRS += python
endif
ifeq ($(MAKECMDGOALS),clean)
SUBDIRS += test
endif
@ -39,7 +35,7 @@ endif
ifeq ($(MAKECMDGOALS),distclean)
SUBDIRS = conf include man test scripts \
libdaemon lib tools daemons libdm \
udev po python
udev po
tools.distclean: test.distclean
endif
DISTCLEAN_DIRS += lcov_reports*

View File

@ -1788,8 +1788,6 @@ libdm/Makefile
libdm/libdevmapper.pc
man/Makefile
po/Makefile
python/Makefile
python/setup.py
scripts/blkdeactivate.sh
scripts/blk_availability_init_red_hat
scripts/blk_availability_systemd_red_hat.service
@ -1814,8 +1812,6 @@ scripts/lvm2_tmpfiles_red_hat.conf
scripts/lvmdump.sh
scripts/Makefile
test/Makefile
test/api/Makefile
test/api/python_lvm_unit.py
tools/Makefile
udev/Makefile
])

2
python/.gitignore vendored
View File

@ -1,2 +0,0 @@
.liblvm_built
setup.py

View File

@ -1,56 +0,0 @@
#
# Copyright (C) 2011-2016 Red Hat, Inc.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU Lesser General Public License v.2.1.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
TARGETS = .liblvm_built
include $(top_builddir)/make.tmpl
.liblvm_built: liblvm_python.c
ifeq ("@PYTHON2_BINDINGS@", "yes")
$(PYTHON2) setup.py build
endif
ifeq ("@PYTHON3_BINDINGS@", "yes")
$(PYTHON3) setup.py build
endif
touch $@
liblvm_python.c:
$(LN_S) $(srcdir)/liblvm.c $@
install_python_bindings: $(TARGETS)
ifeq ("@PYTHON2_BINDINGS@", "yes")
$(PYTHON2) setup.py install --skip-build --prefix $(pythonprefix)
endif
ifeq ("@PYTHON3_BINDINGS@", "yes")
$(PYTHON3) setup.py install --skip-build --prefix $(pythonprefix)
endif
install_lvm2: install_python_bindings
install: install_lvm2
.PHONY: install_python_bindings
.INTERMEDIATE: liblvm_python.c
clean:
$(RM) -r build
distclean: clean
CLEAN_TARGETS += liblvm_python.c
DISTCLEAN_TARGETS += setup.py

View File

@ -1,120 +0,0 @@
#
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#-----------------------------
# Python example code:
#-----------------------------
import lvm
# Note: This example will create a logical unit, tag it and
# delete it, don't run this on production box!
#Dump information about PV
def print_pv(pv):
print('PV name: ', pv.getName(), ' ID: ', pv.getUuid(), 'Size: ', pv.getSize())
#Dump some information about a specific volume group
def print_vg(vg_name):
#Open read only
vg = lvm.vgOpen(vg_name, 'r')
print('Volume group:', vg_name, 'Size: ', vg.getSize())
#Retrieve a list of Physical volumes for this volume group
pv_list = vg.listPVs()
#Print out the physical volumes
for p in pv_list:
print_pv(p)
#Get a list of logical volumes in this volume group
lv_list = vg.listLVs()
if len(lv_list):
for l in lv_list:
print('LV name: ', l.getName(), ' ID: ', l.getUuid())
else:
print('No logical volumes present!')
vg.close()
#Returns the name of a vg with space available
def find_vg_with_free_space():
free_space = 0
rc = None
vg_names = lvm.listVgNames()
for v in vg_names:
vg = lvm.vgOpen(v, 'r')
c_free = vg.getFreeSize()
if c_free > free_space:
free_space = c_free
rc = v
vg.close()
return rc
#Walk through the volume groups and fine one with space in which we can
#create a new logical volume
def create_delete_logical_volume():
vg_name = find_vg_with_free_space()
print('Using volume group ', vg_name, ' for example')
if vg_name:
vg = lvm.vgOpen(vg_name, 'w')
lv = vg.createLvLinear('python_lvm_ok_to_delete', vg.getFreeSize())
if lv:
print('New lv, id= ', lv.getUuid())
#Create a tag
lv.addTag('Demo_tag')
#Get the tags
tags = lv.getTags()
for t in tags:
#Remove tag
lv.removeTag(t)
lv.deactivate()
#Try to rename
lv.rename("python_lvm_renamed")
print('LV name= ', lv.getName())
lv.remove()
vg.close()
else:
print('No free space available to create demo lv!')
if __name__ == '__main__':
#What version
print('lvm version=', lvm.getVersion())
#Get a list of volume group names
vg_names = lvm.listVgNames()
#For each volume group display some information about each of them
for vg_i in vg_names:
print_vg(vg_i)
#Demo creating a logical volume
create_delete_logical_volume()

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2012-2018 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from distutils.core import setup, Extension
liblvm = Extension('lvm',
sources = ['liblvm_python.c'],
libraries= ['lvm2app', 'devmapper'],
library_dirs= ['@top_builddir@/liblvm', '@top_builddir@/libdm'],
include_dirs= ['@top_builddir@/include', '@top_srcdir@'])
setup (name='lvm',
version=@LVM_VERSION@,
description='Python bindings for liblvm2',
license="LGPLv2+",
maintainer='LVM2 maintainers',
maintainer_email='linux-lvm@redhat.com',
url='http://sourceware.org/lvm2/',
ext_modules=[liblvm],
)

View File

@ -27,7 +27,6 @@ datarootdir = @datarootdir@
LVM_TEST_RESULTS ?= results
SUBDIRS = api
# FIXME: resolve testing of: unit
SOURCES = lib/not.c lib/harness.c
CXXSOURCES = lib/runner.cpp
@ -50,9 +49,9 @@ include $(top_builddir)/make.tmpl
T ?= .
S ?= @ # never match anything by default
VERBOSE ?= 0
ALL := $(shell find -L $(srcdir) \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) | $(SORT))
ALL := $(shell find -L $(srcdir) \( -path \*/shell/\*.sh -or -path \*/unit/\*.sh \) | $(SORT))
comma = ,
RUN := $(shell find -L $(srcdir) -regextype posix-egrep \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
RUN := $(shell find -L $(srcdir) -regextype posix-egrep \( -path \*/shell/\*.sh -or -path \*/unit/\*.sh \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
RUN_BASE = $(subst $(srcdir)/,,$(RUN))
ifeq ("@BUILD_LVMETAD@", "yes")
@ -248,12 +247,10 @@ LIB_SHARED = check aux inittest utils get lvm-wrapper
install: .tests-stamp lib/paths-installed
@echo $(srcdir)
$(INSTALL_DIR) $(DATADIR)/{shell,api,unit,lib,dbus} $(EXECDIR)
$(INSTALL_DIR) $(DATADIR)/{shell,unit,lib,dbus} $(EXECDIR)
$(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
$(INSTALL_DATA) api/*.sh $(DATADIR)/api
$(INSTALL_DATA) unit/*.sh $(DATADIR)/unit
$(INSTALL_DATA) lib/mke2fs.conf $(DATADIR)/lib
$(INSTALL_PROGRAM) api/*.{t,py} $(DATADIR)/api
$(INSTALL_PROGRAM) unit/unit-test $(DATADIR)/unit
$(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
$(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
@ -326,7 +323,7 @@ lib/paths-installed: lib/paths-common
$(RM) $@-t
cat lib/paths-common > $@-t
echo 'installed_testsuite=1' >> $@-t
echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:@datadir@/lvm2-testsuite/api:$$PATH' >> $@-t
echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:$$PATH' >> $@-t
mv $@-t $@
lib/paths: lib/paths-common

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2009-2012 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
TARGETS =
PYTEST = python_lvm_unit.py
include $(top_builddir)/make.tmpl
DEFS += -D_REENTRANT
all:
test -x $(PYTEST) || chmod 755 $(PYTEST)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status test/api/Makefile

View File

@ -1,25 +0,0 @@
#!/bin/sh
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_vg 1
lvcreate -n test -l 5 $vg
aux apitest lvtest $vg
check lv_field $vg/test lv_name test
vgremove -ff $vg

View File

@ -1,23 +0,0 @@
#!/bin/sh
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_devs 2
aux apitest pe_start test_vg $dev1
not vgs test_vg
not pvs $dev1

View File

@ -1,34 +0,0 @@
#!/bin/sh
# Copyright (C) 2010-2013 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux kernel_at_least 2 6 33 || skip
aux prepare_pvs 2
get_devs
vgcreate -s 4k "$vg" "${DEVICES[@]}"
lvcreate -aey -l 5 -n foo $vg
lvcreate -s -n snap $vg/foo -l 3 -c 4k
lvcreate -s -n snap2 $vg/foo -l 6 -c 4k
dd if=/dev/zero of="$DM_DEV_DIR/$vg/snap2" count=1 bs=1024 oflag=direct
# skip test with broken kernel
check lv_field $vg/snap2 data_percent "50.00" || skip
lvcreate -aey --type mirror -m 1 -n mirr $vg -l 1 --mirrorlog core
lvs -a $vg
aux apitest percent $vg
vgremove -ff $vg

View File

@ -1,115 +0,0 @@
#!/bin/bash
# Copyright (C) 2012-2015 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMETAD=1
SKIP_WITH_CLVMD=1
. lib/inittest
aux prepare_dmeventd
#
# TODO:
# lvm2app is not yet capable to respect many lvm.conf options
# since a lot of them is set in /tools/liblvmline
# Until fixed - testing always runs with enabled monitoring
# thus it needs dmeventd
#
# Example of using 'gdb' with python:
# gdb -ex r --args python FULL_PATH/lvm2/test/api/python_lvm_unit.py -v TestLvm.test_lv_active_inactive
#Locate the python binding library to use.
if [[ -n "${abs_top_builddir+varset}" ]]; then
# For python2 look for lvm.so, python3 uses some lengthy names
case "$(head -1 $(which python_lvm_unit.py) )" in
*2) python_lib=($(find "$abs_top_builddir" -name lvm.so)) ;;
*) python_lib=($(find "$abs_top_builddir" -name lvm*gnu.so)) ;;
esac
if [[ ${#python_lib[*]} -ne 1 ]]; then
if [[ ${#python_lib[*]} -gt 1 ]]; then
# Unable to test python bindings if multiple libraries found:
echo "Found left over lvm.so: ${python_lib[*]}"
false
else
# Unable to test python bindings if library not available
skip "lvm2-python-libs not built"
fi
fi
PYTHONPATH=$(dirname "${python_lib[*]}"):${PYTHONPATH-}
export PYTHONPATH
elif rpm -q lvm2-python-libs &>/dev/null; then
true
else
skip "lvm2-python-libs neither built nor installed"
fi
#If you change this change the unit test case too.
aux prepare_pvs 6
#Setup which devices the unit test can use.
PY_UNIT_PVS=$(cat DEVICES)
export PY_UNIT_PVS
#When needed to run 1 single individual python test
#python_lvm_unit.py -v -f TestLvm.test_lv_persistence
#exit
# Run individual tests for shorter error trace
for i in \
lv_persistence \
config_find_bool \
config_override \
config_reload \
dupe_lv_create \
get_set_extend_size \
lv_active_inactive \
lv_property \
lv_rename \
lv_resize \
lv_seg \
lv_size \
lv_snapshot \
lv_suspend \
lv_tags \
percent_to_float \
pv_create \
pv_empty_listing \
pv_getters \
pv_life_cycle \
pv_lookup_from_vg \
pv_property \
pv_resize \
pv_segs \
scan \
version \
vg_from_pv_lookups \
vg_getters \
vg_get_name \
vg_get_set_prop \
vg_get_uuid \
vg_lv_name_validate \
vg_names \
vg_reduce \
vg_remove_restore \
vg_tags \
vg_uuids
do
python_lvm_unit.py -v TestLvm.test_$i
rm -f debug.log_DEBUG*
done
# CHECKME: not for testing?
#python_lvm_unit.py -v TestLvm.test_listing
#python_lvm_unit.py -v TestLvm.test_pv_methods

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +0,0 @@
#!/bin/sh
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
. lib/inittest
aux have_thin 1 0 0 || skip
aux prepare_devs 2
vgcreate -s 64k $vg $(cat DEVICES)
lvcreate -L5M -T $vg/pool
lvcreate -V1M -T $vg/pool -n thin
dd if=/dev/urandom of="$DM_DEV_DIR/$vg/thin" count=2 bs=256K
lvcreate -s $vg/thin -K -n snap
dd if=/dev/urandom of="$DM_DEV_DIR/$vg/snap" count=3 bs=256K
lvs -o+discards $vg
aux apitest thin_percent $vg
vgremove -ff $vg

View File

@ -1,17 +0,0 @@
#!/bin/sh
# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_vg 2
aux apitest vglist $vg "$(get vg_field $vg vg_uuid | sed -e s,-,,g)"

View File

@ -1,23 +0,0 @@
#!/bin/sh
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# tests lvm2app library
#
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_pvs 2
aux apitest vgtest $vg1 "$dev1" "$dev2"

View File

@ -1364,11 +1364,6 @@ prepare_profiles() {
done
}
apitest() {
test -x "$TESTOLDPWD/api/$1.t" || skip
"$TESTOLDPWD/api/$1.t" "${@:2}" && rm -f debug.log strace.log
}
unittest() {
test -x "$TESTOLDPWD/unit/unit-test" || skip
"$TESTOLDPWD/unit/unit-test" "${@}"