render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From 91fb6be3924d7b0de8d0d3392f24cdb49f83dbb0 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <91fb6be3924d7b0de8d0d3392f24cdb49f83dbb0@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Tue, 2 Aug 2016 13:41:55 +0200
6ae9ed
Subject: [PATCH] util: storage: Add 'ssh' network storage protocol
6ae9ed
6ae9ed
Allow using 'ssh' protocol in backing chains and later for disks
6ae9ed
themselves.
6ae9ed
6ae9ed
(cherry picked from commit 29f06ff548e8910ba48c207591788b32c3544e40)
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1134878 [JSON backing]
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1247521 [gluster multi-host]
6ae9ed
---
6ae9ed
 src/libxl/libxl_conf.c        | 1 +
6ae9ed
 src/qemu/qemu_command.c       | 7 +++++++
6ae9ed
 src/qemu/qemu_driver.c        | 3 +++
6ae9ed
 src/qemu/qemu_parse_command.c | 1 +
6ae9ed
 src/util/virstoragefile.c     | 4 +++-
6ae9ed
 src/util/virstoragefile.h     | 1 +
6ae9ed
 src/xenconfig/xen_xl.c        | 1 +
6ae9ed
 7 files changed, 17 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
6ae9ed
index 584eb8f..de538be 100644
6ae9ed
--- a/src/libxl/libxl_conf.c
6ae9ed
+++ b/src/libxl/libxl_conf.c
6ae9ed
@@ -581,6 +581,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_ISCSI:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
6ae9ed
+    case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_NONE:
6ae9ed
         virReportError(VIR_ERR_NO_SUPPORT,
6ae9ed
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
6ae9ed
index 6c91e53..9ac90f7 100644
6ae9ed
--- a/src/qemu/qemu_command.c
6ae9ed
+++ b/src/qemu/qemu_command.c
6ae9ed
@@ -480,6 +480,9 @@ qemuNetworkDriveGetPort(int protocol,
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_NBD:
6ae9ed
             return 10809;
6ae9ed
 
6ae9ed
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
+            return 22;
6ae9ed
+
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_ISCSI:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
6ae9ed
             /* no default port specified */
6ae9ed
@@ -878,6 +881,10 @@ qemuBuildNetworkDriveURI(virStorageSourcePtr src,
6ae9ed
             ret = virBufferContentAndReset(&buf;;
6ae9ed
             break;
6ae9ed
 
6ae9ed
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
6ae9ed
+                           _("'ssh' protocol is not yet supported"));
6ae9ed
+            goto cleanup;
6ae9ed
 
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_NONE:
6ae9ed
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
6ae9ed
index 2d6e5d2..aed5e80 100644
6ae9ed
--- a/src/qemu/qemu_driver.c
6ae9ed
+++ b/src/qemu/qemu_driver.c
6ae9ed
@@ -13371,6 +13371,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTP:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTPS:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_TFTP:
6ae9ed
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
             virReportError(VIR_ERR_INTERNAL_ERROR,
6ae9ed
                            _("external inactive snapshots are not supported on "
6ae9ed
@@ -13433,6 +13434,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTP:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTPS:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_TFTP:
6ae9ed
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
             virReportError(VIR_ERR_INTERNAL_ERROR,
6ae9ed
                            _("external active snapshots are not supported on "
6ae9ed
@@ -13577,6 +13579,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTP:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_FTPS:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_TFTP:
6ae9ed
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
         case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
             virReportError(VIR_ERR_INTERNAL_ERROR,
6ae9ed
                            _("internal inactive snapshots are not supported on "
6ae9ed
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
6ae9ed
index 9ee262b..b1d8a1d 100644
6ae9ed
--- a/src/qemu/qemu_parse_command.c
6ae9ed
+++ b/src/qemu/qemu_parse_command.c
6ae9ed
@@ -2013,6 +2013,7 @@ qemuParseCommandLine(virCapsPtr caps,
6ae9ed
                 case VIR_STORAGE_NET_PROTOCOL_FTP:
6ae9ed
                 case VIR_STORAGE_NET_PROTOCOL_FTPS:
6ae9ed
                 case VIR_STORAGE_NET_PROTOCOL_TFTP:
6ae9ed
+                case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
                 case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
                 case VIR_STORAGE_NET_PROTOCOL_NONE:
6ae9ed
                     /* ignored for now */
6ae9ed
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
6ae9ed
index 48c0956..c0172af 100644
6ae9ed
--- a/src/util/virstoragefile.c
6ae9ed
+++ b/src/util/virstoragefile.c
6ae9ed
@@ -84,7 +84,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
6ae9ed
               "https",
6ae9ed
               "ftp",
6ae9ed
               "ftps",
6ae9ed
-              "tftp")
6ae9ed
+              "tftp",
6ae9ed
+              "ssh")
6ae9ed
 
6ae9ed
 VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST,
6ae9ed
               "tcp",
6ae9ed
@@ -2510,6 +2511,7 @@ virStorageSourceParseBackingColon(virStorageSourcePtr src,
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_TFTP:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_ISCSI:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
6ae9ed
+    case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
         virReportError(VIR_ERR_INTERNAL_ERROR,
6ae9ed
                        _("malformed backing store path for protocol %s"),
6ae9ed
                        protocol);
6ae9ed
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
6ae9ed
index 1a76fad..3ea3a60 100644
6ae9ed
--- a/src/util/virstoragefile.h
6ae9ed
+++ b/src/util/virstoragefile.h
6ae9ed
@@ -132,6 +132,7 @@ typedef enum {
6ae9ed
     VIR_STORAGE_NET_PROTOCOL_FTP,
6ae9ed
     VIR_STORAGE_NET_PROTOCOL_FTPS,
6ae9ed
     VIR_STORAGE_NET_PROTOCOL_TFTP,
6ae9ed
+    VIR_STORAGE_NET_PROTOCOL_SSH,
6ae9ed
 
6ae9ed
     VIR_STORAGE_NET_PROTOCOL_LAST
6ae9ed
 } virStorageNetProtocol;
6ae9ed
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
6ae9ed
index d524a82..f8cebd2 100644
6ae9ed
--- a/src/xenconfig/xen_xl.c
6ae9ed
+++ b/src/xenconfig/xen_xl.c
6ae9ed
@@ -726,6 +726,7 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_ISCSI:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
6ae9ed
+    case VIR_STORAGE_NET_PROTOCOL_SSH:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_LAST:
6ae9ed
     case VIR_STORAGE_NET_PROTOCOL_NONE:
6ae9ed
         virReportError(VIR_ERR_NO_SUPPORT,
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed