Open wavemomo opened 1 year ago
@wavemomo There're some missing steps between the Dockerfile and the data volume? How did you create the image for CDI to import?
@fengye87 Thanks for your reply firstly. Here are my steps to create/import image.
create image:
truncate -s 10G input_raw
mkfs.ext4 input_raw
mkdir rootfs
mount input_raw rootfs/
docker create --name ubuntu-rootfs ubuntu-rootfs
docker export ubuntu-rootfs | tar -xvf - -C ./rootfs/
umount ./rootfs
qemu-img convert -f raw input_raw -O qcow2 output_rootfs.qcow2
import into datavolume:
curl -v --insecure -H "Authorization: Bearer $TOKEN" --data-binary @/root/virtink/rootfs.qcow2 https://$(kube ip):31001/v1alpha1/upload
@wavemomo I followed your steps but could not reproduce the same problem. Both my VM and the VM pod stayed in the Running state, but I did see the VM didn't start up normally since there's no login prompt. I think there's something missing in the Dockerfile. I'll look into it further. Could you confirm that you create and start the VM after the data volume has been completed imported? And what version of Virtink are you using?
@fengye87 Yes, the VM and the VM pod would stay in the Running state but it would block(but actully, I start the VM first time, the VM pod would quit after login prompt) . And the version of Virtink in my cluster is v0.10.1.
By the way, can you share your steps of building image and rootfs if it's different from mine?
@wavemomo I used your Dockerfile and your steps to build the image, the only difference is that I was using the http download method of CDI instead of uploading.
@fengye87 But my Dockerfile is not different from the official example given?
@wavemomo There's a difference. See the highlighted line below. That could be the cause.
@fengye87 I try to use the Dockerfile of official example, the error is :
@wavemomo You should use the /rootfs dir as the image's root when use the official rootfs image.
@fengye87 How to use the /rootfs dir as the image's root? Can you give a sample?Thanks very much
@wavemomo You can spin up the container, run your steps inside the container (skip the docker part, just copy /rootfs to the image's mount point), and copy the qcow2 image to host. You may need to run apk add qemu-img
first to install qemu-img inside the container.
I used CDI to do it. But there are some problems.
the Dockerfile is:
the vm.yaml:
when I apply the vm.yaml,the pod is runinng, but it would quit or block later. I try to solve the problem.
use
kubectl logs -f vm-test-vm-xxx
: it looks like successfuly, but the pod will quit later.kubectl describe vm test-vm
: