On Mon, Jun 25, 2012 at 12:14:59PM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)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(a)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