Re: [libvirt] [PATCH] OpenVZ xml refactoring

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

 



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..

> diff -u -p -r1.9 openvz_conf.h
> --- src/openvz_conf.h	10 Jul 2008 12:21:09 -0000	1.9
> +++ src/openvz_conf.h	25 Jul 2008 12:40:17 -0000
> @@ -29,6 +29,7 @@
>  #define OPENVZ_CONF_H
>  
>  #include "openvz_driver.h"
> +#include "domain_conf.h"
>  
>  enum { OPENVZ_WARN, OPENVZ_ERR };
>  
> @@ -61,33 +62,16 @@ struct vps_props {
>  
>  struct openvz_fs_def {
>      char tmpl[OPENVZ_TMPL_MAX];
> -    struct ovz_quota *quota;
> -};
> -
> -struct ovz_ip {
> -    char ip[OPENVZ_IP_MAX];
> -    char netmask[OPENVZ_IP_MAX];
> -    struct ovz_ip *next;
> -};
> -
> -struct ovz_ns {
> -    char ip[OPENVZ_IP_MAX];
> -    struct ovz_ns *next;
> -};
> -
> -struct openvz_net_def {
> -    char hostname[OPENVZ_HOSTNAME_MAX];
> -    char def_gw[OPENVZ_IP_MAX];
> -    struct ovz_ip *ips;
> -    struct ovz_ns *ns;
> +    long int disksize, diskinodes;
>  };
>  
>  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

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]