[PATCH V3 0/4] Implement integrity verification: verify template integrity
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V2 -> V3
use listNetworks() + listDefinedNetworks() instead of listAllNetworks()
V1 -> V2
rename invalid_integrity to validate_integrity
change list to array in API.md
list is the python semantic, array is json semantic.
Implement integrity verification: verify template integrity, update API.md
Sometimes, user create a template, but networks, cdrom, disks or
storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check some paramenters of template.
ShaoHe Feng (4):
Implement integrity verification: verify template integrity, update
API.md
add a new method to get iso info for VMTemplate class
Implement integrity verification: verify template integrity in backend
Implement integrity verification: update test case
docs/API.md | 4 +++
src/kimchi/control/templates.py | 1 +
src/kimchi/mockmodel.py | 5 +++-
src/kimchi/model/templates.py | 7 +++++-
src/kimchi/vmtemplate.py | 54 ++++++++++++++++++++++++++++++++---------
tests/test_model.py | 33 +++++++++++++++++++++++++
tests/test_rest.py | 40 ++++++++++++++++++++++++++++++
7 files changed, 131 insertions(+), 13 deletions(-)
--
1.8.4.2
10 years, 10 months
[PATCH] Fix directory path validation for 'DIR' type storage pool
by Mark Wu
The current regex will refuse the strings which end with '/'.
Obviously, even if the dir path ends with '/', it's still valid.
So this patch changes the regex to accept this case.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storagepool_add_main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index ac97e1a..8c0025f 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -167,7 +167,7 @@ kimchi.validateDirForm = function () {
kimchi.message.error.code('KCHPOOL6002E');
return false;
}
- if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) {
+ if (!/(\/([0-9a-zA-Z-_\.]+))+\/?$/.test(path)) {
kimchi.message.error.code('KCHAPI6003E');
return false;
}
--
1.8.4.2
10 years, 10 months
[PATCH] Use $(wildcard) to list files in Makefile
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Instead of listing file by file in Makefile it is better to use a
pattern for it. That way when adding a new file we don't need to change
the Makefile anymore, unless the pattern changes for some reason (new
file extension or so).
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
config/Makefile.am | 1 -
plugins/sample/Makefile.am | 7 +------
src/kimchi/Makefile.am | 35 +----------------------------------
tests/Makefile.am | 15 +--------------
ui/js/Makefile.am | 7 +------
ui/js/novnc/Makefile.am | 13 +------------
ui/libs/Makefile.am | 7 +------
ui/libs/themes/base/Makefile.am | 4 +---
ui/pages/Makefile.am | 15 +--------------
ui/pages/help/Makefile.am | 2 ++
ui/pages/tabs/Makefile.am | 8 +-------
11 files changed, 11 insertions(+), 103 deletions(-)
diff --git a/config/Makefile.am b/config/Makefile.am
index 8c5d364..514ae25 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -19,4 +19,3 @@
# limitations under the License.
SUBDIRS = ui
-#configdir = $(datadir)/kimchi/config
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index afab703..bb2d926 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -22,9 +22,4 @@
SUBDIRS = ui
-EXTRA_DIST = \
- __init__.py \
- API.json \
- model.py \
- i18n.py \
- sample.conf
+EXTRA_DIST = API.json sample.conf $(wildcard *.py)
diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am
index 6adef3c..6a0e100 100644
--- a/src/kimchi/Makefile.am
+++ b/src/kimchi/Makefile.am
@@ -22,40 +22,7 @@
SUBDIRS = control model
-kimchi_PYTHON = \
- __init__.py \
- asynctask.py \
- auth.py \
- basemodel.py \
- cachebust.py \
- disks.py \
- distroloader.py \
- exception.py \
- featuretests.py \
- i18n.py \
- iscsi.py \
- isoinfo.py \
- mockmodel.py \
- netinfo.py \
- network.py \
- networkxml.py \
- objectstore.py \
- osinfo.py \
- repositories.py \
- rollbackcontext.py \
- root.py \
- scan.py \
- screenshot.py \
- server.py \
- sslcert.py \
- swupdate.py \
- template.py \
- utils.py \
- vmtemplate.py \
- vnc.py \
- websocket.py \
- websockify.py \
- xmlutils.py
+kimchi_PYTHON = $(filter-out config.py, $(wildcard *.py))
nodist_kimchi_PYTHON = config.py
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e8db05c..1c40f5b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,21 +23,8 @@
EXTRA_DIST = \
Makefile.am \
run_tests.sh.in \
- iso_gen.py \
- test_authorization.py \
test_config.py.in \
- test_exception.py \
- test_mockmodel.py \
- test_model.py \
- test_networkxml.py \
- test_osinfo.py \
- test_plugin.py \
- test_rest.py \
- test_rollbackcontext.py \
- test_server.py \
- test_storagepool.py \
- test_vmtemplate.py \
- utils.py \
+ $(filter-out test_config.py, $(wildcard *.py)) \
$(NULL)
noinst_SCRIPTS = run_tests.sh
diff --git a/ui/js/Makefile.am b/ui/js/Makefile.am
index 1468569..ed75ea2 100644
--- a/ui/js/Makefile.am
+++ b/ui/js/Makefile.am
@@ -24,12 +24,7 @@ EXTRA_DIST = src widgets
jsdir = $(datadir)/kimchi/ui/js
-dist_js_DATA = \
- kimchi.min.js \
- jquery.min.js \
- jquery-ui.js \
- modernizr.custom.2.6.2.min.js \
- $(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
kimchi.min.js: widgets/*.js src/*.js
cat $(sort $^) > $@
diff --git a/ui/js/novnc/Makefile.am b/ui/js/novnc/Makefile.am
index 61383f8..b9038d7 100644
--- a/ui/js/novnc/Makefile.am
+++ b/ui/js/novnc/Makefile.am
@@ -22,15 +22,4 @@ SUBDIRS = web-socket-js
jsdir = $(datadir)/kimchi/ui/js/novnc
-dist_js_DATA = \
- base64.js \
- des.js \
- display.js \
- input.js \
- jsunzip.js \
- main.js \
- rfb.js \
- util.js \
- websock.js \
- webutil.js \
- $(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
diff --git a/ui/libs/Makefile.am b/ui/libs/Makefile.am
index d9bc761..0e99517 100644
--- a/ui/libs/Makefile.am
+++ b/ui/libs/Makefile.am
@@ -22,9 +22,4 @@ SUBDIRS = themes
jsdir = $(datadir)/kimchi/ui/libs
-dist_js_DATA = \
- jquery-1.10.0.min.js \
- jquery-ui.min.js \
- jquery-ui-i18n.min.js \
- modernizr.custom.76777.js \
- $(NULL)
+dist_js_DATA = $(wildcard *.js) $(NULL)
diff --git a/ui/libs/themes/base/Makefile.am b/ui/libs/themes/base/Makefile.am
index 811b2e6..ccf12e8 100644
--- a/ui/libs/themes/base/Makefile.am
+++ b/ui/libs/themes/base/Makefile.am
@@ -23,6 +23,4 @@ SUBDIRS = images
basedir = $(datadir)/kimchi/ui/libs/themes/base
-dist_base_DATA = \
- jquery-ui.min.css \
- $(NULL)
+dist_base_DATA = $(wildcard *.css) $(NULL)
diff --git a/ui/pages/Makefile.am b/ui/pages/Makefile.am
index 8d72398..42bbfa0 100644
--- a/ui/pages/Makefile.am
+++ b/ui/pages/Makefile.am
@@ -22,17 +22,4 @@ SUBDIRS = help tabs
htmldir = $(datadir)/kimchi/ui/pages
-dist_html_DATA = \
- error.html.tmpl \
- kimchi-ui.html.tmpl \
- guest-add.html.tmpl \
- guest-edit.html.tmpl \
- guest.html.tmpl \
- template-add.html.tmpl \
- template-edit.html.tmpl \
- vnc_auto.html.tmpl \
- i18n.html.tmpl \
- login-window.html.tmpl \
- storagepool-add.html.tmpl \
- report-add.html.tmpl \
- $(NULL)
+dist_html_DATA = $(wildcard *.html.tmpl) $(NULL)
diff --git a/ui/pages/help/Makefile.am b/ui/pages/help/Makefile.am
index 5146692..cd09995 100644
--- a/ui/pages/help/Makefile.am
+++ b/ui/pages/help/Makefile.am
@@ -25,6 +25,8 @@ helpdir = $(datadir)/kimchi/ui/pages/help
dist_help_DATA = $(HTML_FILES) $(NULL)
+EXTRA_DIST = $(wildcard *.dita)
+
%.html: %.dita $(DITA_XSL_FILE)
xsltproc -o $@ $(DITA_XSL_FILE) $<
$(shell pwd)/gen-index.py
diff --git a/ui/pages/tabs/Makefile.am b/ui/pages/tabs/Makefile.am
index 163401b..fee2a5e 100644
--- a/ui/pages/tabs/Makefile.am
+++ b/ui/pages/tabs/Makefile.am
@@ -20,10 +20,4 @@
tabshtmldir = $(datadir)/kimchi/ui/pages/tabs
-dist_tabshtml_DATA = \
- guests.html.tmpl \
- host.html.tmpl \
- network.html.tmpl \
- storage.html.tmpl \
- templates.html.tmpl \
- $(NULL)
+dist_tabshtml_DATA = $(wildcard *.html.tmpl) $(NULL)
--
1.7.10.4
10 years, 10 months
[PATCH] Issue #320: give friendly prompt when kimchid fails to run with non-root user
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
If a non-root/non-sudo user tries to run kimchid, it fails with the
verbose stacktrace.
This is not friendly to user.
There should be a check for these cases, allowing kimchid to fail
gracefully.
Issue:
https://github.com/kimchi-project/kimchi/issues/320
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/server.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/server.py b/src/kimchi/server.py
index 6dd0404..f93b6ee 100644
--- a/src/kimchi/server.py
+++ b/src/kimchi/server.py
@@ -158,8 +158,13 @@ class Server(object):
pass
cherrypy.log.screen = True
- cherrypy.log.access_file = options.access_log
- cherrypy.log.error_file = options.error_log
+ try:
+ cherrypy.log.access_file = options.access_log
+ cherrypy.log.error_file = options.error_log
+ except IOError as e:
+ print e
+ print "Please run kimchi with root user"
+ exit()
logLevel = LOGGING_LEVEL.get(options.log_level, logging.DEBUG)
dev_env = options.environment != 'production'
--
1.8.4.2
10 years, 10 months
[PATCH 0/6 V4] Host's repositories management support
by Paulo Vital
V3 -> V4:
* PEP8 compatibility
* Fixed bugs regarding exception error system code in mockmodel.py, model/host.py and repository.py
* Removed the "enabled" parameter from update_params' list.
V2 -> V3:
* PEP8 compatibility
* Improved mockmodel.py and model/host.py
* Updated API.json and backend files to use new exception error system code
V1 -> V2:
* Removed the enable/disable from docs/API.md and src/kimchi/API.json
* fixed wrong URI on test_rest.py
* PEP8 compatibility
* Updated repositories.py to make consistent with docs/API.md
* Raised correct exceptions
* Changed model/host.py and mockmodel.py to generate repo_id if not provided
* Changed mockmodel.py to declare MockRepositories class
V1:
This patch set provides support to host's repositories management operations.
At this point, an agnostic class is providing support to backend and
REST API operations. In addition, YUM (for RHEL, Fedora, SLES and OpenSuse)
and APT (for Debian and Ubuntu) specific classes are provided to support the
operation os each software update system.
To test the backend execute the following commands:
$ cd tests
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_create
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_update
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_disable_enable
To test the REST API, execute the following commands (all them are agnostic of the
host's distro):
1) Get list of all repositories enabled in the host:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X GET
2) Create a new repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X POST -d'
{
"repo_id": "fedora-fake",
"baseurl": "http://www.fedora.org",
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-fake-19"
}
'
3) Get information from a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake
4) Update a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X PUT -d'
{
"repo_id":"fedora-fake",
"repo_name":"Fedora 19 FAKEs",
"baseurl": "http://www.fedora.org/downloads"
}
'
5) Disable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/disable -X POST -d ''
6) Enable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/enable -X POST -d ''
7) Delete a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X DELETE
Paulo Vital (6):
Host's repositories management: Update API.md
Host's repositories management: Update REST API
Host's repositories management: Update backend.
Host's repositories management: Update Makefile
Host's repositories management: Update test-cases.
Host's repositories management: Update error exception messages.
Makefile.am | 1 +
docs/API.md | 77 ++++++
src/kimchi/API.json | 76 ++++++
src/kimchi/Makefile.am | 1 +
src/kimchi/control/host.py | 21 ++
src/kimchi/i18n.py | 19 ++
src/kimchi/mockmodel.py | 133 ++++++++++
src/kimchi/model/host.py | 54 ++++-
src/kimchi/repositories.py | 586 +++++++++++++++++++++++++++++++++++++++++++++
tests/test_model.py | 100 ++++++++
tests/test_rest.py | 33 +++
11 files changed, 1100 insertions(+), 1 deletion(-)
create mode 100644 src/kimchi/repositories.py
--
1.8.3.1
10 years, 10 months
[PATCH] Return 403 Forbidden when user does not have permission to access kimchi
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
This patch **partial** fix bug #323.
We still need to update UI to properly avoid user to perform some operations
when he/she does not have enough permission to do it.
Aline Manera (1):
Return 403 Forbidden when user does not have permission to access
kimchi
po/en_US.po | 83 +++++++++++++++++++++++++++++++++++++++++--
po/kimchi.pot | 83 +++++++++++++++++++++++++++++++++++++++++--
po/pt_BR.po | 83 +++++++++++++++++++++++++++++++++++++++++--
po/zh_CN.po | 83 +++++++++++++++++++++++++++++++++++++++++--
src/kimchi/auth.py | 10 ++++--
src/kimchi/i18n.py | 1 +
tests/test_authorization.py | 30 ++++++++--------
7 files changed, 348 insertions(+), 25 deletions(-)
--
1.7.10.4
10 years, 10 months
[PATCH] Fix duplicate dev names in host with multipath storage
by Rodrigo Trujillo
If the host has a storage connection with multipath, lsblk is going to
return the block devices twice, then when creating LOGICAL storage pool
the user sees devices paths replicated in the UI.
This patch fixes this problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/disks.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
index 83d5cc6..ef065e2 100644
--- a/src/kimchi/disks.py
+++ b/src/kimchi/disks.py
@@ -113,7 +113,7 @@ def _get_vgname(devNodePath):
def get_partitions_names():
- names = []
+ names = set()
keys = ["NAME", "TYPE", "FSTYPE", "MOUNTPOINT", "MAJ:MIN"]
# output is on format key="value",
# where key can be NAME, TYPE, FSTYPE, MOUNTPOINT
@@ -133,9 +133,9 @@ def get_partitions_names():
_is_dev_leaf(devNodePath)):
continue
- names.append(name)
+ names.add(name)
- return names
+ return list(names)
def get_partition_details(name):
--
1.8.5.3
10 years, 10 months
[PATCH] Adds spice.html.tmpl to makefile.am
by Rodrigo Trujillo
The file spice.html.tmpl is not being added to rpm packages because it
was not added to Makefile.am. This patch fixed this problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/pages/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/pages/Makefile.am b/ui/pages/Makefile.am
index 8d72398..9908376 100644
--- a/ui/pages/Makefile.am
+++ b/ui/pages/Makefile.am
@@ -35,4 +35,5 @@ dist_html_DATA = \
login-window.html.tmpl \
storagepool-add.html.tmpl \
report-add.html.tmpl \
+ spice.html.tmpl \
$(NULL)
--
1.8.5.3
10 years, 10 months
[PATCH 0/6 V5] Host's repositories management support
by Paulo Vital
V4 -> V5:
* Updated test_rest.py
* Fixed wrong dict declaration on mockmodel.py
V3 -> V4:
* PEP8 compatibility
* Fixed bugs regarding exception error system code in mockmodel.py, model/host.py and repository.py
* Removed the "enabled" parameter from update_params' list.
V2 -> V3:
* PEP8 compatibility
* Improved mockmodel.py and model/host.py
* Updated API.json and backend files to use new exception error system code
V1 -> V2:
* Removed the enable/disable from docs/API.md and src/kimchi/API.json
* fixed wrong URI on test_rest.py
* PEP8 compatibility
* Updated repositories.py to make consistent with docs/API.md
* Raised correct exceptions
* Changed model/host.py and mockmodel.py to generate repo_id if not provided
* Changed mockmodel.py to declare MockRepositories class
V1:
This patch set provides support to host's repositories management operations.
At this point, an agnostic class is providing support to backend and
REST API operations. In addition, YUM (for RHEL, Fedora, SLES and OpenSuse)
and APT (for Debian and Ubuntu) specific classes are provided to support the
operation os each software update system.
To test the backend execute the following commands:
$ cd tests
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_create
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_update
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_disable_enable
To test the REST API, execute the following commands (all them are agnostic of the
host's distro):
1) Get list of all repositories enabled in the host:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X GET
2) Create a new repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X POST -d'
{
"repo_id": "fedora-fake",
"baseurl": "http://www.fedora.org",
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-fake-19"
}
'
3) Get information from a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake
4) Update a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X PUT -d'
{
"repo_id":"fedora-fake",
"repo_name":"Fedora 19 FAKEs",
"baseurl": "http://www.fedora.org/downloads"
}
'
5) Disable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/disable -X POST -d ''
6) Enable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/enable -X POST -d ''
7) Delete a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X DELETE
Paulo Vital (6):
Host's repositories management: Update API.md
Host's repositories management: Update REST API
Host's repositories management: Update backend.
Host's repositories management: Update Makefile
Host's repositories management: Update test-cases.
Host's repositories management: Update error exception messages.
Makefile.am | 1 +
docs/API.md | 77 ++++++
src/kimchi/API.json | 72 ++++++
src/kimchi/Makefile.am | 1 +
src/kimchi/control/host.py | 21 ++
src/kimchi/i18n.py | 19 ++
src/kimchi/mockmodel.py | 135 +++++++++++
src/kimchi/model/host.py | 54 ++++-
src/kimchi/repositories.py | 586 +++++++++++++++++++++++++++++++++++++++++++++
tests/test_model.py | 100 ++++++++
tests/test_rest.py | 38 +++
11 files changed, 1103 insertions(+), 1 deletion(-)
create mode 100644 src/kimchi/repositories.py
--
1.8.3.1
10 years, 10 months
[PATCH 0/2] doc: Create index.html to join all help pages
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
It also fixes a bug found while building deb package.
Aline Manera (2):
bug fix: Package doc html files into deb package
doc: Generate index.html to join all help pages
ui/pages/help/Makefile.am | 8 +++---
ui/pages/help/gen-index.py | 64 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 3 deletions(-)
create mode 100755 ui/pages/help/gen-index.py
--
1.7.10.4
10 years, 10 months