[PATCH v7 0/2] Auto Topology for Guest Templates
by Christy Perez
By this point, the subject isn't exactly accurate, but since v 1-6 had it,
I'm not changing it now.
As the commit message says, this feature is no longer an "auto topology"
feature, but instead just a feature to allow users to configure topology
for a vm template should they so desire.
If we ever want to add an auto-configure option, then version 5 of this
patchset can be resurrected. I would recommend re-adding the auto-element
of the cpu_info for a template, instead of passing in threads=0, however.
New to version 7:
A near complete re-write that only does some checking in the backend,
adds appropriate error messages, a mockmodel test, and a little tweaking
so that the mockmodel tests pass.
Christy Perez (2):
Parts to allow Kimchi to configure the cpu topology.
Mockmodel test for cpuinfo
docs/API.md | 24 ++++++++
src/kimchi/control/cpuinfo.py | 37 ++++++++++++
src/kimchi/control/host.py | 2 +
src/kimchi/i18n.py | 5 ++
src/kimchi/mockmodel.py | 10 ++++
src/kimchi/model/cpuinfo.py | 128 ++++++++++++++++++++++++++++++++++++++++++
src/kimchi/model/templates.py | 10 ++--
7 files changed, 212 insertions(+), 4 deletions(-)
create mode 100644 src/kimchi/control/cpuinfo.py
create mode 100644 src/kimchi/model/cpuinfo.py
--
1.9.3
10 years
[PATCH] Pass through libvirt error if storage create fails
by Christy Perez
A user experienced an error while creating a VM using
logical storage. If a disk size greater than the available
capacity of a pool is requested, the pool.createXML fails,
but the user gets the generic kimchi "unexpected error" message.
This patch puts a try block around the createXML call, and
catches the libvirt error so it can be shown to the user.
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/model/templates.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 6e1a571..475f878 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -290,7 +290,10 @@ def fork_vm_storage(self, vm_uuid):
# TODO: Rebase on the storage API once upstream
pool = self._storage_validate()
vol_list = self.to_volume_list(vm_uuid)
- for v in vol_list:
- # outgoing text to libvirt, encode('utf-8')
- pool.createXML(v['xml'].encode('utf-8'), 0)
+ try:
+ for v in vol_list:
+ # outgoing text to libvirt, encode('utf-8')
+ pool.createXML(v['xml'].encode('utf-8'), 0)
+ except libvirt.libvirtError as e:
+ raise OperationFailed("KCHVMSTOR0008E", {'error': e.message})
return vol_list
--
1.9.3
10 years
[PATCH] Remove README statement that advises user does not use Kimchi in production
by Aline Manera
PowerKVM is a good example that Kimchi can be used in production
environment.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
docs/README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/docs/README.md b/docs/README.md
index de6db91..555ce89 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -169,9 +169,7 @@ pool (default path is: /var/lib/kimchi/isos).
Known Issues
------------
-1. Kimchi is still experimental and should not be used in a production
-environment.
-2. When you are using NFS as storage pool, check the nfs export path permission
+1. When you are using NFS as storage pool, check the nfs export path permission
is configured as:
(1) export path need to be squashed as kvm gid and libvirt uid:
/my_export_path *(all_squash,anongid=<kvm-gid>, anonuid=<libvirt-uid>,rw,sync)
--
1.9.3
10 years
[PATCH] Return empty dict when VM doesn't have current snasphot
by Crístian Viana
The current API design is to return an error 404 when a current snapshot
doesn't exist on a virtual machine. But it was decided that the best
approach is to return an empty structure instead.
Return an empty dict instead of raising an error when a VM doesn't have
a current snapshot. Also, update the tests accordingly.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmsnapshots.py | 2 +-
tests/test_model.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/vmsnapshots.py b/src/kimchi/model/vmsnapshots.py
index ad8460e..0da9dc3 100644
--- a/src/kimchi/model/vmsnapshots.py
+++ b/src/kimchi/model/vmsnapshots.py
@@ -177,7 +177,7 @@ class CurrentVMSnapshotModel(object):
snap_name = vir_snap.getName().decode('utf-8')
except libvirt.libvirtError, e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN_SNAPSHOT:
- raise NotFoundError('KCHSNAP0007E', {'vm': vm_name})
+ return {}
raise OperationFailed('KCHSNAP0008E',
{'vm': vm_name, 'err': e.message})
diff --git a/tests/test_model.py b/tests/test_model.py
index c68b01f..0681be9 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -124,8 +124,8 @@ class ModelTests(unittest.TestCase):
inst.vm_poweroff(u'kimchi-vm')
vm = inst.vm_lookup(u'kimchi-vm')
- self.assertRaises(NotFoundError, inst.currentvmsnapshot_lookup,
- u'kimchi-vm')
+ empty_snap = inst.currentvmsnapshot_lookup(u'kimchi-vm')
+ self.assertEquals({}, empty_snap)
# this snapshot should be deleted when its VM is deleted
params = {'name': u'mysnap'}
--
1.9.3
10 years
[PATCHv7 0/4] LDAP authorization support
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v1>v4, split user and group and be compatible to previous access tagging
v5>v7, Update testcases.
Royce Lv (4):
Split users and groups for permission query
Move validation to authorizaiton
change vm permission tag
Update test model for authentication and authorization
docs/API.md | 19 ++++++----
src/kimchi/control/groups.py | 28 ++++++++++++++
src/kimchi/control/host.py | 14 -------
src/kimchi/control/users.py | 35 +++++++++++++++++
src/kimchi/i18n.py | 1 +
src/kimchi/mockmodel.py | 4 ++
src/kimchi/model/groups.py | 67 +++++++++++++++++++++++++++++++++
src/kimchi/model/host.py | 19 ----------
src/kimchi/model/users.py | 90 ++++++++++++++++++++++++++++++++++++++++++++
src/kimchi/model/vms.py | 65 ++++++++++++++++++++------------
tests/test_authorization.py | 3 +-
tests/test_model.py | 3 +-
tests/test_rest.py | 4 +-
tests/utils.py | 3 +-
14 files changed, 284 insertions(+), 71 deletions(-)
create mode 100644 src/kimchi/control/groups.py
create mode 100644 src/kimchi/control/users.py
create mode 100644 src/kimchi/model/groups.py
create mode 100644 src/kimchi/model/users.py
--
1.8.3.2
10 years
[PATCHv3 0/2] UI: LDAP integration of VM permission
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v1>v3,
Delete useless elements according to YuXin's comments.
Royce Lv (2):
UI: support ldap vm permission tag
Change guest edit permission logic
ui/css/theme-default/guest-edit.css | 81 +++++++---
ui/js/src/kimchi.api.js | 15 +-
ui/js/src/kimchi.guest_edit_main.js | 289 ++++++++++++++++++++++++------------
ui/pages/guest-edit.html.tmpl | 22 ++-
4 files changed, 284 insertions(+), 123 deletions(-)
--
1.8.3.2
10 years
[v2] UI: CPU Topology
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/css/theme-default/template-edit.css | 28 ++++++++++++++++++-
ui/js/src/kimchi.api.js | 14 +++++++++
ui/js/src/kimchi.template_edit_main.js | 47 +++++++++++++++++++++++++++++++-
ui/pages/template-edit.html.tmpl | 16 ++++++++---
4 files changed, 99 insertions(+), 6 deletions(-)
diff --git a/ui/css/theme-default/template-edit.css b/ui/css/theme-default/template-edit.css
index 094e909..7abee7c 100644
--- a/ui/css/theme-default/template-edit.css
+++ b/ui/css/theme-default/template-edit.css
@@ -142,4 +142,30 @@
#edit-template-tabs .hide {
display: none;
-}
\ No newline at end of file
+}
+
+#form-template-processor select,
+#form-template-processor input[type="text"] {
+ margin-left: 10px;
+}
+
+#form-template-processor input[type="checkbox"] {
+ margin-right: 5px;
+}
+
+#form-template-processor .manual {
+ margin-top: 10px;
+ margin-left: -3px;
+}
+
+#form-template-processor .topology {
+ margin: 10px 30px;
+}
+
+#form-template-processor .topology div {
+ margin-bottom: 10px;
+}
+
+#form-template-processor .topology select {
+ width: 80px;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 78c6d66..7a239c0 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1260,5 +1260,19 @@ var kimchi = {
kimchi.message.error(data.responseJSON.reason);
}
});
+ },
+
+ getCPUInfo : function(suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'host/cpuinfo',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
+ });
}
};
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index d4e19c2..9536ab7 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -200,8 +200,44 @@ kimchi.template_edit_main = function() {
});
});
};
+ var initProcessor = function(){
+ var setCPUValue = function(){
+ if(!$('#cores').hasClass("invalid-field")&&$('#cores').val()!=""){
+ $("#cpus").val(parseInt($("#cores").val())*parseInt($("#threads").val()));
+ }else{
+ $("#cpus").val('');
+ }
+ };
+ $("input:text", "#form-template-processor").on('keyup', function(){
+ $(this).toggleClass("invalid-field", !$(this).val().match('^[0-9]*$'));
+ if($(this).prop('id')=='cores') setCPUValue();
+ });
+ $("input:checkbox", "#form-template-processor").click(function(){
+ $(".topology", "#form-template-processor").toggleClass("hide", !$(this).prop("checked"));
+ $("#cpus").attr("disabled", $(this).prop("checked"));
+ setCPUValue();
+ });
+ $('select', '#form-template-processor').change(function(){
+ setCPUValue();
+ });
+ kimchi.getCPUInfo(function(data){
+ var options = "";
+ for(var i=0;Math.pow(2,i)<=data.threads_per_core;i++){
+ var lastOne = Math.pow(2,i+1)>data.threads_per_core?" selected":"";
+ options += "<option"+lastOne+">"+Math.pow(2,i)+"</option>";
+ }
+ $('select', '#form-template-processor').append(options);
+ if(template.cpus) $("#cpus").val(template.cpus);
+ if(template.cpu_info.cores) $("#cores").val(template.cpu_info.cores);
+ if(template.cpu_info.threads){
+ $('select', '#form-template-processor').val(template.cpu_info.threads);
+ $("input:checkbox", "#form-template-processor").trigger('click');
+ }
+ });
+ };
kimchi.listNetworks(initInterface);
kimchi.listStoragePools(initStorage);
+ initProcessor();
};
kimchi.retrieveTemplate(kimchi.selectedTemplate, initTemplate);
@@ -241,7 +277,16 @@ kimchi.template_edit_main = function() {
}
});
data['memory'] = Number(data['memory']);
- data['cpus'] = Number(data['cpus']);
+ data['cpus'] = parseInt($('#cpus').val());
+ if($("input:checkbox", "#form-template-processor").prop("checked")){
+ data['cpu_info'] = {
+ sockets: 1,
+ cores: parseInt($("#cores").val()),
+ threads: parseInt($("#threads").val()),
+ };
+ }else{
+ data['cpu_info'] = {};
+ }
var networks = $('.template-tab-body .item', '#form-template-interface');
var networkForUpdate = new Array();
$.each(networks, function(index, networkEntities) {
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 90a6256..f43b9c0 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -40,6 +40,9 @@
<li>
<a href="#form-template-interface">$_("Interface")</a>
</li>
+ <li>
+ <a href="#form-template-processor">$_("Processor")</a>
+ </li>
</ul>
<form id="form-template-general">
<div class="form-template-inline-wrapper">
@@ -53,9 +56,6 @@
<label for="template-edit-version-textbox">$_("Version")</label>
</div>
<div class="template-edit-wrapper-label">
- <label for="template-edit-cpu-textbox">$_("CPU Number")</label>
- </div>
- <div class="template-edit-wrapper-label">
<label for="template-edit-memory-textbox">$_("Memory (MB)")</label>
</div>
<div class="template-edit-wrapper-label templ-edit-cdrom">
@@ -120,6 +120,14 @@
</div>
<div class="template-tab-body"></div>
</form>
+ <form id="form-template-processor">
+ <div>$_("CPU Number"):<input type="text" value="1" id="cpus"></div>
+ <div class="manual"><input type="checkbox">$_("Manually set CPU topology")</div>
+ <div class="topology hide">
+ <div>$_("Cores"):<input type="text" value="1" id="cores"></div>
+ <div>$_("Threads"):<select id="threads"></select></div>
+ </div>
+ </form>
</div>
</div>
<footer>
@@ -157,4 +165,4 @@
<button class="delete"></button>
</span>
</div>
-</script>
\ No newline at end of file
+</script>
--
1.7.1
10 years
[PATCH] UI: CPU Topology
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/css/theme-default/template-edit.css | 24 ++++++++++++++++++++++-
ui/js/src/kimchi.api.js | 14 +++++++++++++
ui/js/src/kimchi.template_edit_main.js | 33 +++++++++++++++++++++++++++++++-
ui/pages/template-edit.html.tmpl | 17 ++++++++++++---
4 files changed, 82 insertions(+), 6 deletions(-)
diff --git a/ui/css/theme-default/template-edit.css b/ui/css/theme-default/template-edit.css
index 094e909..2231dc6 100644
--- a/ui/css/theme-default/template-edit.css
+++ b/ui/css/theme-default/template-edit.css
@@ -142,4 +142,26 @@
#edit-template-tabs .hide {
display: none;
-}
\ No newline at end of file
+}
+
+#form-template-processor select,
+#form-template-processor input[type="text"] {
+ margin-left: 10px;
+}
+
+#form-template-processor input[type="checkbox"] {
+ margin-right: 5px;
+}
+
+#form-template-processor .manual {
+ margin-top: 10px;
+ margin-left: -3px;
+}
+
+#form-template-processor .topology {
+ margin: 10px 30px;
+}
+
+#form-template-processor .topology div {
+ margin-bottom: 10px;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 78c6d66..7a239c0 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1260,5 +1260,19 @@ var kimchi = {
kimchi.message.error(data.responseJSON.reason);
}
});
+ },
+
+ getCPUInfo : function(suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'host/cpuinfo',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
+ });
}
};
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index d4e19c2..bba4415 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -200,8 +200,33 @@ kimchi.template_edit_main = function() {
});
});
};
+ var initProcessor = function(){
+ $("input:text", "#form-template-processor").on('keyup', function(){
+ $(this).toggleClass("invalid-field", !$(this).val().match('^[0-9]*$'));
+ });
+ $("input:checkbox", "#form-template-processor").click(function(){
+ $(".topology", "#form-template-processor").toggleClass("hide", !$(this).prop("checked"));
+ $("#cpu").attr("disabled", $(this).prop("checked"));
+ });
+ kimchi.getCPUInfo(function(data){
+ var options = "";
+ for(var i=0;Math.pow(2,i)<=data.threads_per_core;i++){
+ var lastOne = Math.pow(2,i+1)>data.threads_per_core?" selected":"";
+ options += "<option"+lastOne+">"+Math.pow(2,i)+"</option>";
+ }
+ $('select', '#form-template-processor').append(options);
+ if(template.cpus) $("#cpu").val(template.cpus);
+ if(template.cpu_info.sockets) $("#sockets").val(template.cpu_info.sockets);
+ if(template.cpu_info.cores) $("#cores").val(template.cpu_info.cores);
+ if(template.cpu_info.threads){
+ $('select', '#form-template-processor').val(template.cpu_info.threads);
+ $("input:checkbox", "#form-template-processor").trigger('click');
+ }
+ });
+ };
kimchi.listNetworks(initInterface);
kimchi.listStoragePools(initStorage);
+ initProcessor();
};
kimchi.retrieveTemplate(kimchi.selectedTemplate, initTemplate);
@@ -241,7 +266,13 @@ kimchi.template_edit_main = function() {
}
});
data['memory'] = Number(data['memory']);
- data['cpus'] = Number(data['cpus']);
+ data['cpus'] = parseInt($('#cpu').val());
+ if($("input:checkbox", "#form-template-processor").prop("checked"))
+ data['cpu_info'] = {
+ sockets: parseInt($("#sockets").val()),
+ cores: parseInt($("#cores").val()),
+ threads: parseInt($("#threads").val()),
+ };
var networks = $('.template-tab-body .item', '#form-template-interface');
var networkForUpdate = new Array();
$.each(networks, function(index, networkEntities) {
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 90a6256..47c3979 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -40,6 +40,9 @@
<li>
<a href="#form-template-interface">$_("Interface")</a>
</li>
+ <li>
+ <a href="#form-template-processor">$_("Processor")</a>
+ </li>
</ul>
<form id="form-template-general">
<div class="form-template-inline-wrapper">
@@ -53,9 +56,6 @@
<label for="template-edit-version-textbox">$_("Version")</label>
</div>
<div class="template-edit-wrapper-label">
- <label for="template-edit-cpu-textbox">$_("CPU Number")</label>
- </div>
- <div class="template-edit-wrapper-label">
<label for="template-edit-memory-textbox">$_("Memory (MB)")</label>
</div>
<div class="template-edit-wrapper-label templ-edit-cdrom">
@@ -120,6 +120,15 @@
</div>
<div class="template-tab-body"></div>
</form>
+ <form id="form-template-processor">
+ <div>$_("CPU Number"):<input type="text" value="1" id="cpu"></div>
+ <div class="manual"><input type="checkbox">$_("Manually set CPU topology")</div>
+ <div class="topology hide">
+ <div>$_("Sockets"):<input type="text" value="1" id="sockets"></div>
+ <div>$_("Cores"):<input type="text" value="1" id="cores"></div>
+ <div>$_("Threads"):<select id="threads"></select></div>
+ </div>
+ </form>
</div>
</div>
<footer>
@@ -157,4 +166,4 @@
<button class="delete"></button>
</span>
</div>
-</script>
\ No newline at end of file
+</script>
--
1.7.1
10 years
[PATCHv6 0/4] LDAP authorization
by lvroyce0210@gmail.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v1>v4, split user and group and be compatible to previous access tagging
v5>v6, Update testcases.
Royce Lv (4):
Split users and groups for permission query
Move validation to authorizaiton
change vm permission tag
Update test model for authentication and authorization
docs/API.md | 19 ++++++----
src/kimchi/control/groups.py | 28 ++++++++++++++
src/kimchi/control/host.py | 14 -------
src/kimchi/control/users.py | 35 +++++++++++++++++
src/kimchi/i18n.py | 1 +
src/kimchi/mockmodel.py | 4 ++
src/kimchi/model/groups.py | 67 +++++++++++++++++++++++++++++++++
src/kimchi/model/host.py | 19 ----------
src/kimchi/model/users.py | 90 ++++++++++++++++++++++++++++++++++++++++++++
src/kimchi/model/vms.py | 65 ++++++++++++++++++++------------
tests/test_authorization.py | 3 +-
tests/test_model.py | 3 +-
tests/test_rest.py | 4 +-
tests/utils.py | 3 +-
14 files changed, 284 insertions(+), 71 deletions(-)
create mode 100644 src/kimchi/control/groups.py
create mode 100644 src/kimchi/control/users.py
create mode 100644 src/kimchi/model/groups.py
create mode 100644 src/kimchi/model/users.py
--
1.8.3.2
10 years
[PATCH v6] Auto Topology for Guest Templates
by Christy Perez
This should be the final major revision for this. After more discussion
with Aline, it seems we've moved very far from "no input from users" to
"let users input the numbers, with some small restrctions."
Aline said she would talk with the UI team, but I'll still put a small
description here:
1. UI adds a new section on the template panel near vcpus. There's a
checkbox with the text, "Manually configure guest CPU topology." If
the users checks it
- The UI calls GET /host/cpuinfo
- The CPUs field becomes inactive, and will now be populated by
the UI based on the sockets & cores (next item):
CPUS = cores * threads
- Two fields appear: A selection field for threads (powers of 2
: 0...log(threads_per_core, 2)). This section should be
called either SMT (Power), or Threads (x86). The 2nd field is
a plain text box titled Cores that takes any integer.
Note: no 'automatic' option for threads/SMT.
- The UI calls POST template with the topology.
2. If the user doesn't check the checkbox, there's nothing new
to pass in for the template create.
Note: Currently there is a failing test in mockmodel, due to the nature
of the libvirt test driver. I'm looking into a workaround for the
getCapabilities function.
Christy Perez (1):
Parts to allow Kimchi to configure the cpu topology.
docs/API.md | 24 ++++++++
src/kimchi/control/cpuinfo.py | 37 ++++++++++++
src/kimchi/control/host.py | 2 +
src/kimchi/i18n.py | 5 ++
src/kimchi/model/cpuinfo.py | 128 ++++++++++++++++++++++++++++++++++++++++++
src/kimchi/model/templates.py | 10 ++--
6 files changed, 202 insertions(+), 4 deletions(-)
create mode 100644 src/kimchi/control/cpuinfo.py
create mode 100644 src/kimchi/model/cpuinfo.py
--
1.9.3
10 years