ovirt_disk: Fix vm creation (#55910)

pull/55929/head
Ondra Machacek 6 years ago committed by ansibot
parent 0e83384dfd
commit 8328eaee91

@ -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:

Loading…
Cancel
Save