<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=""><disk href="/ovirt-engine/api/disks/638676d4-01f3-422c-b14b-0e8f4ba0529d" id="638676d4-01f3-422c-b14b-0e8f4ba0529d"></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=""> <alias>xxx</alias></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=""> <description></description></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=""> <lun_storage id="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=""> <logical_units></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=""> <logical_unit id="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=""> <disk_id>638676d4-01f3-422c-b14b-0e8f4ba0529d</disk_id></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=""> <lun_mapping>39</lun_mapping></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=""> <paths>0</paths></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=""> <product_id>MSA 2040 SAS</product_id></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=""> <serial>SHP_MSA_2040_SAS_00c0ff26285a00004613e55701000000</serial></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=""> <size>536870912000</size></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=""> <vendor_id>HP</vendor_id></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=""> </logical_unit></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=""> </logical_units></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=""> </lun_storage></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=""> <name>3dpse_crawl_tp</name></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=""> <propagate_errors>false</propagate_errors></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=""> <shareable>false</shareable></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=""> <storage_type>lun</storage_type></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=""> <wipe_after_delete>false</wipe_after_delete></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""></disk></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 9 15:15 /dev/disk/by-id/dm-name-3600c0ff00026285a4613e55701000000 -> ../../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 9 15:15 /dev/disk/by-id/dm-uuid-mpath-3600c0ff00026285a4613e55701000000 -> ../../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 -> ../../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 <<a href="mailto:guchen@redhat.com" class="">guchen@redhat.com</a>> 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 direct LUN disk ?</div><div class=""><br class=""></div><div class=""><span data-mce-style="color: #000080; font-weight: bold;" style="font-family: "DejaVu Sans Mono"; 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: "DejaVu Sans Mono"; font-size: 9.2pt;" class="">add_VM_disk(</span><span data-mce-style="color: #94558d;" style="font-family: "DejaVu Sans Mono"; font-size: 9.2pt; color: rgb(148, 85, 141);" class="">self</span><span style="background-color: rgb(255, 255, 255); font-family: "DejaVu Sans Mono"; 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>