<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 &lt;<a href="mailto:jhernand@redhat.com" class="">jhernand@redhat.com</a>&gt; 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="">&lt;disk&gt;<br class="">&nbsp; &nbsp;&lt;type&gt;system&lt;/type&gt;<br class="">&nbsp; &nbsp;&lt;interface&gt;virtio-scsi&lt;/interface&gt;<br class="">&nbsp; &nbsp;&lt;lun_storage&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&lt;logical_unit id="3600c0ff00026285aed8f355701000000"/&gt;<br class="">&nbsp; &nbsp;&lt;/lun_storage&gt;<br class="">&nbsp; &nbsp;&lt;storage_type&gt;lun&lt;/storage_type&gt;<br class="">&lt;/disk&gt;<br class=""></blockquote>...<br class="">&lt; &lt;fault&gt;<br class="">&lt; &nbsp; &nbsp; &lt;reason&gt;Incomplete parameters&lt;/reason&gt;<br class="">&lt; &nbsp; &nbsp; &lt;detail&gt;Storage [type] required for invoke0&lt;/detail&gt;<br class="">&lt; &lt;/fault&gt;<br class=""><br class="">changing to&nbsp;<br class="">&nbsp; &nbsp;kwargs['type_'] = None&nbsp;<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="">&lt;disk&gt;<br class="">&nbsp; &nbsp;&lt;interface&gt;virtio-scsi&lt;/interface&gt;<br class="">&nbsp; &nbsp;&lt;lun_storage&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&lt;logical_unit id="3600c0ff00026285aed8f355701000000"/&gt;<br class="">&nbsp; &nbsp;&lt;/lun_storage&gt;<br class="">&nbsp; &nbsp;&lt;storage_type&gt;lun&lt;/storage_type&gt;<br class="">&lt;/disk&gt;<br class=""></blockquote>...<br class="">&lt; &lt;fault&gt;<br class="">&lt; &nbsp; &nbsp; &lt;reason&gt;Incomplete parameters&lt;/reason&gt;<br class="">&lt; &nbsp; &nbsp; &lt;detail&gt;Storage [type] required for invoke0&lt;/detail&gt;<br class="">&lt; &lt;/fault&gt;<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="">&nbsp;&lt;disk&gt;<br class="">&nbsp; &nbsp;&lt;interface&gt;virtio&lt;/interface&gt;<br class="">&nbsp; &nbsp;&lt;lun_storage&gt;<br class="">&nbsp; &nbsp; &nbsp;&lt;type&gt;fcp&lt;/type&gt;<br class="">&nbsp; &nbsp; &nbsp;&lt;logical_unit id="3600c0ff00026285aed8f355701000000"/&gt;<br class="">&nbsp; &nbsp;&lt;/lun_storage&gt;<br class="">&nbsp;&lt;/disk&gt;<br class=""><br class="">To do that with the Python SDK you need the following code:<br class=""><br class="">&nbsp;params.Disk(<br class="">&nbsp; &nbsp;interface='virtio',<br class="">&nbsp; &nbsp;lun_storage=params.Storage(<br class="">&nbsp; &nbsp; &nbsp;type_='fcp',<br class="">&nbsp; &nbsp; &nbsp;logical_unit=[<br class="">&nbsp; &nbsp; &nbsp; &nbsp;params.LogicalUnit(<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id='0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-2',<br class="">&nbsp; &nbsp; &nbsp; &nbsp;),<br class="">&nbsp; &nbsp; &nbsp;],<br class="">&nbsp; &nbsp;),<br class="">&nbsp;)<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="">&lt;parameter&nbsp;required="true"&nbsp;type="xs:string"&gt;<br class="">&nbsp; &nbsp;&nbsp;&lt;name&gt;disk.lun_storage.type&lt;/name&gt;<br class="">&lt;/parameter&gt;<br class="">&lt;parameter&nbsp;required="true"&nbsp;type="collection"&gt;<br class="">&nbsp; &nbsp;&nbsp;&lt;name&gt;disk.lun_storage.logical_unit&lt;/name&gt;<br class="">&nbsp; &nbsp;&nbsp;&lt;parameters_set&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;parameter&nbsp;required="true"&nbsp;type="xs:string"&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;name&gt;logical_unit.id&lt;/name&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;/parameter&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;parameter&nbsp;required="true"&nbsp;type="xs:string"&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;name&gt;logical_unit.address&lt;/name&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;/parameter&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;parameter&nbsp;required="true"&nbsp;type="xs:int"&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;name&gt;logical_unit.port&lt;/name&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;/parameter&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;parameter&nbsp;required="true"&nbsp;type="xs:string"&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;name&gt;logical_unit.target&lt;/name&gt;<br class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;/parameter&gt;<br class="">&nbsp; &nbsp;&nbsp;&lt;/parameters_set&gt;<br class="">&lt;/parameter&gt;</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="">    &lt;lun_storage id="3600c0ff00026285a2091355701000000"&gt;<br class="">        &lt;logical_unit id="3600c0ff00026285a2091355701000000"&gt;<br class="">            &lt;serial&gt;SHP_MSA_2040_SAS_00c0ff26285a00002091355701000000&lt;/serial&gt;<br class="">            &lt;vendor_id&gt;HP&lt;/vendor_id&gt;<br class="">            &lt;product_id&gt;MSA 2040 SAS&lt;/product_id&gt;<br class="">            &lt;lun_mapping&gt;33&lt;/lun_mapping&gt;<br class="">            &lt;size&gt;1099511627776&lt;/size&gt;<br class="">            &lt;paths&gt;0&lt;/paths&gt;<br class="">            &lt;disk_id&gt;dd98b206-08e4-48c0-9795-d10bc7581a95&lt;/disk_id&gt;<br class="">        &lt;/logical_unit&gt;<br class="">    &lt;/lun_storage&gt;<br class=""></pre><div class="">There is no&nbsp;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>