[libvirt] [PATCH 11/11] storage_scsi: Allow the omitted 'unique_id'

Osier Yang jyang at redhat.com
Fri Jun 7 17:03:49 UTC 2013


---
 src/storage/storage_backend_scsi.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 5635f73..da6a5dd 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -760,18 +760,14 @@ getAdapterName(virStoragePoolSourceAdapter adapter)
 
     if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
         if (adapter.data.scsi_host.parent) {
-            if (!adapter.data.scsi_host.has_unique_id) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("'unique_id' is not specified for "
-                                 "scsi_host adapter"));
+            if (!(addr = getScsiHostParentAddress(adapter.data.scsi_host.parent)))
                 return NULL;
-            } else {
-                if (!(addr = getScsiHostParentAddress(adapter.data.scsi_host.parent)))
-                    return NULL;
 
+            if (!adapter.data.scsi_host.has_unique_id)
+                name = virGuessStableScsiHostName(NULL, addr);
+            else
                 name = virParseStableScsiHostAddress(NULL, addr,
                                                      adapter.data.scsi_host.unique_id);
-            }
         } else if (adapter.data.scsi_host.name) {
             if (VIR_STRDUP(name, adapter.data.scsi_host.name) < 0)
                 return NULL;
-- 
1.8.1.4




More information about the libvir-list mailing list