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)
        attachment_service.remove(detach_only=False)
        print("Disk removed")
```


On Fri, Apr 26, 2019 at 4:36 PM Kaustav Majumder <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.services.DiskAttachmentService
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@ovirt.org
To unsubscribe send an email to 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/O4ZC47JHLBDEHF7ZE27P7AZI2DZ44E4Z/