[Kimchi-devel] [project-kimchi] [PATCH v1 2/4] storagepool: rename and consolidate arguments of creating (back end)

Zhou Zheng Sheng zhshzhou at linux.vnet.ibm.com
Thu Dec 19 08:04:25 UTC 2013


于 2013年12月18日 09:47, Shu Ming 写道:
> 于 2013/12/16 16:01, Zhou Zheng Sheng 写道:
>> 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'.
> 
> Let's keep the name style as the others in this file, like "src_host" or
> "srchost".
> 
>> +    * srcPath: Export path on NFS server for NFS pool.
>> +               Pool types: 'nfs'.
> The same as the above.
> 
>> +    * srcDevices: Array of devices to be used in the Storage Pool
>> +                  Pool types: 'logical'.
> 
> The same as the above.
> 
Thanks for the suggestion. I will change the style.
>>
>>   ### 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>
> 


-- 
Thanks and best regards!

Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou at linux.vnet.ibm.com
Telephone: 86-10-82454397

-- 
project-kimchi mailing list <project-kimchi at googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
--- 
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



More information about the Kimchi-devel mailing list