From: Wen Wang <wenwang(a)linux.vnet.ibm.com>
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 | 25 +++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 8a6e416..aebac56 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1129,6 +1129,20 @@ var kimchi = {
});
},
+ getPCIDeviceDescriptions : 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..580f648 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -365,6 +365,9 @@ kimchi.guest_edit_main = function() {
kimchi.getCapabilities(function(result) {
var pciEnabled = result.kernel_vfio;
for(var i=0; i<hostPCIs.length; i++){
+
+
+
var itemNode =
$.parseHTML(kimchi.substitute($('#pci-tmpl').html(),{
name: hostPCIs[i].name,
product: hostPCIs[i].product.description,
@@ -407,6 +410,28 @@ kimchi.guest_edit_main = function() {
});
}
});
+ kimchi.getPCIDeviceDescriptions(hostPCIs[i].name,
function(infoData) {
+ var pciTitle = "";
+ if(infoData.length>0) {
+ for(var p=0; p<infoData.length; p++) {
+ if(infoData[p].interface) {
+ pciTitle += "interface: " +
infoData[p].interface;
+ pciTitle += ", address: " +
infoData[p].address;
+ pciTitle += ", link_type: " +
infoData[p].link_type;
+ pciTitle += " ";
+ } else if(infoData[p].block) {
+ pciTitle += "block: " +
infoData[p].block;
+ pciTitle += ", drive_type: " +
infoData[p].drive_type;
+ pciTitle += ", model: " +
infoData[p].model;
+ pciTitle += " ";
+ }
+
+ }
+ for(var q=0; q<infoData.length; q++) {
+ pciTitle === "" || $(".name",
"#" + infoData[q].parent).attr("title", pciTitle);
+ }
+ }
+ });
}
});
});
--
1.7.1