<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Thanks for the advice. I have sent a V2 of this patch according to
your comments.<br>
<br>
Best Regards<br>
<br>
Wang Wen<br>
<div class="moz-cite-prefix">在 10/27/14 11:21 AM, Zhou Zheng Sheng
写道:<br>
</div>
<blockquote cite="mid:544DBA52.7040106@linux.vnet.ibm.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-unicode">
<pre wrap="">Hi Wen,
The patch is excellent. I tested the it and it worked with the back-end
_passthrough_affected_by API properly. I find a few problems.
First problem is that only when mouse points to the "Name" column, it
shows the related devices. It's not obvious enough for the user to
discover it. Maybe we can also show the tooltip in all the columns, or
as long as the mouse points to any place inside the row of the device.
The second problem is that the information it shows is not very
self-explanatory. For example, it shows the following information for my
wlan NIC.
interface: wlp3s0, address: 8c:70:5a:5d:5e:90, link_type: IEEE 802.11
While this is correct, but how this information is related to the device
:"Centrino Advanced-N 6205 [Taylor Peak]" is not clear.
Suppose there are 4 affected devices, maybe we can show it like this
Affected devices:
net_wlp3s0_8c_70_5a_5d_5e_90
interface: wlp3s0, address: 8c:70:5a:5d:5e:90, link_type: IEEE 802.11
device2_name_blah
device3_name_blah
device4_name_blah
detailed information blah
I have some other inline comments, please scroll down and see below.
on 2014/10/24 18:16, Wen Wang wrote:
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">> </span>From: Wen Wang <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:wenwang@linux.vnet.ibm.com"><wenwang@linux.vnet.ibm.com></a>
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>This patch provide the way that shows more specific PCI device
<span class="moz-txt-citetags">> </span>information by hanging the mouse on top of device name.
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>Signed-off-by: Wen Wang <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:wenwang@linux.vnet.ibm.com"><wenwang@linux.vnet.ibm.com></a>
<span class="moz-txt-citetags">> </span>---
<span class="moz-txt-citetags">> </span> ui/js/src/kimchi.api.js | 14 ++++++++++++++
<span class="moz-txt-citetags">> </span> ui/js/src/kimchi.guest_edit_main.js | 25 +++++++++++++++++++++++++
<span class="moz-txt-citetags">> </span> 2 files changed, 39 insertions(+), 0 deletions(-)
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
<span class="moz-txt-citetags">> </span>index 8a6e416..aebac56 100644
<span class="moz-txt-citetags">> </span>--- a/ui/js/src/kimchi.api.js
<span class="moz-txt-citetags">> </span>+++ b/ui/js/src/kimchi.api.js
<span class="moz-txt-citetags">> </span>@@ -1129,6 +1129,20 @@ var kimchi = {
<span class="moz-txt-citetags">> </span> });
<span class="moz-txt-citetags">> </span> },
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>+ getPCIDeviceDescriptions : function(pcidev, suc, err) {
</pre>
</blockquote>
<pre wrap="">I think "getPCIDeviceCompanions" may be a better name.
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">> </span>+ kimchi.requestJSON({
<span class="moz-txt-citetags">> </span>+ url : kimchi.url + 'host/devices?_passthrough_affected_by=' + pcidev,
<span class="moz-txt-citetags">> </span>+ type : 'GET',
<span class="moz-txt-citetags">> </span>+ contentType : 'application/json',
<span class="moz-txt-citetags">> </span>+ dataType : 'json',
<span class="moz-txt-citetags">> </span>+ resend : true,
<span class="moz-txt-citetags">> </span>+ success : suc,
<span class="moz-txt-citetags">> </span>+ error : err ? err : function(data) {
<span class="moz-txt-citetags">> </span>+ kimchi.message.error(data.responseJSON.reason);
<span class="moz-txt-citetags">> </span>+ }
<span class="moz-txt-citetags">> </span>+ });
<span class="moz-txt-citetags">> </span>+ },
<span class="moz-txt-citetags">> </span>+
<span class="moz-txt-citetags">> </span> getISCSITargets : function(server, port, suc, err) {
<span class="moz-txt-citetags">> </span> server = encodeURIComponent(server);
<span class="moz-txt-citetags">> </span> port = port ? '&_server_port='+encodeURIComponent(port) : '';
<span class="moz-txt-citetags">> </span>diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
<span class="moz-txt-citetags">> </span>index 030e112..580f648 100644
<span class="moz-txt-citetags">> </span>--- a/ui/js/src/kimchi.guest_edit_main.js
<span class="moz-txt-citetags">> </span>+++ b/ui/js/src/kimchi.guest_edit_main.js
<span class="moz-txt-citetags">> </span>@@ -365,6 +365,9 @@ kimchi.guest_edit_main = function() {
<span class="moz-txt-citetags">> </span> kimchi.getCapabilities(function(result) {
<span class="moz-txt-citetags">> </span> var pciEnabled = result.kernel_vfio;
<span class="moz-txt-citetags">> </span> for(var i=0; i<hostPCIs.length; i++){
<span class="moz-txt-citetags">> </span>+
<span class="moz-txt-citetags">> </span>+
<span class="moz-txt-citetags">> </span>+
<span class="moz-txt-citetags">> </span> var itemNode = $.parseHTML(kimchi.substitute($('#pci-tmpl').html(),{
<span class="moz-txt-citetags">> </span> name: hostPCIs[i].name,
<span class="moz-txt-citetags">> </span> product: hostPCIs[i].product.description,
<span class="moz-txt-citetags">> </span>@@ -407,6 +410,28 @@ kimchi.guest_edit_main = function() {
<span class="moz-txt-citetags">> </span> });
<span class="moz-txt-citetags">> </span> }
<span class="moz-txt-citetags">> </span> });
<span class="moz-txt-citetags">> </span>+ kimchi.getPCIDeviceDescriptions(hostPCIs[i].name, function(infoData) {
<span class="moz-txt-citetags">> </span>+ var pciTitle = "";
<span class="moz-txt-citetags">> </span>+ if(infoData.length>0) {
<span class="moz-txt-citetags">> </span>+ for(var p=0; p<infoData.length; p++) {
<span class="moz-txt-citetags">> </span>+ if(infoData[p].interface) {
<span class="moz-txt-citetags">> </span>+ pciTitle += "interface: " + infoData[p].interface;
<span class="moz-txt-citetags">> </span>+ pciTitle += ", address: " + infoData[p].address;
<span class="moz-txt-citetags">> </span>+ pciTitle += ", link_type: " + infoData[p].link_type;
<span class="moz-txt-citetags">> </span>+ pciTitle += " ";
<span class="moz-txt-citetags">> </span>+ } else if(infoData[p].block) {
<span class="moz-txt-citetags">> </span>+ pciTitle += "block: " + infoData[p].block;
<span class="moz-txt-citetags">> </span>+ pciTitle += ", drive_type: " + infoData[p].drive_type;
<span class="moz-txt-citetags">> </span>+ pciTitle += ", model: " + infoData[p].model;
<span class="moz-txt-citetags">> </span>+ pciTitle += " ";
<span class="moz-txt-citetags">> </span>+ }
</pre>
</blockquote>
<pre wrap="">If you notice, each returned infoData[p] should have a ".device_type".
For example,
[
{
"parent":"pci_0000_00_19_0",
"name":"net_em1_00_21_cc_c2_6d_a6",
"device_type":"net",
"address":"00:21:cc:c2:6d:a6",
"interface":"em1",
"path":"/sys/devices/pci0000:00/0000:00:19.0/net/em1",
"link_type":"IEEE 802.3"
}
]
If the 'infoData[p].device_type == "net"', we can sure that it also
contains ".interface"m ".address" and also ".link_type". I think the
it's better to check the "device_type" rather than to check existence of
"infoData[p].interface" or "infoData[p].block". This is because there
might be a totally different device information which also contains
".interface" or ".block".
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">> </span>+
<span class="moz-txt-citetags">> </span>+ }
<span class="moz-txt-citetags">> </span>+ for(var q=0; q<infoData.length; q++) {
<span class="moz-txt-citetags">> </span>+ pciTitle === "" || $(".name", "#" + infoData[q].parent).attr("title", pciTitle);
<span class="moz-txt-citetags">> </span>+ }
<span class="moz-txt-citetags">> </span>+ }
<span class="moz-txt-citetags">> </span>+ });
<span class="moz-txt-citetags">> </span> }
<span class="moz-txt-citetags">> </span> });
<span class="moz-txt-citetags">> </span> });
<span class="moz-txt-citetags">> </span>
</pre>
</blockquote>
<pre wrap="">
<div class="moz-txt-sig">--
Zhou Zheng Sheng / 周征晟
E-mail: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:zhshzhou@linux.vnet.ibm.com">zhshzhou@linux.vnet.ibm.com</a>
Telephone: 86-10-82454397
</div></pre>
</div>
</blockquote>
<br>
</body>
</html>