Skip to content

Commit

Permalink
snapcraft: add qemu.external-snap snap config option
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
  • Loading branch information
mihalicyn committed Jul 11, 2024
1 parent 96d35fd commit 46b6835
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ description: |-
- openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false]
- ovn.builtin: Use snap-specific OVN configuration [default=false]
- ui.enable: Enable the web interface [default=true]
- qemu.external-snap: Enable use of external QEMU from snap ("external-qemu" plug) [default=false]

For system-wide configuration of the CLI, place your configuration in
/var/snap/lxd/common/global-conf/ (config.yml and servercerts)
Expand Down
7 changes: 7 additions & 0 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ echo "==> Preparing /run/bin"
mkdir -p "/run/bin"
export PATH="/run/bin:${PATH}"

if [ "${qemu_external_snap:-"false"}" = "true" ]; then
echo "==> Setting up external QEMU snap integration"
export LD_LIBRARY_PATH="${SNAP_CURRENT}/opt/external-qemu/lib/${ARCH}:${SNAP_CURRENT}/opt/external-qemu/lib/${ARCH}/pulseaudio:${SNAP_CURRENT}/opt/external-qemu/lib/${ARCH}/ceph:${LD_LIBRARY_PATH}"
export PATH="${SNAP_CURRENT}/opt/external-qemu/bin:${PATH}"
export LXD_EXT_QEMU_SNAP=1
fi

if [ "${ceph_external:-"false"}" = "true" ]; then
ln -s "${SNAP}/wrappers/run-host" "/run/bin/ceph"
ln -s "${SNAP}/wrappers/run-host" "/run/bin/radosgw-admin"
Expand Down
2 changes: 2 additions & 0 deletions snapcraft/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ openvswitch_builtin=$(get_bool "$(snapctl get openvswitch.builtin)")
openvswitch_external=$(get_bool "$(snapctl get openvswitch.external)")
ovn_builtin=$(get_bool "$(snapctl get ovn.builtin)")
ui_enable=$(get_bool "$(snapctl get ui.enable)")
qemu_external_snap=$(get_bool "$(snapctl get qemu.external-snap)")

# Special-handling of daemon.preseed
daemon_preseed=$(snapctl get daemon.preseed)
Expand Down Expand Up @@ -89,6 +90,7 @@ openvswitch_builtin=${openvswitch_builtin:-"false"}
openvswitch_external=${openvswitch_external:-"false"}
ovn_builtin=${ovn_builtin:-"false"}
ui_enable=${ui_enable:-"true"}
qemu_external_snap=${qemu_external_snap:-"false"}
EOC

# Set socket ownership in case it changed
Expand Down

0 comments on commit 46b6835

Please sign in to comment.