[Users] Adding disk via rest api

Ori Liel oliel at redhat.com
Wed Jun 27 06:14:58 UTC 2012


Hi Kuba,

Sorry for your trouble; we had a bug passing storage-domain on 
disk creation. The solution was merged upstream about a week ago 
(on June 19). 

Contact me if you need anything else.

Have a good day,

Ori. 





----- Original Message -----
From: "Rami Vaknin" <rvaknin at redhat.com>
To: "Michael Pasternak" <mpastern at redhat.com>
Cc: users at ovirt.org
Sent: Wednesday, June 27, 2012 8:57:34 AM
Subject: Re: [Users] Adding disk via rest api

On 06/26/2012 01:58 PM, Rami Vaknin wrote:
> On 06/26/2012 01:01 PM, Jakub Libosvar wrote:
>> On 06/26/2012 11:57 AM, Rami Vaknin wrote:
>>> On 06/25/2012 06:47 PM, Jakub Libosvar wrote:
>>>> Hi guys,
>>>>
>>>> I'm struggling with creating disk via api. I tried to POST this body
>>>> <disk>
>>>> <name>my_cool_disk</name>
>>>> <provisioned_size>1073741824</provisioned_size>
>>>> <storage_domains>
>>>> <storage_domain>
>>>> <name>master_sd</name>
>>>> </storage_domain>
>>>> </storage_domains>
>>>> <size>1073741824</size>
>>>> <interface>virtio</interface>
>>>> <format>cow</format>
>>>> </disk>
>>> Try this format:
>>>
>>> url:/api/vms/{vmid}/disks
>> I want the created disk to be attached to no VM. I suppose this will 
>> create the disk attached to vm {vmid}, won't it?
>
> Yeah, I see that creation of disk that not attached to vm fails for no 
> visible reason and with wrong error message.
> In addition, in python sdk I can't access the /api/disks.
>
> Michael, can you help with that?

Michael, forgot to cc you, could you please take a look?
>>
>> Kuba
>>>
>>> body:
>>>
>>> <disk>
>>> <storage_domains>
>>> <storage_domain href="/api/storagedomains/{storageid}" 
>>> id="{storageid}">
>>> <name>storageDomainName</name>
>>> <link href="/api/storagedomains/{storageid}/permissions" 
>>> rel="permissions"/>
>>> <type>data</type>
>>> <master>true</master>
>>> <storage>
>>> <type>nfs</type>
>>> <address>shtut.myshtutcompany.com</address>
>>> <path>/path/to/shtut</path>
>>> </storage>
>>> <available>915901775872</available>
>>> <used>424128020480</used>
>>> <committed>2147483648</committed>
>>> <storage_format>v1</storage_format>
>>> </storage_domain>
>>> </storage_domains>
>>> <size>2147483648</size>
>>> <interface>ide</interface>
>>> <format>cow</format>
>>> <sparse>true</sparse>
>>> </disk>
>>>
>>>
>>> --------------------------------------------------
>>>
>>> ovirt-engine-sdk:
>>>
>>> api.vms.get('my_vm_name').disks.add( 
>>> params.Disk(storage_domains=params.StorageDomains(storage_domain=[api.storagedomains.get('my_iscsi_storage_name')]),
>>>                                                  size=1000000000,
>>>                                                  type_='system',
>>>                                                  status=None,
>>> interface='virtio',
>>>                                                  format='cow',
>>>                                                  sparse=True,
>>>                                                  bootable=True)  )
>>>>
>>>> but getting error from CanDoAction:
>>>> 2012-06-25 17:37:14,497 WARN 
>>>> [org.ovirt.engine.core.bll.AddDiskCommand] (ajp--0.0.0.0-8009-11) 
>>>> [26a7e908] CanDoAction of action AddDisk failed. 
>>>> Reasons:VAR__ACTION__ADD,VAR__TYPE__VM_DISK,ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST
>>>> 2012-06-25 17:37:14,502 ERROR 
>>>> [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] 
>>>> (ajp--0.0.0.0-8009-11) Operation Failed: [Cannot add Virtual 
>>>> Machine Disk. Storage Domain doesn't exist.]
>>>>
>>>> The storage domain 'master_sd' is operational and I can create a 
>>>> disk from webadmin. According rsdl the provisioned_size is not 
>>>> child of disk element
>>>> <parameter required="true" type="xs:int">
>>>> <name>provisioned_size</name>
>>>> </parameter>
>>>> <parameter required="true" type="xs:string">
>>>> <name>disk.interface</name>
>>>> </parameter>
>>>> <parameter required="true" type="xs:string">
>>>> <name>disk.format</name>
>>>> </parameter>
>>>>
>>>> but in api/disks it is.
>>>>
>>>> Any ideas what am I doing wrong?
>>>>
>>>> Thanks,
>>>> Kuba
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at ovirt.org
>>>> http://lists.ovirt.org/mailman/listinfo/users
>>>
>>>
>>
>>
>
>


-- 

Thanks,

Rami Vaknin, QE @ Red Hat, TLV, IL.

_______________________________________________
Users mailing list
Users at ovirt.org
http://lists.ovirt.org/mailman/listinfo/users



More information about the Users mailing list