[PATCH] Bug 416 Fix
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.repository_edit_main.js | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.repository_edit_main.js b/ui/js/src/kimchi.repository_edit_main.js
index 20340a4..a9a0ca6 100644
--- a/ui/js/src/kimchi.repository_edit_main.js
+++ b/ui/js/src/kimchi.repository_edit_main.js
@@ -21,10 +21,10 @@ kimchi.repository_edit_main = function() {
var saveButton = $('#repository-edit-button-save');
- if(kimchi.host.capabilities['repo_mngt_tool']=="yum") {
+ if(kimchi.capabilities['repo_mngt_tool']=="yum") {
editForm.find('input.deb').prop('disabled', true);
}
- else if(kimchi.host.capabilities['repo_mngt_tool']=="deb") {
+ else if(kimchi.capabilities['repo_mngt_tool']=="deb") {
editForm.find('input.yum').prop('disabled', true);
}
--
1.7.1
10 years, 3 months
[PATCH] Bug 418 Fix
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.template_add_main.js | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/kimchi.template_add_main.js b/ui/js/src/kimchi.template_add_main.js
index 2d60888..6223c96 100644
--- a/ui/js/src/kimchi.template_add_main.js
+++ b/ui/js/src/kimchi.template_add_main.js
@@ -338,10 +338,12 @@ kimchi.template_add_main = function() {
$('#vm-image-local-box-back').click(function(){
kimchi.switchPage('vm-image-local-box', 'iso-type-box', 'right');
});
- $('input', '#vm-image-local-box').on('keyup', function(){
- var isValid = kimchi.template_check_path($(this).val());
- $(this).toggleClass('invalid-field', !isValid);
- $('button', $('.body', '#vm-image-local-box')).button(isValid ? "enable" : "disable");
+ $('input', '#vm-image-local-box').on('keyup cut paste', function(){
+ setTimeout(function(){
+ var isValid = kimchi.template_check_path($('input', '#vm-image-local-box').val());
+ $('input', '#vm-image-local-box').toggleClass('invalid-field', !isValid);
+ $('button', $('.body', '#vm-image-local-box')).button(isValid ? "enable" : "disable");
+ }, 0);
});
$('button', $('.body', '#vm-image-local-box')).button({
disabled: true
--
1.7.1
10 years, 3 months
[PATCH] Issue #421: Grid Column Header Issue
by Hongliang Wang
In IE, the grid header columns does not aligned with rows in
"Debug Report" and "Software Update".
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index fe097cb..9e9cb01 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -216,7 +216,7 @@
.debug-report-name,
.debug-report-time {
- width: 200px;
+ width: 424px;
}
#id-debug-img {
@@ -234,18 +234,14 @@
width: 850px;
}
-.software-update-id {
- width: 30px;
-}
-
.software-update-name,
.software-update-repos {
- width: 220px;
+ width: 224px;
}
.software-update-version,
.software-update-arch {
- width: 190px;
+ width: 200px;
}
.host-panel #software-updates-progress-textarea {
@@ -274,7 +270,7 @@
}
.host-panel #repositories-grid .repository-enabled {
- width: 92px;
+ width: 88px;
}
.host-panel #repositories-grid .repository-baseurl.deb {
--
1.8.1.4
10 years, 3 months
[PATCH 0/2 v4] guest-storage-add: removing 'Storage Name'
by Daniel Henrique Barboza
These patches removes the option to set the device name of
the attached storage from the UI and backend.
Daniel Henrique Barboza (2):
guest-storage-add: removing "Storage Name" field
guest-storage-add: removing "Storage Name" backend support
docs/API.md | 1 -
po/de_DE.po | 10 ---------
po/en_US.po | 8 --------
po/es_ES.po | 10 ---------
po/fr_FR.po | 10 ---------
po/it_IT.po | 10 ---------
po/ja_JP.po | 10 ---------
po/kimchi.pot | 8 --------
po/ko_KR.po | 9 --------
po/pt_BR.po | 10 ---------
po/ru_RU.po | 10 ---------
po/zh_CN.po | 8 --------
po/zh_TW.po | 8 --------
src/kimchi/API.json | 6 ------
src/kimchi/i18n.py | 2 --
src/kimchi/mockmodel.py | 9 ++------
src/kimchi/model/vmstorages.py | 33 ++++++++++++------------------
tests/test_model.py | 5 -----
tests/test_rest.py | 14 ++++++-------
ui/js/src/kimchi.guest_storage_add.main.js | 7 +++----
ui/pages/guest-storage-add.html.tmpl | 17 ++++-----------
21 files changed, 28 insertions(+), 177 deletions(-)
--
1.8.3.1
10 years, 3 months
[PATCH 0/2] Fix unsupported config param for update manager
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Royce Lv (2):
Fix: Avoid passing unexpected config params to repository manager
Fix testcases for repository config param
src/kimchi/i18n.py | 1 +
src/kimchi/repositories.py | 14 +++++++++++---
tests/test_model.py | 9 +++++----
3 files changed, 17 insertions(+), 7 deletions(-)
--
1.8.3.2
10 years, 3 months
[PATCH] Add ability to submit custom MAC address on VM network interfaces v2
by bbaude@redhat.com
From: Brent Baude <bbaude(a)redhat.com>
Resubmitting the custom mac address patch with peer review comments
included
---
docs/API.md | 1 +
src/kimchi/API.json | 4 ++++
src/kimchi/i18n.py | 4 ++++
src/kimchi/model/vmifaces.py | 38 +++++++++++++++++++++++++++++--------
tests/test_model.py | 10 ++++++++++
ui/css/theme-default/guest-edit.css | 4 ++--
ui/js/src/kimchi.guest_edit_main.js | 18 ++++++++++++------
ui/pages/guest-edit.html.tmpl | 11 ++++++++---
8 files changed, 71 insertions(+), 19 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index b679ce7..4f92eaa 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -221,6 +221,7 @@ Represents all network interfaces attached to a Virtual Machine.
interface type is network.
* type: The type of VM network interface that libvirt supports.
Now kimchi just supports 'network' type.
+ * custommac: A custom MAC address for the interface
### Sub-Resource: Virtual Machine Network Interface
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index b8604d2..cd100dd 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -334,6 +334,10 @@
"type": "string",
"pattern": "^ne2k_pci|i82551|i82557b|i82559er|rtl8139|e1000|pcnet|virtio$",
"error": "KCHVMIF0006E"
+ },
+ "custommac": {
+ "description": "optional custom mac address for the network interface",
+ "type": "string"
}
}
},
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 9e66c68..da17c6f 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -105,6 +105,10 @@ messages = {
"KCHVMIF0006E": _("Invalid network model card specified for virtual machine interface"),
"KCHVMIF0007E": _("Specify type and network to add a new virtual machine interface"),
"KCHVMIF0008E": _("Specify type and network to update a virtual machine interface"),
+ "KCHVMIF0009E": _("The custom MAC address %(custommac)s is not properly formatted as 12 character hexadecimal value separated by colons(:)"),
+ "KCHVMIF0010E": _("The custom MAC address %(custommac)s is already in use on this guest"),
+ "KCHVMIF0011E": _("Libvirt requires you use a unicast MAC address and %(custommac)s is not"),
+
"KCHTMPL0001E": _("Template %(name)s already exists"),
"KCHTMPL0002E": _("Template %(name)s does not exist"),
diff --git a/src/kimchi/model/vmifaces.py b/src/kimchi/model/vmifaces.py
index 66b3827..b6de38f 100644
--- a/src/kimchi/model/vmifaces.py
+++ b/src/kimchi/model/vmifaces.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import random
+import re
import libvirt
from lxml import etree, objectify
@@ -45,6 +46,20 @@ class VMIfacesModel(object):
random.randint(0x00, 0xff)]
return ':'.join(map(lambda x: "%02x" % x, mac))
+ def checkduplicatemacs(vm, custommac):
+ macs = self.get_list(vm)
+ if custommac in macs:
+ raise NotFoundError("KCHVMIF0010E", {'custommac': mac})
+
+ def validMac(mymac):
+ pattern = r'^(?i)([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$'
+ if bool(re.match(pattern, mac)) is not True:
+ raise NotFoundError("KCHVMIF0009E", {'custommac': mac})
+ else:
+ # Checking for multicast
+ if (int(mymac.split(":")[0], 16) & 0x1) == 1:
+ raise NotFoundError("KCHVMIF0011E", {'custommac': mac})
+
conn = self.conn.get()
networks = conn.listNetworks() + conn.listDefinedNetworks()
@@ -56,14 +71,22 @@ class VMIfacesModel(object):
if DOM_STATE_MAP[dom.info()[0]] != "shutoff":
raise InvalidOperation("KCHVMIF0003E")
- macs = (iface.mac.get('address')
- for iface in self.get_vmifaces(vm, self.conn))
-
- mac = randomMAC()
- while True:
- if mac not in macs:
- break
+ if 'custommac' not in params:
+ macs = (iface.mac.get('address')
+ for iface in self.get_vmifaces(vm, self.conn))
mac = randomMAC()
+ while True:
+ if mac not in macs:
+ break
+ mac = randomMAC()
+
+ else:
+ if len(params['custommac']) == 0:
+ mac = randomMAC()
+ else:
+ mac = params["custommac"]
+ validMac(mac)
+ checkduplicatemacs(vm, mac)
children = [E.mac(address=mac)]
("network" in params.keys() and
@@ -75,7 +98,6 @@ class VMIfacesModel(object):
xml = etree.tostring(E.interface(*children, **attrib))
dom.attachDeviceFlags(xml, libvirt.VIR_DOMAIN_AFFECT_CURRENT)
-
return mac
@staticmethod
diff --git a/tests/test_model.py b/tests/test_model.py
index ceedc6f..6a8c592 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -219,6 +219,16 @@ class ModelTests(unittest.TestCase):
self.assertEquals("default", iface['network'])
self.assertEquals("e1000", iface["model"])
+ # custom MAC address test
+ iface_args = {"type": "network",
+ "network": "test-network",
+ "model": "virtio",
+ "custommac": "52:54:00:17:cd:e7"}
+ mac = inst.vmifaces_create('kimchi-ifaces', iface_args)
+ iface = inst.vmiface_lookup('kimchi-ifaces', mac)
+ self.assertEquals("52:54:00:17:cd:e7", iface['mac'])
+ rollback.prependDefer(inst.vmiface_delete, 'kimchi-ifaces', mac)
+
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_vm_disk(self):
disk_path = '/tmp/existent2.iso'
diff --git a/ui/css/theme-default/guest-edit.css b/ui/css/theme-default/guest-edit.css
index 74c2237..f0e1bb0 100644
--- a/ui/css/theme-default/guest-edit.css
+++ b/ui/css/theme-default/guest-edit.css
@@ -112,7 +112,7 @@
#form-guest-edit-storage .cell,
.guest-edit-interface .cell {
display: inline-block;
- width: 250px;
+ width: 150px;
}
#form-guest-edit-storage .cell.dev {
@@ -130,7 +130,7 @@
}
.guest-edit-interface .body select {
- width: 180px;
+ width: 150px;
padding: 0px;
}
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index c281289..7baf296 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -176,7 +176,10 @@ kimchi.guest_edit_main = function() {
var toggleEdit = function(item, on){
$("label", item).toggleClass("hide", on);
$("select", item).toggleClass("hide", !on);
- $(".action-area", item).toggleClass("hide");
+ $("input", item).toggleClass("hide", !on);
+ $(".action-area#editmode", item).toggleClass("hide", !on);
+ $(".action-area#viewmode", item).toggleClass("hide", on);
+
};
var addItem = function(data) {
var itemNode = $.parseHTML(kimchi.substitute($('#interface-tmpl').html(),data));
@@ -215,20 +218,23 @@ kimchi.guest_edit_main = function() {
var item = $(this).parent().parent();
var interface = {
network: $("select", item).val(),
- type: "network"
+ type: "network",
+ custommac: $("input",item).val().toLowerCase()
};
- var postUpdate = function(){
+ var postUpdate = function(mymac){
$("label", item).text(interface.network);
- toggleEdit(item, false);
+ $("label#custommac", item).text(mymac);
+ toggleEdit(item.prop, false);
};
if(item.prop("id")==""){
kimchi.createGuestInterface(kimchi.selectedGuest, interface, function(data){
item.prop("id", data.mac);
- postUpdate();
+ $("label#custommac", item).text(data.mac)
+ postUpdate(data.mac);
});
}else{
kimchi.updateGuestInterface(kimchi.selectedGuest, item.prop("id"), interface, function(){
- postUpdate();
+ postUpdate(data.mac);
});
}
});
diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
index 0b7dad3..0aa9f3b 100644
--- a/ui/pages/guest-edit.html.tmpl
+++ b/ui/pages/guest-edit.html.tmpl
@@ -108,7 +108,8 @@
<div class="header">
<span class="cell">$_("Network")</span>
<span class="cell">$_("Type")</span>
- <button class="add action-area"></button>
+ <span class="cell">$_("MAC")</span>
+ <button id="interfaceadd" class="add action-area"></button>
</div>
<div class="body"></div>
</form>
@@ -192,10 +193,14 @@
<span class="cell">
<span>{type}</span>
</span>
- <span class="action-area {editMode}">
+ <span class="cell">
+ <label class="{viewMode}" id="custommac">{mac}</label>
+ <input type="text" id="insertmac" class="{editMode}"/>
+ </span>
+ <span class="action-area {editMode}" id="editmode">
<button class="save"></button><button class="cancel"></button>
</span>
- <span class="action-area {viewMode}">
+ <span class="action-area {viewMode}" id="viewmode">
<button class="edit"></button><button class="delete"></button>
</span>
<div>
--
1.9.3
10 years, 3 months
[PATCH] Fix issue #419
by Aline Manera
Aline Manera (1):
bug fix: Probe image file only during the template creation
src/kimchi/vmtemplate.py | 52 ++++++++++++++++++++++++++----------------------
tests/test_rest.py | 2 +-
2 files changed, 29 insertions(+), 25 deletions(-)
--
1.9.3
10 years, 3 months
[PATCH] Bug 446 Fix
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_edit_main.js | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 938dfd9..c281289 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -163,7 +163,8 @@ kimchi.guest_edit_main = function() {
$(".add", "#form-guest-edit-interface").button({
icons: { primary: "ui-icon-plusthick" },
text: false
- }).click(function(){
+ }).click(function(evt){
+ evt.preventDefault();
addItem({
mac: "",
network: "",
@@ -192,13 +193,15 @@ kimchi.guest_edit_main = function() {
disabled: true,
icons: { primary: "ui-icon-pencil" },
text: false
- }).click(function(){
+ }).click(function(evt){
+ evt.preventDefault();
toggleEdit($(this).parent().parent(), true);
});
$(".delete", itemNode).button({
icons: { primary: "ui-icon-trash" },
text: false
- }).click(function(){
+ }).click(function(evt){
+ evt.preventDefault();
var item = $(this).parent().parent();
kimchi.deleteGuestInterface(kimchi.selectedGuest, item.prop("id"), function(){
item.remove();
@@ -207,7 +210,8 @@ kimchi.guest_edit_main = function() {
$(".save", itemNode).button({
icons: { primary: "ui-icon-disk" },
text: false
- }).click(function(){
+ }).click(function(evt){
+ evt.preventDefault();
var item = $(this).parent().parent();
var interface = {
network: $("select", item).val(),
@@ -231,7 +235,8 @@ kimchi.guest_edit_main = function() {
$(".cancel", itemNode).button({
icons: { primary: "ui-icon-arrowreturnthick-1-w" },
text: false
- }).click(function(){
+ }).click(function(evt){
+ evt.preventDefault();
var item = $(this).parent().parent();
$("label", item).text()==="" ? item.remove() : toggleEdit(item, false);
});
@@ -332,7 +337,8 @@ kimchi.guest_edit_main = function() {
filterNodes(key, $("#permission-sel-users"));
filterNodes(key, $("#permission-sel-groups"));
});
- $('#permissionGo').button().click(function() {
+ $('#permissionGo').button().click(function(evt) {
+ evt.preventDefault();
$("#permission-avail-users").children(".item-picked").appendTo("#permission-sel-users").removeClass("item-picked");
sortNodes($("#permission-sel-users"), true);
$("#permission-avail-groups").children(".item-picked").appendTo("#permission-sel-groups").removeClass("item-picked");
@@ -341,7 +347,8 @@ kimchi.guest_edit_main = function() {
filterNodes("", $("#permission-sel-users"));
filterNodes("", $("#permission-sel-groups"));
});
- $('#permissionBack').button().click(function() {
+ $('#permissionBack').button().click(function(evt) {
+ evt.preventDefault();
$("#permission-sel-users").children(".item-picked").appendTo("#permission-avail-users").removeClass("item-picked");
sortNodes($("#permission-avail-users"), true);
$("#permission-sel-groups").children(".item-picked").appendTo("#permission-avail-groups").removeClass("item-picked");
--
1.7.1
10 years, 3 months
[PATCH] Bug 457 Fix
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storagepool_add_main.js | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 618892d..4f1f943 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -351,9 +351,9 @@ kimchi.validateLogicalForm = function () {
};
kimchi.addPool = function(event) {
- $('#pool-doAdd').hide();
- $('#pool-loading').show();
if (kimchi.validateForm()) {
+ $('#pool-doAdd').hide();
+ $('#pool-loading').show();
var formData = $('#form-pool-add').serializeObject();
delete formData.authname;
var poolType = $('#poolTypeId').selectMenu('value');
--
1.7.1
10 years, 3 months
[PATCH] Bugfix#420 UI: Pop up errors when log out at "Host" tab
by Wen Wang
From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
1) This patch fix the error that kimchi cannot log out from "Host" page
and log in again to "Host".
2) Fix the bug that UI popup error when loging out from kimchi.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
src/kimchi/root.py | 2 +-
ui/js/src/kimchi.main.js | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index 96f551d..6f191eb 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -108,7 +108,7 @@ class Root(Resource):
if page.endswith('.html'):
context = template.render('tabs/' + page, data)
cherrypy.response.cookie[
- "lastPage"] = "/#tabs/" + page.rstrip(".html")
+ "lastPage"] = "/#tabs/" + page[:-5]
cherrypy.response.cookie['lastPage']['path'] = '/'
return context
raise cherrypy.HTTPError(404)
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 21ffca7..a3305e9 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -39,6 +39,7 @@ kimchi.setupPeers = function(){
};
kimchi.main = function() {
+ kimchi.isLoggingOut = false;
kimchi.popable();
var genTabs = function(tabs) {
@@ -253,6 +254,7 @@ kimchi.main = function() {
// Perform logging out via Ajax request.
$('#btn-logout').on('click', function() {
kimchi.logout(function() {
+ kimchi.isLoggingOut = true;
document.location.href = "login.html";
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
@@ -281,7 +283,7 @@ kimchi.main = function() {
document.location.href= isSessionTimeout ? 'login.html?error=sessionTimeout' : 'login.html';
return;
}
- else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText)) {
+ else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText) && !kimchi.isLoggingOut) {
kimchi.message.error(i18n['KCHAPI6007E'].replace("%1", jqXHR.state()));
}
if(ajaxSettings['originalError']) {
--
1.7.1
10 years, 3 months