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.
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
Makefile.am | 3 ++-
contrib/wok.spec.fedora.in | 2 +-
contrib/wok.spec.suse.in | 2 +-
src/wok/plugins/kimchi/Makefile.am | 2 --
src/wok/plugins/kimchi/config.py.in | 4 ++++
src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in | 1 -
src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in | 1 -
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, 12 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..ff7589d 100644
--- a/contrib/wok.spec.fedora.in
+++ b/contrib/wok.spec.fedora.in
@@ -135,7 +135,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
-* Fri Jun 19 2015 Lucio Correia <luciojhc(a)linux.vnet.ibm.com> 1.6
+* Fri Jun 19 2015 Lucio Correia <luciojhc(a)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..088aa95 100644
--- a/contrib/wok.spec.suse.in
+++ b/contrib/wok.spec.suse.in
@@ -115,7 +115,7 @@ rm -rf $RPM_BUILD_ROOT
%changelog
-* Fri Jun 19 2015 Lucio Correia <luciojhc(a)linux.vnet.ibm.com> 1.6
+* Fri Jun 19 2015 Lucio Correia <luciojhc(a)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
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
$(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..52bd23e 100644
--- a/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
+++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
@@ -103,7 +103,6 @@ rm -rf $RPM_BUILD_ROOT
%{_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..142ff4b 100644
--- a/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
+++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
@@ -90,7 +90,6 @@ rm -rf $RPM_BUILD_ROOT
%{_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 8335552..7316874 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'])
--
1.9.1