<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<font style="font-size:12pt;" face="Times New Roman" size="3">Hi Matthias, <br>
<br>
As promised, below is the patch demonstrating the issue. One thing I 
lied was its not enum that I missed but I missed one of the data objects
 extended.<br>
------------------------------<br>
</font>
<pre> Patch is only to demonstrate the misleading error warning if<br> one extended data objects is not defined and an attempt to<br> "CastFromAny" is done on the base object. <br><br>HostHostBusAdapter is extended by:<br>HostBlockHba, HostInternetScsiHba, HostFibreChannelHba and HostParallelScsiHba. <br><br>In this demo, definition of HostParallelHba is missing from esx_vi_generator.input.<br> <br>Signed-off-by: Ata E Husain Bohra <ata.husain@hotmail.com><br>---<br> src/esx/esx_storage_driver.c   |   40 ++++++++-<br> src/esx/esx_vi_generator.input |  187 ++++++++++++++++++++++++++++++++++++++++<br> src/esx/esx_vi_generator.py    |    2 +<br> 3 files changed, 226 insertions(+), 3 deletions(-)<br> <br>diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c<br>index 9b64891..963bd42 100644<br>--- a/src/esx/esx_storage_driver.c<br>+++ b/src/esx/esx_storage_driver.c<br>@@ -238,12 +238,46 @@ esxNumberOfDefinedStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED)<br> <br> <br> static int<br>-esxListDefinedStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED,<br>+esxListDefinedStoragePools(virConnectPtr conn,<br>                            char **const names ATTRIBUTE_UNUSED,<br>                            int maxnames ATTRIBUTE_UNUSED)<br> {<br>-    /* ESX storage pools are always active */<br>-    return 0;<br>+    esxPrivate *priv = conn->storagePrivateData;<br>+    esxVI_DynamicProperty *dynamicProperty = NULL;<br>+    esxVI_ObjectContent *hostSystem = NULL;<br>+    esxVI_String *propertyNameList = NULL;<br>+    esxVI_HostHostBusAdapter *hostAdapterList = NULL;<br>+    int result = -1;<br>+<br>+    if (esxVI_String_AppendValueToList(&propertyNameList,<br>+          "config.storageDevice.hostBusAdapter\0") < 0 ||<br>+        esxVI_LookupHostSystemProperties(priv->primary, <br>+            propertyNameList, &hostSystem) < 0) {<br>+        goto cleanup;<br>+    }<br>+<br>+    for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;<br>+         dynamicProperty = dynamicProperty->_next) {<br>+        if (STREQ(dynamicProperty->name,<br>+              "config.storageDevice.hostBusAdapter")) {<br>+            if (esxVI_HostHostBusAdapter_CastListFromAnyType(<br>+                  dynamicProperty->val, &hostAdapterList) < 0 ||<br>+                hostAdapterList == NULL) {<br>+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,<br>+                  _("Could not cast HostHostBusAdapter from AnyType"));<br>+                goto cleanup;<br>+            }<br>+        }<br>+    }<br>+<br>+    result = 0;<br>+<br>+cleanup:<br>+    esxVI_String_Free(&propertyNameList);<br>+    esxVI_ObjectContent_Free(&hostSystem);<br>+    esxVI_HostHostBusAdapter_Free(&hostAdapterList);<br>+<br>+    return result;<br> }<br> <br> <br>diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input<br>index 1a67a8c..85f0749 100644<br>--- a/src/esx/esx_vi_generator.input<br>+++ b/src/esx/esx_vi_generator.input<br>@@ -58,6 +58,14 @@ enum AutoStartWaitHeartbeatSetting<br> end<br> <br> <br>+enum FibreChannelPortType<br>+    fabric<br>+    loop<br>+    pointToPoint<br>+    unknown<br>+end<br>+<br>+<br> enum ManagedEntityStatus<br>     gray<br>     green<br>@@ -263,6 +271,11 @@ object HostAutoStartManagerConfig<br> end<br> <br> <br>+<br>+object HostBlockHba extends HostHostBusAdapter<br>+end<br>+<br>+<br> object HostConfigManager<br>     ManagedObjectReference                   cpuScheduler                   o<br>     ManagedObjectReference                   datastoreSystem                o<br>@@ -310,6 +323,15 @@ object HostDatastoreBrowserSearchSpec<br> end<br> <br> <br>+<br>+object HostFibreChannelHba extends HostHostBusAdapter<br>+    Long                                     nodeWorldWideName              r<br>+    FibreChannelPortType                     portType                       r<br>+    Long                                     portWorldWideName              r<br>+    Long                                     speed                          r<br>+end<br>+<br>+<br> object HostFileSystemVolume<br>     String                                   type                           r<br>     String                                   name                           r<br>@@ -317,6 +339,160 @@ object HostFileSystemVolume<br> end<br> <br> <br>+object HostHostBusAdapter<br>+    Int                                      bus                            r<br>+    String                                   device                         r<br>+    String                                   driver                         o<br>+    String                                   key                            o<br>+    String                                   model                          r<br>+    String                                   pci                            o<br>+    String                                   status                         r<br>+end<br>+<br>+<br>+<br>+object HostInternetScsiHba extends HostHostBusAdapter<br>+    HostInternetScsiHbaAuthenticationCapabilities   authenticationCapabilities  r<br>+    HostInternetScsiHbaAuthenticationProperties     authenticationProperties    r<br>+    HostInternetScsiHbaDiscoveryCapabilities        discoveryCapabilities       r<br>+    HostInternetScsiHbaDiscoveryProperties          discoveryProperties         r<br>+    HostInternetScsiHbaIPCapabilities               ipCapabilities              r<br>+    HostInternetScsiHbaIPProperties                 ipProperties                r<br>+    String                                          iScsiName                   r<br>+    Boolean                                         isSoftwareBased             r<br>+    HostInternetScsiHbaParamValue                   advancedOptions             ol<br>+    HostInternetScsiHbaSendTarget                   configuredSendTarget        ol<br>+    HostInternetScsiHbaStaticTarget                 configuredStaticTarget      ol<br>+    Int                                             currentSpeedMb              o<br>+    HostInternetScsiHbaDigestCapabilities           digestCapabilities          o<br>+    HostInternetScsiHbaDigestProperties             digestProperties            o<br>+    String                                          iScsiAlias                  o<br>+    Int                                             maxSpeedMb                  o<br>+    OptionDef                                       supportedAdvancedOptions    ol<br>+end<br>+<br>+<br>+<br>+object HostInternetScsiHbaAuthenticationCapabilities<br>+    Boolean                                  chapAuthSettable               r<br>+    Boolean                                  krb5AuthSettable               r<br>+    Boolean                                  spkmAuthSettable               r<br>+    Boolean                                  srpAuthSettable                r<br>+    Boolean                                  mutualChapSettable             o<br>+    Boolean                                  targetChapSettable             o<br>+    Boolean                                  targetMutualChapSettable       o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaAuthenticationProperties<br>+    Boolean                                  chapAuthEnabled                r<br>+    String                                   chapAuthenticationType         o<br>+    Boolean                                  chapInherited                  o<br>+    String                                   chapName                       o<br>+    String                                   chapSecret                     o<br>+    String                                   mutualChapAuthenticationType   o<br>+    Boolean                                  mutualChapInherited            o<br>+    String                                   mutualChapName                 o<br>+    String                                   mutualChapSecret               o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaDigestCapabilities<br>+    Boolean                                  dataDigestSettable             o<br>+    Boolean                                  headerDigestSettable           o<br>+    Boolean                                  targetDataDigestSettable       o<br>+    Boolean                                  targetHeaderDigestSettable     o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaDigestProperties<br>+    Boolean                                  dataDigestInherited            o<br>+    String                                   dataDigestType                 o<br>+    Boolean                                  headerDigestInherited          o<br>+    String                                   headerDigestType               o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaDiscoveryCapabilities<br>+    Boolean                                  iSnsDiscoverySettable          r<br>+    Boolean                                  sendTargetsDiscoverySettable   r<br>+    Boolean                                  slpDiscoverySettable           r<br>+    Boolean                                  staticTargetDiscoverySettable  r<br>+end<br>+<br>+<br>+object HostInternetScsiHbaDiscoveryProperties<br>+    Boolean                                  iSnsDiscoveryEnabled           r<br>+    Boolean                                  sendTargetsDiscoveryEnabled    r<br>+    Boolean                                  slpDiscoveryEnabled            r<br>+    Boolean                                  staticTargetDiscoveryEnabled   r<br>+    String                                   iSnsDiscoveryMethod            o<br>+    String                                   iSnsHost                       o<br>+    String                                   slpDiscoveryMethod             o<br>+    String                                   slpHost                        o<br>+end<br>+<br>+object HostInternetScsiHbaIPCapabilities<br>+    Boolean                                         addressSettable             r<br>+    Boolean                                         alternateDnsServerAddressSettable   r<br>+    Boolean                                         defaultGatewaySettable              r<br>+    Boolean                                         ipConfigurationMethodSettable       r<br>+    Boolean                                         primaryDnsServerAddressSettable     r<br>+    Boolean                                         subnetMaskSettable                  r<br>+    Boolean                                         arpRedirectSettable                 o<br>+    Boolean                                         hostNameAsTargetAddress             o<br>+    Boolean                                         ipv6Supported                       o<br>+    Boolean                                         mtuSettable                         o<br>+    Boolean                                         nameAliasSettable                   o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaIPProperties<br>+    Boolean                                         dhcpConfigurationEnabled    r<br>+    String                                          address                     o<br>+    String                                          alternateDnsServerAddress   o<br>+    Boolean                                         arpRedirectEnabled          o<br>+    String                                          defaultGateway              o<br>+    String                                          ipv6Address                 o<br>+    String                                          ipv6DefaultGateway          o<br>+    Boolean                                         jumboFramesEnabled          o<br>+    String                                          mac                         o<br>+    Int                                             mtu                         o<br>+    String                                          primaryDnsServerAddress     o<br>+    String                                          subnetMask                  o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaParamValue extends OptionValue<br>+    Boolean                                  isInherited                    o<br>+end<br>+<br>+<br>+object HostInternetScsiHbaSendTarget<br>+    String                                   address                        r<br>+    HostInternetScsiHbaParamValue            advancedOptions                ol<br>+    HostInternetScsiHbaAuthenticationProperties  authenticationProperties   o<br>+    HostInternetScsiHbaDigestProperties      digestProperties               o<br>+    String                                   parent                         o<br>+    Int                                      port                           o<br>+    OptionDef                                supportedAdvancedOptions       ol<br>+end<br>+<br>+<br>+object HostInternetScsiHbaStaticTarget<br>+    String                                   address                        r<br>+    String                                   iScsiName                      r<br>+    HostInternetScsiHbaParamValue            advancedOptions                ol<br>+    HostInternetScsiHbaAuthenticationProperties  authenticationProperties   o<br>+    HostInternetScsiHbaDigestProperties      digestProperties               o<br>+    String                                   parent                         o<br>+    Int                                      port                           o<br>+    OptionDef                                supportedAdvancedOptions       ol<br>+end<br>+<br>+<br>+<br>+<br> object HostMountInfo<br>     String                                   path                           o<br>     String                                   accessMode                     r<br>@@ -394,11 +570,22 @@ object ObjectUpdate<br> end<br> <br> <br>+object OptionDef extends ElementDescription<br>+    OptionType                               optionType                     r<br>+end<br>+<br>+<br> object OptionType<br>     Boolean                                  valueIsReadonly                o<br> end<br> <br> <br>+object OptionValue<br>+    String                                   key                            r<br>+    AnyType                                  value                          r<br>+end<br>+<br>+<br> object PerfCounterInfo<br>     Int                                      key                            r<br>     ElementDescription                       nameInfo                       r<br>diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py<br>index 8a128df..54df7ab 100755<br>--- a/src/esx/esx_vi_generator.py<br>+++ b/src/esx/esx_vi_generator.py<br>@@ -1519,6 +1519,8 @@ additional_object_features = { "AutoStartDefaults"          : Object.FEATURE__AN<br>                                                               Object.FEATURE__ANY_TYPE,<br>                                "HostDatastoreBrowserSearchResults" : Object.FEATURE__LIST |<br>                                                               Object.FEATURE__ANY_TYPE,<br>+                               "HostHostBusAdapter"         : Object.FEATURE__LIST |<br>+                                                              Object.FEATURE__ANY_TYPE,<br>                                "ManagedObjectReference"     : Object.FEATURE__ANY_TYPE,<br>                                "ObjectContent"              : Object.FEATURE__DEEP_COPY,<br>                                "ResourcePoolResourceUsage"  : Object.FEATURE__ANY_TYPE,<br>-- <br>1.7.9.5<br> </pre>
-----------------------<br>
<br>
Thanks!<br>
Ata<br id="FontBreak">
<br><br><div><div id="SkyDrivePlaceholder"></div>> From: ata.husain@hotmail.com<br>> To: matthias.bolte@googlemail.com<br>> Date: Wed, 18 Jul 2012 12:28:16 -0700<br>> CC: libvirt-list@redhat.com<br>> Subject: Re: [libvirt] ESX: failure while performing "CastFromAnyType"<br>> <br>> Hi Matthias,<br>> <br>> I modified the code significantly from that point, but I think it should be <br>> still reproducible. I will give it a try and reproduce the issue to share <br>> the patch sometime later today or tomorrow.<br>> <br>> Thanks!<br>> Ata<br>> <br>> -----Original Message----- <br>> From: Matthias Bolte<br>> Sent: Wednesday, July 18, 2012 12:19 PM<br>> To: Ata E Husain Bohra<br>> Cc: libvirt-list@redhat.com<br>> Subject: Re: [libvirt] ESX: failure while performing "CastFromAnyType"<br>> <br>> Hi,<br>> <br>> do you have a patch that allows me to reproduce this problem? So I can<br>> improve the error reporting here?<br>> <br>> Regards,<br>> Matthias<br>> <br>> 2012/7/18 Ata E Husain Bohra <ata.husain@hotmail.com>:<br>> > Just want to drop this note, so no one else gets bother with my query. I <br>> > was<br>> > able to find the reason and its fixed. It seems one of the ENUMs deep <br>> > inside<br>> > one of the structures was not defined. I am not sure if single step is the<br>> > only way to solve such issues, as ESX_VI_ERROR never provided any useful<br>> > information.<br>> ><br>> > Thanks!<br>> > Ata<br>> ><br>> > From: Ata E Husain Bohra<br>> > Sent: Monday, July 16, 2012 2:59 PM<br>> > To: LIbvirt<br>> > Subject: [libvirt] ESX: failure while performing "CastFromAnyType"<br>> ><br>> > Hi All,<br>> ><br>> > I am trying to extend “iscsi” support for iSCSI driver, currently am stuck<br>> > at getting iSCSI target list from the hypervisor. I am using hostSystem<br>> > object (propertyNameList is set to “config.storageDevice.hostBusAdapter”) <br>> > to<br>> > retrieve list of “HostHostBusAdapter” from ESX, but the call fails to<br>> > perform “CastFromAnyType”  from ObjectContent –> HostHostBusAdapter. The<br>> > esx_vi_generator.input object definition looks like this:<br>> ><br>> > object HostHostBusAdapter<br>> >     String                                   key<br>> > o<br>> >     String                                   device<br>> > r<br>> >     Int                                      bus<br>> > r<br>> >     String                                   status<br>> > r<br>> >     String                                   model<br>> > r<br>> >     String                                   driver<br>> > o<br>> >     String                                   pci<br>> > o<br>> > end<br>> ><br>> > esx_vi_generaor.py is modified as follows:<br>> ><br>> > "HostHostBusAdapter"         : Object.FEATURE__ANY_TYPE |<br>> >                                Object.FEATURE__LIST,<br>> ><br>> > Using gdb, I see the failure occurs at:<br>> > esx/esx_vi.c:esxVI_List_CastFromAnyType(..) line 1631:<br>> ><br>> > ..<br>> > if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0 ||<br>> >     castFromAnyTypeFunc(childAnyType, &item) < 0 ||<br>> >     esxVI_List_Append(list, item) < 0) {<br>> >     goto cleanup;<br>> > }<br>> > ..<br>> ><br>> > In one of my earlier patches (subject: Add routines to interface driver) I<br>> > patched esx_vi_generator.py to deserialize “string list”; as the patch is<br>> > still under review I manually applied the branch to this branch but no<br>> > change (did not expect change as structure does not contain any list<br>> > object). I am wondering what else is missing to make it work.<br>> ><br>> > Any suggestion how to debug/fix this issue is highly appreciated.<br>> ><br>> > Thanks!<br>> > Ata<br>> ><br>> > ________________________________<br>> > --<br>> > libvir-list mailing list<br>> > libvir-list@redhat.com<br>> > https://www.redhat.com/mailman/listinfo/libvir-list<br>> ><br>> ><br>> > --<br>> > libvir-list mailing list<br>> > libvir-list@redhat.com<br>> > https://www.redhat.com/mailman/listinfo/libvir-list <br>> <br>> --<br>> libvir-list mailing list<br>> libvir-list@redhat.com<br>> https://www.redhat.com/mailman/listinfo/libvir-list<br></div>                                         </div></body>
</html>