[ovirt-users] creation of lun disks
Fabrice Bacchella
fabrice.bacchella at orange.fr
Fri May 13 22:35:33 UTC 2016
> Le 13 mai 2016 à 20:04, Juan Hernández <jhernand at redhat.com> a écrit :
>
> On 05/13/2016 04:21 PM, Fabrice Bacchella wrote:
>> I'm trying to generated a lun disk, using the python SDK.
>>
>> My code can be found
>> at https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py
>>
>> If a try to see the content of a existing disk and test with :
>> print disk.get_type()
>> print disk.get_storage_type()
>>
>> I'm getting :
>> None
>> lun
>>
>> Now I try to create another LUN disk with
>> kwargs['storage_type'] = 'lun'
>> kwargs['type_'] = 'system'
>>
>> I'm getting:
>>
>>> POST /api/disks HTTP/1.1
>>> <disk>
>>> <type>system</type>
>>> <interface>virtio-scsi</interface>
>>> <lun_storage>
>>> <logical_unit id="3600c0ff00026285aed8f355701000000"/>
>>> </lun_storage>
>>> <storage_type>lun</storage_type>
>>> </disk>
>> ...
>> < <fault>
>> < <reason>Incomplete parameters</reason>
>> < <detail>Storage [type] required for invoke0</detail>
>> < </fault>
>>
>> changing to
>> kwargs['type_'] = None
>> change nothing, I'm still getting the same error message.
>>
>>> POST /api/disks HTTP/1.1
>>> <disk>
>>> <interface>virtio-scsi</interface>
>>> <lun_storage>
>>> <logical_unit id="3600c0ff00026285aed8f355701000000"/>
>>> </lun_storage>
>>> <storage_type>lun</storage_type>
>>> </disk>
>> ...
>> < <fault>
>> < <reason>Incomplete parameters</reason>
>> < <detail>Storage [type] required for invoke0</detail>
>> < </fault>
>>
>>
>> What did I do wrong ? There is nothing about that in the logs
>>
>
> When creating a LUN disk you need to specify the type (fcp or iscsi)
> inside the "lun_storage" element, so you need to send an XML document
> like this:
>
> <disk>
> <interface>virtio</interface>
> <lun_storage>
> <type>fcp</type>
> <logical_unit id="3600c0ff00026285aed8f355701000000"/>
> </lun_storage>
> </disk>
>
> To do that with the Python SDK you need the following code:
>
> params.Disk(
> interface='virtio',
> lun_storage=params.Storage(
> type_='fcp',
> logical_unit=[
> params.LogicalUnit(
> id='0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-2',
> ),
> ],
> ),
> )
>
Ok thanks, but now I'm checking the rsdl (I should have done that earlier) and see :
<parameter required="true" type="xs:string">
<name>disk.lun_storage.type</name>
</parameter>
<parameter required="true" type="collection">
<name>disk.lun_storage.logical_unit</name>
<parameters_set>
<parameter required="true" type="xs:string">
<name>logical_unit.id</name>
</parameter>
<parameter required="true" type="xs:string">
<name>logical_unit.address</name>
</parameter>
<parameter required="true" type="xs:int">
<name>logical_unit.port</name>
</parameter>
<parameter required="true" type="xs:string">
<name>logical_unit.target</name>
</parameter>
</parameters_set>
</parameter>
Given the output for a existing SAN disk, I see :
<lun_storage id="3600c0ff00026285a2091355701000000">
<logical_unit id="3600c0ff00026285a2091355701000000">
<serial>SHP_MSA_2040_SAS_00c0ff26285a00002091355701000000</serial>
<vendor_id>HP</vendor_id>
<product_id>MSA 2040 SAS</product_id>
<lun_mapping>33</lun_mapping>
<size>1099511627776</size>
<paths>0</paths>
<disk_id>dd98b206-08e4-48c0-9795-d10bc7581a95</disk_id>
</logical_unit>
</lun_storage>
There is no address, port or target, that are needed only for iscsi. I tried without and everything was fine. So I think they are not required.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160514/ba84c554/attachment-0001.html>
More information about the Users
mailing list