[ovirt-users] creation of lun disks
Juan Hernández
jhernand at redhat.com
Fri May 13 18:04:10 UTC 2016
On 05/13/2016 04:21 PM, Fabrice Bacchella wrote:
> I'm trying to generated a lun disk, using the python SDK.
>
> My code can be found
> at https://github.com/fbacchella/ovirtcmd/blob/master/ovlib/disks/__init__.py
>
> If a try to see the content of a existing disk and test with :
> print disk.get_type()
> print disk.get_storage_type()
>
> I'm getting :
> None
> lun
>
> Now I try to create another LUN disk with
> kwargs['storage_type'] = 'lun'
> kwargs['type_'] = 'system'
>
> I'm getting:
>
>> POST /api/disks HTTP/1.1
>> <disk>
>> <type>system</type>
>> <interface>virtio-scsi</interface>
>> <lun_storage>
>> <logical_unit id="3600c0ff00026285aed8f355701000000"/>
>> </lun_storage>
>> <storage_type>lun</storage_type>
>> </disk>
> ...
> < <fault>
> < <reason>Incomplete parameters</reason>
> < <detail>Storage [type] required for invoke0</detail>
> < </fault>
>
> changing to
> kwargs['type_'] = None
> change nothing, I'm still getting the same error message.
>
>> POST /api/disks HTTP/1.1
>> <disk>
>> <interface>virtio-scsi</interface>
>> <lun_storage>
>> <logical_unit id="3600c0ff00026285aed8f355701000000"/>
>> </lun_storage>
>> <storage_type>lun</storage_type>
>> </disk>
> ...
> < <fault>
> < <reason>Incomplete parameters</reason>
> < <detail>Storage [type] required for invoke0</detail>
> < </fault>
>
>
> What did I do wrong ? There is nothing about that in the logs
>
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:
<disk>
<interface>virtio</interface>
<lun_storage>
<type>fcp</type>
<logical_unit id="3600c0ff00026285aed8f355701000000"/>
</lun_storage>
</disk>
To do that with the Python SDK you need the following code:
params.Disk(
interface='virtio',
lun_storage=params.Storage(
type_='fcp',
logical_unit=[
params.LogicalUnit(
id='0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-2',
),
],
),
)
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
More information about the Users
mailing list