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

[libvirt] [PATCH v2 libvirt 1/8] conf: add <model> child element to <filesystem>



Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
---
 src/conf/domain_conf.c | 25 +++++++++++++++++++++++++
 src/conf/domain_conf.h | 11 +++++++++++
 2 files changed, 36 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c7016f3..9252ffa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -344,6 +344,11 @@ VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "ram",
               "bind")
 
+VIR_ENUM_IMPL(virDomainFSModel, VIR_DOMAIN_FS_MODEL_LAST,
+              "default",
+              "9p",
+              "mtp")
+
 VIR_ENUM_IMPL(virDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
               "default",
               "path",
@@ -6458,6 +6463,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     virDomainFSDefPtr def;
     xmlNodePtr cur, save_node = ctxt->node;
     char *type = NULL;
+    char *model = NULL;
     char *fsdriver = NULL;
     char *source = NULL;
     char *target = NULL;
@@ -6535,6 +6541,9 @@ virDomainFSDefParseXML(xmlNodePtr node,
                     wrpolicy = virXMLPropString(cur, "wrpolicy");
                 if (!format)
                     format = virXMLPropString(cur, "format");
+            } else if (!model &&
+                       xmlStrEqual(cur->name, BAD_CAST "model")) {
+                model = virXMLPropString(cur, "type");
             }
         }
         cur = cur->next;
@@ -6556,6 +6565,14 @@ virDomainFSDefParseXML(xmlNodePtr node,
         }
     }
 
+    if (model) {
+        if ((def->model = virDomainFSModelTypeFromString(model)) <= 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("unknown model value '%s'"), model);
+            goto error;
+        }
+    }
+
     if (wrpolicy) {
         if ((def->wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -15795,6 +15812,14 @@ virDomainFSDefFormat(virBufferPtr buf,
 
     switch (def->type) {
     case VIR_DOMAIN_FS_TYPE_MOUNT:
+        virBufferEscapeString(buf, "<source dir='%s'/>\n",
+                              def->src);
+        if (def->model) {
+            virBufferEscapeString(buf, "<model type='%s'/>\n",
+                                  virDomainFSModelTypeToString(def->model));
+        }
+        break;
+
     case VIR_DOMAIN_FS_TYPE_BIND:
         virBufferEscapeString(buf, "<source dir='%s'/>\n",
                               def->src);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ff7d640..d7664e4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -764,6 +764,15 @@ typedef enum {
     VIR_DOMAIN_FS_TYPE_LAST
 } virDomainFSType;
 
+/* Filesystem model */
+typedef enum {
+    VIR_DOMAIN_FS_MODEL_DEFAULT = 0,
+    VIR_DOMAIN_FS_MODEL_9P,   /* 9P network filesystem */
+    VIR_DOMAIN_FS_MODEL_MTP,   /* MTP usb filesystem */
+
+    VIR_DOMAIN_FS_MODEL_LAST
+} virDomainFSModel;
+
 /* Filesystem driver type */
 typedef enum {
     VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
@@ -808,6 +817,7 @@ struct _virDomainFSDef {
     virDomainDeviceInfo info;
     unsigned long long space_hard_limit; /* in bytes */
     unsigned long long space_soft_limit; /* in bytes */
+    int model;
 };
 
 
@@ -2585,6 +2595,7 @@ VIR_ENUM_DECL(virDomainControllerModelPCI)
 VIR_ENUM_DECL(virDomainControllerModelSCSI)
 VIR_ENUM_DECL(virDomainControllerModelUSB)
 VIR_ENUM_DECL(virDomainFS)
+VIR_ENUM_DECL(virDomainFSModel)
 VIR_ENUM_DECL(virDomainFSDriver)
 VIR_ENUM_DECL(virDomainFSAccessMode)
 VIR_ENUM_DECL(virDomainFSWrpolicy)
-- 
1.9.3


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