[PATCHv5 08/13] Add compatibility attribute to filesystems

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

 



<filesystem ...>
  <driver compatibility='modern'/>
   ...
</filesystem>

https://bugzilla.redhat.com/show_bug.cgi?id=1227354
---
 docs/formatdomain.html.in                                   |  6 ++++++
 docs/schemas/domaincommon.rng                               |  3 +++
 src/conf/domain_conf.c                                      |  9 +++++++++
 src/conf/domain_conf.h                                      |  1 +
 tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml     | 12 ++++++++++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml | 12 ++++++++++++
 6 files changed, 43 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e208767..81ca852 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2953,6 +2953,12 @@
             or "handle", but no formats. Virtuozzo driver supports
             a type of "ploop" with a format of "ploop".
           </li>
+          <li>
+            The <code>compatibility</code> attribute can be used to specify
+            the compatibility of virtio devices. Allowed values are
+            <code>legacy</code>, <code>transitional</code> and <code>modern</code>.
+            <span class="since">Since 2.2.0</span>.
+          </li>
         </ul>
       </dd>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9f912d2..baa9105 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2129,6 +2129,9 @@
           <value>immediate</value>
         </attribute>
       </optional>
+      <optional>
+        <ref name='compatibility'/>
+      </optional>
       <empty/>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1916bb8..2f3927a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8686,6 +8686,9 @@ virDomainFSDefParseXML(xmlNodePtr node,
             goto error;
     }
 
+    if (virDomainDriverCompatibilityParseXML(ctxt, &def->compatibility) < 0)
+        goto error;
+
     def->src->path = source;
     source = NULL;
     def->dst = target;
@@ -20333,6 +20336,11 @@ virDomainFSDefFormat(virBufferPtr buf,
 
     }
 
+    if (def->compatibility) {
+        virBufferAsprintf(&driverBuf, " compatibility='%s'",
+                          virDomainDriverCompatibilityTypeToString(def->compatibility));
+    }
+
     if (virBufferUse(&driverBuf)) {
         virBufferAddLit(buf, "<driver");
         virBufferAddBuffer(buf, &driverBuf);
@@ -20391,6 +20399,7 @@ virDomainFSDefFormat(virBufferPtr buf,
         virBufferAsprintf(buf, "<space_soft_limit unit='bytes'>"
                           "%llu</space_soft_limit>\n", def->space_soft_limit);
     }
+
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</filesystem>\n");
     return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1641ad9..0a4017f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -827,6 +827,7 @@ struct _virDomainFSDef {
     unsigned long long space_hard_limit; /* in bytes */
     unsigned long long space_soft_limit; /* in bytes */
     bool symlinksResolved;
+    virDomainDriverCompatibility compatibility;
 };
 
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 176a270..98697ef 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -46,6 +46,18 @@
     <controller type='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
+    <filesystem type='mount' accessmode='passthrough'>
+      <driver compatibility='legacy'/>
+      <source dir='/export/fs1'/>
+      <target dir='fs1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </filesystem>
+    <filesystem type='mount' accessmode='mapped'>
+      <driver type='path' wrpolicy='immediate' compatibility='modern'/>
+      <source dir='/export/fs2'/>
+      <target dir='fs2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </filesystem>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </input>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 176a270..98697ef 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -46,6 +46,18 @@
     <controller type='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
+    <filesystem type='mount' accessmode='passthrough'>
+      <driver compatibility='legacy'/>
+      <source dir='/export/fs1'/>
+      <target dir='fs1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </filesystem>
+    <filesystem type='mount' accessmode='mapped'>
+      <driver type='path' wrpolicy='immediate' compatibility='modern'/>
+      <source dir='/export/fs2'/>
+      <target dir='fs2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </filesystem>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </input>
-- 
2.7.3

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