]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Allow all volume modes for disk type='lun' sources
authorPeter Krempa <pkrempa@redhat.com>
Wed, 11 May 2016 08:25:24 +0000 (10:25 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 17 May 2016 05:09:56 +0000 (07:09 +0200)
Commit 82ba41108acd0f3f made possible to use direct mapped iSCSI
volumes in qemu as disk sources but didn't remove the define time check.

Rework the check by simplifying the condition and allow any volumes to
be used with disk type='lun'.

src/conf/domain_conf.c

index ed0c471465f3d2a32dc0ea66cef9d907d4569f52..b445469cfcbbd3038df496bfdde403987e2cf55d 100644 (file)
@@ -4145,26 +4145,18 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
             }
         }
 
-        /* Validate LUN configuration
-         * NOTE: virStorageTranslateDiskSourcePool is not run yet, so for
-         *       disk "volume"'s, the closest we can get at config time is
-         *       to ensure mode isn't direct since host/default will allow
-         *       lun/block usage. At run time if it's determined the wrong
-         *       voltype and pooltype values are set, then failure occurs
-         */
-        if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN &&
-            !(disk->src->type == VIR_STORAGE_TYPE_BLOCK ||
-              (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
-               disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI) ||
-              (disk->src->type == VIR_STORAGE_TYPE_VOLUME &&
-               disk->src->srcpool &&
-               disk->src->srcpool->mode !=
-               VIR_STORAGE_SOURCE_POOL_MODE_DIRECT))) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("disk '%s' improperly configured for a "
-                             "device='lun'"),
-                           disk->dst);
-            return -1;
+        /* Validate LUN configuration */
+        if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
+            /* volumes haven't been translated at this point, so accept them */
+            if (!(disk->src->type == VIR_STORAGE_TYPE_BLOCK ||
+                  disk->src->type == VIR_STORAGE_TYPE_VOLUME ||
+                  (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
+                   disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI))) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("disk '%s' improperly configured for a "
+                                 "device='lun'"), disk->dst);
+                return -1;
+            }
         }
 
         if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&