<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><blockquote type="cite" class="">Le 13 mai 2016 à 20:04, Juan Hernández <<a href="mailto:jhernand@redhat.com" class="">jhernand@redhat.com</a>> a écrit :<br class=""><br class="">On 05/13/2016 04:21 PM, Fabrice Bacchella wrote:<br class=""><blockquote type="cite" class="">I'm trying to generated a lun disk, using the python SDK.<br class=""><br class="">My code can be found<br class="">at <a href="https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py" class="">https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py</a><br class=""><br class="">If a try to see the content of a existing disk and test with :<br class="">print disk.get_type()<br class="">print disk.get_storage_type()<br class=""><br class="">I'm getting :<br class="">None<br class="">lun<br class=""><br class="">Now I try to create another LUN disk with<br class="">kwargs['storage_type'] = 'lun'<br class="">kwargs['type_'] = 'system'<br class=""><br class="">I'm getting:<br class=""><br class=""><blockquote type="cite" class="">POST /api/disks HTTP/1.1<br class=""><disk><br class=""> <type>system</type><br class=""> <interface>virtio-scsi</interface><br class=""> <lun_storage><br class=""> <logical_unit id="3600c0ff00026285aed8f355701000000"/><br class=""> </lun_storage><br class=""> <storage_type>lun</storage_type><br class=""></disk><br class=""></blockquote>...<br class="">< <fault><br class="">< <reason>Incomplete parameters</reason><br class="">< <detail>Storage [type] required for invoke0</detail><br class="">< </fault><br class=""><br class="">changing to <br class=""> kwargs['type_'] = None <br class="">change nothing, I'm still getting the same error message.<br class=""><br class=""><blockquote type="cite" class="">POST /api/disks HTTP/1.1<br class=""><disk><br class=""> <interface>virtio-scsi</interface><br class=""> <lun_storage><br class=""> <logical_unit id="3600c0ff00026285aed8f355701000000"/><br class=""> </lun_storage><br class=""> <storage_type>lun</storage_type><br class=""></disk><br class=""></blockquote>...<br class="">< <fault><br class="">< <reason>Incomplete parameters</reason><br class="">< <detail>Storage [type] required for invoke0</detail><br class="">< </fault><br class=""><br class=""><br class="">What did I do wrong ? There is nothing about that in the logs<br class=""><br class=""></blockquote><br class="">When creating a LUN disk you need to specify the type (fcp or iscsi)<br class="">inside the "lun_storage" element, so you need to send an XML document<br class="">like this:<br class=""><br class=""> <disk><br class=""> <interface>virtio</interface><br class=""> <lun_storage><br class=""> <type>fcp</type><br class=""> <logical_unit id="3600c0ff00026285aed8f355701000000"/><br class=""> </lun_storage><br class=""> </disk><br class=""><br class="">To do that with the Python SDK you need the following code:<br class=""><br class=""> params.Disk(<br class=""> interface='virtio',<br class=""> lun_storage=params.Storage(<br class=""> type_='fcp',<br class=""> logical_unit=[<br class=""> params.LogicalUnit(<br class=""> id='0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-2',<br class=""> ),<br class=""> ],<br class=""> ),<br class=""> )<br class=""><br class=""></blockquote><div class=""><br class=""></div>Ok thanks, but now I'm checking the rsdl (I should have done that earlier) and see :<div class=""><br class=""><div class=""><font face="Menlo" class=""><parameter required="true" type="xs:string"><br class=""> <name>disk.lun_storage.type</name><br class=""></parameter><br class=""><parameter required="true" type="collection"><br class=""> <name>disk.lun_storage.logical_unit</name><br class=""> <parameters_set><br class=""> <parameter required="true" type="xs:string"><br class=""> <name>logical_unit.id</name><br class=""> </parameter><br class=""> <parameter required="true" type="xs:string"><br class=""> <name>logical_unit.address</name><br class=""> </parameter><br class=""> <parameter required="true" type="xs:int"><br class=""> <name>logical_unit.port</name><br class=""> </parameter><br class=""> <parameter required="true" type="xs:string"><br class=""> <name>logical_unit.target</name><br class=""> </parameter><br class=""> </parameters_set><br class=""></parameter></font></div><div class=""><br class=""></div><div class="">Given the output for a existing SAN disk, I see :</div><div class=""><pre style="background-color: rgb(255, 255, 255); font-family: Menlo;" class=""> <lun_storage id="3600c0ff00026285a2091355701000000"><br class=""> <logical_unit id="3600c0ff00026285a2091355701000000"><br class=""> <serial>SHP_MSA_2040_SAS_00c0ff26285a00002091355701000000</serial><br class=""> <vendor_id>HP</vendor_id><br class=""> <product_id>MSA 2040 SAS</product_id><br class=""> <lun_mapping>33</lun_mapping><br class=""> <size>1099511627776</size><br class=""> <paths>0</paths><br class=""> <disk_id>dd98b206-08e4-48c0-9795-d10bc7581a95</disk_id><br class=""> </logical_unit><br class=""> </lun_storage><br class=""></pre><div class="">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.</div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><br class=""></div></div></body></html>