diff --git a/rpm/qm.spec b/rpm/qm.spec index ba62db40..519542fb 100644 --- a/rpm/qm.spec +++ b/rpm/qm.spec @@ -221,9 +221,10 @@ install -d %{buildroot}%{_sysconfdir}/containers/containers.conf.d # START - qm dropin sub-package - mount kvm # ######################################################## %if %{enable_qm_mount_bind_kvm} +<<<<<<< HEAD mkdir -p %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d # Add config for qm only - add drop-in file in /etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf - # to nested containers in QM env mount bind it in /dev/kvm + # to QM env mount bind it in /dev/kvm install -m 644 %{_builddir}/qm-%{version}/etc/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf %{buildroot}%{_sysconfdir}/containers/systemd/qm.container.d/qm_dropin_mount_bind_kvm.conf %endif ######################################################## diff --git a/subsystems/kvm/ContainerFile b/subsystems/kvm/ContainerFile new file mode 100644 index 00000000..83ec0b04 --- /dev/null +++ b/subsystems/kvm/ContainerFile @@ -0,0 +1,32 @@ +# ContainerFile used to create the image available at quay.io/qm-images/kvm:latest +# +# How to build +# ================== +# podman login quay.io +# podman build -t quay.io/qm-images/kvm:latest -f ContainerFile +# podman push quay.io/qm-images/kvm:latest +FROM fedora:latest + +ENV PASSWORD_FEDORA_USER=fedora + +RUN dnf -y install virt-install \ + libvirt-daemon \ + libvirt-daemon-qemu \ + libvirt-daemon-kvm \ + libvirt-daemon-config-network \ + guestfs-tools \ + wget \ + vim -y \ + && dnf clean all && rm -rf /var/cache/dnf + +RUN wget -O /var/lib/libvirt/images/Fedora-Cloud-Base-Generic.qcow2 https://cofractal-ewr.mm.fcix.net/fedora/linux/releases/41/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2 + +# Set fedora user pass as fedora +RUN export LIBGUESTFS_BACKEND=direct && \ + virt-customize -a /var/lib/libvirt/images/Fedora-Cloud-Base-Generic.qcow2 --password fedora:password:$PASSWORD_FEDORA_USER + +# Permission to qemu user/group +RUN chown qemu:qemu /var/lib/libvirt/images/Fedora-Cloud-Base-Generic.qcow2 + +# Set systemd as the init system for the container +ENTRYPOINT ["/usr/sbin/init"] diff --git a/subsystems/kvm/kvm.container b/subsystems/kvm/kvm.container new file mode 100644 index 00000000..97c06e85 --- /dev/null +++ b/subsystems/kvm/kvm.container @@ -0,0 +1,9 @@ +[Unit] +Description=kvm Container +After=network.target + +[Container] +Image=quay.io/qm-images/kvm:latest + +[Install] +WantedBy=multi-user.target