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