Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-labeller.sh: Consider AppArmor restrictions #8692

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/virt-launcher/node-labeller/node-labeller.sh
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -ex

KVM_MINOR=$(grep -w 'kvm' /proc/misc | cut -f 1 -d' ')
VIRTTYPE=qemu
Expand All @@ -21,6 +21,13 @@ fi

libvirtd -d

# If the below command fails, then probably we run under AppArmor restrictions
# and the active profile denies exec of /usr/libexec/qemu-kvm for libvirtd. In
# such case, move the binary to a more common location and try again.
if ! virsh domcapabilities --machine q35 --arch x86_64 --virttype $VIRTTYPE > /dev/null; then
[ -f /usr/libexec/qemu-kvm ] && mv /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
fi

virsh domcapabilities --machine q35 --arch x86_64 --virttype $VIRTTYPE > /var/lib/kubevirt-node-labeller/virsh_domcapabilities.xml

cp -r /usr/share/libvirt/cpu_map /var/lib/kubevirt-node-labeller
Expand Down