Skip to content

Commit

Permalink
[WIP]: use quay.io qm - kvm
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
dougsland committed Dec 12, 2024
1 parent 1482985 commit 3ae7b49
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpm/qm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
########################################################
Expand Down
32 changes: 32 additions & 0 deletions subsystems/kvm/ContainerFile
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 9 additions & 0 deletions subsystems/kvm/kvm.container
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=kvm Container
After=network.target

[Container]
Image=quay.io/qm-images/kvm:latest

[Install]
WantedBy=multi-user.target

0 comments on commit 3ae7b49

Please sign in to comment.