These patches are based on commit 04bfeb825e5e155ffa72119253de608ccf3bd72b.
So I may need more work on rebasing.
Most of bugs reported recently are about some tags libvirt-cim doesn't
support will be dropped after resource updated. So a new member was added
into every virt_device and domain structure. And a new structure named
unknown device was added to save those tags new added.
The original implementaion is reading every member of virt_device structure
from xml and save it. But the defect of this is some tags were not a
member of virt_device were dropped. After resource updated, every data
in the virt_device will be used to regenerate new xml. Hence the tags
unsupported above, disappeared.
So I added a member into every virt_device and domain structure, 'others'.
It's a link list and used to save all data read from xml. Another new
structure 'unknown_device' was added to save data except libvirt-cim could
recognize.
The new implementation is, firstly parse_*_device() could read all nodes and
properties from xml and save them into 'others' link list. Then every member
of virt_device will fetch data from others link list and save it. So that
nodes in the 'others' link list could be saved until they are used to re-
generate xml.
After resource updating finished, libvirt-cim will call *_xml() to generate
xml. The new process of generating xml like this, firstly all data in the
members of virt_device will be restored into 'others' link list, then a
function (others_to_xml) will use this link list to generate xml.
Some points I have updated,
1. 'others' link list has to be processed in _get_proc_device() and
_get_mem_device(). They should be copied into new data structure.
2. If resource updating happened, others field should be cleared
because this device has been changed and they are useless.
Besides above some logic may be a little strange or boring. Implemention
like that is just to be compatible with upper layer functions (to make
changes as less as possible). After keep a balance I decided to devide
the whole xml into several parts:
<domain>------------------------others in domain to save unsupported sub-nodes of
domain
-some fields (devices, mem, vcpu...) will be skiped
because
-they have their own parsing functions.
<name>xxx</name>
<uuid>xxx</uuid>
<vcpu>xxx</vcpu>
<mem>xxx</mem>
<devices>
<disk>xxx</disk>------- others in virt_device to save unsupported tags of
this device
<emulator>xxx</emulator>
...----------- unknown_device to save unsupported device except like
<disk>,<emu>,etc.
</devices>
</domain>
Hence, all nodes read from xml will be restored after xml generation.
Xu Wang (47):
Add others member for saving unsupported tag and unknown device
Add others and unknown_device clean up
Add basic operations for reading data from xml node
Fix xml parsing algorithm for parse_fs_device()
Fix xml parsing algorithm for parse_block_device()
Fix xml parsing algorithm for parse_vsi_device()
Fix xml parsing algorithm for parse_net_device()
Fix xml parsing algorithm for parse_vcpu_device()
Fix xml parsing algorithm for parse_emu_device()
Fix xml parsing algorithm for parse_mem_device()
Fix xml parsing algorithm for parse_graphics_device()
Fix xml parsing algorithm for parse_input_device()
Add parse_unknown_device()
Add parse_devices() for unknown type in get_dominfo_from_xml()
Fix xml parsing algorithm in parse_domain()
Fix xml parsing algorithm in parse_os()
Fix xml parsing algorithm in parse_feature()
Add dup function for device copy
Add type CIM_RES_TYPE_DELETED and modify type as it after
resource_del
Add basic functions about converting others link list to xml
Fix xml generation algorithm in disk_block_xml()
Fix xml generation algorithm in disk_file_xml()
Fix xml generation algorithm in disk_fs_xml()
Fix xml generation algorithm in set_net_vsi()
Fix xml generation algorithm in set_net_source()
Fix xml generation algorithm in bridge_net_to_xml()
Fix xml generation algorithm in net_xml()
Fix xml generation algorithm in vcpu_xml()
Fix xml generation algorithm in cputune_xml()
Fix xml generation algorithm in mem_xml()
Fix xml generation algorithm in emu_xml()
Fix xml generation algorithm in graphics_vnc_xml()
Fix xml generation algorithm in graphics_pty_xml()
Fix xml generation algorithm in input_xml()
Fix xml generation algorithm in system_xml()
Fix xml generation algorithm in _xenpv_os_xml()
Fix xml generation algorithm in _fv_bootlist_xml()
Fix xml generation algorithm in _xenfv_os_xml()
Fix xml generation algorithm in _kvm_os_xml()
Fix xml generation algorithm in _lxc_os_xml()
Fix xml generation algorithm in os_xml()
Fix xml generation algorithm in features_xml()
Add functions for xml generation of unknown devices
Fix xml generation algorithm in system_to_xml()
Add cleanup_others() calling during rasd_to_vdev()
Add others handling in _get_mem_device()
Add dup_others() into _get_proc_device()
libxkutil/device_parsing.c | 1351 +++++++++++++++++++++-----
libxkutil/device_parsing.h | 56 ++
libxkutil/xmlgen.c | 1470 +++++++++++++++++++++++------
src/Virt_VirtualSystemManagementService.c | 20 +-
src/svpc_types.h | 1 +
5 files changed, 2346 insertions(+), 552 deletions(-)