[Libvirt-cim] [PATCH V2 01/48] Add others member for saving unsupported tag and unknown device

Xu Wang gesaint at linux.vnet.ibm.com
Wed Nov 13 03:27:36 UTC 2013


于 2013/11/13 8:59, John Ferlan 写道:
> On 10/27/2013 10:45 PM, Xu Wang wrote:
>> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
>> ---
>>   libxkutil/device_parsing.h |   43 +++++++++++++++++++++++++++++++++++++++++++
>>   1 files changed, 43 insertions(+), 0 deletions(-)
>>
>
> I am going to try to take these one at a time.  Run them through cimtest
> singly to see if I can flesh out errors.
>
> I didn't get very far - 2/48 causes some failures in cimtest
>
> ...
>
>> diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h
>> index 2803d6a..147551a 100644
>> --- a/libxkutil/device_parsing.h
>> +++ b/libxkutil/device_parsing.h
>> @@ -33,6 +33,33 @@
>>   
>>   #include "../src/svpc_types.h"
>>   
>> +/* The structure for saving unknown tag in the xml */
>> +enum others_type {
>> +        TYPE_PROP,
>> +        TYPE_NODE
>> +};
>> +
>> +struct others {
> There's an extra space after the { which git am complains about
>
>> +        /* To identify the different tags with same name */
>> +        int id;
>> +        char *name;
>> +        int parent_id;
>> +        char *parent_name;
>> +        enum others_type type;
>> +        char *value;
>> +        struct others *next;
>> +        enum status {
>> +                ACTIVE,
>> +                INACTIVE
>> +        };
> Older compiler complains:
>
> ../libxkutil/device_parsing.h:54: warning: declaration does not declare
> anything
>
>
> New compiler where I don't ignore warnings stops:
>
> In file included from device_parsing.c:33:0:
> device_parsing.h:54:10: error: declaration does not declare anything
> [-Werror]
>           };
>            ^
> cc1: all warnings being treated as errors
>
> I'll have to see more to determine whether I like this pointer to
> pointer within structures... There's usually some assumption somewhere
> which causes a failure...
>
> John
Dear John,
My idea is, using a data structure (a link list) to keep the elements 
left after all kinds of
virtual devices fetched tags they needed from xml. And if I just mark a 
node of others with
status instead of delete it, the whole structure of xml could be saved 
as well.
The introduction of 'id' in 'others' structure is to identify several 
<tags> with the same
name. The console device support new introduced and some tags in 
'unknown_device'
have to use 'id' to identify elements. It maybe a little coarse now so I 
need any suggestion
from you to make it works better. If you have any better idea to solve 
the unsupported
tags missing issue please share with me :-) Because so many patches 
about it merged
and there will be more in the future.
These 48 patches just the first part in my designing. After that I want 
to build the
management about all data (even in 'others' member). And all of these 
updates are
compatitable with older version libvirt-cim. So the upper layer need 
little change and
keep the original feature but could make libvirt-cim becomes more powerful.
XFAIL about hotplug disappeared after updated. About the warning you 
mentioned above
I'll check and fix it in the new version.

Thanks,
Xu Wang
>> +};
>> +
>> +/* The structure for saving unknown device */
>> +struct unknown_device {
>> +        char *name;
>> +        struct others *others;
>> +};
>> +
>>   struct vsi_device {
>>           char *vsi_type;
>>           char *manager_id;
>> @@ -56,6 +83,7 @@ struct disk_device {
>>           char *bus_type;
>>           char *cache;
>>           char *access_mode; /* access modes for DISK_FS (filesystem) type */
>> +        struct others *others;
>>   };
>>   
>>   struct net_device {
>> @@ -70,6 +98,7 @@ struct net_device {
>>           uint64_t reservation;
>>           uint64_t limit;
>>           struct vsi_device vsi;
>> +        struct others *others;
>>   };
>>   
>>   struct mem_device {
>> @@ -78,16 +107,19 @@ struct mem_device {
>>           enum { MEM_DUMP_CORE_NOT_SET,
>>                  MEM_DUMP_CORE_ON,
>>                  MEM_DUMP_CORE_OFF } dumpCore;
>> +        struct others *others;
>>   };
>>   
>>   struct vcpu_device {
>>           uint64_t quantity;
>>           uint32_t weight;
>>           uint64_t limit;
>> +        struct others *others;
>>   };
>>   
>>   struct emu_device {
>>           char *path;
>> +        struct others *others;
>>   };
>>   
>>   struct vnc_device {
>> @@ -95,12 +127,14 @@ struct vnc_device {
>>           char *host;
>>           char *keymap;
>>           char *passwd;
>> +        struct others *others;
>>   };
>>   
>>   struct sdl_device {
>>           char *display;
>>           char *xauth;
>>           char *fullscreen;
>> +        struct others *others;
>>   };
>>   
>>   struct graphics_device {
>> @@ -109,6 +143,7 @@ struct graphics_device {
>>               struct vnc_device vnc;
>>               struct sdl_device sdl;
>>           } dev;
>> +        struct others *others;
>>   };
>>   
>>   struct path_device {
>> @@ -146,11 +181,13 @@ struct console_device {
>>                   struct udp_device  udp;
>>           }  source_dev;
>>           char *target_type;
>> +        struct others *others;
>>   };
>>   
>>   struct input_device {
>>           char *type;
>>           char *bus;
>> +        struct others *others;
>>   };
>>   
>>   struct virt_device {
>> @@ -164,6 +201,7 @@ struct virt_device {
>>                   struct graphics_device graphics;
>>                   struct console_device console;
>>                   struct input_device input;
>> +                struct unknown_device unknown;
>>           } dev;
>>           char *id;
>>   };
>> @@ -239,6 +277,11 @@ struct domain {
>>   
>>           struct virt_device *dev_vcpu;
>>           int dev_vcpu_ct;
>> +
>> +        struct virt_device *dev_unknown;
>> +        int dev_unknown_ct;
>> +
>> +        struct others *others;
>>   };
>>   
>>   struct virt_device *virt_device_dup(struct virt_device *dev);
>>




More information about the Libvirt-cim mailing list