[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] OpenVZ xml refactoring




On Fri, Jul 25, 2008 at 04:44:09PM +0400, Evgeniy Sokolov wrote:
Patch switch OpenVZ XML format to generic.
main changes:
- I used generic virDomainNetDef to define network in container.
  And wrote function to apply virDomainNetDef for container.
  Method virDomainNetDefParseXML is public now.
- tag "container" is changed to "devices"
- changed format of tag "filesystem"
- added processing "vcpu" tag.

Index: src/domain_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/domain_conf.c,v
retrieving revision 1.5
diff -u -p -r1.5 domain_conf.c
--- src/domain_conf.c	19 Jul 2008 07:42:34 -0000	1.5
+++ src/domain_conf.c	25 Jul 2008 12:40:17 -0000
@@ -633,7 +633,7 @@ static void virDomainNetRandomMAC(virDom
  * @param node XML nodeset to parse for net definition
  * @return 0 on success, -1 on failure
  */
-static virDomainNetDefPtr
+virDomainNetDefPtr
 virDomainNetDefParseXML(virConnectPtr conn,
                         xmlNodePtr node) {
     virDomainNetDefPtr def;
Index: src/domain_conf.h
===================================================================
RCS file: /data/cvs/libvirt/src/domain_conf.h,v
retrieving revision 1.1
diff -u -p -r1.1 domain_conf.h
--- src/domain_conf.h	11 Jul 2008 16:23:36 -0000	1.1
+++ src/domain_conf.h	25 Jul 2008 12:40:17 -0000
@@ -472,6 +472,9 @@ int virDomainLoadAllConfigs(virConnectPt
 int virDomainDeleteConfig(virConnectPtr conn,
                           virDomainObjPtr dom);
+virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn,
+                        xmlNodePtr node);
+

This is not needed - we already export a generic virDOmainDeviceDefParse
method, which allows parsing of an individual device of any type. That
said, I don't think you need to use that either..
But to use virDomainDeviceDefParse we need before convert xmlNodePtr to xml-string, or not?

struct openvz_vm_def {
     char name[OPENVZ_NAME_MAX];
     unsigned char uuid[VIR_UUID_BUFLEN];
     char profile[OPENVZ_PROFILE_MAX];
+    unsigned long vcpus;
     struct openvz_fs_def fs;
-    struct openvz_net_def net;
+    virDomainNetDefPtr net;
 };

Rather than doing this 50/50  port, we should just switch over
to the virDomainDefPtr/virDomainObjPtr objects entirely and
do away with openvz_vm and openvz_vm_def objects completely.

This will require the addition of my filesystem patch to the
generic parser, but that's less effort that maintaining the
custom parser in openvz code. This will allowing 95% of the
openvz_conf.c file to go away entirely

Yes, you are right.
It is half of port and intermediate state. But it support generic xml format. I propouse to completely switch to generic virDomainDefPtr/virDomainObjPtr in nearest future.

I will correct defects from Daniel Veillard and send new patch soon.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]