I think I am able to triage this issue, please have a look at the review post with subject "[PATCH] ESX: Fix DISPATCH_FREE generation code to free all extended objectsþ".

Thanks!
Ata

From: ata.husain@hotmail.com
To: libvir-list@redhat.com
Date: Tue, 1 Jan 2013 18:35:25 -0800
Subject: [libvirt] ESX error while freeing inherited objects

Hi All,
 
Freeing of an object having inheritance depth >=2 throws an error such as:
" internal error Call to esxVI_<grand_parent>_Free for unexpected type 'Child'.  "
 
For instance:
Below code snippet is from esx_vi_generator.input (modified)
 
object VirtualDevice
    Int                                      key                            r   
    Description                              deviceInfo                     o   
    VirtualDeviceBackingInfo                 backing                        o   
    VirtualDeviceConnectInfo                 connectable                    o   
    Int                                      controllerKey                  o   
    Int                                      unitNumber                     o   
end

object VirtualController extends VirtualDevice
    Int                                      busNumber                      r
    Int                                      device                         ol
end


object VirtualIDEController extends VirtualController
end
 
object VirtualDeviceConfigSpec
    VirtualDeviceConfigSpecOperation         operation                      o
    VirtualDeviceConfigSpecFileOperation     fileOperation                  o
    VirtualDevice                            device                         r
end
 

object VirtualMachineConfigSpec
.
.
.
   VirtualDeviceConfigSpec                  deviceChange                   ol
.
.
end
 
On free of "VirtualMachineConfigSpec", I hit below error:
"
libvir: ESX Driver error : internal error Call to esxVI_VirtualDevice_Free for unexpected type 'VirtualIDEController'
"
 
But if I remove VirtualController and include its fields directly to VirtualIDEController, error is resolved. Please let me know if I'm missing anything, else, it seems like a bug with generated code.
 
While debugging the error seems to come from:
 
esx_vi_types.c:
 
/*
 * Macros to implement dynamic dispatched functions
 */
#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type,   \
                                   _dispatch,  _error_return)                 \
    switch (_actual_type) {                                                   \
      _dispatch                                                               \
                                                                              \
      case esxVI_Type_##__type:                                               \
        break;                                                                \
                                                                              \
      default:                                                                \
        virReportError(VIR_ERR_INTERNAL_ERROR,                                \
                       _("Call to %s for unexpected type '%s'"),              \
                       __FUNCTION__, _actual_type_name);                      \
        return _error_return;                                                 \
    }

 
Thanks!
Ata

-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list