<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 11, 2020 at 4:01 AM Ryan Gahagan <<a href="mailto:rgahagan@cs.utexas.edu">rgahagan@cs.utexas.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Ryan Gahagan <<a href="mailto:rgahagan@cs.utexas.edu" target="_blank">rgahagan@cs.utexas.edu</a>><br>
---<br></blockquote><div>The patch for compatibilities usually is on src/qemu/qemu_capabilities* and tests/qemucapabilitiesdata/caps_*.</div><div>Because nfs disk is supported since qemu v2.9(<a href="https://github.com/qemu/qemu/blob/master/qapi/block-core.json#L3759">https://github.com/qemu/qemu/blob/master/qapi/block-core.json#L3759</a>), the</div><div>compatibilities flags should be added to check whether the target qemu supports nfs disk. <a href="https://gitlab.com/libvirt/libvirt/-/commit/9825f71b53014bd2b418680ffeb2b27dd768a7fc">https://gitlab.com/libvirt/libvirt/-/commit/9825f71b53014bd2b418680ffeb2b27dd768a7fc</a> is a example:</div><div>The diff in src/qemu/qemu_capabilities.* defines the name & flag of this capability flag, and the method to query the capability. For</div><div>more information of the capability query, you can refer to the code comments of virQEMUQAPISchemaPathGet in libvirt and the <br></div><div>query-qmp-schema in qemu <a href="https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html">https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html</a></div><div>The diff in  tests/qemucapabilitiesdata/caps_*.xml defines the capability unit tests for different arhes and qemu versions.</div><div><br></div><div>For this patch, the diff in src/util/* and src/libxl/* could be included in the "util: ..." patch. The diff of src/qemu/* is better to be included</div><div>in the "qemu: ..." patch.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 src/libxl/libxl_conf.c    | 1 +<br>
 src/libxl/xen_xl.c        | 1 +<br>
 src/qemu/qemu_block.c     | 3 +++<br>
 src/qemu/qemu_command.c   | 1 +<br>
 src/qemu/qemu_domain.c    | 2 ++<br>
 src/qemu/qemu_snapshot.c  | 3 +++<br>
 src/util/virstoragefile.c | 6 ++++++<br>
 src/util/virstoragefile.h | 1 +<br>
 8 files changed, 18 insertions(+)<br>
<br>
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c<br>
index 00748e21e8..6a8ae27f54 100644<br>
--- a/src/libxl/libxl_conf.c<br>
+++ b/src/libxl/libxl_conf.c<br>
@@ -941,6 +941,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,<br>
     case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:<br>
     case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
     case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+    case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
     case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
     case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
         virReportError(VIR_ERR_NO_SUPPORT,<br>
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c<br>
index ba0942601f..17b93d0f5c 100644<br>
--- a/src/libxl/xen_xl.c<br>
+++ b/src/libxl/xen_xl.c<br>
@@ -1600,6 +1600,7 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)<br>
     case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:<br>
     case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
     case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+    case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
     case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
     case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
         virReportError(VIR_ERR_NO_SUPPORT,<br>
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c<br>
index 4640e339c0..b224a550f3 100644<br>
--- a/src/qemu/qemu_block.c<br>
+++ b/src/qemu/qemu_block.c<br>
@@ -1180,6 +1180,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,<br>
                 return NULL;<br>
             break;<br>
<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             virReportEnumRangeError(virStorageNetProtocol, src->protocol);<br>
@@ -2111,6 +2112,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,<br>
             case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:<br>
             case VIR_STORAGE_NET_PROTOCOL_RBD:<br>
             case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+            case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
             case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
             case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
@@ -2502,6 +2504,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSourcePtr src,<br>
         case VIR_STORAGE_NET_PROTOCOL_NBD:<br>
         case VIR_STORAGE_NET_PROTOCOL_ISCSI:<br>
         case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_HTTP:<br>
         case VIR_STORAGE_NET_PROTOCOL_HTTPS:<br>
         case VIR_STORAGE_NET_PROTOCOL_FTP:<br>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c<br>
index b06a086e18..c58f39ebf1 100644<br>
--- a/src/qemu/qemu_command.c<br>
+++ b/src/qemu/qemu_command.c<br>
@@ -1044,6 +1044,7 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,<br>
                            _("'ssh' protocol is not yet supported"));<br>
             return NULL;<br>
<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
         case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
             virReportError(VIR_ERR_INTERNAL_ERROR,<br>
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c<br>
index 766f76020c..b5a4a22ed3 100644<br>
--- a/src/qemu/qemu_domain.c<br>
+++ b/src/qemu/qemu_domain.c<br>
@@ -9629,6 +9629,8 @@ qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,<br>
     case VIR_STORAGE_NET_PROTOCOL_FTP:<br>
     case VIR_STORAGE_NET_PROTOCOL_FTPS:<br>
     case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
+    case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
+        /* Assumed NFS doesn't support TLS (needs Kerberos) */<br>
     case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
         if (src->haveTLS == VIR_TRISTATE_BOOL_YES) {<br>
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,<br>
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c<br>
index 15494c3415..7e89a8839b 100644<br>
--- a/src/qemu/qemu_snapshot.c<br>
+++ b/src/qemu/qemu_snapshot.c<br>
@@ -413,6 +413,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdisk,<br>
         case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
         case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
         case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             virReportError(VIR_ERR_INTERNAL_ERROR,<br>
                            _("external inactive snapshots are not supported on "<br>
@@ -501,6 +502,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObjPtr vm,<br>
         case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
         case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
         case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             virReportError(VIR_ERR_INTERNAL_ERROR,<br>
                            _("external active snapshots are not supported on "<br>
@@ -631,6 +633,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDefPtr disk,<br>
         case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
         case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
         case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             virReportError(VIR_ERR_INTERNAL_ERROR,<br>
                            _("internal inactive snapshots are not supported on "<br>
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c<br>
index fac93118fd..5a57e5d12d 100644<br>
--- a/src/util/virstoragefile.c<br>
+++ b/src/util/virstoragefile.c<br>
@@ -90,6 +90,7 @@ VIR_ENUM_IMPL(virStorageNetProtocol,<br>
               "tftp",<br>
               "ssh",<br>
               "vxhs",<br>
+              "nfs",<br>
 );<br>
<br>
 VIR_ENUM_IMPL(virStorageNetHostTransport,<br>
@@ -3152,6 +3153,7 @@ virStorageSourceParseBackingColon(virStorageSourcePtr src,<br>
     case VIR_STORAGE_NET_PROTOCOL_GLUSTER:<br>
     case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
     case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+    case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
         virReportError(VIR_ERR_INTERNAL_ERROR,<br>
                        _("malformed backing store path for protocol %s"),<br>
                        protocol);<br>
@@ -4627,6 +4629,10 @@ virStorageSourceNetworkDefaultPort(virStorageNetProtocol protocol)<br>
         case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
             return 9999;<br>
<br>
+        case VIR_STORAGE_NET_PROTOCOL_NFS:<br>
+            /* return based on exmaple and SUSE support docs */<br>
+            return 2049;<br>
+<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
         case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
             return 0;<br>
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h<br>
index 87763cf389..c5d5f0233a 100644<br>
--- a/src/util/virstoragefile.h<br>
+++ b/src/util/virstoragefile.h<br>
@@ -135,6 +135,7 @@ typedef enum {<br>
     VIR_STORAGE_NET_PROTOCOL_TFTP,<br>
     VIR_STORAGE_NET_PROTOCOL_SSH,<br>
     VIR_STORAGE_NET_PROTOCOL_VXHS,<br>
+    VIR_STORAGE_NET_PROTOCOL_NFS,<br>
<br>
     VIR_STORAGE_NET_PROTOCOL_LAST<br>
 } virStorageNetProtocol;<br>
-- <br>
2.29.0<br>
<br>
</blockquote></div></div>