[libvirt] [PATCH libvirt-gconfig] Add support for domain filesystems with type=bind|ram

Christophe Fergeau cfergeau at redhat.com
Mon Jun 25 12:16:38 UTC 2012


On Mon, Jun 25, 2012 at 12:14:59PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> This adds support for filesystems with type=bind or type=ram,

Both of these are new in libvirt 0.9.13. However, libvirt-glib will
still compile and work if it's linking with an older libvirt, the only
issue will be that the API introduced in this patch  won't work.

> 
> eg
> 
>    <filesystem type='bind'>
>      <source dir="/some/guest/file"/>
>      <target dir=/other/guest/file"/>
>    </filesystem>
> 
> And
> 
>    <filesystem type='ram'>
>       <source usage='102400'/>
>       <target dir='/run'/>
>    </filesystem>
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-filesys.c |   19 +++++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig-domain-filesys.h |    4 ++++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
> index c9c7aa8..54f124a 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
> @@ -146,6 +146,7 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
>  
>      switch (filesys->priv->type) {
>          case GVIR_CONFIG_DOMAIN_FILESYS_MOUNT:
> +        case GVIR_CONFIG_DOMAIN_FILESYS_BIND:
>              attribute_name = "dir";
>              break;
>          case GVIR_CONFIG_DOMAIN_FILESYS_FILE:
> @@ -157,6 +158,9 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
>          case GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE:
>              attribute_name = "name";
>              break;
> +        case GVIR_CONFIG_DOMAIN_FILESYS_RAM:
> +            g_return_if_reached();
> +
>          default:
>              g_return_if_reached();
>      }
> @@ -166,6 +170,21 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
>                                                      attribute_name, source);
>  }
>  
> +void gvir_config_domain_filesys_set_ram_usage(GVirConfigDomainFilesys *filesys,
> +                                              guint64 bytes)
> +{
> +    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_FILESYS(filesys));

g_return_if_fail(filesys->priv->type == GVIR_CONFIG_DOMAIN_FILESYS_RAM);
would spot incorrect uses of this API.

ACK.

Christophe
-------------- 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/20120625/00f5c0e0/attachment-0001.sig>


More information about the libvir-list mailing list