]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: move virStorageTranslateDiskSourcePool into domain conf
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 25 Jan 2018 09:35:51 +0000 (09:35 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 9 Feb 2018 11:05:10 +0000 (11:05 +0000)
The virStorageTranslateDiskSourcePool method modifies a virDomainDiskDef
to resolve any storage pool reference. For some reason this was added
into the storage driver code, despite working entirely in terms of the
public APIs. Move it into the domain conf file and rename it to match the
object it modifies.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/bhyve/bhyve_command.c
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_process.c
src/storage/storage_driver.c
src/storage/storage_driver.h

index 55032ae1df55beb6389bb5636e87223713b29595..c1241b81104d39ea59794a948a280d3609296dff 100644 (file)
@@ -37,7 +37,6 @@
 #include "virnetdev.h"
 #include "virnetdevbridge.h"
 #include "virnetdevtap.h"
-#include "storage/storage_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_BHYVE
 
@@ -199,7 +198,7 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
             goto error;
         }
 
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+        if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
             goto error;
 
         disk_source = virDomainDiskGetSource(disk);
@@ -295,7 +294,7 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
 {
     const char *disk_source;
 
-    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+    if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
         return -1;
 
     if (disk->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
@@ -676,7 +675,7 @@ static bool
 virBhyveUsableDisk(virConnectPtr conn, virDomainDiskDefPtr disk)
 {
 
-    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+    if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
         return false;
 
     if ((disk->device != VIR_DOMAIN_DISK_DEVICE_DISK) &&
index 1423cf2c5518e0359b1752adbd95541e752f9a7c..fb732a0c2af4fab00dfe8aa781632cde64a7f0af 100644 (file)
@@ -28919,3 +28919,256 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
 
     return netResolveActualType(iface);
 }
+
+
+static int
+virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
+                                    virStoragePoolDefPtr pooldef)
+{
+    int ret = -1;
+    char **tokens = NULL;
+
+    /* Only support one host */
+    if (pooldef->source.nhost != 1) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Expected exactly 1 host for the storage pool"));
+        goto cleanup;
+    }
+
+    /* iscsi pool only supports one host */
+    def->src->nhosts = 1;
+
+    if (VIR_ALLOC_N(def->src->hosts, def->src->nhosts) < 0)
+        goto cleanup;
+
+    if (VIR_STRDUP(def->src->hosts[0].name, pooldef->source.hosts[0].name) < 0)
+        goto cleanup;
+
+    def->src->hosts[0].port = pooldef->source.hosts[0].port ?
+        pooldef->source.hosts[0].port : 3260;
+
+    /* iscsi volume has name like "unit:0:0:1" */
+    if (!(tokens = virStringSplit(def->src->srcpool->volume, ":", 0)))
+        goto cleanup;
+
+    if (virStringListLength((const char * const *)tokens) != 4) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("unexpected iscsi volume name '%s'"),
+                       def->src->srcpool->volume);
+        goto cleanup;
+    }
+
+    /* iscsi pool has only one source device path */
+    if (virAsprintf(&def->src->path, "%s/%s",
+                    pooldef->source.devices[0].path,
+                    tokens[3]) < 0)
+        goto cleanup;
+
+    /* Storage pool have not supported these 2 attributes yet,
+     * use the defaults.
+     */
+    def->src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
+    def->src->hosts[0].socket = NULL;
+
+    def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+
+    ret = 0;
+
+ cleanup:
+    virStringListFree(tokens);
+    return ret;
+}
+
+
+static int
+virDomainDiskTranslateSourcePoolAuth(virDomainDiskDefPtr def,
+                                     virStoragePoolSourcePtr source)
+{
+    int ret = -1;
+
+    /* Only necessary when authentication set */
+    if (!source->auth) {
+        ret = 0;
+        goto cleanup;
+    }
+    def->src->auth = virStorageAuthDefCopy(source->auth);
+    if (!def->src->auth)
+        goto cleanup;
+    /* A <disk> doesn't use <auth type='%s', so clear that out for the disk */
+    def->src->auth->authType = VIR_STORAGE_AUTH_TYPE_NONE;
+    ret = 0;
+
+ cleanup:
+    return ret;
+}
+
+
+int
+virDomainDiskTranslateSourcePool(virConnectPtr conn,
+                                 virDomainDiskDefPtr def)
+{
+    virStoragePoolDefPtr pooldef = NULL;
+    virStoragePoolPtr pool = NULL;
+    virStorageVolPtr vol = NULL;
+    char *poolxml = NULL;
+    virStorageVolInfo info;
+    int ret = -1;
+
+    if (def->src->type != VIR_STORAGE_TYPE_VOLUME)
+        return 0;
+
+    if (!def->src->srcpool)
+        return 0;
+
+    if (!(pool = virStoragePoolLookupByName(conn, def->src->srcpool->pool)))
+        return -1;
+
+    if (virStoragePoolIsActive(pool) != 1) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("storage pool '%s' containing volume '%s' "
+                         "is not active"),
+                       def->src->srcpool->pool, def->src->srcpool->volume);
+        goto cleanup;
+    }
+
+    if (!(vol = virStorageVolLookupByName(pool, def->src->srcpool->volume)))
+        goto cleanup;
+
+    if (virStorageVolGetInfo(vol, &info) < 0)
+        goto cleanup;
+
+    if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
+        goto cleanup;
+
+    if (!(pooldef = virStoragePoolDefParseString(poolxml)))
+        goto cleanup;
+
+    def->src->srcpool->pooltype = pooldef->type;
+    def->src->srcpool->voltype = info.type;
+
+    if (def->src->srcpool->mode && pooldef->type != VIR_STORAGE_POOL_ISCSI) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("disk source mode is only valid when "
+                         "storage pool is of iscsi type"));
+        goto cleanup;
+    }
+
+    VIR_FREE(def->src->path);
+    virStorageNetHostDefFree(def->src->nhosts, def->src->hosts);
+    def->src->nhosts = 0;
+    def->src->hosts = NULL;
+    virStorageAuthDefFree(def->src->auth);
+    def->src->auth = NULL;
+
+    switch ((virStoragePoolType) pooldef->type) {
+    case VIR_STORAGE_POOL_DIR:
+    case VIR_STORAGE_POOL_FS:
+    case VIR_STORAGE_POOL_NETFS:
+    case VIR_STORAGE_POOL_LOGICAL:
+    case VIR_STORAGE_POOL_DISK:
+    case VIR_STORAGE_POOL_SCSI:
+    case VIR_STORAGE_POOL_ZFS:
+    case VIR_STORAGE_POOL_VSTORAGE:
+        if (!(def->src->path = virStorageVolGetPath(vol)))
+            goto cleanup;
+
+        if (def->startupPolicy && info.type != VIR_STORAGE_VOL_FILE) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("'startupPolicy' is only valid for "
+                             "'file' type volume"));
+            goto cleanup;
+        }
+
+
+        switch (info.type) {
+        case VIR_STORAGE_VOL_FILE:
+            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_FILE;
+            break;
+
+        case VIR_STORAGE_VOL_DIR:
+            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_DIR;
+            break;
+
+        case VIR_STORAGE_VOL_BLOCK:
+            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
+            break;
+
+        case VIR_STORAGE_VOL_PLOOP:
+            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_FILE;
+            break;
+
+        case VIR_STORAGE_VOL_NETWORK:
+        case VIR_STORAGE_VOL_NETDIR:
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("unexpected storage volume type '%s' "
+                             "for storage pool type '%s'"),
+                           virStorageVolTypeToString(info.type),
+                           virStoragePoolTypeToString(pooldef->type));
+            goto cleanup;
+        }
+
+        break;
+
+    case VIR_STORAGE_POOL_ISCSI:
+        if (def->startupPolicy) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("'startupPolicy' is only valid for "
+                             "'file' type volume"));
+            goto cleanup;
+        }
+
+       switch (def->src->srcpool->mode) {
+       case VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT:
+       case VIR_STORAGE_SOURCE_POOL_MODE_LAST:
+           def->src->srcpool->mode = VIR_STORAGE_SOURCE_POOL_MODE_HOST;
+           ATTRIBUTE_FALLTHROUGH;
+       case VIR_STORAGE_SOURCE_POOL_MODE_HOST:
+           def->src->srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
+           if (!(def->src->path = virStorageVolGetPath(vol)))
+               goto cleanup;
+           break;
+
+       case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT:
+           def->src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
+           def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+
+           if (virDomainDiskTranslateSourcePoolAuth(def,
+                                                    &pooldef->source) < 0)
+               goto cleanup;
+
+           /* Source pool may not fill in the secrettype field,
+            * so we need to do so here
+            */
+           if (def->src->auth && !def->src->auth->secrettype) {
+               const char *secrettype =
+                   virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
+               if (VIR_STRDUP(def->src->auth->secrettype, secrettype) < 0)
+                   goto cleanup;
+           }
+
+           if (virDomainDiskAddISCSIPoolSourceHost(def, pooldef) < 0)
+               goto cleanup;
+           break;
+       }
+       break;
+
+    case VIR_STORAGE_POOL_MPATH:
+    case VIR_STORAGE_POOL_RBD:
+    case VIR_STORAGE_POOL_SHEEPDOG:
+    case VIR_STORAGE_POOL_GLUSTER:
+    case VIR_STORAGE_POOL_LAST:
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("using '%s' pools for backing 'volume' disks "
+                         "isn't yet supported"),
+                       virStoragePoolTypeToString(pooldef->type));
+        goto cleanup;
+    }
+
+    ret = 0;
+ cleanup:
+    virObjectUnref(pool);
+    virObjectUnref(vol);
+    VIR_FREE(poolxml);
+    virStoragePoolDefFree(pooldef);
+    return ret;
+}
index 8aba0b562fd898ad56280c3606606011e8cea1e4..6cd81ef2de611a1eda2230824144c765aa583acf 100644 (file)
@@ -3523,4 +3523,8 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
     ATTRIBUTE_NONNULL(1);
 
 
