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