Here is an example of a REST-API call that I used:

 POST /api/vms/22222222-2222-2222-2222-222222222222/diskattachments HTTP/1.1
 Accept: application/xml
 Content-type: application/xml

<disk_attachment>
    <bootable>false</bootable>
    <pass_discard>true</pass_discard>
    <interface>virtio_scsi</interface>
     <active>true</active>
     <disk id="11111111-1111-1111-1111-111111111111">
         <snapshot id="11111111-1111-1111-1111-111111111111"/>
     </disk>
</disk_attachment>

On Tue, Aug 13, 2019 at 10:22 AM midhun raj <[email protected]> wrote:

> I am getting error as .......
>
> (
>     [status] => error
>     [message] => [Interface is required, Attribute:
> diskVmElement.diskInterface]
>     [output] => {
>   "detail" : "[Interface is required, Attribute:
> diskVmElement.diskInterface]",
>   "reason" : "Operation Failed"
> }
>
> I changed the api like this
>
> On Mon, Aug 12, 2019 at 4:55 PM Eyal Shenitzky <[email protected]>
> wrote:
>
>> Hi Midhun,
>>
>> In order to attach a snapshot to a VM you should use the following call:
>>
>>  POST /api/vms/22222222-2222-2222-2222-222222222222/diskattachments
>> HTTP/1.1
>>  Accept: application/xml
>>  Content-type: application/xml
>>
>> <disk_attachment>
>>      <active>true</active>
>>      <disk id="11111111-1111-1111-1111-111111111111">
>>          <snapshot id="11111111-1111-1111-1111-111111111111"/>
>>      </disk>
>> </disk_attachment>
>>
>>
>>
>> On Mon, Aug 12, 2019 at 10:34 AM <[email protected]> wrote:
>>
>>> I have 2 virtual machines in my ovirt open virtualisation manager.The
>>> name of first virtual machine is backupvm and the name of second virtual
>>> machine is secondvm .I have created many snapshot shot of secondvm I want
>>> to convert a particular snapshot ofsecondvm using the ovirt api to secondvm
>>> backup and attach it to backupvm The link of the api is
>>> https://ovirt.org/documentation/admin-guide/chap-Backups_and_Migration.html#backing-up-a-virtual-machine
>>> .I want to run the fourth step which says.
>>>
>>> Attach the snapshot to the backup virtual machine and activate the disk:
>>>
>>>  POST /api/vms/22222222-2222-2222-2222-222222222222/disks/ HTTP/1.1
>>>  Accept: application/xml
>>>  Content-type: application/xml
>>>
>>>  <disk id="11111111-1111-1111-1111-111111111111">
>>>      <snapshot id="11111111-1111-1111-1111-111111111111"/>
>>>      <active>true</active>
>>>  </disk>
>>> .I want to attach this snapshots after converting them to backups of vms
>>> and then attach to vm named  backupvm.The api for this is mentioned as
>>>
>>> The id of secondvm is a88a79ab-1f0c-4f32-bdaa-abc8109b3c0d and the id of
>>> backupvm is a88a79ab-1f0c-4f32-bdaa-abc8109b3c0d.The id of snapshot is
>>> 804cb937-5961-4a55-a453-74932c508dd6 and id of disk is
>>> e6c623e3-31d8-4554-ad5a-2b581914494b
>>>
>>> I have written a curl command for this as
>>>
>>> curl -u 'username:password' -H "Accept: application/xml" -H
>>> "Content-type: application/xml"  -X POST -d '<disk
>>> id="e6c623e3-31d8-4554-ad5a-2b581914494b">
>>>                     <snapshot id="804cb937-5961-4a55-a453-74932c508dd6"/>
>>>                        <active>true</active>
>>>                        </disk>'
>>>  
>>> https:<url>/ovirt-engine/api/vms/a88a79ab-1f0c-4f32-bdaa-abc8109b3c0d/disks/
>>> ;
>>> I expect the vm snapshot to be attached to backupvm.But i am not getting
>>> any response .Hence i am under the assumption that it is not working..
>>>
>>> What modification should i make in the curl command to get it working
>>>
>>> In the figure below secondvm is labelled as bobcarenewvm
>>>
>>> https://i.stack.imgur.com/LC3An.png
>>> https://i.stack.imgur.com/Lgozu.png
>>> https://i.stack.imgur.com/efQrf.png
>>> https://i.stack.imgur.com/3wAyA.png
>>>
>>> Please help me,
>>> Thanks and Regards,
>>> Midhun.
>>> _______________________________________________
>>> Devel mailing list -- [email protected]
>>> To unsubscribe send an email to [email protected]
>>> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
>>> oVirt Code of Conduct:
>>> https://www.ovirt.org/community/about/community-guidelines/
>>> List Archives:
>>> https://lists.ovirt.org/archives/list/[email protected]/message/U2HYTU7AVHOVJT3DPPWZERM32EJGZ5OC/
>>>
>>
>>
>> --
>> Regards,
>> Eyal Shenitzky
>>
>

-- 
Regards,
Eyal Shenitzky
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/3TC5IB73H2WI4ISYUDH7TWGKWJ6DS77T/

Reply via email to