Re: [libvirt] [RFC PATCH 2/5] Add namespace callback hooks to domain_conf.

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

 



On Tue, Apr 13, 2010 at 02:36:47PM -0400, Chris Lalancette wrote:
> Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c        |  106 +++++++++++++++++++++++++++++------------
>  src/conf/domain_conf.h        |   26 ++++++++--
>  src/esx/esx_driver.c          |    4 +-
>  src/lxc/lxc_controller.c      |    2 +-
>  src/lxc/lxc_driver.c          |   10 ++--
>  src/opennebula/one_driver.c   |    4 +-
>  src/openvz/openvz_driver.c    |    4 +-
>  src/phyp/phyp_driver.c        |    2 +-
>  src/security/virt-aa-helper.c |    2 +-
>  src/test/test_driver.c        |   12 ++--
>  src/uml/uml_driver.c          |    4 +-
>  src/vbox/vbox_tmpl.c          |    2 +-
>  src/xen/xend_internal.c       |    4 +-
>  src/xen/xm_internal.c         |    2 +-
>  src/xenapi/xenapi_driver.c    |    4 +-
>  tests/bochsconf2xmltest       |  Bin 0 -> 714002 bytes
>  tests/qemuxml2argvtest.c      |    2 +-
>  tests/qemuxml2xmltest.c       |    2 +-
>  tests/xmconfigtest.c          |    2 +-
>  tests/xml2vmxtest.c           |    2 +-
>  20 files changed, 127 insertions(+), 69 deletions(-)
>  create mode 100755 tests/bochsconf2xmltest


> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 82f2d15..95a8dfb 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -794,6 +794,19 @@ int virDomainSnapshotObjUnref(virDomainSnapshotObjPtr snapshot);
>  int virDomainSnapshotHasChildren(virDomainSnapshotObjPtr snap,
>                                  virDomainSnapshotObjListPtr snapshots);
>  
> +typedef void *(*virDomainDefNamespaceParse)(xmlDocPtr, xmlNodePtr,
> +                                            xmlXPathContextPtr);
> +typedef void (*virDomainDefNamespaceFree)(void *);
> +typedef int (*virDomainDefNamespaceXMLFormat)(virBufferPtr, void *);
> +typedef const char *(*virDomainDefNamespaceHref)(void);
> +
> +struct xmlNamespace {
> +    virDomainDefNamespaceParse parse;
> +    virDomainDefNamespaceFree free;
> +    virDomainDefNamespaceXMLFormat format;
> +    virDomainDefNamespaceHref href;
> +};

Lets rename that struct to have a virDomain prefix, since 'xmlNamespace'
could easily clash with something libxml might define.

> +
>  /* Guest VM main configuration */
>  typedef struct _virDomainDef virDomainDef;
>  typedef virDomainDef *virDomainDefPtr;
> @@ -863,6 +876,9 @@ struct _virDomainDef {
>      virSecurityLabelDef seclabel;
>      virDomainWatchdogDefPtr watchdog;
>      virCPUDefPtr cpu;
> +
> +    void *namespaceData;
> +    struct xmlNamespace ns;
>  };

As mentioned in the other patch reply, I think it'd be preferable to
keep a struct with the parser config in virCapsPtr, so we don't need
to add to this struct, nor pass it into all the parse/format methods.

>  
>  /* Guest VM runtime state */
> @@ -965,21 +981,18 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
>                                                int flags);
>  virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
>                                          const char *xmlStr,
> +                                        struct xmlNamespace *ns,
>                                          int flags);
>  virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
>                                        const char *filename,
> +                                      struct xmlNamespace *ns,
>                                        int flags);
>  virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
>                                        xmlDocPtr doc,
>                                        xmlNodePtr root,
> +                                      struct xmlNamespace *ns,
>                                        int flags);
>  
> -virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
> -                                      const char *filename);
> -virDomainObjPtr virDomainObjParseNode(virCapsPtr caps,
> -                                      xmlDocPtr xml,
> -                                      xmlNodePtr root);
> -
>  int virDomainDefAddImplicitControllers(virDomainDefPtr def);
>  
>  # endif
> @@ -1024,6 +1037,7 @@ int virDomainLoadAllConfigs(virCapsPtr caps,
>                              const char *autostartDir,
>                              int liveStatus,
>                              virDomainLoadConfigNotify notify,
> +                            struct xmlNamespace *ns,
>                              void *opaque);
>  

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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]