[RFC PATCH 1/6] compatibilities: added in flags for NFS support

Han Han hhan at redhat.com
Fri Dec 11 04:08:06 UTC 2020


On Fri, Dec 11, 2020 at 4:01 AM Ryan Gahagan <rgahagan at cs.utexas.edu> wrote:

> Signed-off-by: Ryan Gahagan <rgahagan at cs.utexas.edu>
> ---
>
The patch for compatibilities usually is on src/qemu/qemu_capabilities* and
tests/qemucapabilitiesdata/caps_*.
Because nfs disk is supported since qemu v2.9(
https://github.com/qemu/qemu/blob/master/qapi/block-core.json#L3759), the
compatibilities flags should be added to check whether the target qemu
supports nfs disk.
https://gitlab.com/libvirt/libvirt/-/commit/9825f71b53014bd2b418680ffeb2b27dd768a7fc
is a example:
The diff in src/qemu/qemu_capabilities.* defines the name & flag of this
capability flag, and the method to query the capability. For
more information of the capability query, you can refer to the code
comments of virQEMUQAPISchemaPathGet in libvirt and the
query-qmp-schema in qemu
https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html
The diff in  tests/qemucapabilitiesdata/caps_*.xml defines the capability
unit tests for different arhes and qemu versions.

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
in the "qemu: ..." patch.

>  src/libxl/libxl_conf.c    | 1 +
>  src/libxl/xen_xl.c        | 1 +
>  src/qemu/qemu_block.c     | 3 +++
>  src/qemu/qemu_command.c   | 1 +
>  src/qemu/qemu_domain.c    | 2 ++
>  src/qemu/qemu_snapshot.c  | 3 +++
>  src/util/virstoragefile.c | 6 ++++++
>  src/util/virstoragefile.h | 1 +
>  8 files changed, 18 insertions(+)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 00748e21e8..6a8ae27f54 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -941,6 +941,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
>      case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
>      case VIR_STORAGE_NET_PROTOCOL_SSH:
>      case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +    case VIR_STORAGE_NET_PROTOCOL_NFS:
>      case VIR_STORAGE_NET_PROTOCOL_LAST:
>      case VIR_STORAGE_NET_PROTOCOL_NONE:
>          virReportError(VIR_ERR_NO_SUPPORT,
> diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
> index ba0942601f..17b93d0f5c 100644
> --- a/src/libxl/xen_xl.c
> +++ b/src/libxl/xen_xl.c
> @@ -1600,6 +1600,7 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
>      case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
>      case VIR_STORAGE_NET_PROTOCOL_SSH:
>      case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +    case VIR_STORAGE_NET_PROTOCOL_NFS:
>      case VIR_STORAGE_NET_PROTOCOL_LAST:
>      case VIR_STORAGE_NET_PROTOCOL_NONE:
>          virReportError(VIR_ERR_NO_SUPPORT,
> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index 4640e339c0..b224a550f3 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -1180,6 +1180,7 @@
> qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
>                  return NULL;
>              break;
>
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_NONE:
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>              virReportEnumRangeError(virStorageNetProtocol, src->protocol);
> @@ -2111,6 +2112,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr
> src,
>              case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
>              case VIR_STORAGE_NET_PROTOCOL_RBD:
>              case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +            case VIR_STORAGE_NET_PROTOCOL_NFS:
>              case VIR_STORAGE_NET_PROTOCOL_SSH:
>              case VIR_STORAGE_NET_PROTOCOL_LAST:
>              case VIR_STORAGE_NET_PROTOCOL_NONE:
> @@ -2502,6 +2504,7 @@
> qemuBlockStorageSourceCreateGetStorageProps(virStorageSourcePtr src,
>          case VIR_STORAGE_NET_PROTOCOL_NBD:
>          case VIR_STORAGE_NET_PROTOCOL_ISCSI:
>          case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_HTTP:
>          case VIR_STORAGE_NET_PROTOCOL_HTTPS:
>          case VIR_STORAGE_NET_PROTOCOL_FTP:
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index b06a086e18..c58f39ebf1 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1044,6 +1044,7 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
>                             _("'ssh' protocol is not yet supported"));
>              return NULL;
>
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>          case VIR_STORAGE_NET_PROTOCOL_NONE:
>              virReportError(VIR_ERR_INTERNAL_ERROR,
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 766f76020c..b5a4a22ed3 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -9629,6 +9629,8 @@
> qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
>      case VIR_STORAGE_NET_PROTOCOL_FTP:
>      case VIR_STORAGE_NET_PROTOCOL_FTPS:
>      case VIR_STORAGE_NET_PROTOCOL_TFTP:
> +    case VIR_STORAGE_NET_PROTOCOL_NFS:
> +        /* Assumed NFS doesn't support TLS (needs Kerberos) */
>      case VIR_STORAGE_NET_PROTOCOL_SSH:
>          if (src->haveTLS == VIR_TRISTATE_BOOL_YES) {
>              virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
> index 15494c3415..7e89a8839b 100644
> --- a/src/qemu/qemu_snapshot.c
> +++ b/src/qemu/qemu_snapshot.c
> @@ -413,6 +413,7 @@
> qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr
> snapdisk,
>          case VIR_STORAGE_NET_PROTOCOL_TFTP:
>          case VIR_STORAGE_NET_PROTOCOL_SSH:
>          case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("external inactive snapshots are not
> supported on "
> @@ -501,6 +502,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObjPtr
> vm,
>          case VIR_STORAGE_NET_PROTOCOL_TFTP:
>          case VIR_STORAGE_NET_PROTOCOL_SSH:
>          case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("external active snapshots are not supported
> on "
> @@ -631,6 +633,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDefPtr
> disk,
>          case VIR_STORAGE_NET_PROTOCOL_TFTP:
>          case VIR_STORAGE_NET_PROTOCOL_SSH:
>          case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("internal inactive snapshots are not
> supported on "
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index fac93118fd..5a57e5d12d 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -90,6 +90,7 @@ VIR_ENUM_IMPL(virStorageNetProtocol,
>                "tftp",
>                "ssh",
>                "vxhs",
> +              "nfs",
>  );
>
>  VIR_ENUM_IMPL(virStorageNetHostTransport,
> @@ -3152,6 +3153,7 @@
> virStorageSourceParseBackingColon(virStorageSourcePtr src,
>      case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
>      case VIR_STORAGE_NET_PROTOCOL_SSH:
>      case VIR_STORAGE_NET_PROTOCOL_VXHS:
> +    case VIR_STORAGE_NET_PROTOCOL_NFS:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("malformed backing store path for protocol %s"),
>                         protocol);
> @@ -4627,6 +4629,10 @@
> virStorageSourceNetworkDefaultPort(virStorageNetProtocol protocol)
>          case VIR_STORAGE_NET_PROTOCOL_VXHS:
>              return 9999;
>
> +        case VIR_STORAGE_NET_PROTOCOL_NFS:
> +            /* return based on exmaple and SUSE support docs */
> +            return 2049;
> +
>          case VIR_STORAGE_NET_PROTOCOL_LAST:
>          case VIR_STORAGE_NET_PROTOCOL_NONE:
>              return 0;
> diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
> index 87763cf389..c5d5f0233a 100644
> --- a/src/util/virstoragefile.h
> +++ b/src/util/virstoragefile.h
> @@ -135,6 +135,7 @@ typedef enum {
>      VIR_STORAGE_NET_PROTOCOL_TFTP,
>      VIR_STORAGE_NET_PROTOCOL_SSH,
>      VIR_STORAGE_NET_PROTOCOL_VXHS,
> +    VIR_STORAGE_NET_PROTOCOL_NFS,
>
>      VIR_STORAGE_NET_PROTOCOL_LAST
>  } virStorageNetProtocol;
> --
> 2.29.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201211/424e9838/attachment-0001.htm>


More information about the libvir-list mailing list