Implement pyocf adapter with sample OCF test

PyOCF is a tool written with testing OCF functionality in mind.
It is a Python3 (3.6 version required) package which wraps OCF
by providing Python objects in place of OCF objects (volumes, queues,
etc). Thin layer of translation between OCF objects and PyOCF objects
enables using customized behaviors for OCF primitives by subclassing
PyOCF classes.

This initial version implements only WT and WI modes and single,
synchronously operating Queue.

TO DO:

  - Queues/Cleaner/MetadataUpdater implemented as Python threads
  - Loading of caches from PyOCF Volumes (fix bugs in OCF)
  - Make sure it works multi-threaded for more sophisticated tests

Co-authored-by: Jan Musial <jan.musial@intel.com>
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Michal Rakowski
2019-01-09 12:50:23 +01:00
committed by Jan Musial
parent 794b008127
commit e5227cef89
35 changed files with 2166 additions and 1018 deletions

View File

@@ -5,36 +5,45 @@
PWD=$(shell pwd)
OCFDIR=$(PWD)/../../
ADAPTERDIR=$(PWD)/test_adapter
SRCDIR=$(ADAPTERDIR)/src
INCDIR=$(ADAPTERDIR)/include
ADAPTERDIR=$(PWD)/pyocf
SRCDIR=$(ADAPTERDIR)/ocf/src
INCDIR=$(ADAPTERDIR)/ocf/include
WRAPDIR=$(ADAPTERDIR)/wrappers
CC=gcc
CFLAGS=-g -Wall -I$(INCDIR) -I$(SRCDIR)
LDFLAGS=-pthread
CFLAGS=-g -Wall -I$(INCDIR) -I$(SRCDIR)/ocf/env
LDFLAGS=-pthread -lz
SRC=$(shell find $(SRCDIR) -name \*.c)
SRC=$(shell find $(SRCDIR) $(WRAPDIR) -name \*.c)
OBJS=$(patsubst %.c, %.o, $(SRC))
OCFLIB=libocf.so
OCFLIB=$(ADAPTERDIR)/libocf.so
all: sync $(OBJS) $(OCFLIB)
all: | sync
$(MAKE) $(OCFLIB)
$(OCFLIB): $(OBJS)
$(CC) -shared -o $@ $(CFLAGS) $^ -fPIC $(LDFLAGS)
@echo "Building $@"
@$(CC) -shared -o $@ $(CFLAGS) $^ -fPIC $(LDFLAGS)
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ -fPIC $^ $(LDFLAGS)
@echo "Compiling $@"
@$(CC) -c $(CFLAGS) -o $@ -fPIC $^ $(LDFLAGS)
sync:
$(MAKE) -C $(OCFDIR) inc O=$(ADAPTERDIR)
$(MAKE) -C $(OCFDIR) src O=$(ADAPTERDIR)
@echo "Syncing OCF sources"
@mkdir -p $(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) inc O=$(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) src O=$(ADAPTERDIR)/ocf
@$(MAKE) -C $(OCFDIR) env O=$(ADAPTERDIR)/ocf ENV=posix
clean:
rm -rf $(OCFLIB) $(OBJS)
@rm -rf $(OCFLIB) $(OBJS)
@echo " CLEAN "
distclean:
rm -rf $(OCFLIB) $(OBJS)
rm -rf $(SRCDIR)/ocf
rm -rf $(INCDIR)/ocf
distclean: clean
@rm -rf $(OCFLIB) $(OBJS)
@rm -rf $(SRCDIR)/ocf
@rm -rf $(INCDIR)/ocf
@echo " DISTCLEAN "
.PHONY: all clean
.PHONY: all clean sync distclean