giovtorres / kvm-install-vm

Bash script to build local virtual machines using KVM/libvirt and cloud-init.
MIT License
333 stars 161 forks source link

Could not create domain with virt-install #70

Open tuxpeople opened 3 years ago

tuxpeople commented 3 years ago

This is what I try:

[root@lab1 ~]# kvm-install-vm create -c 2 -m 2048 -d 20 -v foo4
- Copying cloud image (CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2) ... OK
- Resizing the disk to 20G ... OK
- Generating ISO for cloud-init ... OK
- Creating storage pool with the following command
    virsh  \
     pool-create-as  \
     --name=foo4  \
     --type=dir  \
     --target=/data/virt/vms/foo4
OK
- Installing the domain with the following command
    virt-install  \
     --import  \
     --name=foo4  \
     --memory=2048  \
     --vcpus=2  \
     --cpu=host  \
     --disk=foo4.qcow2,format=qcow2,bus=virtio  \
     --disk=foo4-cidata.iso  \
     --network=bridge=bridge99,model=virtio  \
     --os-type=linux  \
     --os-variant=centos8  \
     --noautoconsole  \
     --graphics=spice,port=-1,listen=localhost
ERR: Could not create domain with virt-install.

Even with -v, not that much of information. Let's try it manually by copying the command from above:

[root@lab1 ~]#     virt-install  \
>      --import  \
>      --name=foo4  \
>      --memory=2048  \
>      --vcpus=2  \
>      --cpu=host  \
>      --disk=foo4.qcow2,format=qcow2,bus=virtio  \
>      --disk=foo4-cidata.iso  \
>      --network=bridge=bridge99,model=virtio  \
>      --os-type=linux  \
>      --os-variant=centos8  \
>      --noautoconsole  \
>      --graphics=spice,port=-1,listen=localhost
ERROR    Fehler: --disk foo4.qcow2,format=qcow2,bus=virtio: Size must be specified for non existent volume 'foo4.qcow2'

Is it me, using it wrong or is it a bug?

eayin2 commented 3 years ago

You need to check in libvirtd logs, for systemd e.g.: journalctl -u libvirtd -n 1000 -f. Maybe the bridge bridge99 tied to the physical NIC didn't exist yet, then it fails to setup the network.

H--o-l commented 3 years ago

Same issue here since I update to Fedora 34. For me journalctl -u libvirtd -n 1000 -f give the following:

-- Boot 96183c7b2a98412ab4c228b37c9658e2 --
juin 23 09:20:38 fedora systemd[1]: Starting Virtualization daemon...
juin 23 09:20:38 fedora systemd[1]: Started Virtualization daemon.
juin 23 09:20:38 fedora libvirtd[1256]: libcap-ng used by "/usr/sbin/libvirtd" failed due to not having CAP_SETPCAP in capng_apply
juin 23 09:20:38 fedora libvirtd[1258]: libcap-ng used by "/usr/sbin/libvirtd" failed due to not having CAP_SETPCAP in capng_apply
juin 23 09:22:38 fedora systemd[1]: libvirtd.service: Deactivated successfully.

I find these two upstream bugs report: https://bugzilla.redhat.com/show_bug.cgi?id=1924218 https://bugzilla.redhat.com/show_bug.cgi?id=1952715#c4

Didn't find a workaround for now.