+int virDomainDiskTranslateSourcePool(virConnectPtr conn,
+                                     virDomainDiskDefPtr def);
+
+
 #endif /* __DOMAIN_CONF_H */
index f2801a0d730476d0bd07b881ea7f69d2fe762dc1..3b14d7d158933a1ef60260218fdfb33a879de446 100644 (file)
@@ -345,6 +345,7 @@ virDomainDiskSetDriver;
 virDomainDiskSetFormat;
 virDomainDiskSetSource;
 virDomainDiskSetType;
+virDomainDiskTranslateSourcePool;
 virDomainFSDefFree;
 virDomainFSDefNew;
 virDomainFSDriverTypeToString;
index 44b5655bdb5fd4cdeda26ae455a1310af4159052..978ecd4e073e83b34473ce10cc92714672371c93 100644 (file)
@@ -99,7 +99,6 @@
 #include "virstring.h"
 #include "viraccessapicheck.h"
 #include "viraccessapicheckqemu.h"
-#include "storage/storage_driver.h"
 #include "virhostdev.h"
 #include "domain_capabilities.h"
 #include "vircgroup.h"
@@ -7882,7 +7881,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
     virDomainDiskDefPtr orig_disk = NULL;
     int ret = -1;
 
-    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+    if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
         goto cleanup;
 
     if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0)
