[Users] Adding disk via rest api

Jakub Libosvar libosvar at redhat.com
Mon Jun 25 15:47:15 UTC 2012


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>

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



More information about the Users mailing list