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
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(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
--
Thanks,
Rami Vaknin, QE @ Red Hat, TLV, IL.