<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><b><span style="font-size:14.0pt">1.Lost soapAction in http request header<o:p></o:p></span></b></p>
<p class="MsoNormal">     When I tried to retrieve  the property of <strong><span style="font-family:"Calibri","sans-serif"">storage.perDatastoreUsage 
</span></strong><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">under</span></strong><strong><span style="font-family:"Calibri","sans-serif"">
</span></strong><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">specify virtual machine  and  got a invalidProperty error but other properties(e.g.
</span></strong><strong><span style="font-family:"Calibri","sans-serif"">summary.storage,</span></strong><span class="MsoHyperlink">
</span><strong><span style="font-family:"Calibri","sans-serif"">guest</span></strong><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">) under the same virtual machine are ok.<o:p></o:p></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">Then I write a same program use vsphere web service sdk in java  and catch the http package by wireshark.<o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#313131">By comparing, I found that we lost soapAction field in http request header, it seems to like this:</span>
<span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#313131">SOAPAction: "urn:vim25/5.0”.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#313131">I checked the vsphere development document and found some key description as following:<o:p></o:p></span></p>
<p class="MsoNormal"><a name="1104165"><i><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">When a client application connects to a Web service running on an vSphere server (ESX/ESXi or vCenter Server
</span></i></a><i><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">system), the server detects the version of the API that was used to develop the client and makes available only those operations supported by the client.
<o:p></o:p></span></i></p>
<p class="MsoNormal"><a name="1104166"><i><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">Client applications convey information about the API version used in the SOAP messages that they send to a
</span></i></a><i><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">vSphere server. These SOAP messages include a versionID in the soapAction attribute. The details are handled transparently by the SOAP toolkit and the client proxy code.
 The server adjusts its behavior based on the client’s version information, exposing the API version that the client supports to the client.
<o:p></o:p></span></i></p>
<p class="MsoNormal"><a name="1104193"><i>If you are developing a client application that must support multiple server versions at the same time
</i></a><i>(ESX/ESXi 5.0 and ESX/ESXi 3.x, for example), you must obtain information about the API versions that are supported on the server and provide logic in your code to use or not use features, based upon the version information.</i><i><o:p></o:p></i></p>
<p class="MsoNormal">Finally, I added  the soapAction field into http request header  and got a correct result. So I added some lines in function
<span style="font-size:12.0pt;font-family:"Times New Roman","serif"">esxVI_Context_Connect() at  </span><span style="font-size:10.0pt;font-family:"Courier New"">src/esx/esx_vi.c as following:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">           
<b>if (virAsprintf(&soapAction, "SOAPAction: \"urn:vim25/%s\"",<o:p></o:p></b></span></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">                                    ctx->service->about->apiVersion) < 0) {<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">                        virReportOOMError();<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">                        goto cleanup;<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">            }<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">            ctx->curl->headers = curl_slist_append(ctx->curl->headers, soapAction);<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Courier New""><o:p> </o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Courier New"">2</span></b><b><span style="font-size:14.0pt">.cat not deserialize the String(maybe other primary types are included) which as a list<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  </span>
<strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">when  I tried to retrieve the property of</span></strong><b><span style="font-size:10.0pt;font-family:"Courier New"">
</span><strong><span style="font-family:"Calibri","sans-serif"">config.network.pnic
</span></strong></b><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">under hostsystem and got an  error in virsh.log which goes like as following:<o:p></o:p></span></strong></p>
<p class="MsoNormal"><i>2013-04-22 01:57:42.692+0000: 29640: error : esxVI_String_Deserialize:1233 : internal error Wrong XML element type 3<o:p></o:p></i></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  Then I debug my program and find  that bug lays  where  deserialize
</span><b>resourcePoolSchedulerDisallowedReason  </b>which is a member of <strong>
<span style="font-family:"Calibri","sans-serif"">PhysicalNic  </span></strong><strong><span style="font-family:"Calibri","sans-serif";font-weight:normal">and has a
</span></strong><b>string[] </b> type.<o:p></o:p></p>
<p class="MsoNormal">I catch the soap message by wireshark and find that this xml element has no child ,it seems like as following:<o:p></o:p></p>
<p class="MsoNormal"><i><resourcePoolSchedulerDisallowedReason>hardwareUnsupported</resourcePoolSchedulerDisallowedReason<o:p></o:p></i></p>
<p class="MsoNormal">But the libvirt program still parses  it as if it has children, I think this is key point that leads to this bug.<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:9.0pt">Now I fix my program by setting this member as ignore in esx_vi_generator.input.<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:9.0pt">Maybe you want to investigate and fix this bug.<span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Dennis<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>