Creating a VM from an existing data volume

25 views
Skip to first unread message

Manuri Perera

unread,
Feb 10, 2020, 5:34:20 AM2/10/20
to kubevirt-dev
Hi,

I'm a bit confused about how to create a VM from an existing data volume. I have cloned an existing data volume using [1]. Now, how should I create a VM referring to this cloned data volume? I've read the data volume section of this[2] documentation
but it is not clear to me how I should be doing this. Any help would be really appreciated.



Thanks,
Manuri

Petr Kotas

unread,
Feb 10, 2020, 7:19:27 AM2/10/20
to Manuri Perera, kubevirt-dev
Hi Manuri,

If you successfully imported the image using datavolume, you should have that datavolume in your namespace.

To clarify the documentation, it is a two-step example compressed in one:
1) the datavolumetemplates tell the controller how to create the datavolume, but you already have that one created
2) describes how the VMI should look. The important part is
spec:
      domain:
        devices:
          disks:
          - disk:
              bus: virtio
            name: datavolumedisk1
        resources:
          requests:
            memory: 64M
      volumes:
      - dataVolume:
          name: alpine-dv
        name: datavolumedisk1

where alpine-dv is the name of datavolume created by the template. In your case it would be the one you created by import.
The datavolumedisk1 is the name of the disk you create in volumes section, you pair to the VM in devices.disks.disk.name
Once it is assigned the VMI will be created and it will have assigned the datavolume you want.

Hope this helps,
Kind regards,
Petr

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevirt-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubevirt-dev/f8d268c7-48a2-4699-983b-9d4feed93fd1%40googlegroups.com.

Manuri Perera

unread,
Feb 10, 2020, 8:14:56 AM2/10/20
to kubevirt-dev
Thanks Petr!
To unsubscribe from this group and stop receiving emails from it, send an email to kubevi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages