From 8328eaee9110d1b0db73ba91a2a57a852c7da318 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Tue, 30 Apr 2019 12:32:55 +0200 Subject: [PATCH] ovirt_disk: Fix vm creation (#55910) --- lib/ansible/modules/cloud/ovirt/ovirt_disk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_disk.py b/lib/ansible/modules/cloud/ovirt/ovirt_disk.py index 34e968d217..5a403d9658 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_disk.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_disk.py @@ -701,10 +701,10 @@ def main(): disk = _search_by_lun(disks_service, lun.get('id')) else: disk = disks_module.search_entity(search_params=searchable_attributes(module)) - if vm_service: + if vm_service and disk: # If the VM don't exist in VMs disks, but still it's found it means it was found # for template with same name as VM, so we should force create the VM disk. - force_create = disk.id not in [a.disk.id for a in vm_service.disk_attachments_service().list()] + force_create = disk.id not in [a.disk.id for a in vm_service.disk_attachments_service().list() if a.disk] ret = None # First take care of creating the VM, if needed: