[Libvirt-cim] [PATCH V2 02/48] Add others and unknown_device clean up

John Ferlan jferlan at redhat.com
Wed Nov 13 01:20:40 UTC 2013


On 10/27/2013 10:45 PM, Xu Wang wrote:
> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
> ---
>  libxkutil/device_parsing.c |   54 ++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 54 insertions(+), 0 deletions(-)
> 

If I apply the cimtest patches from Viktor, I get cimtest failures after
applying this patch.  That's about as far as I've had time to dig. It
seems cimprovagt cores and for some reason the abrt isn't saving
things... The failures are in:

--------------------------------------------------------------------
RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL
ERROR 	- Exception details :(1, u'CIM_ERR_FAILED: Lost connection with
cimprovagt "libvirt-cim".')
ERROR 	- Exception: Unable to generate indication
InvokeMethod(RemoveResourceSettings): CIM_ERR_FAILED: Lost connection
with cimprovagt "libvirt-cim".
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: FAIL
ERROR 	- 6 device insts != 7 RASD insts
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: FAIL
ERROR 	- u'KVM_ConsoleDisplayController'
--------------------------------------------------------------------
VirtualSystemManagementService - 16_removeresource.py: FAIL
ERROR 	- (1, u'CIM_ERR_FAILED: Lost connection with cimprovagt
"libvirt-cim".')
InvokeMethod(RemoveResourceSettings): CIM_ERR_FAILED: Lost connection
with cimprovagt "libvirt-cim".
--------------------------------------------------------------------

I'll investigate more in my morning..

FWIW: This is on a RHEL6.5 host that I'm borrowing...

> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
> index aecca4c..f1da880 100644
> --- a/libxkutil/device_parsing.c
> +++ b/libxkutil/device_parsing.c
> @@ -63,6 +63,49 @@
>  /* Device parse function */
>  typedef int (*dev_parse_func_t)(xmlNode *, struct virt_device **);
>  
> +void cleanup_node_of_others(struct others *others)

static void

> +{
> +        if (others == NULL) {
> +                return;
> +        }
> +
> +        if (others->name) {
> +                free(others->name);
> +        }
> +
> +        if (others->parent_name) {
> +                free(others->parent_name);
> +        }
> +
> +        if (others->value) {
> +                free(others->value);
> +        }
> +
> +        free(others);
> +}
> +
> +void cleanup_others(struct others *others)

static void

> +{
> +        struct others *head = others;
> +
> +        if (others == NULL)
> +                return;

Since we'd only enter the while loop if head (or others) were non NULL
the above isn't really necessary
> +
> +        while (head) {
> +                head = others->next;
> +                cleanup_node_of_others(others);
> +                others = head;
> +        }

           while (others) {
               next = others->next;
               cleanup_node_of_others(others);
               others = next;
           }

Have to figure out why cimprovagt dies, I'm assuming it's in this logic
somewhere...

John

> +}
> +
> +static void cleanup_unknown_device(struct unknown_device *dev)
> +{
> +        if (dev == NULL)
> +                return;
> +
> +        cleanup_others(dev->others);
> +}
> +
>  static void cleanup_disk_device(struct disk_device *dev)
>  {
>          if (dev == NULL)
> @@ -77,6 +120,7 @@ static void cleanup_disk_device(struct disk_device *dev)
>          free(dev->virtual_dev);
>          free(dev->bus_type);
>          free(dev->access_mode);
> +        cleanup_others(dev->others);
>  }
>  
>  static void cleanup_vsi_device(struct vsi_device *dev)
> @@ -107,6 +151,7 @@ static void cleanup_net_device(struct net_device *dev)
>          free(dev->filter_ref);
>          free(dev->poolid);
>          cleanup_vsi_device(&dev->vsi);
> +        cleanup_others(dev->others);
>  }
>  
>  static void cleanup_emu_device(struct emu_device *dev)
> @@ -115,6 +160,7 @@ static void cleanup_emu_device(struct emu_device *dev)
>                  return;
>  
>          free(dev->path);
> +        cleanup_others(dev->others);
>  }
>  
>  static void cleanup_vnc_device(struct graphics_device *dev)
> @@ -123,6 +169,7 @@ static void cleanup_vnc_device(struct graphics_device *dev)
>          free(dev->dev.vnc.host);
>          free(dev->dev.vnc.keymap);
>          free(dev->dev.vnc.passwd);
> +        cleanup_others(dev->dev.vnc.others);
>  }
>  
>  static void cleanup_sdl_device(struct graphics_device *dev)
> @@ -130,6 +177,7 @@ static void cleanup_sdl_device(struct graphics_device *dev)
>          free(dev->dev.sdl.display);
>          free(dev->dev.sdl.xauth);
>          free(dev->dev.sdl.fullscreen);
> +        cleanup_others(dev->dev.sdl.others);
>  }
>  
>  static void cleanup_graphics_device(struct graphics_device *dev)
> @@ -143,6 +191,7 @@ static void cleanup_graphics_device(struct graphics_device *dev)
>                  cleanup_vnc_device(dev);
>  
>          free(dev->type);
> +        cleanup_others(dev->others);
>  }
>  
>  static void cleanup_path_device(struct path_device *dev)
> @@ -228,6 +277,7 @@ static void cleanup_console_device(struct console_device *dev)
>          dev->source_type = 0;
>          free(dev->target_type);
>          memset(&dev->source_dev, 0, sizeof(dev->source_dev));
> +        cleanup_others(dev->others);
>  };
>  
>  static void console_device_dup(struct console_device *t,
> @@ -286,6 +336,7 @@ static void cleanup_input_device(struct input_device *dev)
>  
>          free(dev->type);
>          free(dev->bus);
> +        cleanup_others(dev->others);
>  }
>  
>  void cleanup_virt_device(struct virt_device *dev)
> @@ -305,6 +356,8 @@ void cleanup_virt_device(struct virt_device *dev)
>                  cleanup_input_device(&dev->dev.input);
>          else if (dev->type == CIM_RES_TYPE_CONSOLE)
>                  cleanup_console_device(&dev->dev.console);
> +        else if (dev->type == CIM_RES_TYPE_UNKNOWN)
> +                cleanup_unknown_device(&dev->dev.unknown);
>  
>          free(dev->id);
>  
> @@ -1693,6 +1746,7 @@ void cleanup_dominfo(struct domain **dominfo)
>          cleanup_virt_devices(&dom->dev_graphics, dom->dev_graphics_ct);
>          cleanup_virt_devices(&dom->dev_input, dom->dev_input_ct);
>          cleanup_virt_devices(&dom->dev_console, dom->dev_console_ct);
> +        cleanup_virt_devices(&dom->dev_unknown, dom->dev_unknown_ct);
>  
>          free(dom);
>  
> 




More information about the Libvirt-cim mailing list