[PATCH v2] Support Linux Bridge creation
by Ramon Medeiros
Create linux-bridge with libvirt API. Kimchi was only creating macvtap
devices, with has some limitation. For further information, take a look
at Kimchi wiki discuss:
https://github.com/kimchi-project/kimchi/wiki/Create-guest-network
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
Changes:
v2:
Remove unused imports and constants
Fix pep8 issues
Testing:
In my case, i create a new bridge over the interface enp0s25 with name ramon
curl -u root -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8010/plugins/kimchi/networks" -X POST -d '{"name": "ramon", "connection":"bridge", "interface":"enp0s25", "mode":"linux-bridge"}'
To delete, you can remove by UI or:
curl -u root -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8010/plugins/kimchi/networks/ramon" -X DELETE -d ''
---
src/wok/plugins/kimchi/model/networks.py | 35 ++++++++++++++++++++++++++++--
src/wok/plugins/kimchi/network.py | 19 ++++++++++++++++
src/wok/plugins/kimchi/xmlutils/network.py | 12 ++++++++++
3 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/src/wok/plugins/kimchi/model/networks.py b/src/wok/plugins/kimchi/model/networks.py
index 71ea595..c17a3bf 100644
--- a/src/wok/plugins/kimchi/model/networks.py
+++ b/src/wok/plugins/kimchi/model/networks.py
@@ -30,12 +30,13 @@ from wok.rollbackcontext import RollbackContext
from wok.utils import run_command, wok_log
from wok.xmlutils.utils import xpath_get_text
+
from wok.plugins.kimchi import netinfo
from wok.plugins.kimchi import network as knetwork
from wok.plugins.kimchi.osinfo import defaults as tmpl_defaults
from wok.plugins.kimchi.xmlutils.network import create_vlan_tagged_bridge_xml
from wok.plugins.kimchi.xmlutils.network import to_network_xml
-
+from wok.plugins.kimchi.xmlutils.network import create_linux_bridge
KIMCHI_BRIDGE_PREFIX = 'kb'
@@ -160,7 +161,10 @@ class NetworksModel(object):
def _set_network_bridge(self, params):
try:
iface = params['interface']
- if iface in self.get_all_networks_interfaces():
+
+ if params["mode"] == "linux-bridge":
+ iface = self._create_linux_bridge(iface)
+ elif iface in self.get_all_networks_interfaces():
msg_args = {'iface': iface, 'network': params['name']}
raise InvalidParameter("KCHNET0006E", msg_args)
except KeyError:
@@ -196,6 +200,33 @@ class NetworksModel(object):
net_dict['bridge'] and interfaces.append(net_dict['bridge'])
return interfaces
+ def _create_linux_bridge(self, interface):
+ newBridge = KIMCHI_BRIDGE_PREFIX + interface[-8:]
+ bridges_list = knetwork.list_bridges()
+
+ bridges = []
+ for bridge in bridges_list:
+ bridges.append(bridge["bridge"])
+
+ # bridge already exists: create new name
+ if newBridge in bridges:
+ for i in range(0, 10):
+ newBridge = KIMCHI_BRIDGE_PREFIX + interface[-7:] + str(i)
+ if newBridge not in bridges:
+ break
+
+ # create linux bridge by libvirt
+ try:
+ conn = self.conn.get()
+ iface = conn.interfaceDefineXML(create_linux_bridge(newBridge,
+ interface))
+ iface.create()
+ except libvirt.libvirtError as e:
+ raise OperationFailed("KCHNET0008E",
+ {'name': newBridge,
+ 'err': e.get_error_message()})
+ return newBridge
+
def _create_vlan_tagged_bridge(self, interface, vlan_id):
# Truncate the interface name if it exceeds 8 characters to make sure
# the length of bridge name is less than 15 (its maximum value).
diff --git a/src/wok/plugins/kimchi/network.py b/src/wok/plugins/kimchi/network.py
index 1433b8a..18df281 100644
--- a/src/wok/plugins/kimchi/network.py
+++ b/src/wok/plugins/kimchi/network.py
@@ -21,6 +21,7 @@
import ethtool
import ipaddr
+from wok.utils import run_command
APrivateNets = ipaddr.IPNetwork("10.0.0.0/8")
BPrivateNets = ipaddr.IPNetwork("172.16.0.0/12")
@@ -60,3 +61,21 @@ def get_one_free_network(used_nets, nets_pool=PrivateNets):
if net:
return net
return None
+
+def list_bridges():
+ # get all bridges
+ _, err, rc = run_command(['brctl', 'show'])
+ output = _.splitlines()
+
+ # iterate over output
+ i = 1
+ bridges = []
+ while (i < len(output)):
+
+ # get bridge name
+ bridges.append({"bridge": output[i].split('\t')[0],
+ "interface": output[i].split('\t')[5]})
+ i += 1
+
+ return bridges
+
diff --git a/src/wok/plugins/kimchi/xmlutils/network.py b/src/wok/plugins/kimchi/xmlutils/network.py
index c73aad9..2fdf8d4 100644
--- a/src/wok/plugins/kimchi/xmlutils/network.py
+++ b/src/wok/plugins/kimchi/xmlutils/network.py
@@ -120,3 +120,15 @@ def create_vlan_tagged_bridge_xml(bridge, interface, vlan_id):
type='bridge',
name=bridge)
return ET.tostring(m)
+
+def create_linux_bridge(bridge, interface):
+ m = E.interface(
+ E.start(mode='onboot'),
+ E.bridge(
+ E.interface(
+ type='ethernet',
+ name=interface)),
+ type='bridge',
+ name=bridge)
+ return ET.tostring(m)
+
--
2.1.0
9 years, 1 month
[PATCH 0/2 v3] Fix Issues #743 and #744
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
Fix Issue #744 - gingerbase: objectstore issues
plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue 'unable to open database file' and gingerbase.py
Fix Issue #743 - gingerbase: fail to create RPM.
In files gingerbase.spec.fedora.in and gignerbase.spec.suse.in and make-deb.sh.in
add setup instruction
correct the file section
day correction
Name changed from gingerbase to ginger-base
Added files ChangeLog and CONTRIBUTE.md
VERSION changed to 2.0.0
Review Comments taken care.
chandrureddy (2):
Plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue 'unable to open database file' in root.py and
gingerbase.py
In files gingerbase.spec.fedora.in and gignerbase.spec.suse.in and
make-deb.sh.in add setup instruction correct the file
section day correction Name changed from gingerbase to
ginger-base
src/wok/plugins/gingerbase/CONTRIBUTE.md | 19 +++++++++++++
src/wok/plugins/gingerbase/ChangeLog | 31 ++++++++++++++++++++++
src/wok/plugins/gingerbase/Makefile.am | 18 +++++++------
src/wok/plugins/gingerbase/VERSION | 2 +-
src/wok/plugins/gingerbase/config.py.in | 6 ++---
.../gingerbase/contrib/gingerbase.spec.fedora.in | 24 ++++++-----------
.../gingerbase/contrib/gingerbase.spec.suse.in | 28 +++++++++----------
src/wok/plugins/gingerbase/contrib/make-deb.sh.in | 2 +-
src/wok/plugins/gingerbase/gingerbase.conf | 2 +-
src/wok/plugins/gingerbase/gingerbase.py | 16 +++++------
10 files changed, 94 insertions(+), 54 deletions(-)
create mode 100644 src/wok/plugins/gingerbase/CONTRIBUTE.md
create mode 100644 src/wok/plugins/gingerbase/ChangeLog
--
2.1.0
9 years, 1 month
[PATCH 0/2 v2] Fix Issues #743 and #744
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
Fix Issue #744 - gingerbase: objectstore issues
plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue 'unable to open database file' and gingerbase.py
Fix Issue #743 - gingerbase: fail to create RPM.
In files gingerbase.spec.fedora.in and gignerbase.spec.suse.in and make-deb.sh.in
add setup instruction
correct the file section
day correction
Name changed from gingerbase to ginger-base
Added files ChangeLog and CONTRIBUTE.md
VERSION changed to 2.0.0
Review Comments taken care.
chandrureddy (2):
Plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue 'unable to open database file' in gingerbase.py
In files gingerbase.spec.fedora.in and gignerbase.spec.suse.in and
make-deb.sh.in add setup instruction correct the file
section day correction Name changed from gingerbase to
ginger-base
src/wok/plugins/gingerbase/CONTRIBUTE.md | 19 +++++++++++++
src/wok/plugins/gingerbase/ChangeLog | 31 ++++++++++++++++++++++
src/wok/plugins/gingerbase/Makefile.am | 18 +++++++------
src/wok/plugins/gingerbase/VERSION | 2 +-
src/wok/plugins/gingerbase/config.py.in | 6 ++---
.../gingerbase/contrib/gingerbase.spec.fedora.in | 26 +++++++-----------
.../gingerbase/contrib/gingerbase.spec.suse.in | 30 ++++++++++-----------
src/wok/plugins/gingerbase/contrib/make-deb.sh.in | 2 +-
src/wok/plugins/gingerbase/gingerbase.conf | 2 +-
src/wok/plugins/gingerbase/gingerbase.py | 16 +++++------
10 files changed, 98 insertions(+), 54 deletions(-)
create mode 100644 src/wok/plugins/gingerbase/CONTRIBUTE.md
create mode 100644 src/wok/plugins/gingerbase/ChangeLog
--
2.1.0
9 years, 1 month
[PATCH] Bug fix: Update Kimchi URL while checking ISO stream support
by Aline Manera
Using the wrong URL was blocking user to create Template using remote ISO files.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/model/featuretests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wok/plugins/kimchi/model/featuretests.py b/src/wok/plugins/kimchi/model/featuretests.py
index 7c4e9ce..b889006 100644
--- a/src/wok/plugins/kimchi/model/featuretests.py
+++ b/src/wok/plugins/kimchi/model/featuretests.py
@@ -162,7 +162,7 @@ class FeatureTests(object):
def qemu_supports_iso_stream():
host = cherrypy.server.socket_host
port = cherrypy.server.socket_port
- cmd = "qemu-io -r http://%s:%d/images/icon-fedora.png \
+ cmd = "qemu-io -r http://%s:%d/plugins/kimchi/images/icon-fedora.png \
-c 'read -v 0 512'" % (host, port)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
--
2.1.0
9 years, 1 month
[PATCH] Fix issue 'unable to open database file' when run 'sudo src/wokd --environment=dev'
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/root.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/wok/plugins/kimchi/root.py b/src/wok/plugins/kimchi/root.py
index 44452b4..37da8b3 100644
--- a/src/wok/plugins/kimchi/root.py
+++ b/src/wok/plugins/kimchi/root.py
@@ -30,6 +30,15 @@ from wok.root import WokRoot
class KimchiRoot(WokRoot):
def __init__(self, wok_options):
+ make_dirs = [
+ os.path.dirname(os.path.abspath(config.get_object_store())),
+ os.path.abspath(config.get_distros_store()),
+ os.path.abspath(config.get_screenshot_path())
+ ]
+ for directory in make_dirs:
+ if not os.path.isdir(directory):
+ os.makedirs(directory)
+
if hasattr(wok_options, "model"):
self.model = wok_options.model
elif wok_options.test:
@@ -53,14 +62,5 @@ class KimchiRoot(WokRoot):
self.domain = 'kimchi'
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_screenshot_path())
- ]
- for directory in make_dirs:
- if not os.path.isdir(directory):
- os.makedirs(directory)
-
def get_custom_conf(self):
return config.KimchiConfig()
--
2.1.0
9 years, 1 month
[PATCH 0/3 v2] Live migration backend
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
Changes in v2:
- changes asked by pvital: verifying host name properly, break line in
docs/API.md, changed the format of i18n messages.
- one of the existing tests was enhanced to support the local host
verification properly.
----
This patch series implements the first release of the Live (and cold!)
migration in Kimchi.
*** Requirements for a VM migration ***
- shared storage. The disk/storage path must be the same at the origin
and destination.
- password-less login
- enough resorces in the destination host to allocate the VM
Limitations of this first version and possible candidates for future work:
- non-shared migration not supported
- do not automate the process of password-less login (but it is able to
verify this condition)
- due to the above limitation, the 'user' parameter value is only 'root'
at this moment
- do not verify the 'shared storage' condition
- do not verify same hypervisor/arch conditions
- the origin VM will shutdown after migration (not sure if can be helped)
*** Curl usage ***
curl -u username -H "Content-Type: application/json" -H "Accept: application/json" -k "https://localhost:10001/plugins/kimchi/vms/<VM NAME>/migrate" -X POST -d '{"remote_host":"insert_remote_IP_address", "user":"username"}'
*** Unit test usage ***
The unit tests for this feature needs an additional parameter in the command line
of ./run-tests.sh:
$ sudo KIMCHI_LIVE_MIGRATION_TEST=remote_host_IP ./run_tests.sh test_livemigration
If this parameter is not supplied the unit test will simply skip. The test also
verifies the password-less condition before trying to test a vm migration.
*** SUBJECT HERE ***
*** BLURB HERE ***
Daniel Henrique Barboza (3):
Live migration backend: API and messages
Live migration backend: control/vms and model/vms changes
Live migration backend: unit tests
src/wok/plugins/kimchi/API.json | 17 ++
src/wok/plugins/kimchi/control/vms.py | 3 +
src/wok/plugins/kimchi/docs/API.md | 5 +
src/wok/plugins/kimchi/i18n.py | 9 +
src/wok/plugins/kimchi/model/vms.py | 73 +++++-
src/wok/plugins/kimchi/tests/test_livemigration.py | 282 +++++++++++++++++++++
src/wok/plugins/kimchi/ui/js/src/kimchi.api.js | 13 +
7 files changed, 401 insertions(+), 1 deletion(-)
create mode 100644 src/wok/plugins/kimchi/tests/test_livemigration.py
--
2.4.3
9 years, 1 month
[PATCH 0/3 v3] Live migration backend
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
Changes in v3:
- get hostname by using python socket API instead of run_command
with 'hostname' command
- closed remote connection in _migrate_task
- removed 'test:///default' declaration in test files
- added a test to cover the API
Changes in v2:
- changes asked by pvital: verifying host name properly, break line in
docs/API.md, changed the format of i18n messages.
- one of the existing tests was enhanced to support the local host
verification properly.
----
This patch series implements the first release of the Live (and cold!)
migration in Kimchi.
*** Requirements for a VM migration ***
- shared storage. The disk/storage path must be the same at the origin
and destination.
- password-less login
- enough resorces in the destination host to allocate the VM
Limitations of this first version and possible candidates for future work:
- non-shared migration not supported
- do not automate the process of password-less login (but it is able to
verify this condition)
- due to the above limitation, the 'user' parameter value is only 'root'
at this moment
- do not verify the 'shared storage' condition
- do not verify same hypervisor/arch conditions
- the origin VM will shutdown after migration (not sure if can be helped)
*** Curl usage ***
curl -u username -H "Content-Type: application/json" -H "Accept: application/json" -k "https://localhost:10001/plugins/kimchi/vms/<VM NAME>/migrate" -X POST -d '{"remote_host":"insert_remote_IP_address", "user":"username"}'
*** Unit test usage ***
The unit tests for this feature needs an additional parameter in the command line
of ./run-tests.sh:
$ sudo KIMCHI_LIVE_MIGRATION_TEST=remote_host_IP ./run_tests.sh test_livemigration
If this parameter is not supplied the unit test will simply skip. The test also
verifies the password-less condition before trying to test a vm migration.
Daniel Henrique Barboza (3):
Live migration backend: API and messages
Live migration backend: control/vms and model/vms changes
Live migration backend: unit tests
src/wok/plugins/kimchi/API.json | 17 +
src/wok/plugins/kimchi/control/vms.py | 3 +
src/wok/plugins/kimchi/docs/API.md | 5 +
src/wok/plugins/kimchi/i18n.py | 7 +
src/wok/plugins/kimchi/model/vms.py | 75 ++++-
src/wok/plugins/kimchi/tests/test_livemigration.py | 356 +++++++++++++++++++++
src/wok/plugins/kimchi/ui/js/src/kimchi.api.js | 13 +
7 files changed, 475 insertions(+), 1 deletion(-)
create mode 100644 src/wok/plugins/kimchi/tests/test_livemigration.py
--
2.4.3
9 years, 1 month
[PATCH 1/2] Fix Issue #744 - gingerbase: objectstore issues
by chandra@linux.vnet.ibm.com
From: chandrureddy <chandra(a)linux.vnet.ibm.com>
plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue 'unable to open database file' in root.py and gingerbase.py
---
src/wok/plugins/gingerbase/Makefile.am | 18 ++++++++++--------
src/wok/plugins/gingerbase/config.py.in | 6 +++---
src/wok/plugins/gingerbase/gingerbase.conf | 2 +-
src/wok/plugins/gingerbase/gingerbase.py | 16 ++++++++--------
src/wok/plugins/kimchi/root.py | 18 +++++++++---------
5 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/src/wok/plugins/gingerbase/Makefile.am b/src/wok/plugins/gingerbase/Makefile.am
index 99a69df..533cdf8 100644
--- a/src/wok/plugins/gingerbase/Makefile.am
+++ b/src/wok/plugins/gingerbase/Makefile.am
@@ -31,6 +31,9 @@ gingerbasedir = $(pythondir)/wok/plugins/gingerbase
confdir = $(sysconfdir)/wok/plugins.d
dist_conf_DATA = gingerbase.conf
+name=ginger-base
+distdir=$(name)-$(PACKAGE_VERSION)
+
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = --install -I m4
@@ -80,8 +83,8 @@ do_substitution = \
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
-e 's,[@]wokdir[@],$(wokdir),g' \
-e 's,[@]gingerbasedir[@],$(gingerbasedir),g' \
- -e 's,[@]kimchiversion[@],$(PACKAGE_VERSION),g' \
- -e 's,[@]kimchirelease[@],$(PACKAGE_RELEASE),g' \
+ -e 's,[@]gingerbaseversion[@],$(PACKAGE_VERSION),g' \
+ -e 's,[@]gingerbaserelease[@],$(PACKAGE_RELEASE),g' \
-e 's,[@]withspice[@],$(WITH_SPICE),g'
config.py: config.py.in Makefile
@@ -94,8 +97,8 @@ config.py: config.py.in Makefile
install-deb: install
cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
- mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi
- mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase/debugreports
deb: contrib/make-deb.sh
@@ -131,18 +134,17 @@ ChangeLog:
fi
install-data-local:
- $(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/kimchi/
+ $(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/gingerbase/
$(MKDIR_P) $(DESTDIR)$(gingerbasedir)
$(INSTALL_DATA) API.json $(DESTDIR)$(gingerbasedir)/API.json
- mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+ mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase/debugreports
uninstall-local:
@if test -f $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; then \
$(RM) $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; \
fi; \
$(RM) $(DESTDIR)$(gingerbasedir)/API.json
- $(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
- $(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi/objectstore_gingerbase
+ $(RM) -rf $(DESTDIR)/$(localstatedir)/lib/gingerbase
VERSION:
@if test -d .git; then \
diff --git a/src/wok/plugins/gingerbase/config.py.in b/src/wok/plugins/gingerbase/config.py.in
index 922c914..9d911da 100644
--- a/src/wok/plugins/gingerbase/config.py.in
+++ b/src/wok/plugins/gingerbase/config.py.in
@@ -27,12 +27,12 @@ gingerBaseLock = threading.Lock()
def get_debugreports_path():
- return os.path.join('/var/lib/kimchi', 'debugreports')
+ return os.path.join(PluginPaths('gingerbase').conf_dir, 'debugreports')
def get_object_store():
- return os.path.join('/var/lib/kimchi',
- 'objectstore' + '_gingerbase')
+ return os.path.join(PluginPaths('gingerbase').state_dir,
+ 'objectstore_gingerbase')
class GingerBasePaths(PluginPaths):
diff --git a/src/wok/plugins/gingerbase/gingerbase.conf b/src/wok/plugins/gingerbase/gingerbase.conf
index cbe3358..560e38b 100644
--- a/src/wok/plugins/gingerbase/gingerbase.conf
+++ b/src/wok/plugins/gingerbase/gingerbase.conf
@@ -20,7 +20,7 @@ tools.wokauth.on = True
[/data/debugreports]
tools.staticdir.on = True
-tools.staticdir.dir = '/var/lib/kimchi/debugreports'
+tools.staticdir.dir = wok.config.PluginPaths('gingerbase').state_dir + '/debugreports'
tools.nocache.on = False
tools.wokauth.on = True
tools.staticdir.content_types = {'xz': 'application/x-xz'}
diff --git a/src/wok/plugins/gingerbase/gingerbase.py b/src/wok/plugins/gingerbase/gingerbase.py
index 0d3709e..bca1503 100644
--- a/src/wok/plugins/gingerbase/gingerbase.py
+++ b/src/wok/plugins/gingerbase/gingerbase.py
@@ -29,6 +29,14 @@ from wok.root import WokRoot
class GingerBase(WokRoot):
def __init__(self, wok_options):
+ make_dirs = [
+ os.path.dirname(os.path.abspath(config.get_object_store())),
+ os.path.abspath(config.get_debugreports_path())
+ ]
+ for directory in make_dirs:
+ if not os.path.isdir(directory):
+ os.makedirs(directory)
+
if hasattr(wok_options, "model"):
self.model = wok_options.model
elif wok_options.test:
@@ -48,13 +56,5 @@ class GingerBase(WokRoot):
self.domain = 'gingerbase'
self.messages = messages
- make_dirs = [
- os.path.dirname(os.path.abspath(config.get_object_store())),
- os.path.abspath(config.get_debugreports_path())
- ]
- for directory in make_dirs:
- if not os.path.isdir(directory):
- os.makedirs(directory)
-
def get_custom_conf(self):
return config.GingerBaseConfig()
diff --git a/src/wok/plugins/kimchi/root.py b/src/wok/plugins/kimchi/root.py
index 44452b4..37da8b3 100644
--- a/src/wok/plugins/kimchi/root.py
+++ b/src/wok/plugins/kimchi/root.py
@@ -30,6 +30,15 @@ from wok.root import WokRoot
class KimchiRoot(WokRoot):
def __init__(self, wok_options):
+ make_dirs = [
+ os.path.dirname(os.path.abspath(config.get_object_store())),
+ os.path.abspath(config.get_distros_store()),
+ os.path.abspath(config.get_screenshot_path())
+ ]
+ for directory in make_dirs:
+ if not os.path.isdir(directory):
+ os.makedirs(directory)
+
if hasattr(wok_options, "model"):
self.model = wok_options.model
elif wok_options.test:
@@ -53,14 +62,5 @@ class KimchiRoot(WokRoot):
self.domain = 'kimchi'
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_screenshot_path())
- ]
- for directory in make_dirs:
- if not os.path.isdir(directory):
- os.makedirs(directory)
-
def get_custom_conf(self):
return config.KimchiConfig()
--
2.1.0
9 years, 1 month
[PATCH] Log any exception raised
by Aline Manera
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/exception.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wok/exception.py b/src/wok/exception.py
index bac326c..26ae2d1 100644
--- a/src/wok/exception.py
+++ b/src/wok/exception.py
@@ -22,7 +22,6 @@
import cherrypy
import gettext
-
from wok.i18n import messages as _messages
from wok.template import get_lang, validate_language
@@ -51,6 +50,7 @@ class WokException(Exception):
msg = unicode(msg, 'utf-8') % args
pattern = "%s: %s" % (code, msg)
+ cherrypy.log.error_log.error(pattern)
Exception.__init__(self, pattern)
def _get_translation(self):
--
2.1.0
9 years, 1 month
[PATCH] [WOK] Github #745: Making import error messages less useless
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
Title says it all.
This is an experiment I've made by removing the package 'python-magic' and
then trying to boot WoK:
Failed to import plugin plugins.kimchi.KimchiRoot
Failed to import plugin plugins.ginger.Ginger
Today, there's absolutely no info of what happened. With this fix we'll get:
Failed to import plugin plugins.kimchi.KimchiRoot, error: Class plugins.kimchi.KimchiRoot can not be imported, error: No module named magic
Failed to import plugin plugins.ginger.Ginger, error: Class plugins.ginger.Ginger can not be imported, error: No module named magic
And then we can install the missing dependency right away.
Daniel Henrique Barboza (1):
Github #745: WoK: improve error message when importing plug-ins
src/wok/server.py | 17 ++++++++++-------
src/wok/utils.py | 7 +++++--
2 files changed, 15 insertions(+), 9 deletions(-)
--
2.4.3
9 years, 1 month