[PATCH v4] Remove debug report's file path from UI
by Mark Wu
Now the file path displayed on UI is "/data/debugreports/<reportname>/",
It's misleading because people could assume it's path on file system,
but it's the uri path in fact. We don't need expose the URI path because
the download button can help user to get the file. So this patch removes
it from UI. And this patch also renames debug report's 'file' attribute
to 'uri', because we use it to represent the download uri path.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
v3 -> v4: Update mockmodel accordingly.
docs/API.md | 2 +-
src/kimchi/control/debugreports.py | 2 +-
src/kimchi/mockmodel.py | 2 +-
src/kimchi/model/debugreports.py | 2 +-
ui/css/theme-default/host.css | 4 ----
ui/js/src/kimchi.host.js | 4 ----
ui/pages/i18n.html.tmpl | 1 -
7 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 672ef14..105498a 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -672,7 +672,7 @@ specific to the low level collection tool being used.
* **GET**: Retrieve the full description of Debug Report
* name: The debug report name used to identify the report
- * file: The debug report file name used to identify the report
+ * uri: The URI path to download a debug report
* time: The time when the debug report is created
* **DELETE**: Remove the Debug Report
diff --git a/src/kimchi/control/debugreports.py b/src/kimchi/control/debugreports.py
index 9922cfa..6efae23 100644
--- a/src/kimchi/control/debugreports.py
+++ b/src/kimchi/control/debugreports.py
@@ -37,7 +37,7 @@ class DebugReport(Resource):
@property
def data(self):
return {'name': self.ident,
- 'file': self.info['file'],
+ 'uri': self.info['uri'],
'time': self.info['ctime']}
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 743c7c6..3690776 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -311,7 +311,7 @@ class MockModel(object):
ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
file_target = os.path.split(file_target)[-1]
file_target = os.path.join("/data/debugreports", file_target)
- return {'file': file_target,
+ return {'uri': file_target,
'ctime': ctime}
def debugreportcontent_lookup(self, name):
diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
index c6e698b..6ae282a 100644
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -162,7 +162,7 @@ class DebugReportModel(object):
ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
file_target = os.path.split(file_target)[-1]
file_target = os.path.join("/data/debugreports", file_target)
- return {'file': file_target,
+ return {'uri': file_target,
'ctime': ctime}
def delete(self, name):
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 0f8b941..8af34f5 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -215,14 +215,10 @@
}
.debug-report-name,
-.debug-report-file,
.debug-report-time {
width: 200px;
}
-.debug-report-file {
- width: 300px;
-}
/* End of Debug Report */
/* Software Updates */
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6300f37..fa7b4c8 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -186,10 +186,6 @@ kimchi.host_main = function() {
label: i18n['KCHDR6003M'],
'class': 'debug-report-name'
}, {
- name: 'file',
- label: i18n['KCHDR6004M'],
- 'class': 'debug-report-file'
- }, {
name: 'time',
label: i18n['KCHDR6005M'],
'class': 'debug-report-time'
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 2f47e50..a626759 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -92,7 +92,6 @@ var i18n = {
'KCHDR6001M': "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")",
'KCHDR6002M': "$_("Debug Reports")",
'KCHDR6003M': "$_("Name")",
- 'KCHDR6004M': "$_("File Path")",
'KCHDR6005M': "$_("Generated Time")",
'KCHDR6006M': "$_("Generate")",
'KCHDR6007M': "$_("Generating...")",
--
1.8.4.2
10 years, 6 months
[PATCH V2 0/2] Fix non persistent network handling
by Rodrigo Trujillo
V2:
Address Ming comments:
- Updates API.md
- remove useless comments and return
V1:
Kimchi networks have the same problem storage had. Non persistent
networks are not stop, they are removed by libvirt and this causes
an error in Kimchi.
Rodrigo Trujillo (2):
Fix non persistent network handling (backend)
Fix non persistent network handling (frontend)
docs/API.md | 2 ++
src/kimchi/control/networks.py | 3 ++-
src/kimchi/model/networks.py | 3 ++-
ui/js/src/kimchi.network.js | 55 ++++++++++++++++++++++++++++--------------
ui/pages/i18n.html.tmpl | 1 +
5 files changed, 44 insertions(+), 20 deletions(-)
--
1.8.5.3
10 years, 6 months
[PATCH] Issue#349: Software Update Grid Keeps Loading when Error Returns
by Hongliang Wang
Software update grid keeps loading on UI when server returns 500 error.
Instead, we shall remove the loading UI and add a message UI to let the
user know something is wrong, as well as add a button to allow the user
retry.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/grid.css | 20 +++++++++++++
ui/js/src/kimchi.api.js | 4 +--
ui/js/src/kimchi.grid.js | 66 +++++++++++++++++++++++++++++++++----------
ui/js/src/kimchi.host.js | 11 +++++++-
ui/pages/i18n.html.tmpl | 5 ++++
5 files changed, 87 insertions(+), 19 deletions(-)
diff --git a/ui/css/theme-default/grid.css b/ui/css/theme-default/grid.css
index 44ae614..684dd7b 100644
--- a/ui/css/theme-default/grid.css
+++ b/ui/css/theme-default/grid.css
@@ -239,3 +239,23 @@
height: 48px;
width: 49px;
}
+
+.grid-message {
+ background: white;
+ box-sizing: border-box;
+ bottom: 0;
+ left: 0;
+ overflow: auto;
+ padding: .2em .5em;
+ position: absolute;
+ right: 0;
+ z-index: 5;
+}
+
+.grid-message-text {
+ line-height: 25px;
+}
+
+.retry-button {
+ margin: 0 1em;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 4310435..11f83df 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -838,10 +838,8 @@ var kimchi = {
}, 200);
break;
case 'finished':
- suc(result);
- break;
case 'failed':
- err(result);
+ suc(result);
break;
default:
break;
diff --git a/ui/js/src/kimchi.grid.js b/ui/js/src/kimchi.grid.js
index 540f1ba..f35228d 100644
--- a/ui/js/src/kimchi.grid.js
+++ b/ui/js/src/kimchi.grid.js
@@ -62,6 +62,18 @@ kimchi.widget.Grid = function(params) {
'</div>',
'</div>',
'</div>',
+ '<div class="grid-message hidden">',
+ '<div class="grid-message-text">',
+ i18n['KCHGRD6002M'],
+ '<button class="retry-button btn-small">',
+ i18n['KCHGRD6003M'],
+ '</button>',
+ '</div>',
+ '<div class="detailed-title">',
+ i18n['KCHGRD6004M'],
+ '</div>',
+ '<div class="detailed-text"></div>',
+ '</div>',
'</div>'
];
@@ -161,6 +173,9 @@ kimchi.widget.Grid = function(params) {
var maskNode = $('.grid-mask', gridNode);
maskNode.css('top', captionHeight + 'px');
+ var messageNode = $('.grid-message', gridNode);
+ messageNode.css('top', captionHeight + 'px');
+
var fillBody = function(container, fields, data) {
var tbody = ($('tbody', container).length && $('tbody', container))
|| $('<tbody></tbody>').appendTo(container);
@@ -384,28 +399,49 @@ kimchi.widget.Grid = function(params) {
$('body').on('mousemove', positionResizer);
$('body').on('mouseup', endResizing);
+ this.showMessage = function(msg) {
+ $('.detailed-text', messageNode).text(msg);
+ $(messageNode).removeClass('hidden');
+ };
+
+ this.hideMessage = function() {
+ $(messageNode).addClass('hidden');
+ };
+
this.destroy = function() {
$('body').off('mousemove', positionResizer);
$('body').off('mouseup', endResizing);
};
var data = params['data'];
- if(!data) {
- return;
- }
+ var self = this;
+ var reload = function() {
+ if(!data) {
+ return;
+ }
- if($.isArray(data)) {
- this.setData(data);
- return;
- }
+ $(messageNode).addClass('hidden');
- if($.isFunction(data)) {
- var self = this;
- var loadData = data;
- maskNode.removeClass('hidden');
- loadData(function(data) {
+ if($.isArray(data)) {
self.setData(data);
- maskNode.addClass('hidden');
- });
- }
+ return;
+ }
+
+ if($.isFunction(data)) {
+ var loadData = data;
+ maskNode.removeClass('hidden');
+ loadData(function(data) {
+ self.setData(data);
+ maskNode.addClass('hidden');
+ });
+ }
+ };
+
+ var reloadButton = $('.retry-button', gridNode);
+ $(reloadButton).on('click', function(event) {
+ reload();
+ });
+
+ this.reload = reload;
+ reload();
};
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6e4678f..2990cdd 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -57,7 +57,9 @@ kimchi.host_main = function() {
kimchi.topic('kimchi/softwareUpdated').publish({
result: result
});
- }, function(result) {
+ }, function(error) {
+ var message = error && error['responseJSON'] && error['responseJSON']['reason'];
+ kimchi.message.error(message || i18n['KCHUPD6009M']);
$(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
}, reloadProgressArea);
}
@@ -100,6 +102,13 @@ kimchi.host_main = function() {
var updateButton = $('#' + softwareUpdatesGridID + '-update-button');
$(updateButton).prop('disabled', softwareUpdates.length === 0);
+ }, function(error) {
+ var message = error && error['responseJSON'] && error['responseJSON']['reason'];
+ if($.isFunction(gridCallback)) {
+ gridCallback([]);
+ }
+ softwareUpdatesGrid &&
+ softwareUpdatesGrid.showMessage(message || i18n['KCHUPD6008M']);
});
};
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 2f47e50..362cde2 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -60,6 +60,9 @@ var i18n = {
'KCHAPI6006M': "$_("Warning")",
'KCHGRD6001M': "$_("Loading...")",
+ 'KCHGRD6002M': "$_("Operation failed.")",
+ 'KCHGRD6003M': "$_("Retry")",
+ 'KCHGRD6004M': "$_("Detailed message:")",
'KCHTMPL6001W': "$_("No iso found")",
@@ -87,6 +90,8 @@ var i18n = {
'KCHUPD6005M': "$_("Repository")",
'KCHUPD6006M': "$_("Update All")",
'KCHUPD6007M': "$_("Updating...")",
+ 'KCHUPD6008M': "$_("Failed to retrieve updates.")",
+ 'KCHUPD6009M': "$_("Failed to update package(s).")",
'KCHDR6001M': "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")",
--
1.8.1.4
10 years, 6 months
[PATCH] Fix build dependency of pep8
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
On fresh installation,
make check will fail because of lack of pep8 checker.
Add it to build dependency.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
contrib/DEBIAN/control.in | 1 +
contrib/kimchi.spec.fedora.in | 1 +
contrib/kimchi.spec.suse.in | 1 +
docs/README.md | 7 ++++---
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index c2b2a40..0a730b6 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -24,6 +24,7 @@ Depends: python-cherrypy3 (>= 3.2.0),
open-iscsi,
firewalld
Build-Depends: libxslt,
+ pep8,
python-libxml2
Maintainer: Aline Manera <alinefm(a)br.ibm.com>
Description: Kimchi web server
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index bf80104..18bd369 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -31,6 +31,7 @@ Requires: nfs-utils
Requires: iscsi-initiator-utils
BuildRequires: libxslt
BuildRequires: libxml2-python
+BuildRequires: python-pep8
%if 0%{?rhel} == 6
Requires: python-ordereddict
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index cba0899..efbb876 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -27,6 +27,7 @@ Requires: nfs-client
Requires: open-iscsi
BuildRequires: libxslt-tools
BuildRequires: python-libxml2
+BuildRequires: python-pep8
%if 0%{?sles_version} == 11
Requires: python-ordereddict
diff --git a/docs/README.md b/docs/README.md
index 8b8b181..9875ee1 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -53,7 +53,8 @@ Install Dependencies
PyPAM m2crypto python-jsonschema rpm-build \
qemu-kvm python-psutil python-ethtool sos \
python-ipaddr python-lxml nfs-utils \
- iscsi-initiator-utils libxslt pyparted
+ iscsi-initiator-utils libxslt pyparted \
+ python-pep8
# If using RHEL6, install the following additional packages:
$ sudo yum install python-unittest2 python-ordereddict
# Restart libvirt to allow configuration changes to take effect
@@ -75,7 +76,7 @@ for more information on how to configure your system to access this repository.
python-pam python-m2crypto python-jsonschema \
qemu-kvm libtool python-psutil python-ethtool \
sosreport python-ipaddr python-lxml nfs-common \
- open-iscsi lvm2 xsltproc python-parted
+ open-iscsi lvm2 xsltproc python-parted pep8
Packages version requirement:
python-jsonschema >= 1.3.0
@@ -89,7 +90,7 @@ for more information on how to configure your system to access this repository.
python-pam python-M2Crypto python-jsonschema \
rpm-build kvm python-psutil python-ethtool \
python-ipaddr python-lxml nfs-client open-iscsi \
- libxslt-tools python-xml python-parted
+ libxslt-tools python-xml python-parted python-pep8
Packages version requirement:
python-psutil >= 0.6.0
--
1.8.3.2
10 years, 6 months
2 errors on rhel7 beta
by Sheldon
1. can not install python-cheetah for missing Dependency.
1.
--> Finished Dependency Resolution
2.
Error: Package: python-cheetah-2.4.4-4.el7.x86_64 (epel)
3.
Requires: python-pygments
4.
You could try using --skip-broken to work around the problem
5.
You could try running: rpm -Va --nofiles --nodigest
I just install epel and cdrom repo.
2. can not start kimchid first time, restart kimchid again, it can works.
1.
sudo ./src/kimchid
2.
libvirt: Storage Driver error : Storage pool not found: no storage
pool with matching name 'default'
3.
Loading YumUpdate features.
4.
Loaded plugins: langpacks, product-id
5.
libvirt: Network Driver error : Network not found: no network with
matching name 'default'
6.
libvirt: Network Driver error : Failed to create symlink
'/etc/libvirt/qemu/networks/autostart/default.xml' to
'/etc/libvirt/qemu/networks/default.xml': File exists
7.
Fatal: Cannot create default network because of KCHNET0008E: Unable
to create network default. Details: Failed to create symlink
'/etc/libvirt/qemu/networks/autostart/default.xml' to
'/etc/libvirt/qemu/networks/default.xml': File exists, exit kimchid
I run kimchi on nested kimchi. check the default network address, kimchi
lookup 192.168.123.0/24 for default, it is different with the
default network address on host.
--
Thanks and best regards!
Sheldon Feng(???)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center
10 years, 6 months
[PATCH] Adds 'in_use' info to API.md
by Rodrigo Trujillo
The network lookup function returns the new field "in_use". API.md was
not updated properly. This patch fixes this.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
docs/API.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/API.md b/docs/API.md
index b8f941a..103d88b 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -485,6 +485,7 @@ A interface represents available interface on host.
* active: The Network is ready for use
* inactive: The Network is not available
* autostart: Network autostart onboot
+ * in_use: Indicates ('true') if some guest is attached to this network
* vms: all vms attached to this network
* subnet: Network segment in slash-separated format with ip address and prefix
* dhcp: DHCP services on the virtual network is enabled.
--
1.8.5.3
10 years, 6 months
[PATCH] Issue#352: Debug Report Section NOT Hidden for Non-root User
by Hongliang Wang
When a non-root user tries to request /debugreports, he will receive
an HTTP 403 error. In this situation, we should hide the section.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.host.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6e4678f..ae2ee7d 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -202,6 +202,7 @@ kimchi.host_main = function() {
var listDebugReports = function() {
kimchi.listReports(function(reports) {
+ $('#debug-report-section').removeClass('hidden');
$.each(reports, function(i, item) {
reports[i]['id'] = i + 1;
});
@@ -211,6 +212,12 @@ kimchi.host_main = function() {
else {
initReportGrid(reports);
}
+ }, function(error) {
+ if(error['status'] == 403) {
+ $('#debug-report-section').addClass('hidden');
+ return;
+ }
+ $('#debug-report-section').removeClass('hidden');
});
};
@@ -281,7 +288,6 @@ kimchi.host_main = function() {
}
if(capabilities['system_report_tool']) {
- $('#debug-report-section').removeClass('hidden');
listDebugReports();
kimchi.topic('kimchi/debugReportAdded')
.subscribe(listDebugReports);
--
1.8.1.4
10 years, 6 months
[PATCH 0/2] Fix non persistent network handling
by Rodrigo Trujillo
Kimchi networks have the same problem storage had. Non persistent
networks are not stop, they are removed by libvirt and this causes
an error in Kimchi.
Rodrigo Trujillo (2):
Fix non persistent network handling (backend)
Fix non persistent network handling (frontend)
src/kimchi/control/networks.py | 3 ++-
src/kimchi/model/networks.py | 9 ++++++-
ui/js/src/kimchi.network.js | 55 ++++++++++++++++++++++++++++--------------
ui/pages/i18n.html.tmpl | 1 +
4 files changed, 48 insertions(+), 20 deletions(-)
--
1.8.5.3
10 years, 6 months
[PATCH 00/10] Fixes on repository management feature
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
This patch set also fixes the issue #336
(https://github.com/kimchi-project/kimchi/issues/336)
In addition to several fixes found in repositories.py
Aline Manera (10):
bug fix: Expose repository management tool name
bug fix: Reorganize repository information
mockmodel: Move specific repository data under 'config'
Update messages used in the repositories management feature
bug fix: Raise exception comming from backend
bug fix: Sort repositories
bug fix: Let package manager tool create the repository ID
bug fix: Do not store internal repository information
Update test cases to reflect the repositories changes
bug fix: Lock yum/apt operations
docs/API.md | 82 +++--
po/en_US.po | 186 ++++++++---
po/kimchi.pot | 177 ++++++++---
po/pt_BR.po | 186 ++++++++---
po/zh_CN.po | 186 ++++++++---
src/kimchi/API.json | 111 ++++---
src/kimchi/config.py.in | 3 +
src/kimchi/control/host.py | 3 +-
src/kimchi/i18n.py | 36 ++-
src/kimchi/mockmodel.py | 145 ++++-----
src/kimchi/model/config.py | 6 +-
src/kimchi/model/host.py | 30 +-
src/kimchi/repositories.py | 730 +++++++++++++++++++-------------------------
src/kimchi/swupdate.py | 7 +
tests/test_model.py | 151 +++++----
tests/test_rest.py | 10 +-
16 files changed, 1188 insertions(+), 861 deletions(-)
--
1.7.10.4
10 years, 6 months
[PATCH v3] VLAN: Do not allow bridge to be the trunk device
by zhshzhou@linux.vnet.ibm.com
From: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
In Linux networking, a usual VLAN + bridge network setup is as the
following.
eth0 |-> eth0.10 -> br10 -> vnet101, vnet102, ...
|-> eth0.20 -> br20 -> vnet201, vnet202, ...
While the eth0 trunk and VLAN interfaces provide the isolation service,
the bridges provide the switching inside the respective VLAN.
It's not very useful to have a bridge device as the trunk because the
VLAN interfaces on a trunk should be isolated.
This patch contains changes to the back-end and front-end.
The back-end checks if the front-end submits an invalid setup to use a
bridge as the VLAN trunk device and raises exception.
Before this patch, if the user creates a bridged network over an
existing bridge with VLAN tag set. The back-end just ignores the VLAN
and creates an ordinary bridged network. After this patch, the back-end
raises an exception with an explanation in this case.
The front-end also checks the currently selected interface type. If the
selected interface is a bridge, it disables the vlan check box,
otherwise it enables the vlan check box.
V2
Add front-end code to disable vlan check box if the selected interface
is a bridge.
V3
Clear the vlan check box and vlan id input box value when disabling them.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/networks.py | 2 ++
ui/js/src/kimchi.network.js | 14 ++++++++++++++
3 files changed, 17 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 589c8cb..b463bd1 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -182,6 +182,7 @@ messages = {
"KCHNET0016E": _("Specify name and type to create a Network"),
"KCHNET0017E": _("Unable to delete network %(name)s. There are some virtual machines and/or templates linked to this network."),
"KCHNET0018E": _("Unable to deactivate network %(name)s. There are some virtual machines and/or templates linked to this network."),
+ "KCHNET0019E": _("Bridge device %(name)s can not be the trunk device of a VLAN."),
"KCHDR0001E": _("Debug report %(name)s does not exist"),
"KCHDR0002E": _("Debug report tool not found in system"),
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 27abd54..7872a73 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -151,6 +151,8 @@ class NetworksModel(object):
raise MissingParameter("KCHNET0004E", {'name': params['name']})
if netinfo.is_bridge(iface):
+ if 'vlan_id' in params:
+ raise InvalidParameter('KCHNET0019E', {'name': iface})
params['bridge'] = iface
elif netinfo.is_bare_nic(iface) or netinfo.is_bonding(iface):
if params.get('vlan_id') is None:
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 7c4bc77..1642b99 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -215,10 +215,24 @@ kimchi.initNetworkDialog = function() {
kimchi.openNetworkDialog = function(okCallback) {
kimchi.getInterfaces(function(result) {
var options = "";
+ var nics = {};
for (var i = 0; i < result.length; i++) {
options += "<option value=" + result[i].name + ">" + result[i].name + "</option>";
+ nics[result[i].name] = result[i];
}
$("#networkInterface").append(options);
+ onChange = function() {
+ if (nics[$("#networkInterface").val()].type === "bridge") {
+ $("#enableVlan").prop("checked", false);
+ $("#enableVlan").prop("disabled", true);
+ $("#networkVlanID").val("");
+ $("#networkVlanID").prop("disabled", true);
+ } else {
+ $("#enableVlan").prop("disabled", false);
+ }
+ };
+ $("#networkInterface").on("change", onChange);
+ onChange();
kimchi.setDefaultNetworkType(result.length!==0);
});
$("#networkConfig").dialog({
--
1.8.5.3
10 years, 6 months