We have found ourselves in the same situation. We build a VM with packer (qemu-kvm) and upload it to oVirt using virt-v2v.
Then we need to attach the disk using an ansible task in our playbook before converting it to a template.
I have noticed however that the Ubuntu cloud image https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img can be uploaded by virt-v2v and the disk is attaced automatically. So there must be some information inside the img file that makes it work. If I have time someday I will try to look at that.

BR
Peter

Den fre. 24. feb. 2023 kl. 20.41 skrev Alan G <alan+ovirt@griff.me.uk>:
Hi,

Trying to create a VM while attaching an existing disk. I can create the VM then attach the disk with an additional call, but I thought it should be possible to do it in one hit?

My code is
vm = vms_service.add(
    types.Vm(
        name='alma8.7',
        description='AlmaLinux 8.7 CIS Packer image',
        cluster=types.Cluster(
            name='Default',
        ),
        type=types.VmType('server'),
        template=types.Template(
            name='Blank',
        ),
        disk_attachments=[types.DiskAttachment(
            disk=types.Disk(id = "0532e728-a1fb-4ff8-a4f3-0702fc876fce"),
            bootable=True,
            active=True,
            interface=types.DiskInterface.VIRTIO,
        )]
    ),
)

This request returns no error but the disk isn't actually attached to the created VM.

_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/ULFW36VXPHV4VOTPS7GPODPLK4F75M7I/