<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Did you have a look at:<div class=""><br class=""></div><div class=""><br class=""></div><div class=""><a href="http://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4.services.DisksService" class="">http://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4.services.DisksService</a></div><div class=""><a href="http://ovirt.github.io/ovirt-engine-sdk/master/types.m.html#ovirtsdk4.types.LogicalUnit" class="">http://ovirt.github.io/ovirt-engine-sdk/master/types.m.html#ovirtsdk4.types.LogicalUnit</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">In my case a attached LUN is exported as:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;disk href="/ovirt-engine/api/disks/638676d4-01f3-422c-b14b-0e8f4ba0529d" id="638676d4-01f3-422c-b14b-0e8f4ba0529d"&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;alias&gt;xxx&lt;/alias&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;description&gt;&lt;/description&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;lun_storage id="3600c0ff00026285a4613e55701000000"&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &lt;logical_units&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &lt;logical_unit id="3600c0ff00026285a4613e55701000000"&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;disk_id&gt;638676d4-01f3-422c-b14b-0e8f4ba0529d&lt;/disk_id&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;lun_mapping&gt;39&lt;/lun_mapping&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;paths&gt;0&lt;/paths&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;product_id&gt;MSA 2040 SAS&lt;/product_id&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;serial&gt;SHP_MSA_2040_SAS_00c0ff26285a00004613e55701000000&lt;/serial&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;size&gt;536870912000&lt;/size&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;vendor_id&gt;HP&lt;/vendor_id&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &lt;/logical_unit&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &lt;/logical_units&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;/lun_storage&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;name&gt;3dpse_crawl_tp&lt;/name&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;propagate_errors&gt;false&lt;/propagate_errors&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;shareable&gt;false&lt;/shareable&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;storage_type&gt;lun&lt;/storage_type&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &lt;wipe_after_delete&gt;false&lt;/wipe_after_delete&gt;</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&lt;/disk&gt;</div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">The lun_storage id is taken directly from the lun is as seen by the kernel:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ls -l /dev/disk/*/*3600c0ff00026285a4613e55701000000*</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lrwxrwxrwx 1 root root 10 May&nbsp; 9 15:15 /dev/disk/by-id/dm-name-3600c0ff00026285a4613e55701000000 -&gt; ../../dm-4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lrwxrwxrwx 1 root root 10 May&nbsp; 9 15:15 /dev/disk/by-id/dm-uuid-mpath-3600c0ff00026285a4613e55701000000 -&gt; ../../dm-4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">lrwxrwxrwx 1 root root 10 May 17 16:01 /dev/disk/by-id/scsi-3600c0ff00026285a4613e55701000000 -&gt; ../../sdec</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">In the old sdk3, I was doing it that way:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><a href="https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py#L35" class="">https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py#L35</a></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">What was called params is now a type.</span></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 17 mai 2017 à 13:21, Guy Chen &lt;<a href="mailto:guchen@redhat.com" class="">guchen@redhat.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;" class=""><div class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div class=""><span style="font-size: 12pt;" class="">I am trying to add direct LUN disk to a VM with python ovirtsdk4 ( storage domain is iscsi ) .</span></div><div class="">Adding a COW disk is working as in the SDK example, attached below, i have tried different things that i saw online but did not work, anybody have an example of how to add a&nbsp;direct LUN disk ?</div><div class=""><br class=""></div><div class=""><span data-mce-style="color: #000080; font-weight: bold;" style="font-family: &quot;DejaVu Sans Mono&quot;; font-size: 9.2pt; color: rgb(0, 0, 128); font-weight: bold;" class="">def </span><span style="background-color: rgb(255, 255, 255); font-family: &quot;DejaVu Sans Mono&quot;; font-size: 9.2pt;" class="">add_VM_disk(</span><span data-mce-style="color: #94558d;" style="font-family: &quot;DejaVu Sans Mono&quot;; font-size: 9.2pt; color: rgb(148, 85, 141);" class="">self</span><span style="background-color: rgb(255, 255, 255); font-family: &quot;DejaVu Sans Mono&quot;; font-size: 9.2pt;" class="">):</span></div><div class=""><pre style="background-color: #ffffff; font-family: 'DejaVu Sans Mono'; font-size: 9.2pt;" data-mce-style="background-color: #ffffff; font-family: 'DejaVu Sans Mono'; font-size: 9.2pt;" class=""><br class="">    vms_service = <span style="color: #94558d;" data-mce-style="color: #94558d;" class="">self</span>.connection.system_service().vms_service()<br class="">    vm = vms_service.list(<span style="color: #660099;" data-mce-style="color: #660099;" class="">search</span>=<span style="color: #008000; font-weight: bold;" data-mce-style="color: #008000; font-weight: bold;" class="">'name=myvm'</span>)[<span style="color: #0000ff;" data-mce-style="color: #0000ff;" class="">0</span>]<br class=""><div class=""><br class=""></div>    <span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class=""># Locate the service that manages the disk attachments of the virtual<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    # machine:<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    </span>disk_attachments_service = vms_service.vm_service(vm.id).disk_attachments_service()<br class=""><div class=""><br class=""></div>    <span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class=""># Use the "add" method of the disk attachments service to add the disk.<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    # Note that the size of the disk, the `provisioned_size` attribute, is<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    # specified in bytes, so to create a disk of 10 GiB the value should<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    # be 10 * 2^30.<br class=""></span><span style="color: #808080; font-style: italic;" data-mce-style="color: #808080; font-style: italic;" class="">    </span><span style="color: #808080;" data-mce-style="color: #808080;" class="">disk_attachment </span>= disk_attachments_service.add(<br class="">        types.DiskAttachment(<br class="">            <span style="color: #660099;" data-mce-style="color: #660099;" class="">disk</span>=types.Disk(<br class="">                <span style="color: #660099;" data-mce-style="color: #660099;" class="">name</span>=<span style="color: #008000; font-weight: bold;" data-mce-style="color: #008000; font-weight: bold;" class="">'mydisk'</span>,<br class="">                <span style="color: #660099;" data-mce-style="color: #660099;" class="">description</span>=<span style="color: #008000; font-weight: bold;" data-mce-style="color: #008000; font-weight: bold;" class="">'My disk'</span>,<br class="">                <span style="color: #660099;" data-mce-style="color: #660099;" class="">format</span>=types.DiskFormat.COW,<br class="">                <span style="color: #660099;" data-mce-style="color: #660099;" class="">provisioned_size</span>=<span style="color: #0000ff;" data-mce-style="color: #0000ff;" class="">10 </span>* <span style="color: #0000ff;" data-mce-style="color: #0000ff;" class="">2 </span>** <span style="color: #0000ff;" data-mce-style="color: #0000ff;" class="">30</span>,<br class="">            ),<br class="">            <span style="color: #660099;" data-mce-style="color: #660099;" class="">interface</span>=types.DiskInterface.VIRTIO,<br class="">            <span style="color: #660099;" data-mce-style="color: #660099;" class="">bootable</span>=<span style="color: #000080; font-weight: bold;" data-mce-style="color: #000080; font-weight: bold;" class="">False</span>,<br class="">            <span style="color: #660099;" data-mce-style="color: #660099;" class="">active</span>=<span style="color: #000080; font-weight: bold;" data-mce-style="color: #000080; font-weight: bold;" class="">True</span>,<br class="">        ),<br class="">    )</pre></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div>_______________________________________________<br class="">Users mailing list<br class=""><a href="mailto:Users@ovirt.org" class="">Users@ovirt.org</a><br class="">http://lists.ovirt.org/mailman/listinfo/users<br class=""></div></blockquote></div><br class=""></div></body></html>