There is also this usage guide:
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk#usage
which may help you better understand difference between the service and
the type.
On 26/04/2019 11:30, Joey Ma wrote:
> Beside the doc you've referred to, the example codes for sdk [1] are
> always the recommendation. Well, you could also check the codes of oVirt
> module [2] for Ansible if the examples are incomplete.
>
>
> [1]:
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples
> [2]:
>
https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/cloud/o...
>
> On Fri, Apr 26, 2019 at 5:10 PM Kaustav Majumder <kmajumde(a)redhat.com
> <mailto:kmajumde@redhat.com>> wrote:
>
> Thank you so much . It worked. i often get confused with the sdk. Is
> there a doc explaining this?
>
> On Fri, Apr 26, 2019 at 2:37 PM Joey Ma <majunjiev(a)gmail.com
> <mailto:majunjiev@gmail.com>> wrote:
>
> Hi Kaustav,
>
> IHMO, the `attachment` variable is an instance of
> DiskAttachment, instead of the type of DiskAttachmentService as
> expected. You should probably replace
>
> ```python
> # Line 18-20
> if attachment:
> attachment.remove(detach_only=False)
> print("Disk removed")
> ```
>
> with
>
> ```python
> if attachment:
> attachment_service =
> disk_attachments_service.attachment_service(attachment.id
> <
http://attachment.id>)
> attachment_service.remove(detach_only=False)
> print("Disk removed")
> ```
>
>
> On Fri, Apr 26, 2019 at 4:36 PM Kaustav Majumder
> <kmajumde(a)redhat.com <mailto:kmajumde@redhat.com>> wrote:
>
> Hi,
> I am trying to detach and delete disk from my vm. I found
> this service in the docs
> DiskAttachmentService
>
http://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4....
> I am not able to fetch this service. Below if the snippet of
> code I am trying.
>
https://pastebin.com/UUu0Pfc8
>
> Error--> File "./pre_setup/delete_vm_disk.py", line 19,
in
> remove_attached_vm_disk
> attachment.remove(detach_only=False)
> AttributeError: 'DiskAttachment' object has no attribute
> 'remove'
>
>
>
>
>
> --
>
> Thanks,
>
> Kaustav Majumder
>
> _______________________________________________
> Users mailing list -- users(a)ovirt.org <mailto:users@ovirt.org>
> To unsubscribe send an email to users-leave(a)ovirt.org
> <mailto:users-leave@ovirt.org>
> 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/users@ovirt.org/message/O4ZC47JHLBD...
>
>
>
> --
>
> Thanks,
>
> Kaustav Majumder
>
>
> _______________________________________________
> Users mailing list -- users(a)ovirt.org
> To unsubscribe send an email to users-leave(a)ovirt.org
> 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/users@ovirt.org/message/2VAGHC6IUUT...
>