[PATCH] Bug 461 Fix: (UI)Support Repository Meta Link
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_add_main.js | 10 +++-------
ui/pages/repository-add.html.tmpl | 6 +++++-
ui/pages/repository-edit.html.tmpl | 8 ++++++++
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/ui/js/src/kimchi.repository_add_main.js b/ui/js/src/kimchi.repository_add_main.js
index 2a277fd..d572c69 100644
--- a/ui/js/src/kimchi.repository_add_main.js
+++ b/ui/js/src/kimchi.repository_add_main.js
@@ -57,17 +57,13 @@ kimchi.repository_add_main = function() {
}
var formData = $(addForm).serializeObject();
-
- if (formData && formData.isMirror!=undefined) {
- formData.isMirror=(String(formData.isMirror).toLowerCase() === 'true');
- }
- if(formData.isMirror) {
+ if(formData.linkType) {
if(formData.config==undefined) {
formData.config=new Object();
}
- formData.config.mirrorlist=formData.baseurl;
+ formData.config[formData.linkType]=formData.baseurl;
delete formData.baseurl;
- delete formData.isMirror;
+ delete formData.linkType;
}
weedObject(formData);
if(formData.config && formData.config.comps) {
diff --git a/ui/pages/repository-add.html.tmpl b/ui/pages/repository-add.html.tmpl
index 6de4f76..96cf6f6 100644
--- a/ui/pages/repository-add.html.tmpl
+++ b/ui/pages/repository-add.html.tmpl
@@ -63,9 +63,13 @@
</div>
<div class="field yum">
<p class="yum">
- <input type="checkbox" name="isMirror" value="true" id="isMirror" />
+ <input type="radio" name="linkType" value="mirrorlist" id="isMirror" />
<label for="isMirror">$_("Repository is a mirror")</label>
</p>
+ <p class="yum">
+ <input type="radio" name="linkType" value="metalink" id="isMeta" />
+ <label for="isMeta">$_("Repository is a meta link")</label>
+ </p>
</div>
</section>
<section class="form-section repository-dist deb">
diff --git a/ui/pages/repository-edit.html.tmpl b/ui/pages/repository-edit.html.tmpl
index f13cb90..4467ca8 100644
--- a/ui/pages/repository-edit.html.tmpl
+++ b/ui/pages/repository-edit.html.tmpl
@@ -71,6 +71,14 @@
<input id="repository-edit-urlargs-textbox" class="yum" name="config[mirrorlist]" type="text" />
</div>
</div>
+ <div class="yum">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-urlargs-textbox">$_("Meta Link URL")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-urlargs-textbox" class="yum" name="config[metalink]" type="text" />
+ </div>
+ </div>
<div class="repository-comps deb">
<div class="repository-edit-wrapper-label">
<label for="repository-edit-urlargs-textbox">$_("Components")</label>
--
1.7.1
10 years
[PATCH] Bugfix#527 Reverting a snapshot doesn't change initial state of "Edit Guest"
by wenwang@linux.vnet.ibm.com
From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
Close diaguage when reverting a VM finished.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_edit_main.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 4f497e5..5c2def6 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -564,6 +564,7 @@ kimchi.guest_edit_main = function() {
$(".icon", item).addClass("hide");
$("button", "#form-guest-edit-snapshot").button("enable");
setCurrentSnapshot(item.prop("id"));
+ kimchi.window.close();
}, function(data){
kimchi.message.error(data.responseJSON.reason);
$(".icon", item).addClass("hide");
--
1.9.3
10 years
[PATCH] Bugfix#428: Host stats graphics are not aligned in Italian
by Wen Wang
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 9e9cb01..93ae524 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -117,7 +117,7 @@
.host-panel .info-container {
padding-top: 16px;
- width: 890px;
+ width: 892px;
}
.host-panel .section-header {
--
1.9.3
10 years
[PATCH 0/3] Issue #543
by Crístian Viana
Crístian Viana (3):
bugfix: Fix regexp in "kimchi.utils.get_next_clone_name"
Support different "tags" when generating a new name in
"get_next_clone_name"
issue #543: Generate unique vol names when downloading files with same
name
src/kimchi/model/storagevolumes.py | 12 ++++++++++--
src/kimchi/utils.py | 17 ++++++++++-------
2 files changed, 20 insertions(+), 9 deletions(-)
--
1.9.3
10 years
[PATCH] Bug fix #463: Allow add networks with non-ASCII characters to template and guest
by Aline Manera
Kimchi uses unicode internally but libvirt stores its data encoded with
utf-8. So we also need to encode the given value to utf-8 to compare it
properly to libvirt results.
Also add test cases to cover this scenario.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/networks.py | 4 ++--
src/kimchi/model/templates.py | 6 +++---
src/kimchi/model/vmifaces.py | 1 +
src/kimchi/vmtemplate.py | 4 ++--
src/kimchi/xmlutils/utils.py | 9 ++++++++-
tests/test_model.py | 21 ++++++++++++++++++++-
6 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index f3ea099..1e94fd2 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -293,8 +293,8 @@ class NetworkModel(object):
conn = self.conn.get()
for dom in conn.listAllDomains(0):
networks = self._vm_get_networks(dom)
- if network in networks and (state is None or
- state == dom.state(0)[0]):
+ if network.encode('utf-8') in networks and \
+ (state is None or state == dom.state(0)[0]):
vms.append(dom.name())
return vms
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 2ca80ba..85f0839 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -83,7 +83,7 @@ class TemplatesModel(object):
for net_name in params.get(u'networks', []):
try:
- conn.networkLookupByName(net_name)
+ conn.networkLookupByName(net_name.encode('utf-8'))
except Exception:
raise InvalidParameter("KCHTMPL0003E", {'network': net_name,
'template': name})
@@ -200,7 +200,7 @@ class TemplateModel(object):
for net_name in params.get(u'networks', []):
try:
- conn.networkLookupByName(net_name)
+ conn.networkLookupByName(net_name.encode('utf-8'))
except Exception:
raise InvalidParameter("KCHTMPL0003E", {'network': net_name,
'template': name})
@@ -260,7 +260,7 @@ class LibvirtVMTemplate(VMTemplate):
for name in names:
try:
conn = self.conn.get()
- network = conn.networkLookupByName(name)
+ network = conn.networkLookupByName(name.encode('utf-8'))
except libvirt.libvirtError:
raise InvalidParameter("KCHTMPL0003E", {'network': name,
'template': self.name})
diff --git a/src/kimchi/model/vmifaces.py b/src/kimchi/model/vmifaces.py
index 1206cde..0c10fa9 100644
--- a/src/kimchi/model/vmifaces.py
+++ b/src/kimchi/model/vmifaces.py
@@ -42,6 +42,7 @@ class VMIfacesModel(object):
def create(self, vm, params):
conn = self.conn.get()
networks = conn.listNetworks() + conn.listDefinedNetworks()
+ networks = map(lambda x: x.decode('utf-8'), networks)
if params["type"] == "network" and params["network"] not in networks:
raise InvalidParameter("KCHVMIF0002E",
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 8582d48..5e4a6a8 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -184,7 +184,7 @@ class VMTemplate(object):
disks_xml += get_disk_xml(params)[1]
- return disks_xml
+ return unicode(disks_xml, 'utf-8')
def to_volume_list(self, vm_uuid):
storage_path = self._get_storage_path()
@@ -232,7 +232,7 @@ class VMTemplate(object):
networks += get_iface_xml(params, self.info['arch'],
self.info['os_distro'],
self.info['os_version'])
- return networks
+ return unicode(networks, 'utf-8')
def _get_input_output_xml(self):
sound = """
diff --git a/src/kimchi/xmlutils/utils.py b/src/kimchi/xmlutils/utils.py
index 4863bb5..be08a14 100644
--- a/src/kimchi/xmlutils/utils.py
+++ b/src/kimchi/xmlutils/utils.py
@@ -23,7 +23,14 @@ from lxml import objectify
def xpath_get_text(xml, expr):
doc = ET.fromstring(xml)
- res = [x.text if not isinstance(x, str) else x for x in doc.xpath(expr)]
+
+ res = []
+ for x in doc.xpath(expr):
+ if isinstance(x, unicode):
+ x = x.encode('utf-8')
+ elif not isinstance(x, str):
+ x = x.text
+ res.append(x)
return res
diff --git a/tests/test_model.py b/tests/test_model.py
index aa2a1bb..acaa711 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -889,6 +889,17 @@ class ModelTests(unittest.TestCase):
'subnet': '127.0.100.0/24'}
inst.networks_create(net_args)
rollback.prependDefer(inst.network_delete, net_name)
+ inst.network_activate(net_name)
+ rollback.prependDefer(inst.network_deactivate, net_name)
+
+ net_name = u'kīмсhī-пet'
+ net_args = {'name': net_name,
+ 'connection': 'nat',
+ 'subnet': '127.0.20.0/24'}
+ inst.networks_create(net_args)
+ rollback.prependDefer(inst.network_delete, net_name)
+ inst.network_activate(net_name)
+ rollback.prependDefer(inst.network_deactivate, net_name)
orig_params = {'name': 'test', 'memory': 1024, 'cpus': 1,
'cdrom': self.kimchi_iso}
@@ -908,7 +919,7 @@ class ModelTests(unittest.TestCase):
self.assertEquals("default", info["networks"][0])
params = {'name': 'new-test', 'memory': 1024, 'cpus': 1,
- 'networks': ['default', 'test-network']}
+ 'networks': ['default', 'test-network', u'kīмсhī-пet']}
inst.template_update('new-test', params)
info = inst.template_lookup('new-test')
for key in params.keys():
@@ -932,6 +943,14 @@ class ModelTests(unittest.TestCase):
self.assertRaises(InvalidParameter, inst.template_update,
'new-test', params)
+ params = {'name': 'some-vm', 'template': '/templates/new-test'}
+ self.assertEquals('some-vm', inst.vms_create(params))
+ rollback.prependDefer(inst.vm_delete, 'some-vm')
+
+ iface_args = {'type': 'network', 'network': u'kīмсhī-пet'}
+ mac = inst.vmifaces_create('some-vm', iface_args)
+ self.assertEquals(17, len(mac))
+
def test_vm_edit(self):
config.set("authentication", "method", "pam")
inst = model.Model(None,
--
1.9.3
10 years
[PATCH] Issue#536: raise proper error message when disk os info absent
by lvroyce0210@gmail.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
When disk os cannot be decided by libguestfs,
it will leave it to 'unknown' distro and version.
But if no boot information available,
ImageFormatError is left unhandled and this will introduce
500 error when disk os info is absent.
Handle this error to fix this.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 8582d48..3266e7b 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -29,6 +29,7 @@ from lxml.builder import E
from kimchi import imageinfo
from kimchi import osinfo
from kimchi.exception import InvalidParameter, IsoFormatError, MissingParameter
+from kimchi.exception import ImageFormatError, OperationFailed
from kimchi.isoinfo import IsoImage
from kimchi.utils import check_url_path, pool_name_from_uri
from kimchi.xmlutils.disk import get_disk_xml
@@ -51,7 +52,10 @@ class VMTemplate(object):
self.fc_host_support = args.get('fc_host_support')
# Fetch defaults based on the os distro and version
- distro, version = self._get_os_info(args, scan)
+ try:
+ distro, version = self._get_os_info(args, scan)
+ except ImageFormatError as e:
+ raise OperationFailed('KCHTMPL0020E', {'err': e.message})
os_distro = args.get('os_distro', distro)
os_version = args.get('os_version', version)
entry = osinfo.lookup(os_distro, os_version)
--
1.8.3.2
10 years
[PATCH v2 0/3] Issue #543
by Crístian Viana
The differences between this and the previous patchset (v1) are:
- Patch 3/3 has been updated: generate unique name for all types of storage
volumes (not just 'url'); rebased to the latest commit (a378799); reworded
commit message.
Crístian Viana (3):
bugfix: Fix regexp in "kimchi.utils.get_next_clone_name"
Support different "tags" when generating a new name in
"get_next_clone_name"
issue #543: Generate unique names when creating volumes without name
src/kimchi/model/storagevolumes.py | 9 ++++++++-
src/kimchi/utils.py | 17 ++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
--
1.9.3
10 years
[PATCH] Bug 539 Partial Fix: Enhance Error Handling
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_main.js | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 21caf1b..611d8c7 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -211,6 +211,7 @@ kimchi.listVmsAuto = function() {
if(kimchi.trackingTasks.indexOf(tasks[i].id)==-1)
kimchi.trackTask(tasks[i].id, null, function(err){
kimchi.message.error(err.message);
+ kimchi.listVmsAuto();
}, null);
}
}, null, true);
@@ -345,7 +346,12 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu) {
confirm : i18n['KCHAPI6002M'],
cancel : i18n['KCHAPI6003M']
}, function() {
- kimchi.cloneGuest(guest, function(data){
+ kimchi.cloneGuest(guest, function(task){
+ if(kimchi.trackingTasks.indexOf(task.id)==-1)
+ kimchi.trackTask(task.id, null, function(err){
+ kimchi.message.error(err.message);
+ kimchi.listVmsAuto();
+ }, null);
kimchi.listVmsAuto();
});
}, null);
--
1.7.1
10 years
[PATCH 0/2] Bugfix #496 System leftovers after uninstalling Kimchi
by Ramon Medeiros
Remove directories and some files on kimchi package removal
Ramon Medeiros (2):
Remove empty directories after rpm -e kimchi on fedora
Remove empty directories on dpkg -e
contrib/kimchi.spec.fedora.in | 21 ++++++++++++++++++++-
contrib/make-deb.sh.in | 2 ++
2 files changed, 22 insertions(+), 1 deletion(-)
--
1.8.3.1
10 years