[PATCH] fix: Add missing license copyright to css files
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
host.css, grid.css and line-chart.css were missing the Kimchi license.
Add it to them.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
ui/css/theme-default/grid.css | 20 ++++++++++++++++++++
ui/css/theme-default/host.css | 20 ++++++++++++++++++++
ui/css/theme-default/line-chart.css | 20 ++++++++++++++++++++
3 files changed, 60 insertions(+)
diff --git a/ui/css/theme-default/grid.css b/ui/css/theme-default/grid.css
index 2704fee..c5aa8e6 100644
--- a/ui/css/theme-default/grid.css
+++ b/ui/css/theme-default/grid.css
@@ -1,3 +1,23 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
.resizing {
cursor: col-resize;
}
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 457c4ef..0ef8b10 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -1,3 +1,23 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
.host-panel {
font-size: 12px;
margin-bottom: 100px;
diff --git a/ui/css/theme-default/line-chart.css b/ui/css/theme-default/line-chart.css
index 4fc0e2e..e1d8cb9 100644
--- a/ui/css/theme-default/line-chart.css
+++ b/ui/css/theme-default/line-chart.css
@@ -1,3 +1,23 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
.chart-container {
background: black;
}
--
1.7.10.4
10 years, 10 months
[PATCH] GET /plugins failed, fix it
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
commit 478d01d add a more parameter "filter_params" for get method of collection.
But it does not add this new parameter to derived class.
$ curl -H "Content-Type: application/json" -H "Accept: application/json" \
http://localhost:8000/plugins
Error as follow:
[27/Jan/2014:23:01:50] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line
656, in respond
response.body = self.handler()
File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line
188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line
34, in __call__
return self.callable(*self.args, **self.kwargs)
File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py",
line 266, in index
return self.get(filter_params)
TypeError: get() takes exactly 1 argument (2 given)
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/control/plugins.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/control/plugins.py b/src/kimchi/control/plugins.py
index 5938085..1221342 100644
--- a/src/kimchi/control/plugins.py
+++ b/src/kimchi/control/plugins.py
@@ -37,7 +37,7 @@ class Plugins(Collection):
def data(self):
return self.info
- def get(self):
+ def get(self, *args):
res_list = []
try:
get_list = getattr(self.model, model_fn(self, 'get_list'))
--
1.8.4.2
10 years, 10 months
[PATCH] Github issue #306: Creating a guest OS whose name contain spaces causes it to fail.
by Otavio R. Piske
From: "Otavio R. Piske" <angusyoung(a)gmail.com>
Kimchi fails to start the guest OS if the user names it with spaces. As pointed in the issue #306, other VM management interfaces prevent the user from creating a guest OS if the name contain invalid characters.
This patch adds a validation logic that prevents the user from naming a Guest OS with anything other than alphanumeric chars, '-', '.' or '_'.
Signed-off-by: Otavio R. Piske <angusyoung(a)gmail.com>
---
ui/js/src/kimchi.guest_add_main.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/ui/js/src/kimchi.guest_add_main.js b/ui/js/src/kimchi.guest_add_main.js
index 2085562..b65f2ef 100644
--- a/ui/js/src/kimchi.guest_add_main.js
+++ b/ui/js/src/kimchi.guest_add_main.js
@@ -53,6 +53,18 @@ kimchi.guest_add_main = function() {
if (!$('input[name=template]:checked', '#templateTile').val()) {
return false;
}
+
+ var name = $('input[name=name]', '#form-vm-add').val();
+
+ /* This regex should match anything that it's not an alphanumeric
+ * string, -, ., or _.
+ */
+ var invalidChars = /[^A-Za-z0-9\-\.\_]/g;
+
+ if (invalidChars.exec(name)) {
+ return false;
+ }
+
return true;
}
@@ -60,6 +72,9 @@ kimchi.guest_add_main = function() {
if (validateForm()) {
$('#vm-doAdd').removeAttr('disabled');
}
+ else {
+ $('#vm-doAdd').attr('disabled', 'disabled');
+ }
});
var addGuest = function(event) {
--
1.7.10.4
10 years, 10 months
About the review process
by Shu Ming
More and more patches coming into this mailing list and I found some
comments to the patches were not addressed correctly. One scenario was
that reviewer A had concern on the patch, but B and C gave the
"reviewed-by" to th patch, then the maintainer merged the patch into the
upstream without the concern addressed. The concern may be a very good
point to improve the code. In order to eliminate the scenario, I think
we can improve the code review process in this way:
1) To the reviewer, if you have concern on the patch, please give your
opinion in a very clear way like "NACK" opposite to "Reviewed-by" in the
first line of the reply.
2) To the submitter, please address all the concern and have the
reviewer to give a clear opinion.
3) To the maintainer, please don't not merge the patch if the concern is
not addressed.
4) To help the reviewer to understand your code, please post RFC for
your features and have a widely discussion.
One example, see the detail in the bottom,
"Use new control modules in root.py" which was given one concern on the
patch, but the submitter didn't reply to the concern. Then two others
gave the "reviewed-by" to th patch that leads to the patch merged. The
concern on the patch "not sure we can move these code to __all__ or
other attribute of control/__init__.py just from kimchi.control.networks
import *" was not very clear to the patch submitter and the patch
submitter just ignored the comment.
IMO, that is not a clean way to do the review. Here, we do miss the
chance to improve the origin patch. Finally, another patch "Improve
controller" was post to address the concern which caused code quality
improvement of the original patch delayed and work duplicated.
See the example patch here and the reviewer's comment and concern inline.
---
On 12/24/2013 02:41 AM, Aline Manera wrote:
> --- a/src/kimchi/root.py
> +++ b/src/kimchi/root.py
> @@ -26,13 +26,23 @@ import json
>
>
> from kimchi import auth
> -from kimchi import controller
> from kimchi import template
> from kimchi.config import get_api_schema_file
> from kimchi.control.utils import parse_request
> -
> -
> -class Root(controller.Resource):
> +from kimchi.control.base import Resource
> +from kimchi.control.config import Config
> +from kimchi.control.debugreports import DebugReports
> +from kimchi.control.host import Host
> +from kimchi.control.interfaces import Interfaces
> +from kimchi.control.networks import Networks
> +from kimchi.control.plugins import Plugins
> +from kimchi.control.storagepools import StoragePools
> +from kimchi.control.tasks import Tasks
> +from kimchi.control.templates import Templates
> +from kimchi.control.vms import VMs
not sure we can move these code to __all__ or other attribute of
control/__init__.py just
from kimchi.control.networks import *
+
+
+class Root(Resource):
def __init__(self, model, dev_env):
self._handled_error = ['error_page.400', 'error_page.404',
'error_page.405', 'error_page.406',
@@ -45,17 +55,17 @@ class Root(controller.Resource):
self._cp_config = dict([(key, self.error_development_handler)
for key in self._handled_error])
10 years, 10 months
[PATCH] PEP8 cleanup and bug fix for src/kimchi/utils.py
by Mark Wu
This patch makes src/kimchi/utils.py pep8 clean, and fix the
wrong var reference of 'storage_server'.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
Makefile.am | 1 +
src/kimchi/utils.py | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 9ccac0e..1ee8c1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,6 +56,7 @@ PEP8_WHITELIST = \
src/kimchi/rollbackcontext.py \
src/kimchi/root.py \
src/kimchi/server.py \
+ src/kimchi/utils.py \
tests/test_mockmodel.py \
tests/test_model.py \
tests/test_plugin.py \
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index ae0cfac..be32195 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -18,7 +18,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
import cherrypy
@@ -37,6 +37,7 @@ from threading import Timer
kimchi_log = cherrypy.log.error_log
+
def is_digit(value):
if isinstance(value, int):
return True
@@ -169,11 +170,11 @@ def patch_find_nfs_target(nfs_server):
try:
out = run_command(cmd, 10)[0]
except TimeoutExpired:
- kimchi_log.warning("server %s query timeout, may not have any path exported",
- storage_server)
+ kimchi_log.warning("server %s query timeout, may not have any path "
+ "exported", nfs_server)
return list()
- targets = parse_cmd_output(out, output_items = ['target'])
+ targets = parse_cmd_output(out, output_items=['target'])
for target in targets:
target['type'] = 'nfs'
target['host_name'] = nfs_server
--
1.8.4.2
10 years, 10 months
[PATCH] Python: Do not allow lines longer than 80 characters
by Crístian Viana
In order to make the code more consistent, set a maximum of 80
characters per line in Python files.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
src/kimchi/mockmodel.py | 24 ++++++++-----
src/kimchi/model.py | 88 ++++++++++++++++++++++++++++-------------------
src/kimchi/objectstore.py | 3 +-
src/kimchi/osinfo.py | 18 ++++++----
src/kimchi/scan.py | 7 ++--
src/kimchi/template.py | 3 +-
src/kimchi/vmtemplate.py | 7 ++--
tests/test_osinfo.py | 3 +-
8 files changed, 96 insertions(+), 57 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 4ef3fa6..1b345ae 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -61,7 +61,8 @@ class MockModel(object):
self.distros = self._get_distros()
def get_capabilities(self):
- return {'libvirt_stream_protocols': ['http', 'https', 'ftp', 'ftps', 'tftp'],
+ return {'libvirt_stream_protocols': ['http', 'https', 'ftp', 'ftps',
+ 'tftp'],
'qemu_stream': True,
'screenshot': True,
'system_report_tool': True}
@@ -208,10 +209,12 @@ class MockModel(object):
ident = name
new_storagepool = new_t.get(u'storagepool', '')
+ new_name = kimchi.model.pool_name_from_uri(new_storagepool)
try:
- self._get_storagepool(kimchi.model.pool_name_from_uri(new_storagepool))
+ self._get_storagepool(new_name)
except Exception as e:
- raise InvalidParameter("Storagepool specified is not valid: %s." % e.message)
+ raise InvalidParameter("Storagepool specified is not valid: %s." %
+ e.message)
for net_name in params.get(u'networks', []):
try:
@@ -303,7 +306,8 @@ class MockModel(object):
pool.info['autostart'] = False
except KeyError, item:
raise MissingParameter(item)
- if name in self._mock_storagepools or name in (kimchi.model.ISO_POOL_NAME,):
+ if (name in self._mock_storagepools or
+ name in (kimchi.model.ISO_POOL_NAME,)):
raise InvalidOperation("StoragePool already exists")
self._mock_storagepools[name] = pool
return name
@@ -605,9 +609,11 @@ class MockVMTemplate(VMTemplate):
try:
pool = self.model._get_storagepool(pool_name)
except NotFoundError:
- raise InvalidParameter('Storage specified by template does not exist')
+ raise InvalidParameter('Storage specified by template does '
+ 'not exist')
if pool.info['state'] != 'active':
- raise InvalidParameter('Storage specified by template is not active')
+ raise InvalidParameter('Storage specified by template is '
+ 'not active')
return pool
@@ -634,13 +640,15 @@ class MockVM(object):
self.networks = template_info['networks']
self.info = {'state': 'shutoff',
'stats': "{'cpu_utilization': 20, 'net_throughput' : 35, \
- 'net_throughput_peak': 100, 'io_throughput': 45, \
+ 'net_throughput_peak': 100, \
+ 'io_throughput': 45, \
'io_throughput_peak': 100}",
'uuid': self.uuid,
'memory': template_info['memory'],
'cpus': template_info['cpus'],
'icon': None,
- 'graphics': {'type': 'vnc', 'listen': '0.0.0.0', 'port': None}
+ 'graphics': {'type': 'vnc', 'listen': '0.0.0.0',
+ 'port': None}
}
self.info['graphics'].update(template_info['graphics'])
diff --git a/src/kimchi/model.py b/src/kimchi/model.py
index ea528c6..37d98dc 100644
--- a/src/kimchi/model.py
+++ b/src/kimchi/model.py
@@ -64,7 +64,8 @@ from kimchi import xmlutils
from kimchi.asynctask import AsyncTask
from kimchi.distroloader import DistroLoader
from kimchi.exception import InvalidOperation, InvalidParameter, IsoFormatError
-from kimchi.exception import MissingParameter, NotFoundError, OperationFailed, TimeoutExpired
+from kimchi.exception import MissingParameter, NotFoundError, OperationFailed
+from kimchi.exception import TimeoutExpired
from kimchi.featuretests import FeatureTests
from kimchi.iscsi import TargetClient
from kimchi.isoinfo import IsoImage
@@ -155,7 +156,8 @@ class Model(object):
# Please add new possible debug report command here
# and implement the report generating function
# based on the new report command
- self.report_tools = ({'cmd': 'sosreport --help', 'fn': self._sosreport_generate},
+ self.report_tools = ({'cmd': 'sosreport --help',
+ 'fn': self._sosreport_generate},
{'cmd': 'supportconfig -h', 'fn':None},
{'cmd': 'linuxexplorers --help', 'fn':None})
@@ -185,18 +187,18 @@ class Model(object):
try:
net = conn.networkDefineXML(xml)
except libvirt.libvirtError, e:
- cherrypy.log.error(
- "Fatal: Cannot create default network because of %s, exit kimchid" % e.message,
- severity=logging.ERROR)
+ cherrypy.log.error("Fatal: Cannot create default network "
+ "because of %s, exit kimchid" %
+ e.message, severity=logging.ERROR)
sys.exit(1)
if net.isActive() == 0:
try:
net.create()
except libvirt.libvirtError, e:
- cherrypy.log.error(
- "Fatal: Cannot activate default network because of %s, exit kimchid" % e.message,
- severity=logging.ERROR)
+ cherrypy.log.error("Fatal: Cannot activate default network "
+ "because of %s, exit kimchid" %
+ e.message, severity=logging.ERROR)
sys.exit(1)
def _default_pool_check(self):
@@ -210,9 +212,9 @@ class Model(object):
pass
except OperationFailed as e:
# path used by other pool or other reasons of failure, exit
- cherrypy.log.error(
- "Fatal: Cannot create default pool because of %s, exit kimchid" % e.message,
- severity=logging.ERROR)
+ cherrypy.log.error("Fatal: Cannot create default pool because of "
+ "%s, exit kimchid" %
+ e.message, severity=logging.ERROR)
sys.exit(1)
if self.storagepool_lookup('default')['state'] == 'inactive':
@@ -477,12 +479,15 @@ class Model(object):
for key, val in params.items():
if key in VM_STATIC_UPDATE_PARAMS:
- new_xml = xmlutils.xml_item_update(new_xml, VM_STATIC_UPDATE_PARAMS[key], val)
+ new_xml = xmlutils.xml_item_update(new_xml,
+ VM_STATIC_UPDATE_PARAMS[key],
+ val)
try:
if 'name' in params:
if state == 'running':
- raise InvalidParameter("vm name can just updated when vm shutoff")
+ raise InvalidParameter("vm name can just updated when "
+ "vm shutoff")
else:
dom.undefine()
conn = self.conn.get()
@@ -506,7 +511,8 @@ class Model(object):
info = dom.info()
state = Model.dom_state_map[info[0]]
screenshot = None
- graphics_type, graphics_listen, graphics_port = self._vm_get_graphics(name)
+ graphics = self._vm_get_graphics(name)
+ graphics_type, graphics_listen, graphics_port = graphics
graphics_port = graphics_port if state == 'running' else None
try:
if state == 'running':
@@ -628,7 +634,8 @@ class Model(object):
t = self._get_template(t_name, vm_overrides)
if not self.qemu_stream and t.info.get('iso_stream', False):
- raise InvalidOperation("Remote ISO image is not supported by this server.")
+ raise InvalidOperation("Remote ISO image is not supported by "
+ "this server.")
t.validate()
vol_list = t.fork_vm_storage(vm_uuid)
@@ -639,7 +646,7 @@ class Model(object):
with self.objstore as session:
session.store('vm', vm_uuid, {'icon': icon})
- libvirt_stream = False if len(self.libvirt_stream_protocols) == 0 else True
+ libvirt_stream = len(self.libvirt_stream_protocols) != 0
graphics = params.get('graphics')
xml = t.to_vm_xml(name, vm_uuid,
@@ -718,7 +725,8 @@ class Model(object):
try:
self._get_storagepool(pool_name_from_uri(new_storagepool))
except Exception as e:
- raise InvalidParameter("Storagepool specified is not valid: %s." % e.message)
+ raise InvalidParameter("Storagepool specified is not valid: %s." %
+ e.message)
for net_name in params.get(u'networks', []):
try:
@@ -1041,7 +1049,8 @@ class Model(object):
with self.objstore as session:
session.delete('scanning', pool_name)
except Exception, e:
- kimchi_log.debug("Exception %s occured when cleaning scan result" % e.message)
+ kimchi_log.debug("Exception %s occured when cleaning scan result" %
+ e.message)
def _do_deep_scan(self, params):
scan_params = dict(ignore_list=[])
@@ -1054,10 +1063,11 @@ class Model(object):
if res['state'] == 'active':
scan_params['ignore_list'].append(res['path'])
except Exception, e:
- kimchi_log.debug("Exception %s occured when get ignore path" % e.message)
+ kimchi_log.debug("Exception %s occured when get ignore path" %
+ e.message)
- params['path'] = scan_params['pool_path'] = self.scanner.scan_dir_prepare(
- params['name'])
+ path = self.scanner.scan_dir_prepare(params['name'])
+ params['path'] = scan_params['pool_path'] = path
task_id = self.add_task('', self.scanner.start_scan, scan_params)
# Record scanning-task/storagepool mapping for future querying
with self.objstore as session:
@@ -1252,8 +1262,8 @@ class Model(object):
bootable = True
except IsoFormatError:
bootable = False
- res.update(
- dict(os_distro=os_distro, os_version=os_version, path=path, bootable=bootable))
+ res.update(dict(os_distro=os_distro, os_version=os_version,
+ path=path, bootable=bootable))
return res
@@ -1315,7 +1325,8 @@ class Model(object):
def _sosreport_generate(self, cb, name):
command = 'sosreport --batch --name "%s"' % name
try:
- retcode = subprocess.call(command, shell=True, stdout=subprocess.PIPE)
+ retcode = subprocess.call(command, shell=True,
+ stdout=subprocess.PIPE)
if retcode < 0:
raise OperationFailed('Command terminated with signal')
elif retcode > 0:
@@ -1360,7 +1371,8 @@ class Model(object):
for helper_tool in self.report_tools:
try:
retcode = subprocess.call(helper_tool['cmd'], shell=True,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
if retcode == 0:
return helper_tool['fn']
except Exception, e:
@@ -1450,9 +1462,11 @@ class LibvirtVMTemplate(VMTemplate):
conn = self.conn.get()
pool = conn.storagePoolLookupByName(pool_name)
except libvirt.libvirtError:
- raise InvalidParameter('Storage specified by template does not exist')
+ raise InvalidParameter('Storage specified by template does '
+ 'not exist')
if not pool.isActive():
- raise InvalidParameter('Storage specified by template is not active')
+ raise InvalidParameter('Storage specified by template is '
+ 'not active')
return pool
@@ -1463,9 +1477,11 @@ class LibvirtVMTemplate(VMTemplate):
conn = self.conn.get()
network = conn.networkLookupByName(name)
except libvirt.libvirtError:
- raise InvalidParameter('Network specified by template does not exist')
+ raise InvalidParameter('Network specified by template does '
+ 'not exist')
if not network.isActive():
- raise InvalidParameter('Network specified by template is not active')
+ raise InvalidParameter('Network specified by template is '
+ 'not active')
def _get_storage_path(self):
pool = self._storage_validate()
@@ -1582,7 +1598,8 @@ class NetfsPoolDef(StoragePoolDef):
run_command(mount_cmd, 30)
rollback.prependDefer(run_command, umount_cmd)
except TimeoutExpired:
- raise InvalidParameter("Export path %s may block during nfs mount" % export_path)
+ raise InvalidParameter("Export path %s may block during "
+ "nfs mount" % export_path)
with open("/proc/mounts" , "rb") as f:
rawMounts = f.read()
@@ -1593,8 +1610,8 @@ class NetfsPoolDef(StoragePoolDef):
mounted = True
if not mounted:
- raise InvalidParameter(
- "Export path %s mount failed during nfs mount" % export_path)
+ raise InvalidParameter("Export path %s mount failed during "
+ "nfs mount" % export_path)
@property
def xml(self):
@@ -1830,7 +1847,8 @@ class LibvirtConnection(object):
except libvirt.libvirtError:
kimchi_log.error('Unable to connect to libvirt.')
if not retries:
- kimchi_log.error('Libvirt is not available, exiting.')
+ kimchi_log.error('Libvirt is not available, '
+ 'exiting.')
cherrypy.engine.stop()
raise
time.sleep(2)
@@ -1847,8 +1865,8 @@ class LibvirtConnection(object):
setattr(cls, name, wrapMethod(method))
self._connections[conn_id] = conn
- # In case we're running into troubles with keeping the connections
- # alive we should place here:
+ # In case we're running into troubles with keeping the
+ # connections alive we should place here:
# conn.setKeepAlive(interval=5, count=3)
# However the values need to be considered wisely to not affect
# hosts which are hosting a lot of virtual machines
diff --git a/src/kimchi/objectstore.py b/src/kimchi/objectstore.py
index 7b567f3..5096ea8 100644
--- a/src/kimchi/objectstore.py
+++ b/src/kimchi/objectstore.py
@@ -107,7 +107,8 @@ class ObjectStore(object):
try:
return self._connections[ident]
except KeyError:
- self._connections[ident] = sqlite3.connect(self.location, timeout=10)
+ self._connections[ident] = sqlite3.connect(self.location,
+ timeout=10)
if len(self._connections.keys()) > 10:
id, conn = self._connections.popitem(last=False)
conn.interrupt()
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index f92db3d..14df9a6 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -56,18 +56,24 @@ modern_version_bases = {'debian': '6.0', 'ubuntu': '7.10', 'opensuse': '10.3',
isolinks = {
'debian': {
- 'squeeze': 'http://cdimage.debian.org/debian-cd/6.0.7-live/amd64/iso-hybrid/debian-li...',
+ 'squeeze': 'http://cdimage.debian.org/debian-cd/6.0.7-live/amd64/'
+ 'iso-hybrid/debian-live-6.0.7-amd64-gnome-desktop.iso',
},
'ubuntu': {
- 'raring': 'http://ubuntu-releases.cs.umn.edu/13.04/ubuntu-13.04-desktop-amd64.iso',
+ 'raring': 'http://ubuntu-releases.cs.umn.edu/13.04/'
+ 'ubuntu-13.04-desktop-amd64.iso',
},
'opensuse': {
- '12.3': 'http://suse.mirrors.tds.net/pub/opensuse/distribution/12.3/iso/openSUSE-1...',
+ '12.3': 'http://suse.mirrors.tds.net/pub/opensuse/distribution/12.3/'
+ 'iso/openSUSE-12.3-DVD-x86_64.iso',
},
'fedora': {
- '16': 'http://fedora.mirrors.tds.net/pub/fedora/releases/16/Live/x86_64/Fedora-1...',
- '17': 'http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/x86_64/Fedora-1...',
- '18': 'http://fedora.mirrors.tds.net/pub/fedora/releases/18/Live/x86_64/Fedora-1...',
+ '16': 'http://fedora.mirrors.tds.net/pub/fedora/releases/16/Live/'
+ 'x86_64/Fedora-16-x86_64-Live-Desktop.iso',
+ '17': 'http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/'
+ 'x86_64/Fedora-17-x86_64-Live-Desktop.iso',
+ '18': 'http://fedora.mirrors.tds.net/pub/fedora/releases/18/Live/'
+ 'x86_64/Fedora-18-x86_64-Live-Desktop.iso',
},
}
diff --git a/src/kimchi/scan.py b/src/kimchi/scan.py
index e192f01..ca460a0 100644
--- a/src/kimchi/scan.py
+++ b/src/kimchi/scan.py
@@ -59,8 +59,8 @@ class Scanner(object):
shutil.rmtree(d)
self.clean_cb(transient_pool)
except OSError as e:
- kimchi_log.debug(
- "Exception %s occured when cleaning stale pool, ignore" % e.message)
+ kimchi_log.debug("Exception %s occured when cleaning stale pool, "
+ "ignore" % e.message)
def scan_dir_prepare(self, name):
# clean stale scan storage pools
@@ -77,7 +77,8 @@ class Scanner(object):
if (iso_info['distro'], iso_info['version']) == iso_img.probe():
return
- iso_path = iso_name + hashlib.md5(iso_info['path']).hexdigest() + '.iso'
+ iso_path = (iso_name + hashlib.md5(iso_info['path']).hexdigest() +
+ '.iso')
link_name = os.path.join(params['pool_path'],
os.path.basename(iso_path))
os.symlink(iso_info['path'], link_name)
diff --git a/src/kimchi/template.py b/src/kimchi/template.py
index 1f19c4a..faa3c72 100644
--- a/src/kimchi/template.py
+++ b/src/kimchi/template.py
@@ -83,7 +83,8 @@ def can_accept_html():
def render(resource, data):
if can_accept('application/json'):
- cherrypy.response.headers['Content-Type'] = 'application/json;charset=utf-8'
+ cherrypy.response.headers['Content-Type'] = ('application/json;'
+ 'charset=utf-8')
return json.dumps(data, indent=2,
separators=(',', ':'),
encoding='iso-8859-1')
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 58147e3..6a3def3 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -111,9 +111,12 @@ class VMTemplate(object):
qemu_stream_cmdline = """
<qemu:commandline>
<qemu:arg value='-drive'/>
- <qemu:arg value='file=%(url)s,if=none,id=drive-%(bus)s0-1-0,readonly=on,format=raw'/>
+ <qemu:arg value='file=%(url)s,
+ if=none,id=drive-%(bus)s0-1-0,readonly=on,
+ format=raw'/>
<qemu:arg value='-device'/>
- <qemu:arg value='%(bus)s-cd,bus=%(bus)s.1,unit=0,drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
+ <qemu:arg value='%(bus)s-cd,bus=%(bus)s.1,unit=0,
+ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
</qemu:commandline>
"""
diff --git a/tests/test_osinfo.py b/tests/test_osinfo.py
index 0f88a35..28ac89b 100644
--- a/tests/test_osinfo.py
+++ b/tests/test_osinfo.py
@@ -34,7 +34,8 @@ class OSInfoTests(unittest.TestCase):
self.assertEquals(['default'], entry['networks'])
def test_fedora_lookup(self):
- cd = 'http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/x86_64/Fedora-1...'
+ cd = 'http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/x86_64/'
+ 'Fedora-17-x86_64-Live-Desktop.iso'
entry = lookup('fedora', '17')
self.assertEquals(10, entry['disks'][0]['size'])
self.assertEquals(cd, entry['cdrom'])
--
1.8.4.2
10 years, 10 months
[PATCH] HTML: Make the form element's labels clickable
by Crístian Viana
A good usability feature of an HTML form is to click on an element's
label to activate the element itself. For example, when clicking on a
checkbox's label, the checkbox itself is checked, instead of requiring
the user to click on the small corresponding element.
Assign every checkbox's and radio's labels to their corresponding
form elements.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
ui/pages/storagepool-add.html.tmpl | 6 +++---
ui/pages/tabs/network.html.tmpl | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
index 03c063d..12a9779 100644
--- a/ui/pages/storagepool-add.html.tmpl
+++ b/ui/pages/storagepool-add.html.tmpl
@@ -117,7 +117,7 @@
<section class="form-section">
<div class="field">
<input type="checkbox" id="authId" name="authname">
- <label>$_("Add iSCSI Authentication")</label>
+ <label for="authId">$_("Add iSCSI Authentication")</label>
</div>
</section>
<section class="authenticationfield form-section tmpl-html">
@@ -143,8 +143,8 @@
</script>
<script id="partitionTmpl" type="html/text">
<div>
- <input type="checkbox" value="{path}" name="devices">
- <label>{path}</label>
+ <input type="checkbox" id="{name}" value="{path}" name="devices">
+ <label for="{name}">{path}</label>
</div>
</script>
</body>
diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl
index fcf8556..9c149b7 100644
--- a/ui/pages/tabs/network.html.tmpl
+++ b/ui/pages/tabs/network.html.tmpl
@@ -61,15 +61,15 @@
<div class="section-content">
<div class="input-container">
<input type="radio" id="networkTypeIso" name="networkType" value="isolated">
- <label>$_("Isolated: no physical network connection")</label>
+ <label for="networkTypeIso">$_("Isolated: no physical network connection")</label>
</div>
<div class="input-container">
<input type="radio" id="networkTypeNat" name="networkType" value="nat">
- <label>$_("NAT: outbound physical network connection only")</label>
+ <label for="networkTypeNat">$_("NAT: outbound physical network connection only")</label>
</div>
<div class="input-container">
<input type="radio" id="networkTypeBri" name="networkType" value="bridged">
- <label>$_("Bridged: VMs are connected to physical network directly")</label>
+ <label for="networkTypeBri">$_("Bridged: VMs are connected to physical network directly")</label>
</div>
<div class="destination">
<label>$_("Destination"): </label>
@@ -78,7 +78,7 @@
<div class="VLAN">
<label>$_("Enable VLAN"): </label>
<input id="enableVlan" type="checkbox" value=""/>
- <label>$_("VLAN ID"): </label>
+ <label for="enableVlan">$_("VLAN ID"): </label>
<input type="text" id="networkVlanID" disabled>
</div>
</div>
--
1.8.4.2
10 years, 10 months
[PATCH V3 0/4] support create/delete VMIface
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V2 -> V3
rebase
V1 -> V2
do not support hot plugging attach/detach interface
we will support this feature after we implement events.
1. get all vms:
$ curl -u <user> -H 'Accept: application/json' -H 'Content-type:
application/json' http://localhost:8000/vms
2. get all networks:
$ curl -u <user> -H 'Accept: application/json' -H 'Content-type:
application/json' http://localhost:8000/networks
3. get all ifaces of a vm
$ curl -u <user> -H 'Accept: application/json' -H 'Content-type:
application/json' http://localhost:8000/vms/test-vm-0/ifaces/
[
{
"mac":"52:54:00:00:00:01",
"model":"virtio",
"type":"network",
"network":"default"
}
]
4. attach a new iface to vm
$ curl -u <user> -H 'Accept: application/json' -H 'Content-type:
application/json' http://localhost:8000/vms/test-vm-8/ifaces -X POST -d '
{
"type":"network",
"network":"test-network-0"
}
'
{
"mac":"52:54:00:00:00:0d",
"model":"virtio",
"type":"network",
"network":"test-network-0"
}
5. detach a iface from vm
$ curl -u <user> -H 'Accept: application/json' -H 'Content-type:
application/json' http://localhost:8000/vms/test-vm-8/ifaces/52:54:00:00:00:0d -X DELETE
ShaoHe Feng (4):
support create/delete VMIface: update model
support create/delete VMIface: update mockmodel
support create/delete VMIface: update API.json
support create/delete VMIface: update testcase
src/kimchi/API.json | 21 +++++++++++++++++++
src/kimchi/mockmodel.py | 21 +++++++++++++++++++
src/kimchi/model.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-
tests/test_model.py | 22 +++++++++++++++++++
tests/test_rest.py | 27 ++++++++++++++++++++++++
5 files changed, 146 insertions(+), 1 deletion(-)
--
1.8.4.2
10 years, 10 months
[PATCH V2] bug fix: guest iface does not return model if no model is found
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
On some distros, libvirt will not set model automatically.
if no model is found, guest iface will not return this field.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Signed-off-by: SAline Manera <alinefm(a)br.ibm.com>
---
docs/API.md | 2 +-
src/kimchi/model.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index f6f89f9..580728c 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -180,7 +180,7 @@ A interface represents available network interface on VM.
* bridge *(optional)*: the name of resource bridge, only be available when the
interface type is bridge.
* mac: Media Access Control Address of the VM interface.
- * model: model of emulated network interface card. It will be one of these models:
+ * model *(optional)*: model of emulated network interface card. It will be one of these models:
ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
* network *(optional)*: the name of resource network, only be available when the
interface type is network.
diff --git a/src/kimchi/model.py b/src/kimchi/model.py
index 63e748e..544fa80 100644
--- a/src/kimchi/model.py
+++ b/src/kimchi/model.py
@@ -1001,7 +1001,8 @@ class Model(object):
info['type'] = iface.attrib['type']
info['mac'] = iface.mac.get('address')
- info['model'] = iface.model.get('type')
+ if iface.find("model") is not None:
+ info['model'] = iface.model.get('type')
if info['type'] == 'network':
info['network'] = iface.source.get('network')
if info['type'] == 'bridge':
--
1.8.4.2
10 years, 10 months
Help from UI experts to my latest patch
by Rodrigo Trujillo
Hi guys,
I wonder if someone expert in UI can help me with my latest patch.
Actually, the patch: [PATCH V2 7/7] (WIP) Storagepool SCSI/FC: Draft
UI to allow user to select a LUN to new VM
You guys will find the code some TODO's and FIXME
I need to popup a window with LUN's names and allow user to select one
of them. Then retrieve this selection. I think this is not that
complicated, but I could not research deeper how to do it. See an
example below:
*********************************
(X) Close
Select Host
() Lun 1
() Lun 2
() Lun xxx
----------------------------------------
________
| Select |
*********************************
Appreciate any help
Regards,
Rodrigo
10 years, 10 months