[PATCH V3] Enhancement: PCI Device information enhancement
by Wen Wang
From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
V2 -> V3:
1) Deal with translations issues
2) Changed the tip display format
V1 -> V2:
1) Changed the API name to "getPCIDeviceCompanion".
2) Changed for a more specific way of detecting the related devices.
3) Added the "Affected devices" to the tip with aligned format.
4) tip will when the pointer hang over any section of the affected line.
This patch provide the way that shows more specific PCI device
information by hanging the mouse on top of device name.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 14 ++++++++++++++
ui/js/src/kimchi.guest_edit_main.js | 24 ++++++++++++++++++++++++
ui/pages/i18n.json.tmpl | 7 +++++++
3 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 8a6e416..ebf826b 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1129,6 +1129,20 @@ var kimchi = {
});
},
+ getPCIDeviceCompanions : function(pcidev, suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'host/devices?_passthrough_affected_by=' + pcidev,
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
+ });
+ },
+
getISCSITargets : function(server, port, suc, err) {
server = encodeURIComponent(server);
port = port ? '&_server_port='+encodeURIComponent(port) : '';
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 030e112..ed8c689 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -407,6 +407,30 @@ kimchi.guest_edit_main = function() {
});
}
});
+ kimchi.getPCIDeviceCompanions(hostPCIs[i].name, function(infoData) {
+ var pciTitle = i18n["KCHVMED6007M"] + "\n";
+ var haveCompanions = false;
+ for(var p=0; p<infoData.length; p++) {
+ if(infoData[p].device_type === "net") {
+ haveCompanions = true;
+ pciTitle += " " + infoData[p].name + "\n";
+ pciTitle += " " + i18n["KCHVMED6001M"] + " " + infoData[p].interface;
+ pciTitle += ", " + i18n["KCHVMED6002M"] + " " + infoData[p].address;
+ pciTitle += ", " + i18n["KCHVMED6003M"] + " " + infoData[p].link_type + "\n";
+ } else if(infoData[p].device_type === "storage") {
+ haveCompanions = true;
+ pciTitle += " " + infoData[p].name + "\n";
+ pciTitle += " " + i18n["KCHVMED6004M"] + " " + infoData[p].block;
+ pciTitle += ", " + i18n["KCHVMED6005M"] + " " + infoData[p].drive_type;
+ pciTitle += ", " + i18n["KCHVMED6006M"] + " " + infoData[p].model + "\n";
+ }
+ }
+ for(var q=0; q<infoData.length; q++) {
+ haveCompanions && $(".name", "#" + infoData[q].parent).attr("title", pciTitle);
+ haveCompanions && $(".product", "#" + infoData[q].parent).attr("title", pciTitle);
+ haveCompanions && $(".vendor", "#" + infoData[q].parent).attr("title", pciTitle);
+ }
+ });
}
});
});
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index 75f1e43..ac2ca83 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -139,6 +139,13 @@
"KCHVMCD6008M": "$_("Successfully detached!")",
"KCHVMCD6009M": "$_("This disk will be detached permanently and you can re-attach it. Continue to detach it?")",
+ "KCHVMED6001M": "$_("interface:")",
+ "KCHVMED6002M": "$_("address:")",
+ "KCHVMED6003M": "$_("link_type:")",
+ "KCHVMED6004M": "$_("block:")",
+ "KCHVMED6005M": "$_("drive_type:")",
+ "KCHVMED6006M": "$_("model:")",
+ "KCHVMED6007M": "$_("Affected devices:")",
"KCHNET6001E": "$_("The VLAN id must be between 1 and 4094.")",
--
1.7.1
10 years, 1 month
[PATCH 0/2 v4] Edit disk format in vm template - backend
by Daniel Henrique Barboza
Changes in v4:
- removed POST documentation (not supported) and added GET and PUT documentation in API.md
Changes in v3:
- changed the name of the new parameter to 'format' instead of 'type'
- added all the supported disk formats in i18n.py messages
- using 'GET' to retrieve the updated value in unit tests
Changes in v2:
- added unit tests
- added support to all default disk types
These patches implement the backend support to change the disk format
when editing a template.
Example of usage:
1- create a test template:
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates -X POST -d'{"name": "test_template", "cdrom": "/valid/iso/path.iso"}'
2- change the disk format to 'cloop':
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates/test_template -X PUT -d'{"disks":[{"index":0,"size":10, "format": "cloop"}]}'
3- retrieve the template to see the changes:
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates/test_template -X GET
Enter host password for user 'user':
{
"cpus":1,
"cpu_info":{},
"graphics":{
"type":"vnc",
"listen":"127.0.0.1"
},
"cdrom":"/valid/iso/path.iso",
"networks":[
"default"
],
"icon":"images/icon-opensuse.png",
"os_distro":"opensuse",
"name":"test_template",
"disks":[
{
"index":0,
"size":10,
"format":"cloop"
}
],
"invalid":{},
"os_version":"13.1",
"storagepool":"/storagepools/default",
"memory":1024,
"folder":[]
}
Daniel Henrique Barboza (2):
Choose disk image format in vm template - backend
Unit tests for the new disk image format
docs/API.md | 6 ++--
src/kimchi/API.json | 8 +++++-
src/kimchi/i18n.py | 3 +-
src/kimchi/vmtemplate.py | 5 +++-
tests/test_mockmodel.py | 75 ++++++++++++++++++++++++++++++++++++++++--------
tests/test_model.py | 14 +++++++++
6 files changed, 94 insertions(+), 17 deletions(-)
--
1.8.3.1
10 years, 1 month
Kimchi migration within peers
by simonjin
Hi all,
I'm presenting here my proposal for the feature "Guest migration" which
is expected to be implemented for Kimchi 1.4.
Description
Migrate guest vm within peer/host discovered by Kimchi peers using openSLP.
In the first stage 1, only do migration will be supported,
in stage2, migrateCancel and migrateMonitor will be supported.
*Migration Mode: *
1. Support libvirt tunnelled transport managed by direct migration.
2. Only support Live migration mode.
3. Only support migration over TCP
*Migration Capability Check*
- Source libvirtd/client should be able to connect destination libvirtd.
- CPU architectures compare(X86 vs PPC).
- No PCI device passthrough.
- In a shared storage pool and the pool can be access/write by destination.
REST API
Only one new REST command will be added in stage 1.
Syntax
POST /vms//<vm-name>//migrate
Parameters:
in config.py.in:
('migration_destination_timeout', '21600',
'Maximum time the destination waits for the migration to
finish.
21600 should be enough since all the peers will be in the
same LAN'),
('migration_max_bandwidth', 'unlimited',
'default in libvirt is unlimited'),
('migration_downtime', '500',
'Maxmium allowed downtime for live migration in milliseconds '
'(anything below 100ms is ignored) if you do not care about '
'liveness of migration, set to a very high value, such as '
'600000.'),
Return:
An asynchronous Task with "target_uri" containing "/vms/</new-vm-name/>".
As expected with any Task, the cloning process can be tracked by
checking the corresponding task's status.
*Do_migration step:*
- migration source check .
- connect migration destination, guest vm config/params transfer and setup.
- migration source prepare.
- do actually migration.
- recover if failed.
- do finish if migration successful.
Comments are welcome!
--
Yun Tong Jin, Simon
Linux Technology Center, Open Virtualization project
IBM Systems & Technology Group
jinyt(a)cn.ibm.com, Phone: 824549654
10 years, 1 month
[PATCH] ISSUE#466: Filter valid format only on src_type of 'file'
by lvroyce0210@gmail.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
When src_type is block and volume is iscsi,
filter will prevent volume to be attached due to its format is 'unknown'.
Change the filter to only apply to 'file' src_type,
so that iscsi volume will not be blocked.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmstorages.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index 055aa50..a48d9fa 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -153,17 +153,19 @@ class VMStoragesModel(object):
if vol_info['ref_cnt'] != 0:
raise InvalidParameter("KCHVMSTOR0016E")
- supported_format = {
+ params['path'] = vol_info['path']
+ params['src_type'] = _check_path(params['path'])
+ valid_format = {
"disk": ["raw", "bochs", "qcow", "qcow2", "qed", "vmdk"],
"cdrom": "iso"}
- if vol_info['format'] in supported_format[params['type']]:
- if params['type'] == 'disk':
+ if params['src_type'] == 'file':
+ if params['type'] == 'disk' and
+ vol_info['format'] in valid_format[params['type']]:
params['format'] = vol_info['format']
- else:
- raise InvalidParameter("KCHVMSTOR0018E",
- {"format": vol_info['format'],
- "type": params['type']})
- params['path'] = vol_info['path']
+ else:
+ raise InvalidParameter("KCHVMSTOR0018E",
+ {"format": vol_info['format'],
+ "type": params['type']})
params['src_type'] = _check_path(params['path'])
if (params['bus'] not in HOTPLUG_TYPE
and DOM_STATE_MAP[dom.info()[0]] != 'shutoff'):
--
1.8.3.2
10 years, 1 month
[PATCH 0/2 v3] Edit disk format in vm template - backend
by Daniel Henrique Barboza
Changes in v3:
- changed the name of the new parameter to 'format' instead of 'type'
- added all the supported disk formats in i18n.py messages
- using 'GET' to retrieve the updated value in unit tests
Changes in v2:
- added unit tests
- added support to all default disk types
These patches implement the backend support to change the disk format
when editing a template.
Example of usage:
1- create a test template:
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates -X POST -d'{"name": "test_template", "cdrom": "/valid/iso/path.iso"}'
2- change the disk format to 'cloop':
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates/test_template -X PUT -d'{"disks":[{"index":0,"size":10, "format": "cloop"}]}'
3- retrieve the template to see the changes:
$ curl -u user -H "Content-Type: application/json -H "Accept: application/json" http://localhost:8010/templates/test_template -X GET
Enter host password for user 'user':
{
"cpus":1,
"cpu_info":{},
"graphics":{
"type":"vnc",
"listen":"127.0.0.1"
},
"cdrom":"/valid/iso/path.iso",
"networks":[
"default"
],
"icon":"images/icon-opensuse.png",
"os_distro":"opensuse",
"name":"test_template",
"disks":[
{
"index":0,
"size":10,
"format":"cloop"
}
],
"invalid":{},
"os_version":"13.1",
"storagepool":"/storagepools/default",
"memory":1024,
"folder":[]
}
Daniel Henrique Barboza (2):
Choose disk image format in vm template - backend
Unit tests for the new disk image format
docs/API.md | 1 +
src/kimchi/API.json | 8 +++++-
src/kimchi/i18n.py | 3 +-
src/kimchi/vmtemplate.py | 5 +++-
tests/test_mockmodel.py | 75 ++++++++++++++++++++++++++++++++++++++++--------
tests/test_model.py | 14 +++++++++
6 files changed, 91 insertions(+), 15 deletions(-)
--
1.8.3.1
10 years, 1 month
[PATCH 0/2 v2] Backend support - edit disk type in template
by Daniel Henrique Barboza
Changes in v2:
- added unit tests
- added support to all default disk types
These patches implement the backend support to change the disk type
when editing a template.
To test it:
- create a default template:
$ curl -u user:passwd -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8010/templates -X POST -d'{"name": "test_default_template", "cdrom":<valid_cdrom_path>}'
- changing the disk type of the default template to 'dmg':
$ curl -u user:passwd -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8010/templates/test_default_template -X PUT -d'{"disks":[{"index":0,"size":10, "type": "dmg"}]}'
Daniel Henrique Barboza (2):
Choose disk image type in vm template - backend
Unit tests for the new disk image types
docs/API.md | 1 +
src/kimchi/API.json | 8 ++++++-
src/kimchi/i18n.py | 1 +
src/kimchi/vmtemplate.py | 5 +++-
tests/test_mockmodel.py | 62 +++++++++++++++++++++++++++++++++++++++---------
tests/test_model.py | 14 +++++++++++
6 files changed, 78 insertions(+), 13 deletions(-)
--
1.8.3.1
10 years, 1 month
[PATCH] Create xmlutils/qemucmdline.py to generate <qemu:commandline> XML
by Aline Manera
This patch depends on "[PATCH 0/8 V2] Create a common function to generate guest disk XML"
Aline Manera (1):
Create xmlutils/qemucmdline.py to generate <qemu:commandline> XML
src/kimchi/vmtemplate.py | 28 ++++++++++--------------
src/kimchi/xmlutils/qemucmdline.py | 45 ++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 16 deletions(-)
create mode 100644 src/kimchi/xmlutils/qemucmdline.py
--
1.9.3
10 years, 1 month
Patches for PPC and other fixes/features
by Rodrigo Trujillo
I am going to send some patches that my we have worked for a while.
I will send separately, so some can be apply while others may need
adjustments.
Regards,
Rodrigo
10 years, 1 month
[PATCH 0/8 V3] Create a common function to generate guest disk XML
by Aline Manera
V2 -> V3:
- Create check_remote_disk_path() on model/utils.py to verify the necessity
to convert hostname to IP
V1 -> V2:
- Make xmlutils/disk.py independent of model instances
Aline Manera (8):
Move _get_storage_xml() to xmlutils/disk.py
Move vmdisks.py functions to xmlutils/disk.py
Remove 'bus' paramater from /vms/<name>/storages documentation
Update get_disk_xml() to get the device same according to bus and
index values
Remove ignore_src parameter from get_disk_xml()
Get disk type according to file path on get_disk_xml()
Check QEMU stream DNS capability when attaching new disk to guest
Update vmtemplate.py to use get_disk_xml() while generating CDROM XML
docs/API.md | 1 -
src/kimchi/model/storagevolumes.py | 8 +-
src/kimchi/model/utils.py | 19 ++++-
src/kimchi/model/vmstorages.py | 144 +++++++++------------------------
src/kimchi/vmdisks.py | 75 ------------------
src/kimchi/vmtemplate.py | 74 ++++++-----------
src/kimchi/xmlutils/disk.py | 158 +++++++++++++++++++++++++++++++++++++
tests/test_model.py | 11 ++-
8 files changed, 248 insertions(+), 242 deletions(-)
delete mode 100644 src/kimchi/vmdisks.py
create mode 100644 src/kimchi/xmlutils/disk.py
--
1.9.3
10 years, 1 month
[PATCH V2] Number of CPUs in Host's Basic Information.
by Paulo Vital
Support to provide the information of the number of on-line CPUs
present in the Host system.
This patch also updated the API.md, mockmodel, unittests and English
help page to express the new information.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
docs/API.md | 3 ++-
src/kimchi/mockmodel.py | 3 ++-
src/kimchi/model/host.py | 5 +++--
tests/test_model.py | 3 ++-
tests/test_rest.py | 3 ++-
ui/pages/help/en_US/host.dita | 4 ++--
ui/pages/tabs/host.html.tmpl | 6 +++++-
7 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 6984649..fdfb04f 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -790,7 +790,8 @@ Contains information of host.
* **GET**: Retrieve host static information
* memory: Total size of host physical memory
The unit is Bytes
- * cpu: The model name of host CPU
+ * cpu_model: The model name of host CPU
+ * cpus: The number of online CPUs available on host
* os_distro: The OS distribution that runs on host
* os_version: The version of OS distribution
* os_codename: The code name of OS distribution
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index de9df0e..7163f8d 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -936,7 +936,8 @@ class MockModel(object):
def host_lookup(self, *name):
res = {}
res['memory'] = 6114058240
- res['cpu'] = 'Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz'
+ res['cpu_model'] = 'Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz'
+ res['cpus'] = 4
res['os_distro'] = 'Red Hat Enterprise Linux Server'
res['os_version'] = '6.4'
res['os_codename'] = 'Santiago'
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index 1bc3ca2..8cddcdc 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -81,14 +81,15 @@ class HostModel(object):
def _get_host_info(self):
res = {}
if platform.machine().startswith('ppc'):
- res['cpu'] = self._get_ppc_cpu_info()
+ res['cpu_model'] = self._get_ppc_cpu_info()
else:
with open('/proc/cpuinfo') as f:
for line in f.xreadlines():
if "model name" in line:
- res['cpu'] = line.split(':')[1].strip()
+ res['cpu_model'] = line.split(':')[1].strip()
break
+ res['cpus'] = psutil.NUM_CPUS
res['memory'] = psutil.TOTAL_PHYMEM
# Include IBM PowerKVM name to supported distro names
diff --git a/tests/test_model.py b/tests/test_model.py
index 896540d..c06eaae 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1298,7 +1298,8 @@ class ModelTests(unittest.TestCase):
objstore_loc=self.tmp_store)
info = inst.host_lookup()
distro, version, codename = platform.linux_distribution()
- self.assertIn('cpu', info)
+ self.assertIn('cpu_model', info)
+ self.assertIn('cpus', info)
self.assertEquals(distro, info['os_distro'])
self.assertEquals(version, info['os_version'])
self.assertEquals(unicode(codename, "utf-8"), info['os_codename'])
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 60dce2f..9bc930f 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1753,8 +1753,9 @@ class RestTests(unittest.TestCase):
self.assertEquals('6.4', info['os_version'])
self.assertEquals('Santiago', info['os_codename'])
self.assertEquals('Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz',
- info['cpu'])
+ info['cpu_model'])
self.assertEquals(6114058240, info['memory'])
+ self.assertEquals(4, info['cpus'])
def test_hoststats(self):
stats_keys = ['cpu_utilization', 'memory', 'disk_read_rate',
diff --git a/ui/pages/help/en_US/host.dita b/ui/pages/help/en_US/host.dita
index 335c51c..0dcb670 100644
--- a/ui/pages/help/en_US/host.dita
+++ b/ui/pages/help/en_US/host.dita
@@ -24,8 +24,8 @@ to the host system, if it is not already connected.</li>
<dlentry>
<dt>Basic information</dt>
<dd>This section displays the host operating system distribution,
-version, and code name, as well as the processor type and amount of
-memory in GB.</dd>
+version, and code name, as well as the processor type, the number of
+online CPUs and amount of memory in GB.</dd>
</dlentry><dlentry>
<dt>System statistics</dt>
<dd>This section displays graphs to show statistics for CPU, memory,
diff --git a/ui/pages/tabs/host.html.tmpl b/ui/pages/tabs/host.html.tmpl
index 8641962..81266ce 100644
--- a/ui/pages/tabs/host.html.tmpl
+++ b/ui/pages/tabs/host.html.tmpl
@@ -72,7 +72,11 @@
</div>
<div class="section-row">
<div class="section-label">$_("Processor")</div>
- <div class="section-value">{cpu}</div>
+ <div class="section-value">{cpu_model}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("CPU(s)")</div>
+ <div class="section-value">{cpus}</div>
</div>
<div class="section-row">
<div class="section-label">$_("Memory")</div>
--
1.9.3
10 years, 1 month