[Kimchi-devel] [PATCH 1/2] List iSCSI server for initiator while creating iSCSI Pool

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Tue May 27 15:33:50 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

The server should be already used in an existed iSCSI Pool.

Test this patch by:
$ curl -k -u shhfeng:123456 -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> http://localhost:8000/storageservers?_target_type=iscsi
[
  {
    "host":"127.0.0.1"
  }
]

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 src/kimchi/API.json                | 2 +-
 src/kimchi/model/storagepools.py   | 4 +++-
 src/kimchi/model/storageservers.py | 3 +--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 76c94ab..05a5866 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -416,7 +416,7 @@
                 "_target_type": {
                     "description": "List storage servers of given type",
                     "type": "string",
-                    "pattern": "^netfs$"
+                    "pattern": "^netfs|iscsi$"
                 }
             },
             "additionalProperties": false,
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index c0f2c58..c699fc6 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -37,9 +37,11 @@ POOL_STATE_MAP = {0: 'inactive',
                   4: 'inaccessible'}
 
 # Types of pools supported
-# FIXME: Addd 'iscsi'
 STORAGE_SOURCES = {'netfs': {'addr': '/pool/source/host/@name',
                              'path': '/pool/source/dir/@path'},
+                   'iscsi': {'addr': '/pool/source/host/@name',
+                             'port': '/pool/source/host/@port',
+                             'path': '/pool/source/device/@path'},
                    'scsi': {'adapter_type': '/pool/source/adapter/@type',
                             'adapter_name': '/pool/source/adapter/@name',
                             'wwnn': '/pool/source/adapter/@wwnn',
diff --git a/src/kimchi/model/storageservers.py b/src/kimchi/model/storageservers.py
index c9dfb25..6259b92 100644
--- a/src/kimchi/model/storageservers.py
+++ b/src/kimchi/model/storageservers.py
@@ -21,8 +21,7 @@ from kimchi.exception import NotFoundError
 from kimchi.model.storagepools import StoragePoolModel, StoragePoolsModel
 
 # Types of remote storage servers supported
-# FIXME: Add iscsi?
-STORAGE_SERVERS = ['netfs']
+STORAGE_SERVERS = ['netfs', 'iscsi']
 
 
 class StorageServersModel(object):
-- 
1.9.3




More information about the Kimchi-devel mailing list