@@ -8009,7 +8008,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
                            _("target %s already exists"), disk->dst);
             return -1;
         }
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+        if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
             return -1;
         if (qemuCheckDiskConfig(disk, NULL) < 0)
             return -1;
@@ -14244,7 +14243,7 @@ qemuDomainSnapshotPrepareDiskExternal(virConnectPtr conn,
         return -1;
 
     if (!active) {
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+        if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
             return -1;
 
         if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0)
@@ -14296,7 +14295,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
     if (active)
         return 0;
 
-    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+    if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
         return -1;
 
     actualType = virStorageSourceGetActualType(disk->src);
index 1a406b6d2670b954216f07d9d33cee3d71de4ac5..c7bf25eeefefeafb2de086f4031facdacb0e6908 100644 (file)
@@ -56,7 +56,6 @@
 #include "virstoragefile.h"
 #include "virstring.h"
 #include "virtime.h"
-#include "storage/storage_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -714,7 +713,7 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+    if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
         goto cleanup;
 
     if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
index 7cfe581b3d4db6b89b1b38d106089beca8b89f33..10211de871b1e3f4cbc16ff4a900301999ed0882 100644 (file)
@@ -72,7 +72,6 @@
 #include "virstring.h"
 #include "virhostdev.h"
 #include "secret_util.h"
-#include "storage/storage_driver.h"
 #include "configmake.h"
 #include "nwfilter_conf.h"
 #include "netdev_bandwidth_conf.h"
@@ -5605,7 +5604,7 @@ qemuProcessPrepareDomainStorage(virConnectPtr conn,
         size_t idx = i - 1;
         virDomainDiskDefPtr disk = vm->def->disks[idx];
 
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0) {
+        if (virDomainDiskTranslateSourcePool(conn, disk) < 0) {
             if (qemuDomainCheckDiskStartupPolicy(driver, vm, idx, cold_boot) < 0)
                 return -1;
 
@@ -7365,7 +7364,7 @@ qemuProcessReconnect(void *opaque)
         virDomainDiskDefPtr disk = obj->def->disks[i];
         virDomainDeviceDef dev;
 
-        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
+        if (virDomainDiskTranslateSourcePool(conn, disk) < 0)
             goto error;
 
         /* backing chains need to be refreshed only if they could change */
index f2afb0b3f91cfbda98fda54f5bc698c5e95c2bf2..1b4bce4fc8897260aca7fd7055bf271da1e21271 100644 (file)
@@ -2752,257 +2752,6 @@ storageConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
 }
 
 
-static int
-virStorageAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
-                                 virStoragePoolDefPtr pooldef)
-{
-    int ret = -1;
-    char **tokens = NULL;
-
-    /* Only support one host */
-    if (pooldef->source.nhost != 1) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("Expected exactly 1 host for the storage pool"));
-        goto cleanup;
-    }
-
-    /* iscsi pool only supports one host */
-    def->src->nhosts = 1;
-
-    if (VIR_ALLOC_N(def->src->hosts, def->src->nhosts) < 0)
-        goto cleanup;
-
-    if (VIR_STRDUP(def->src->hosts[0].name, pooldef->source.hosts[0].name) < 0)
-        goto cleanup;
-
-    def->src->hosts[0].port = pooldef->source.hosts[0].port ?
-        pooldef->source.hosts[0].port : 3260;
-
-    /* iscsi volume has name like "unit:0:0:1" */
-    if (!(tokens = virStringSplit(def->src->srcpool->volume, ":", 0)))
-        goto cleanup;
-
-    if (virStringListLength((const char * const *)tokens) != 4) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unexpected iscsi volume name '%s'"),
-                       def->src->srcpool->volume);
-        goto cleanup;
-    }
-
-    /* iscsi pool has only one source device path */
-    if (virAsprintf(&def->src->path, "%s/%s",
-                    pooldef->source.devices[0].path,
-                    tokens[3]) < 0)
-        goto cleanup;
-
-    /* Storage pool have not supported these 2 attributes yet,
-     * use the defaults.
-     */
-    def->src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
-    def->src->hosts[0].socket = NULL;
-
-    def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
-
-    ret = 0;
-
- cleanup:
-    virStringListFree(tokens);
-    return ret;
-}
-
-
-static int
-virStorageTranslateDiskSourcePoolAuth(virDomainDiskDefPtr def,
-                                      virStoragePoolSourcePtr source)
-{
-    int ret = -1;
-
-    /* Only necessary when authentication set */
-    if (!source->auth) {
-        ret = 0;
-        goto cleanup;
-    }
-    def->src->auth = virStorageAuthDefCopy(source->auth);
-    if (!def->src->auth)
-        goto cleanup;
-    /* A <disk> doesn't use <auth type='%s', so clear that out for the disk */
-    def->src->auth->authType = VIR_STORAGE_AUTH_TYPE_NONE;
-    ret = 0;
-
- cleanup:
-    return ret;
-}
-
-
-int
-virStorageTranslateDiskSourcePool(virConnectPtr conn,
-                                  virDomainDiskDefPtr def)
-{
-    virStoragePoolDefPtr pooldef = NULL;
-    virStoragePoolPtr pool = NULL;
-    virStorageVolPtr vol = NULL;
-    char *poolxml = NULL;
-    virStorageVolInfo info;
-    int ret = -1;
-
-    if (def->src->type != VIR_STORAGE_TYPE_VOLUME)
-        return 0;
-
-    if (!def->src->srcpool)
-        return 0;
-
-    if (!(pool = virStoragePoolLookupByName(conn, def->src->srcpool->pool)))
-        return -1;
-
-    if (virStoragePoolIsActive(pool) != 1) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("storage pool '%s' containing volume '%s' "
-                         "is not active"),
-                       def->src->srcpool->pool, def->src->srcpool->volume);
-        goto cleanup;
-    }
-
-    if (!(vol = virStorageVolLookupByName(pool, def->src->srcpool->volume)))
-        goto cleanup;
-
-    if (virStorageVolGetInfo(vol, &info) < 0)
-        goto cleanup;
-
-    if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
-        goto cleanup;
-
-    if (!(pooldef = virStoragePoolDefParseString(poolxml)))
-        goto cleanup;
-
-    def->src->srcpool->pooltype = pooldef->type;
-    def->src->srcpool->voltype = info.type;
-
-    if (def->src->srcpool->mode && pooldef->type != VIR_STORAGE_POOL_ISCSI) {
-        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("disk source mode is only valid when "
-                         "storage pool is of iscsi type"));
-        goto cleanup;
-    }
-
-    VIR_FREE(def->src->path);
-    virStorageNetHostDefFree(def->src->nhosts, def->src->hosts);
-    def->src->nhosts = 0;
-    def->src->hosts = NULL;
-    virStorageAuthDefFree(def->src->auth);
-    def->src->auth = NULL;
-
-    switch ((virStoragePoolType) pooldef->type) {
-    case VIR_STORAGE_POOL_DIR:
-    case VIR_STORAGE_POOL_FS:
-    case VIR_STORAGE_POOL_NETFS:
-    case VIR_STORAGE_POOL_LOGICAL:
-    case VIR_STORAGE_POOL_DISK:
-    case VIR_STORAGE_POOL_SCSI:
-    case VIR_STORAGE_POOL_ZFS:
-    case VIR_STORAGE_POOL_VSTORAGE:
-        if (!(def->src->path = virStorageVolGetPath(vol)))
-            goto cleanup;
-
-        if (def->startupPolicy && info.type != VIR_STORAGE_VOL_FILE) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("'startupPolicy' is only valid for "
-                             "'file' type volume"));
-            goto cleanup;
-        }
-
-
-        switch (info.type) {
-        case VIR_STORAGE_VOL_FILE:
-            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_FILE;
-            break;
-
-        case VIR_STORAGE_VOL_DIR:
-            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_DIR;
-            break;
-
-        case VIR_STORAGE_VOL_BLOCK:
-            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
-            break;
-
-        case VIR_STORAGE_VOL_PLOOP:
-            def->src->srcpool->actualtype = VIR_STORAGE_TYPE_FILE;
-            break;
-
-        case VIR_STORAGE_VOL_NETWORK:
-        case VIR_STORAGE_VOL_NETDIR:
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected storage volume type '%s' "
-                             "for storage pool type '%s'"),
-                           virStorageVolTypeToString(info.type),
-                           virStoragePoolTypeToString(pooldef->type));
-            goto cleanup;
-        }
-
-        break;
-
-    case VIR_STORAGE_POOL_ISCSI:
-        if (def->startupPolicy) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("'startupPolicy' is only valid for "
-                             "'file' type volume"));
-            goto cleanup;
-        }
-
-       switch (def->src->srcpool->mode) {
-       case VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT:
-       case VIR_STORAGE_SOURCE_POOL_MODE_LAST:
-           def->src->srcpool->mode = VIR_STORAGE_SOURCE_POOL_MODE_HOST;
-           ATTRIBUTE_FALLTHROUGH;
-       case VIR_STORAGE_SOURCE_POOL_MODE_HOST:
-           def->src->srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
-           if (!(def->src->path = virStorageVolGetPath(vol)))
-               goto cleanup;
-           break;
-
-       case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT:
-           def->src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
-           def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
-
-           if (virStorageTranslateDiskSourcePoolAuth(def,
-                                                     &pooldef->source) < 0)
-               goto cleanup;
-
-           /* Source pool may not fill in the secrettype field,
-            * so we need to do so here
-            */
-           if (def->src->auth && !def->src->auth->secrettype) {
-               const char *secrettype =
-                   virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
-               if (VIR_STRDUP(def->src->auth->secrettype, secrettype) < 0)
-                   goto cleanup;
-           }
-
-           if (virStorageAddISCSIPoolSourceHost(def, pooldef) < 0)
-               goto cleanup;
-           break;
-       }
-       break;
-
-    case VIR_STORAGE_POOL_MPATH:
-    case VIR_STORAGE_POOL_RBD:
-    case VIR_STORAGE_POOL_SHEEPDOG:
-    case VIR_STORAGE_POOL_GLUSTER:
-    case VIR_STORAGE_POOL_LAST:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("using '%s' pools for backing 'volume' disks "
-                         "isn't yet supported"),
-                       virStoragePoolTypeToString(pooldef->type));
-        goto cleanup;
-    }
-
-    ret = 0;
- cleanup:
-    virObjectUnref(pool);
-    virObjectUnref(vol);
-    VIR_FREE(poolxml);
-    virStoragePoolDefFree(pooldef);
-    return ret;
-}
 
 
 /*
index fd2fae1ba269986728fc5ade1a05e89a317c739f..c284bf520f4a8b60e248d54fe487400502750ac1 100644 (file)
@@ -29,9 +29,6 @@
 # include "domain_conf.h"
 # include "virstorageobj.h"
 
-int virStorageTranslateDiskSourcePool(virConnectPtr conn,
-                                      virDomainDiskDefPtr def);
-
 virStoragePoolObjPtr virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
     ATTRIBUTE_NONNULL(1);