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

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

This adds support for filesystems with type=bind or type=ram,

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@xxxxxxxxxx>
---
 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));
+    GVirConfigObject *src;
+
+    src = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys),
+                                           "source");
+
+    gvir_config_object_set_attribute_with_type(src,
+                                               "usage", G_TYPE_UINT64, bytes,
+                                               "units", G_TYPE_STRING, "bytes",
+                                               NULL);
+
+}
 
 void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys,
                                            const char *path)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
index 2ceb2a8..e4b7c20 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
@@ -61,6 +61,8 @@ typedef enum {
     GVIR_CONFIG_DOMAIN_FILESYS_BLOCK,
     GVIR_CONFIG_DOMAIN_FILESYS_FILE,
     GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE,
+    GVIR_CONFIG_DOMAIN_FILESYS_RAM,
+    GVIR_CONFIG_DOMAIN_FILESYS_BIND,
 } GVirConfigDomainFilesysType;
 
 typedef enum {
@@ -89,6 +91,8 @@ void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys
                                                 GVirConfigDomainFilesysDriverType type);
 void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
                                            const char *source);
+void gvir_config_domain_filesys_set_ram_usage(GVirConfigDomainFilesys *filesys,
+                                              guint64 bytes);
 void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys,
                                            const char *target);
 void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys,
-- 
1.7.10.2

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