[libvirt] [libvirt-glib 2/4] Add gvir_config_domain_get_os()

Christophe Fergeau cfergeau at redhat.com
Fri May 4 08:53:28 UTC 2012


On Fri, May 04, 2012 at 03:07:43AM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> ---
>  libvirt-gconfig/libvirt-gconfig-domain.c |   18 ++++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig-domain.h |    1 +
>  libvirt-gconfig/libvirt-gconfig.sym      |    5 +++++
>  3 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
> index 04915ab..b19ac4c 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain.c
> @@ -323,6 +323,24 @@ void gvir_config_domain_set_clock(GVirConfigDomain *domain,
>                                        GVIR_CONFIG_OBJECT(klock));
>  }
>  
> +/**
> + * gvir_config_domain_get_os:
> + *
> + * Returns: (transfer full):
> + */
> +GVirConfigDomainOs *gvir_config_domain_get_os(GVirConfigDomain *domain)
> +{
> +    GVirConfigObject *object;
> +
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), NULL);
> +
> +    object = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(domain),
> +                                          "os",
> +                                          GVIR_CONFIG_TYPE_DOMAIN_OS);
> +
> +    return GVIR_CONFIG_DOMAIN_OS(object);
> +}

We want to return a NULL object when there is no "os" node in the
configuration I think, or to create a default node with the default values
if the presence of this node is mandatory and if libvirt doesn't create it for
us.

Christophe
> +
>  void gvir_config_domain_set_os(GVirConfigDomain *domain,
>                                 GVirConfigDomainOs *os)
>  {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
> index 1dbfd95..bdb842b 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain.h
> @@ -114,6 +114,7 @@ void gvir_config_domain_set_features(GVirConfigDomain *domain,
>                                       const GStrv features);
>  void gvir_config_domain_set_clock(GVirConfigDomain *domain,
>                                    GVirConfigDomainClock *klock);
> +GVirConfigDomainOs *gvir_config_domain_get_os(GVirConfigDomain *domain);
>  void gvir_config_domain_set_os(GVirConfigDomain *domain,
>                                 GVirConfigDomainOs *os);
>  void gvir_config_domain_set_seclabel(GVirConfigDomain *domain,
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
> index ffeb16b..67e9c3f 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -374,4 +374,9 @@ LIBVIRT_GCONFIG_0.0.8 {
>          *;
>  };
>  
> +LIBVIRT_GCONFIG_0.0.9 {
> +  global:
> +	gvir_config_domain_get_os;
> +} LIBVIRT_GCONFIG_0.0.8;
> +
>  # .... define new API here using predicted next version number ....
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120504/e1ec4ee2/attachment-0001.sig>


More information about the libvir-list mailing list