[wok 0/3] Fix code issues pointed by make check-local
by Lucio Correia
Lucio Correia (3):
Fix makefile to ignore Kimchi plugin
Fix unnecessary/duplicated imports
Fix PEP8 errors
Makefile.am | 2 +-
plugins/kimchi/config.py.in | 1 -
plugins/kimchi/mockmodel.py | 19 +-
plugins/kimchi/model/config.py | 2 +-
plugins/kimchi/model/cpuinfo.py | 2 +-
plugins/kimchi/model/debugreports.py | 2 +-
plugins/kimchi/model/diskutils.py | 4 +-
plugins/kimchi/model/hostdev.py | 4 +-
plugins/kimchi/model/libvirtconnection.py | 12 +-
plugins/kimchi/model/networks.py | 3 +-
plugins/kimchi/model/peers.py | 4 +-
plugins/kimchi/model/storagepools.py | 13 +-
plugins/kimchi/model/storagevolumes.py | 9 +-
plugins/kimchi/model/vms.py | 32 ++-
plugins/kimchi/model/vmstorages.py | 6 +-
plugins/kimchi/osinfo.py | 1 -
plugins/kimchi/root.py | 1 -
plugins/kimchi/screenshot.py | 2 +-
plugins/kimchi/tests/test_authorization.py | 36 ++-
plugins/kimchi/tests/test_config.py.in | 8 +-
plugins/kimchi/tests/test_exception.py | 26 ++-
plugins/kimchi/tests/test_host.py | 30 ++-
plugins/kimchi/tests/test_mock_network.py | 4 +-
plugins/kimchi/tests/test_mock_storagepool.py | 12 +-
plugins/kimchi/tests/test_mock_storagevolume.py | 8 +-
plugins/kimchi/tests/test_mockmodel.py | 6 +-
plugins/kimchi/tests/test_model.py | 24 +-
plugins/kimchi/tests/test_model_network.py | 8 +-
plugins/kimchi/tests/test_model_storagepool.py | 20 +-
plugins/kimchi/tests/test_model_storagevolume.py | 18 +-
plugins/kimchi/tests/test_plugin.py | 1 -
plugins/kimchi/tests/test_rest.py | 318 ++++++++++++++-------
plugins/kimchi/tests/test_template.py | 61 +++--
plugins/kimchi/tests/utils.py | 8 +-
plugins/kimchi/utils.py | 1 -
src/wok/cachebust.py | 2 +-
src/wok/server.py | 11 +-
src/wok/utils.py | 6 +-
38 files changed, 466 insertions(+), 261 deletions(-)
9 years, 3 months
[wok V3 0/6] Make wok branch identical to wok V3
by Lucio Correia
These changes are already included in "[PATCH V3 00/34] Split code into Wok
server and Kimchi plugin" and don't need to be reviewed again.
This patchset is just to make the upstream branch "wok" identical to
"[PATCH V3 00/34] Split code into Wok server and Kimchi plugin".
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
Lucio Correia (6):
Move back some basic UI files to wok
Renamed some moved-back kimchi-named files to wok
Unduplicate some UI files
Update makefiles to reflect UI changes
Replace kimchi by wok calls to reflect UI changes
Create an icon.css with kimchi plugin specific layout
plugins/kimchi/configure.ac | 4 -
plugins/kimchi/ui/Makefile.am | 2 +-
plugins/kimchi/ui/css/theme-default/button.css | 524 --------------------
plugins/kimchi/ui/css/theme-default/icon.css | 106 ++++
plugins/kimchi/ui/css/theme-default/message.css | 135 -----
plugins/kimchi/ui/css/theme-default/popover.css | 124 -----
plugins/kimchi/ui/images/theme-default/bg-mask.png | Bin 2899 -> 0 bytes
.../ui/images/theme-default/folder-arrow-down.png | Bin 2956 -> 0 bytes
.../kimchi/ui/images/theme-default/logo-white.png | Bin 9879 -> 0 bytes
plugins/kimchi/ui/js/Makefile.am | 4 +-
.../ui/js/src/kimchi.guest_storage_add.main.js | 4 +-
plugins/kimchi/ui/js/src/kimchi.host.js | 14 +-
.../kimchi/ui/js/src/kimchi.template_edit_main.js | 4 +-
plugins/kimchi/ui/libs/Makefile.am | 22 -
plugins/kimchi/ui/libs/themes/Makefile.am | 18 -
plugins/kimchi/ui/libs/themes/base/Makefile.am | 22 -
.../kimchi/ui/libs/themes/base/images/Makefile.am | 20 -
.../ui-bg_diagonals-thick_18_b81900_40x40.png | Bin 457 -> 0 bytes
.../ui-bg_diagonals-thick_20_666666_40x40.png | Bin 351 -> 0 bytes
.../base/images/ui-bg_flat_10_000000_40x100.png | Bin 244 -> 0 bytes
.../base/images/ui-bg_glass_100_f6f6f6_1x400.png | Bin 301 -> 0 bytes
.../base/images/ui-bg_glass_100_fdf5ce_1x400.png | Bin 387 -> 0 bytes
.../images/ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 5854 -> 0 bytes
.../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 317 -> 0 bytes
.../ui-bg_highlight-soft_75_ffe45c_1x100.png | Bin 367 -> 0 bytes
.../themes/base/images/ui-icons_228ef1_256x240.png | Bin 4599 -> 0 bytes
.../themes/base/images/ui-icons_ef8c08_256x240.png | Bin 4599 -> 0 bytes
.../themes/base/images/ui-icons_ffd27a_256x240.png | Bin 4599 -> 0 bytes
.../themes/base/images/ui-icons_ffffff_256x240.png | Bin 6468 -> 0 bytes
plugins/kimchi/ui/pages/error.html.tmpl | 69 ---
ui/css/theme-default/button.css | 85 ----
.../ui => ui}/css/theme-default/circleGauge.css | 0
.../kimchi/ui => ui}/css/theme-default/form.css | 0
.../kimchi/ui => ui}/css/theme-default/grid.css | 2 +-
.../css/theme-default/jquery-ui.custom.css | 0
.../ui => ui}/css/theme-default/line-chart.css | 0
.../ui => ui}/css/theme-default/tile-check.css | 0
.../kimchi/ui => ui}/css/theme-default/toolbar.css | 0
.../ui => ui}/images/theme-default/alert.png | Bin 3537 -> 3537 bytes
ui/images/theme-default/arrow-down.png | Bin 0 -> 537 bytes
.../ui => ui}/images/theme-default/check-green.png | Bin 3501 -> 3501 bytes
.../ui => ui}/images/theme-default/check-grey.png | Bin 3535 -> 3535 bytes
.../images/theme-default/folder-arrow-right.png | Bin 2958 -> 2958 bytes
.../ui => ui}/images/theme-default/icon-alert.png | Bin 3545 -> 3545 bytes
.../ui => ui}/images/theme-default/icon-event.png | Bin 3791 -> 3791 bytes
.../images/theme-default/icon-setting.png | Bin 3664 -> 3664 bytes
.../ui => ui}/images/theme-default/icon-tool.png | Bin 4466 -> 4466 bytes
.../ui => ui}/images/theme-default/thumb-guest.png | Bin 3896 -> 3896 bytes
.../ui => ui}/images/theme-default/thumb-host.png | Bin 5069 -> 5069 bytes
.../images/theme-default/wok-loading.gif | Bin 6181 -> 6181 bytes
.../js/src/kimchi.form.js => ui/js/src/wok.form.js | 0
.../js/src/kimchi.grid.js => ui/js/src/wok.grid.js | 10 +-
.../js/src/wok.line-chart.js | 4 +-
.../kimchi.select.js => ui/js/src/wok.select.js | 2 +-
.../kimchi/ui => ui}/js/widgets/circleGauge.js | 4 +-
.../base/images/ui-bg_glass_65_ffffff_1x400.png | Bin 246 -> 246 bytes
.../themes/base/images/ui-icons_222222_256x240.png | Bin 7006 -> 7006 bytes
57 files changed, 131 insertions(+), 1048 deletions(-)
delete mode 100644 plugins/kimchi/ui/css/theme-default/button.css
create mode 100644 plugins/kimchi/ui/css/theme-default/icon.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/message.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/popover.css
delete mode 100644 plugins/kimchi/ui/images/theme-default/bg-mask.png
delete mode 100644 plugins/kimchi/ui/images/theme-default/folder-arrow-down.png
delete mode 100644 plugins/kimchi/ui/images/theme-default/logo-white.png
delete mode 100644 plugins/kimchi/ui/libs/Makefile.am
delete mode 100644 plugins/kimchi/ui/libs/themes/Makefile.am
delete mode 100644 plugins/kimchi/ui/libs/themes/base/Makefile.am
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/Makefile.am
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_diagonals-thick_18_b81900_40x40.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_diagonals-thick_20_666666_40x40.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_flat_10_000000_40x100.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_glass_100_f6f6f6_1x400.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_glass_100_fdf5ce_1x400.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_gloss-wave_35_f6a828_500x100.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-icons_228ef1_256x240.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-icons_ef8c08_256x240.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-icons_ffd27a_256x240.png
delete mode 100644 plugins/kimchi/ui/libs/themes/base/images/ui-icons_ffffff_256x240.png
delete mode 100644 plugins/kimchi/ui/pages/error.html.tmpl
rename {plugins/kimchi/ui => ui}/css/theme-default/circleGauge.css (100%)
rename {plugins/kimchi/ui => ui}/css/theme-default/form.css (100%)
rename {plugins/kimchi/ui => ui}/css/theme-default/grid.css (98%)
rename {plugins/kimchi/ui => ui}/css/theme-default/jquery-ui.custom.css (100%)
rename {plugins/kimchi/ui => ui}/css/theme-default/line-chart.css (100%)
rename {plugins/kimchi/ui => ui}/css/theme-default/tile-check.css (100%)
rename {plugins/kimchi/ui => ui}/css/theme-default/toolbar.css (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/alert.png (100%)
create mode 100644 ui/images/theme-default/arrow-down.png
rename {plugins/kimchi/ui => ui}/images/theme-default/check-green.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/check-grey.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/folder-arrow-right.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/icon-alert.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/icon-event.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/icon-setting.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/icon-tool.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/thumb-guest.png (100%)
rename {plugins/kimchi/ui => ui}/images/theme-default/thumb-host.png (100%)
rename plugins/kimchi/ui/images/theme-default/kimchi-loading.gif => ui/images/theme-default/wok-loading.gif (100%)
rename plugins/kimchi/ui/js/src/kimchi.form.js => ui/js/src/wok.form.js (100%)
rename plugins/kimchi/ui/js/src/kimchi.grid.js => ui/js/src/wok.grid.js (98%)
rename plugins/kimchi/ui/js/src/kimchi.line-chart.js => ui/js/src/wok.line-chart.js (98%)
rename plugins/kimchi/ui/js/src/kimchi.select.js => ui/js/src/wok.select.js (97%)
rename {plugins/kimchi/ui => ui}/js/widgets/circleGauge.js (97%)
rename {plugins/kimchi/ui => ui}/libs/themes/base/images/ui-bg_glass_65_ffffff_1x400.png (100%)
rename {plugins/kimchi/ui => ui}/libs/themes/base/images/ui-icons_222222_256x240.png (100%)
9 years, 3 months
[PATCH 0/4] Improve VM CPU update code
by Crístian Deives
This patchset refactors part of the code related to updating VM CPUs.
I am aware of two tests which are failing with this patchset. They'll be worked
on before the final version.
Crístian Deives (4):
Use locks to prevent concurrent updates to VMs
Update VCPU by using libvirt function
Set max VCPU count to the max supported value
Check if the VM update params are valid for the current state
src/kimchi/i18n.py | 3 ++-
src/kimchi/mockmodel.py | 48 ++++++++++++++------------------------
src/kimchi/model/vms.py | 62 ++++++++++++++++++++++++++++++++++++++-----------
tests/test_rest.py | 3 ++-
4 files changed, 71 insertions(+), 45 deletions(-)
--
2.4.3
9 years, 3 months
[PATCH] Disallow storage format changes in UI for templates based on image file
by Jose Ricardo Ziviani
- Only support qcow2 for VMs created by a template based on an existing
image file. This commit sets the template format type to qcow2 and
disables changes on it for such scenario.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.template_edit_main.js | 37 +++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 21f5575..141e451 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -58,6 +58,14 @@ kimchi.template_edit_main = function() {
kimchi.select('template-edit-graphics-list', spiceOpt);
}
};
+ var isImageBasedTemplate = function() {
+ if (template["vm-image"] &&
+ typeof template["vm-image"] == "string" &&
+ template["vm-image"].substr(template["vm-image"].length - 4) == ".img") {
+ return true;
+ }
+ return false;
+ }
enableSpice();
var initStorage = function(result) {
var scsipools = {};
@@ -88,10 +96,16 @@ kimchi.template_edit_main = function() {
$('#selectStorageName').append(storageOptions);
// Set disk format
- $('#diskFormat').val(storageData.storageDiskFormat);
- $('#diskFormat').on('change', function() {
- $('.template-storage-disk-format').val($(this).val());
- });
+ if (isImageBasedTemplate()) {
+ $('#diskFormat').val('qcow2');
+ $('#diskFormat').prop('disabled', 'disabled');
+ }
+ else {
+ $('#diskFormat').val(storageData.storageDiskFormat);
+ $('#diskFormat').on('change', function() {
+ $('.template-storage-disk-format').val($(this).val());
+ });
+ }
$('#selectStorageName').change(function() {
var selectedItem = $(this).parent().parent();
@@ -106,16 +120,21 @@ kimchi.template_edit_main = function() {
kimchi.getStoragePoolVolume(tempStorageName, tempName[tempName.length-1], function(info) {
volSize = info.capacity / Math.pow(1024, 3);
$('.template-storage-disk', selectedItem).attr('readonly', true).val(volSize);
- $('#diskFormat').val('raw');
- $('#diskFormat').prop('disabled', true).change();
+ if (!isImageBasedTemplate()) {
+ $('#diskFormat').val('raw');
+ $('#diskFormat').prop('disabled', true).change();
+ }
});
} else if (tempType === 'logical') {
$('.template-storage-disk', selectedItem).attr('readonly', false);
- $('#diskFormat').val('raw');
- $('#diskFormat').prop('disabled', true).change();
+ if (!isImageBasedTemplate()) {
+ $('#diskFormat').val('raw');
+ $('#diskFormat').prop('disabled', true).change();
+ }
} else {
$('.template-storage-disk', selectedItem).attr('readonly', false);
- if ($('#diskFormat').prop('disabled') == true) {
+ if ($('#diskFormat').prop('disabled') == true &&
+ !isImageBasedTemplate()) {
$('#diskFormat').val('qcow2');
$('#diskFormat').prop('disabled', false).change();
}
--
1.9.1
9 years, 3 months
[PATCH v2] Issues #682/#684/#685: Change some code errors when start, shutdown or poweroff vms
by Ramon Medeiros
Changes:
v2:
Fix pep8 issues
When trying to start a running vm, shutoff or poweroff a shutdown vm,
the retrieved error was 500 (Internal Server Error). A better error
would be 400 (Invalid Request).
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 106e9bc..9dfd9fe 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -1105,24 +1105,36 @@ class VMModel(object):
try:
dom.create()
except libvirt.libvirtError as e:
- raise OperationFailed("KCHVM0019E",
- {'name': name, 'err': e.get_error_message()})
+ # vm already running: return error 403
+ error_params = {'name': name, 'err': e.get_error_message()}
+ if DOM_STATE_MAP[dom.info()[0]] == "running":
+ raise InvalidOperation("KCHVM0019E", error_params)
+ else:
+ raise OperationFailed("KCHVM0019E", error_params)
def poweroff(self, name):
dom = self.get_vm(name, self.conn)
try:
dom.destroy()
except libvirt.libvirtError as e:
- raise OperationFailed("KCHVM0020E",
- {'name': name, 'err': e.get_error_message()})
+ # vm already powered off: return error 403
+ error_params = {'name': name, 'err': e.get_error_message()}
+ if DOM_STATE_MAP[dom.info()[0]] == "shutoff":
+ raise InvalidOperation("KCHVM0020E", error_params)
+ else:
+ raise OperationFailed("KCHVM0020E", error_params)
def shutdown(self, name):
dom = self.get_vm(name, self.conn)
try:
dom.shutdown()
except libvirt.libvirtError as e:
- raise OperationFailed("KCHVM0029E",
- {'name': name, 'err': e.get_error_message()})
+ # vm already powered off: return error 403
+ error_params = {'name': name, 'err': e.get_error_message()}
+ if DOM_STATE_MAP[dom.info()[0]] == "shutoff":
+ raise InvalidOperation("KCHVM0029E", error_params)
+ else:
+ raise OperationFailed("KCHVM0029E", error_params)
def reset(self, name):
dom = self.get_vm(name, self.conn)
--
2.1.0
9 years, 3 months
[PATCH 0/2] Issues #682/#684/#685: Change some code errors when start, shutdown or poweroff vms
by Ramon Medeiros
Changes:
v3:
Added tests
v2:
Fixed pep8 issues
Ramon Medeiros (2):
Issues #682/#684/#685: Change some code errors when start, shutdown or
poweroff vms
Add unity tests for start/shutdown/poweroff response commands
src/kimchi/i18n.py | 4 ++++
src/kimchi/model/vms.py | 20 ++++++++++++++++++++
tests/test_rest.py | 12 ++++++++++++
3 files changed, 36 insertions(+)
--
2.1.0
9 years, 3 months
[PATCH 0/2 v4] Issues #682/#684/#685: Change some code errors when start, shutdown or poweroff vms
by Ramon Medeiros
Changes:
v4:
Fixed typo
v3:
Added tests
v2:
Fixed pep8 issues
Ramon Medeiros (2):
Issues #682/#684/#685: Change some code errors when start, shutdown or
poweroff vms
Add unity tests for start/shutdown/poweroff response commands
src/kimchi/i18n.py | 4 ++++
src/kimchi/model/vms.py | 20 ++++++++++++++++++++
tests/test_rest.py | 16 ++++++++++++++++
3 files changed, 40 insertions(+)
--
2.1.0
9 years, 3 months
[PATCH v2] Disallow storage format changes in UI for templates based on image file
by Jose Ricardo Ziviani
- Only support qcow2 for VMs created by a template based on an existing
image file. This commit sets the template format type to qcow2 and
disables changes on it for such scenario.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.template_edit_main.js | 35 +++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 21f5575..5b2fa75 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -58,6 +58,12 @@ kimchi.template_edit_main = function() {
kimchi.select('template-edit-graphics-list', spiceOpt);
}
};
+ var isImageBasedTemplate = function() {
+ if (template["vm-image"] && typeof template["vm-image"] == "string") {
+ return true;
+ }
+ return false;
+ }
enableSpice();
var initStorage = function(result) {
var scsipools = {};
@@ -88,10 +94,16 @@ kimchi.template_edit_main = function() {
$('#selectStorageName').append(storageOptions);
// Set disk format
- $('#diskFormat').val(storageData.storageDiskFormat);
- $('#diskFormat').on('change', function() {
- $('.template-storage-disk-format').val($(this).val());
- });
+ if (isImageBasedTemplate()) {
+ $('#diskFormat').val('qcow2');
+ $('#diskFormat').prop('disabled', 'disabled');
+ }
+ else {
+ $('#diskFormat').val(storageData.storageDiskFormat);
+ $('#diskFormat').on('change', function() {
+ $('.template-storage-disk-format').val($(this).val());
+ });
+ }
$('#selectStorageName').change(function() {
var selectedItem = $(this).parent().parent();
@@ -106,16 +118,21 @@ kimchi.template_edit_main = function() {
kimchi.getStoragePoolVolume(tempStorageName, tempName[tempName.length-1], function(info) {
volSize = info.capacity / Math.pow(1024, 3);
$('.template-storage-disk', selectedItem).attr('readonly', true).val(volSize);
- $('#diskFormat').val('raw');
- $('#diskFormat').prop('disabled', true).change();
+ if (!isImageBasedTemplate()) {
+ $('#diskFormat').val('raw');
+ $('#diskFormat').prop('disabled', true).change();
+ }
});
} else if (tempType === 'logical') {
$('.template-storage-disk', selectedItem).attr('readonly', false);
- $('#diskFormat').val('raw');
- $('#diskFormat').prop('disabled', true).change();
+ if (!isImageBasedTemplate()) {
+ $('#diskFormat').val('raw');
+ $('#diskFormat').prop('disabled', true).change();
+ }
} else {
$('.template-storage-disk', selectedItem).attr('readonly', false);
- if ($('#diskFormat').prop('disabled') == true) {
+ if ($('#diskFormat').prop('disabled') == true &&
+ !isImageBasedTemplate()) {
$('#diskFormat').val('qcow2');
$('#diskFormat').prop('disabled', false).change();
}
--
1.9.1
9 years, 3 months
[PATCH v2] Issue #694: VLAN ID accepting only one digit
by Ramon Medeiros
Changes:
v2:
Correct Issue number on title
Verify vlan name size before adding it. If name greater than 15
characters, display an error.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/networks.py | 3 +++
2 files changed, 4 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 862df7f..2f9c8d2 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -257,6 +257,7 @@ messages = {
"KCHNET0020E": _("Failed to activate interface %(iface)s: %(err)s."),
"KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
"KCHNET0022E": _("Failed to start network %(name)s. Details: %(err)s"),
+ "KCHNET0023E": _("Interface name %(name)s exceeds kernel limit of 15 characters"),
"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 275e12b..03737d1 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -216,6 +216,9 @@ class NetworksModel(object):
if br_name in bridges:
raise InvalidOperation("KCHNET0010E", {'iface': br_name})
+ if len(br_name) > 15:
+ raise InvalidOperation("KCHNET0023E", {'name': br_name})
+
with RollbackContext() as rollback:
try:
vlan_tagged_br = conn.interfaceDefineXML(br_xml, 0)
--
2.1.0
9 years, 3 months
[PATCH] Issue #693: VLAN ID accepting only one digit
by Ramon Medeiros
Verify vlan name size before adding it. If name greater than 15
characters, display an error.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
The size limit of vlan name is defined in kernel headers:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/...
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/networks.py | 3 +++
2 files changed, 4 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 862df7f..2f9c8d2 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -257,6 +257,7 @@ messages = {
"KCHNET0020E": _("Failed to activate interface %(iface)s: %(err)s."),
"KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
"KCHNET0022E": _("Failed to start network %(name)s. Details: %(err)s"),
+ "KCHNET0023E": _("Interface name %(name)s exceeds kernel limit of 15 characters"),
"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 275e12b..03737d1 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -216,6 +216,9 @@ class NetworksModel(object):
if br_name in bridges:
raise InvalidOperation("KCHNET0010E", {'iface': br_name})
+ if len(br_name) > 15:
+ raise InvalidOperation("KCHNET0023E", {'name': br_name})
+
with RollbackContext() as rollback:
try:
vlan_tagged_br = conn.interfaceDefineXML(br_xml, 0)
--
2.1.0
9 years, 3 months