As we are adding support to new type of storage pool, the current naming
scheme of the storage pool creating arguments should be rearranged to be
more extendable. This patch renames some arguments and consolidates the
argument of the same purposes as follow.
nfsserver -> srcHost
This is because in future patches, iSCSI pool can use this srcHost as
well. Other network backed storage pool can also make use of this
argument.
nfspath -> srcPath
This is because other netfs pool can also make use of this argument.
devices -> srcDevices
To differentiate source arguments from the target arguments, we can add
a "src" prefix to source arguments.
---
docs/API.md | 19 +++++++++++--------
src/kimchi/model.py | 17 +++++++++--------
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 74bc1b5..dd3d7f1 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -180,15 +180,18 @@ Represents a snapshot of the Virtual Machine's primary monitor.
* **GET**: Retrieve a summarized list of all defined Storage Pools
* **POST**: Create a new Storage Pool
- * name: The name of the Storage Pool
- * path: The path of the defined Storage Pool,
+ * name: The name of the Storage Pool.
+ * type: The type of the defined Storage Pool.
+ Supported types: 'dir', 'kimchi-iso', 'netfs', 'logical'
+ * path: The path of the defined Storage Pool.
For 'kimchi-iso' pool refers to targeted deep scan path.
- * type: The type of the defined Storage Pool,
- Supported types: 'dir', 'kimchi-iso', 'netfs'
- * nfsserver: IP or hostname of NFS server to create NFS pool.
- * nfspath: export path on nfs server for NFS pool.
- * devices: Array of devices to be used in the Storage Pool
- Exclusive to the 'logical' storage pool type.
+ Pool types: 'dir', 'kimchi-iso'.
+ * srcHost: IP or hostname of server for a pool backed from a remote host.
+ Pool types: 'nfs'.
+ * srcPath: Export path on NFS server for NFS pool.
+ Pool types: 'nfs'.
+ * srcDevices: Array of devices to be used in the Storage Pool
+ Pool types: 'logical'.
### Resource: Storage Pool
diff --git a/src/kimchi/model.py b/src/kimchi/model.py
index d22e02d..af0d728 100644
--- a/src/kimchi/model.py
+++ b/src/kimchi/model.py
@@ -1424,8 +1424,8 @@ def _get_netfs_storagepool_xml(poolArgs):
# Required parameters
# name:
# type:
- # nfsserver:
- # nfspath:
+ # srcHost:
+ # srcPath:
path = '/var/lib/kimchi/nfs_mount/' + poolArgs['name']
if not os.path.exists(path):
os.makedirs(path)
@@ -1434,8 +1434,8 @@ def _get_netfs_storagepool_xml(poolArgs):
<pool type='%(type)s'>
<name>%(name)s</name>
<source>
- <host name='%(nfsserver)s'/>
- <dir path='%(nfspath)s'/>
+ <host name='%(srcHost)s'/>
+ <dir path='%(srcPath)s'/>
</source>
<target>
<path>%(path)s</path>
@@ -1449,22 +1449,23 @@ def _get_logical_storagepool_xml(poolArgs):
# Required parameters
# name:
# type:
- # devices:
+ # srcDevices:
path = '/var/lib/kimchi/logical_mount/' + poolArgs['name']
if not os.path.exists(path):
os.makedirs(path)
devices = []
- for device_path in poolArgs['devices']:
+ for device_path in poolArgs['srcDevices']:
devices.append('<device path="%s" />' % device_path)
- poolArgs.update({'devices': ''.join(devices),
+ poolArgs.update({'srcDevices': ''.join(devices),
'path': path})
+
xml = """
<pool type='%(type)s'>
<name>%(name)s</name>
<source>
- %(devices)s
+ %(srcDevices)s
</source>
<target>
<path>%(path)s</path>
--
1.7.11.7