Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into spice-web-client-…
Browse files Browse the repository at this point in the history
…addon
  • Loading branch information
pgurenko committed Jun 2, 2019
2 parents ef68fa1 + 230b53e commit 686e45b
Show file tree
Hide file tree
Showing 107 changed files with 7,454 additions and 6,203 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, W504, E741, C901
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9,B950
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Pre-commit git hooks, run locally before every commit
# Init with
# $ pip install -r requirements-dev.txt
# $ pre-commit install

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
#- id: check-docstring-first
- id: check-json
#- id: check-added-large-files
- id: check-yaml
- id: debug-statements
#- id: name-tests-test
- id: double-quote-string-fixer
- id: requirements-txt-fixer
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4
hooks:
- id: autopep8
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.3.5
hooks:
- id: reorder-python-imports
language_version: python3
71 changes: 48 additions & 23 deletions API.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-03/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Kimchi API",
"description": "Json schema for Kimchi API",
"type": "object",
Expand All @@ -9,15 +9,16 @@
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["spice", "vnc"],
"error": "KCHVM0014E"
},
"listen": {
"error": "KCHVM0015E",
"type": [
"anyOf": [
{
"type": "string",
"format": "ip-address"
"format": "ipv4"
},
{
"type": "string",
Expand Down Expand Up @@ -93,18 +94,20 @@
"interface": {
"description": "Host network interface. This indicates how to configure the host network interface (Ethernet, Bond, VLAN) as direct macvtap or as OVS interface to a VM.",
"type": "object",
"required": [
"type",
"name"
],
"properties": {
"type": {
"description": "Host network interface type. Valid types are: 'macvtap' for host network interface (Ethernet, Bond, VLAN) to be connected as direct MacVTap or 'ovs' for openvswitch host network interface to be connected as virtual switch to a VM.",
"type": "string",
"pattern": "^(macvtap|ovs)$",
"required": "True",
"error": "KCHTMPL0034E"
},
"name": {
"description": "The host network interface name. It should be name of host network interface(Ethernet, Bond, VLAN) for type 'macvtap' and name of host openvswitch bridge interface for type ovs",
"type": "string",
"required": "True",
"error": "KCHTMPL0035E"
},
"mode": {
Expand All @@ -121,21 +124,23 @@
"properties": {
"storagepools_create": {
"type": "object",
"required": [
"name",
"type"
],
"error": "KCHPOOL0026E",
"properties": {
"name": {
"description": "The name of the Storage Pool",
"type": "string",
"minLength": 1,
"pattern": "^[^/]*$",
"required": true,
"error": "KCHPOOL0016E"
},
"type": {
"description": "The type of the defined Storage Pool",
"type": "string",
"pattern": "^dir|netfs|logical|kimchi-iso|iscsi|scsi$",
"required": true,
"error": "KCHPOOL0017E"
},
"path": {
Expand Down Expand Up @@ -270,23 +275,28 @@
},
"storagevolume_update": {
"type": "object",
"required": [
"chunk",
"chunk_size"
],
"properties": {
"chunk": {
"description": "Upload storage volume chunk",
"error": "KCHVOL0024E",
"required": true
"error": "KCHVOL0024E"
},
"chunk_size": {
"description": "Chunk size of uploaded storage volume",
"type": "string",
"error": "KCHVOL0024E",
"required": true
"error": "KCHVOL0024E"
}
},
"additionalProperties": false
},
"vms_create": {
"type": "object",
"required": [
"template"
],
"error": "KCHVM0016E",
"properties": {
"name": {
Expand All @@ -309,7 +319,6 @@
"description": "The URI of a template to use when building a VM",
"type": "string",
"pattern": "^/plugins/kimchi/templates/(.*?)/?$",
"required": true,
"error": "KCHVM0012E"
},
"storagepool": {
Expand Down Expand Up @@ -430,11 +439,13 @@
},
"vm_migrate": {
"type": "object",
"required": [
"remote_host"
],
"properties": {
"remote_host": {
"description": "IP address or hostname of the remote server",
"type": "string",
"required": true,
"minLength": 1,
"error": "KCHVM0060E"
},
Expand All @@ -459,21 +470,23 @@
},
"networks_create": {
"type": "object",
"required": [
"name",
"connection"
],
"error": "KCHNET0016E",
"properties": {
"name": {
"description": "The name of the new network",
"type": "string",
"minLength": 1,
"pattern": "^[^/\"]*$",
"required": true,
"error": "KCHNET0011E"
},
"connection": {
"description": "Specifies how this network should be connected to the other networks",
"type": "string",
"pattern": "^isolated|nat|bridge|macvtap|vepa|passthrough$",
"required": true,
"error": "KCHNET0012E"
},
"subnet": {
Expand Down Expand Up @@ -529,13 +542,15 @@
},
"vmifaces_create": {
"type": "object",
"required": [
"type"
],
"error": "KCHVMIF0007E",
"properties": {
"type": {
"description": "The type of VM network interface that libvirt supports. Type 'macvtap' for host network interface (Ethernet, Bond, VLAN) to be connected as direct MacVTap or 'ovs' for openvswitch host network interface to be connected as virtual switch to a VM or 'network' for libvirt virtual network to be connected to VM. ",
"type": "string",
"pattern": "^network|macvtap|ovs$",
"required": true,
"error": "KCHVMIF0004E"
},
"network": {
Expand Down Expand Up @@ -582,6 +597,9 @@
},
"templates_create": {
"type": "object",
"required": [
"source_media"
],
"error": "KCHTMPL0016E",
"properties": {
"name": {
Expand Down Expand Up @@ -612,21 +630,22 @@
"memory": { "$ref": "#/kimchitype/memory" },
"source_media": {
"type" : "object",
"required": [
"type"
],
"properties" : {
"type": {
"description": "Type of source media: disk or netboot",
"type": "string",
"pattern": "^disk|netboot$",
"required": true
"pattern": "^disk|netboot$"
},
"path": {
"description": "Path for installation media (ISO, disk, remote ISO)",
"type": "string",
"pattern" : "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$"
}
},
"additionalProperties": false,
"required": true
"additionalProperties": false
},
"disks": {
"description": "List of disks",
Expand Down Expand Up @@ -728,13 +747,15 @@
},
"vmstorages_create": {
"type": "object",
"required": [
"type"
],
"error": "KCHVMSTOR0012E",
"properties": {
"type": {
"description": "The storage type",
"type": "string",
"pattern": "^cdrom|disk$",
"required": true,
"error": "KCHVMSTOR0002E"
},
"pool": {
Expand All @@ -759,13 +780,15 @@
},
"vmstorage_update": {
"type": "object",
"required": [
"path"
],
"error": "KCHVMSTOR0013E",
"properties": {
"path": {
"description": "Path of iso image file or disk mount point",
"type": "string",
"pattern": "^(|(/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
"required": true,
"error": "KCHVMSTOR0003E"
}
},
Expand Down Expand Up @@ -909,12 +932,14 @@
},
"vmhostdevs_create": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "Then name of the device to assign to VM",
"type": "string",
"pattern": "^[_A-Za-z0-9-]+$",
"required": true,
"error": "KCHVMHDEV0004E"
}
},
Expand Down
38 changes: 0 additions & 38 deletions IBM-license-blacklist

This file was deleted.

2 changes: 0 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ check-local:
git grep --cached -Il '' | grep -v '^ui/spice-html5/' | \
xargs egrep '.* +$$' \
&& echo "ERROR: Whitespaces found" || echo "Ok"; \
echo "IBM copyright year verification ..." ; \
/bin/bash ../../../../check-IBM-license-header.sh ; \
fi;
@if [ -f $(RPMLINT) ]; then \
./check_spec_errors.sh; \
Expand Down
1 change: 0 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
# 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

from wok.plugins.kimchi.root import Kimchi
__all__ = [Kimchi]
6 changes: 3 additions & 3 deletions config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ config = get_config()
def find_qemu_binary(find_emulator=False):
try:
connect = libvirt.open(None)
except Exception, e:
except Exception as e:
raise Exception("Unable to get qemu binary location: %s" % e)
try:
xml = connect.getCapabilities()
Expand All @@ -96,7 +96,7 @@ def find_qemu_binary(find_emulator=False):
/domain[@type='kvm']/emulator" % arch
res = xpath_get_text(xml, expr)
location = res[0]
except Exception, e:
except Exception as e:
raise Exception("Unable to get qemu binary location: %s" % e)
finally:
connect.close()
Expand Down Expand Up @@ -175,7 +175,7 @@ class KimchiConfig(PluginConfig):
'tools.staticdir.dir':
get_virtviewerfiles_path(),
'tools.staticdir.on': True}}
for uri, data in static_config.iteritems():
for uri, data in static_config.items():
custom_config[uri] = {'tools.nocache.on': True,
'tools.wokauth.on': True}
path = data['path']
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ AS_IF([test "x$PACKAGE_RELEASE" = x],

AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wno-portability])
AM_PATH_PYTHON([2.6])
AM_PATH_PYTHON([3.6])
AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
AC_PATH_PROG([GIT], [git], [/usr/bin/git])
AC_PATH_PROG([RPMLINT], [rpmlint], [/usr/bin/rpmlint])
Expand Down
Loading

0 comments on commit 686e45b

Please sign in to comment.