[Kimchi-devel] [PATCH V2] Fix issue #738 - Part 2: Split Wok and Kimchi object stores

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Mon Oct 19 18:06:15 UTC 2015


On Mon, 2015-10-19 at 14:46 -0200, Lucio Correia wrote:
> Wok and Kimchi currently share the same object store. This
> patch creates a specific store for Kimchi and uses it as
> default location for Kimchi's model.
> 
> This patch depends on "Fix Kimchi Model V2" just sent, due to
> conflicts.
> 
> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
>  Makefile.am                                          | 3 ++-
>  contrib/wok.spec.fedora.in                           | 3 ++-
>  contrib/wok.spec.suse.in                             | 3 ++-
>  src/wok/plugins/kimchi/Makefile.am                   | 2 --
>  src/wok/plugins/kimchi/config.py.in                  | 4 ++++
>  src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in | 2 +-
>  src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in   | 2 +-
>  src/wok/plugins/kimchi/model/model.py                | 3 ++-
>  src/wok/plugins/kimchi/root.py                       | 1 +
>  src/wok/plugins/kimchi/tests/test_mockmodel.py       | 2 +-
>  10 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 3d3b5d6..430d6bc 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -81,6 +81,7 @@ install-deb: install
>  		cp -R $(top_srcdir)/contrib/wokd-upstart.conf.debian
> \
>  			$(DESTDIR)/etc/init/wokd.conf; \
>  	fi
> +	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/wok/
>  	$(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services
>  	cp -R $(top_srcdir)/src/firewalld.xml \
>  		$(DESTDIR)/usr/lib/firewalld/services/wokd.xml
> @@ -126,7 +127,7 @@ install-data-local:
>  		mkdir -p $(DESTDIR)/etc/init.d/; \
>  		$(INSTALL_DATA) contrib/wokd.sysvinit
> $(DESTDIR)/etc/init.d/wokd; \
>  		chmod +x $(DESTDIR)/etc/init.d/wokd; \
> -    fi; \
> +	fi; \
>  	if test -d /usr/lib/firewalld/services/; then \
>  		mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \
>  		$(INSTALL_DATA) src/firewalld.xml
> $(DESTDIR)/usr/lib/firewalld/services/wokd.xml; \
> diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in
> index 7987fa8..176bf05 100644
> --- a/contrib/wok.spec.fedora.in
> +++ b/contrib/wok.spec.fedora.in
> @@ -122,6 +122,7 @@ rm -rf $RPM_BUILD_ROOT
>  %if 0%{?with_systemd}
>  %{_sysconfdir}/nginx/conf.d/wok.conf
>  %{_sharedstatedir}/wok/
> +%{_sharedstatedir}/wok/objectstore
>  %{_localstatedir}/log/wok/*
>  %{_localstatedir}/log/wok/
>  %{_unitdir}/wokd.service
> @@ -135,7 +136,7 @@ rm -rf $RPM_BUILD_ROOT
>  %endif
> 
>  %changelog
> -* Fri Jun 19 2015 Lucio Correia <luciojhc at linux.vnet.ibm.com> 1.6
> +* Fri Jun 19 2015 Lucio Correia <luciojhc at linux.vnet.ibm.com> 2.0
>  - Rename to wokd
>  - Remove kimchi specifics
> 
> diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in
> index f749b9e..742ac72 100644
> --- a/contrib/wok.spec.suse.in
> +++ b/contrib/wok.spec.suse.in
> @@ -95,6 +95,7 @@ rm -rf $RPM_BUILD_ROOT
>  %{_sysconfdir}/nginx/conf.d/wok.conf.in
>  %{_sysconfdir}/nginx/conf.d/wok.conf
>  %{_var}/lib/wok/
> +%{_var}/lib/wok/objectstore
>  %{_localstatedir}/log/wok/*
>  %{_localstatedir}/log/wok/
>  %{_mandir}/man8/wokd.8.gz
> @@ -115,7 +116,7 @@ rm -rf $RPM_BUILD_ROOT
> 
> 
>  %changelog
> -* Fri Jun 19 2015 Lucio Correia <luciojhc at linux.vnet.ibm.com> 1.6
> +* Fri Jun 19 2015 Lucio Correia <luciojhc at linux.vnet.ibm.com> 2.0
>  - Rename to wokd
>  - Remove kimchi specifics
> 
> diff --git a/src/wok/plugins/kimchi/Makefile.am
> b/src/wok/plugins/kimchi/Makefile.am
> index 47212fe..82c4b19 100644
> --- a/src/wok/plugins/kimchi/Makefile.am
> +++ b/src/wok/plugins/kimchi/Makefile.am
> @@ -99,7 +99,6 @@ config.py: config.py.in Makefile
>  install-deb: install
>  	cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
>  	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi
> -	touch $(DESTDIR)/$(localstatedir)/lib/wok/objectstore

Need let this line on Makefile or the build of DEB will fail. However,
the path must be $(DESTDIR)/$(localstatedir)/lib/kimchi/objectstore

>  	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/vnc-tokens
>  	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
>  	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/screenshots
> @@ -144,7 +143,6 @@ install-data-local:
>  		$(INSTALL_DATA) contrib/kimchid.service.fedora
> $(DESTDIR)/etc/systemd/system/wokd.service.d/kimchi.conf; \
>  	fi; \
>  	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/kimchi/
> -	touch $(DESTDIR)/$(localstatedir)/lib/wok/objectstore

Same here, or RPM creation will fail. Let the line but modify the path.

>  	$(MKDIR_P) $(DESTDIR)$(kimchidir)
>  	$(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json
>  	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/vnc-tokens
> diff --git a/src/wok/plugins/kimchi/config.py.in
> b/src/wok/plugins/kimchi/config.py.in
> index 6ae0ccd..43e94e1 100644
> --- a/src/wok/plugins/kimchi/config.py.in
> +++ b/src/wok/plugins/kimchi/config.py.in
> @@ -42,6 +42,10 @@ def get_debugreports_path():
>      return os.path.join(PluginPaths('kimchi').state_dir,
> 'debugreports')
> 
> 
> +def get_object_store():
> +    return os.path.join(PluginPaths('kimchi').state_dir,
> 'objectstore')
> +
> +
>  def get_screenshot_path():
>      return os.path.join(PluginPaths('kimchi').state_dir,
> 'screenshots')
> 
> diff --git a/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
> b/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
> index e4b7b6d..41a8a86 100644
> --- a/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
> +++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
> @@ -100,10 +100,10 @@ rm -rf $RPM_BUILD_ROOT
>  %{_sysconfdir}/kimchi/
>  %{_sharedstatedir}/kimchi/debugreports/
>  %{_sharedstatedir}/kimchi/isos/
> +%{_sharedstatedir}/kimchi/objectstore
>  %{_sharedstatedir}/kimchi/screenshots/
>  %{_sharedstatedir}/kimchi/vnc-tokens/
>  %{_sharedstatedir}/kimchi/
> -%{_sharedstatedir}/wok/objectstore
> 
> 
>  %changelog
> diff --git a/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
> b/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
> index 03dfa7b..6fbdb3e 100644
> --- a/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
> +++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
> @@ -87,10 +87,10 @@ rm -rf $RPM_BUILD_ROOT
>  %{_sysconfdir}/kimchi/
>  %{_var}/lib/kimchi/debugreports/
>  %{_var}/lib/kimchi/isos/
> +%{_var}/lib/kimchi/objectstore
>  %{_var}/lib/kimchi/screenshots/
>  %{_var}/lib/kimchi/vnc-tokens/
>  %{_var}/lib/kimchi/
> -%{_var}/lib/wok/objectstore
> 
> 
>  %changelog
> diff --git a/src/wok/plugins/kimchi/model/model.py
> b/src/wok/plugins/kimchi/model/model.py
> index 39097c4..95bd7f3 100644
> --- a/src/wok/plugins/kimchi/model/model.py
> +++ b/src/wok/plugins/kimchi/model/model.py
> @@ -22,6 +22,7 @@ import os
> 
>  from wok.basemodel import BaseModel
>  from wok.objectstore import ObjectStore
> +from wok.plugins.kimchi import config
>  from wok.utils import import_module, listPathModules
> 
>  from libvirtconnection import LibvirtConnection
> @@ -41,7 +42,7 @@ class Model(BaseModel):
> 
>              return instances
> 
> -        self.objstore = ObjectStore(objstore_loc)
> +        self.objstore = ObjectStore(objstore_loc or
> config.get_object_store())
>          self.conn = LibvirtConnection(libvirt_uri)
>          kargs = {'objstore': self.objstore, 'conn': self.conn}
>          models = []
> diff --git a/src/wok/plugins/kimchi/root.py
> b/src/wok/plugins/kimchi/root.py
> index 9cbc70f..c59f859 100644
> --- a/src/wok/plugins/kimchi/root.py
> +++ b/src/wok/plugins/kimchi/root.py
> @@ -54,6 +54,7 @@ class KimchiRoot(WokRoot):
>          self.messages = messages
> 
>          make_dirs = [
> +           
>  os.path.dirname(os.path.abspath(config.get_object_store())),
>              os.path.abspath(config.get_distros_store()),
>              os.path.abspath(config.get_debugreports_path()),
>              os.path.abspath(config.get_screenshot_path())
> diff --git a/src/wok/plugins/kimchi/tests/test_mockmodel.py
> b/src/wok/plugins/kimchi/tests/test_mockmodel.py
> index ffbf8d5..2e6b60f 100644
> --- a/src/wok/plugins/kimchi/tests/test_mockmodel.py
> +++ b/src/wok/plugins/kimchi/tests/test_mockmodel.py
> @@ -135,7 +135,7 @@ class MockModelTests(unittest.TestCase):
>          self.assertEquals(get_template_default('old', 'memory'),
>                            info['memory'])
>          self.assertEquals(1, info['cpus'])
> -        self.assertEquals('images/icon-vm.png', info['icon'])
> +        self.assertEquals('plugins/kimchi/images/icon-vm.png',
> info['icon'])
>          self.assertEquals(stats_keys, set(info['stats'].keys()))
>          self.assertEquals('vnc', info['graphics']['type'])
>          self.assertEquals('127.0.0.1', info['graphics']['listen'])




More information about the Kimchi-devel mailing list