1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ovirt_disk: Fix vm creation (#55910)

This commit is contained in:
Ondra Machacek 2019-04-30 12:32:55 +02:00 committed by ansibot
parent 0e83384dfd
commit 8328eaee91

View file

@ -701,10 +701,10 @@ def main():
disk = _search_by_lun(disks_service, lun.get('id')) disk = _search_by_lun(disks_service, lun.get('id'))
else: else:
disk = disks_module.search_entity(search_params=searchable_attributes(module)) 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 # 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. # 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 ret = None
# First take care of creating the VM, if needed: # First take care of creating the VM, if needed: