render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
3e5111
From c828a666c154dece5bce0530c6a53d72d91ca3a1 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <c828a666c154dece5bce0530c6a53d72d91ca3a1@dist-git>
3e5111
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
3e5111
Date: Fri, 9 Jun 2017 12:49:04 +0200
3e5111
Subject: [PATCH] Add virtio-related options to filesystems
3e5111
MIME-Version: 1.0
3e5111
Content-Type: text/plain; charset=UTF-8
3e5111
Content-Transfer-Encoding: 8bit
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
3e5111
3e5111
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
(cherry picked from commit b10c22d9fa11e2a67eca04592688bd701700f77f)
3e5111
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 docs/formatdomain.html.in                              |  5 +++++
3e5111
 docs/schemas/domaincommon.rng                          |  1 +
3e5111
 src/conf/domain_conf.c                                 | 10 ++++++++++
3e5111
 src/conf/domain_conf.h                                 |  1 +
3e5111
 tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml |  3 ++-
3e5111
 5 files changed, 19 insertions(+), 1 deletion(-)
3e5111
3e5111
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
3e5111
index 2b26f090cd..8d3f916a19 100644
3e5111
--- a/docs/formatdomain.html.in
3e5111
+++ b/docs/formatdomain.html.in
3e5111
@@ -3293,6 +3293,11 @@
3e5111
             or "handle", but no formats. Virtuozzo driver supports
3e5111
             a type of "ploop" with a format of "ploop".
3e5111
           
3e5111
+          
  • 3e5111
    +          For virtio-backed devices,
    3e5111
    +          Virtio-specific options can also be
    3e5111
    +          set. (Since 3.5.0)
    3e5111
    +          
    3e5111
             
    3e5111
           
    3e5111
     
    3e5111
    diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
    3e5111
    index 2108d23df7..5e526b6100 100644
    3e5111
    --- a/docs/schemas/domaincommon.rng
    3e5111
    +++ b/docs/schemas/domaincommon.rng
    3e5111
    @@ -2202,6 +2202,7 @@
    3e5111
               <value>immediate</value>
    3e5111
             </attribute>
    3e5111
           </optional>
    3e5111
    +      <ref name='virtioOptions'/>
    3e5111
           <empty/>
    3e5111
         </element>
    3e5111
       </define>
    3e5111
    diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
    3e5111
    index 2e5eeb1172..5c7ffc0419 100644
    3e5111
    --- a/src/conf/domain_conf.c
    3e5111
    +++ b/src/conf/domain_conf.c
    3e5111
    @@ -1905,6 +1905,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
    3e5111
         virStorageSourceFree(def->src);
    3e5111
         VIR_FREE(def->dst);
    3e5111
         virDomainDeviceInfoClear(&def->info);
    3e5111
    +    VIR_FREE(def->virtio);
    3e5111
     
    3e5111
         VIR_FREE(def);
    3e5111
     }
    3e5111
    @@ -9451,6 +9452,9 @@ virDomainFSDefParseXML(xmlNodePtr node,
    3e5111
                 goto error;
    3e5111
         }
    3e5111
     
    3e5111
    +    if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
    3e5111
    +        goto error;
    3e5111
    +
    3e5111
         def->src->path = source;
    3e5111
         source = NULL;
    3e5111
         def->dst = target;
    3e5111
    @@ -19246,6 +19250,10 @@ virDomainFsDefCheckABIStability(virDomainFSDefPtr src,
    3e5111
             return false;
    3e5111
         }
    3e5111
     
    3e5111
    +    if (src->virtio && dst->virtio &&
    3e5111
    +        !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
    3e5111
    +        return false;
    3e5111
    +
    3e5111
         if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
    3e5111
             return false;
    3e5111
     
    3e5111
    @@ -21713,6 +21721,8 @@ virDomainFSDefFormat(virBufferPtr buf,
    3e5111
     
    3e5111
         }
    3e5111
     
    3e5111
    +    virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
    3e5111
    +
    3e5111
         if (virBufferUse(&driverBuf)) {
    3e5111
             virBufferAddLit(buf, "
    3e5111
             virBufferAddBuffer(buf, &driverBuf);
    3e5111
    diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
    3e5111
    index 205c9e27b1..fdd852c29d 100644
    3e5111
    --- a/src/conf/domain_conf.h
    3e5111
    +++ b/src/conf/domain_conf.h
    3e5111
    @@ -876,6 +876,7 @@ struct _virDomainFSDef {
    3e5111
         unsigned long long space_hard_limit; /* in bytes */
    3e5111
         unsigned long long space_soft_limit; /* in bytes */
    3e5111
         bool symlinksResolved;
    3e5111
    +    virDomainVirtioOptionsPtr virtio;
    3e5111
     };
    3e5111
     
    3e5111
     
    3e5111
    diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
    3e5111
    index 867e56c107..33da214611 100644
    3e5111
    --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
    3e5111
    +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
    3e5111
    @@ -36,12 +36,13 @@
    3e5111
           <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    3e5111
         </controller>
    3e5111
         <filesystem type='mount' accessmode='passthrough'>
    3e5111
    +      <driver iommu='on' ats='on'/>
    3e5111
           <source dir='/export/fs1'/>
    3e5111
           <target dir='fs1'/>
    3e5111
           <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    3e5111
         </filesystem>
    3e5111
         <filesystem type='mount' accessmode='mapped'>
    3e5111
    -      <driver type='path' wrpolicy='immediate'/>
    3e5111
    +      <driver type='path' wrpolicy='immediate' iommu='on' ats='on'/>
    3e5111
           <source dir='/export/fs2'/>
    3e5111
           <target dir='fs2'/>
    3e5111
           <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    3e5111
    -- 
    3e5111
    2.13.1
    3e5111