Your IP : 216.73.216.189


Current Path : /proc/thread-self/root/proc/thread-self/root/snap/lxd/current/snap/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/snap/lxd/current/snap/snapcraft.yaml

apps:
    activate:
        command: commands/daemon.activate
        daemon: oneshot
        plugs:
            - lxd-support
            - system-observe
    buginfo:
        command: commands/buginfo
        plugs:
            - lxd-support
            - system-observe
    check-kernel:
        command: commands/lxd-check-kernel
        plugs:
            - lxd-support
            - system-observe
    daemon:
        command: commands/daemon.start
        command-chain:
            - bin/gpu-2404-custom-wrapper
        daemon: simple
        plugs:
            - lxd-support
            - network-bind
            - system-observe
        reload-command: commands/daemon.reload
        restart-condition: on-failure
        slots:
            - lxd
        sockets:
            unix:
                listen-stream: $SNAP_COMMON/lxd/unix.socket
                socket-mode: 432
        stop-command: commands/daemon.stop
        stop-timeout: 600s
    lxc:
        command: commands/lxc
        completer: lxc-completer.sh
        plugs:
            - lxd-support
            - system-observe
    lxd:
        command: commands/lxd
        plugs:
            - lxd-support
            - system-observe
    user-daemon:
        command: commands/lxd-user
        daemon: simple
        plugs:
            - lxd-support
            - network-bind
            - system-observe
        restart-condition: on-failure
        sockets:
            unix:
                listen-stream: $SNAP_COMMON/lxd-user/unix.socket
                socket-mode: 432
        stop-timeout: 600s
assumes:
    - snapd2.64
base: core24
confinement: strict
contact: lxd@lists.canonical.com
description: |-
    LXD is a system container and virtual machine manager.

    It offers a simple CLI and REST API to manage local or remote instances,
    uses an image based workflow and support for a variety of advanced features.

    Images are available for all Ubuntu releases and architectures as well
    as for a wide number of other Linux distributions. Existing
    integrations with many deployment and operation tools, makes it work
    just like a public cloud, except everything is under your control.

    LXD containers are lightweight, secure by default and a great
    alternative to virtual machines when running Linux on Linux.

    LXD virtual machines are modern and secure, using UEFI and secure-boot
    by default and a great choice when a different kernel or operating
    system is needed.

    With clustering, up to 50 LXD servers can be easily joined and managed
    together with the same tools and APIs and without needing any external
    dependencies.


    Supported configuration options for the snap (snap set lxd [<key>=<value>...]):

      - apparmor.unprivileged-restrictions-disable: Whether to disable restrictions on unprivileged user namespaces [default=true]
      - ceph.builtin: Use snap-specific Ceph configuration [default=false]
      - ceph.external: Use the system's ceph tools (ignores ceph.builtin) [default=false]
      - daemon.debug: Increase logging to debug level [default=false]
      - daemon.group: Set group of users that have full control over LXD [default=lxd]
      - daemon.user.group: Set group of users that have restricted LXD access [default=lxd]
      - daemon.preseed: Pass a YAML configuration to `lxd init` on initial start
      - daemon.syslog: Send LXD log events to syslog [default=false]
      - daemon.verbose: Increase logging to verbose level [default=false]
      - db.trace: Enable dqlite trace logging (very verbose) [default=false]
      - lvm.external: Use the system's LVM tools [default=false]
      - lxcfs.loadavg: Start tracking per-container load average [default=false]
      - lxcfs.cfs: Consider CPU shares for CPU usage [default=false]
      - lxcfs.debug: Increase logging to debug level [default=false]
      - openvswitch.builtin: Run a snap-specific OVS daemon [default=false]
      - openvswitch.external: Use the system's OVS tools (ignores openvswitch.builtin) [default=false]
      - ovn.builtin: Use snap-specific OVN configuration [default=false]
      - zfs.external: Use the system's ZFS tools [default=false]

    For system-wide configuration of the CLI, place your configuration in
    /var/snap/lxd/common/global-conf/ (config.yml and servercerts)
grade: stable
hooks:
    configure:
        plugs:
            - lxd-support
            - network
            - system-observe
    connect-plug-ceph-conf:
        plugs:
            - lxd-support
            - system-observe
    connect-plug-ovn-certificates:
        plugs:
            - lxd-support
            - system-observe
    connect-plug-ovn-chassis:
        plugs:
            - lxd-support
            - system-observe
    connect-plug-qemu-external:
        plugs:
            - lxd-support
            - system-observe
    disconnect-plug-ceph-conf:
        plugs:
            - lxd-support
            - system-observe
    disconnect-plug-ovn-certificates:
        plugs:
            - lxd-support
            - system-observe
    disconnect-plug-ovn-chassis:
        plugs:
            - lxd-support
            - system-observe
    disconnect-plug-qemu-external:
        plugs:
            - lxd-support
            - system-observe
    remove:
        plugs:
            - lxd-support
            - system-observe
issues: https://github.com/canonical/lxd/issues
layout:
    /usr/share/drirc.d:
        symlink: $SNAP/gpu-2404/drirc.d
    /usr/share/libdrm:
        bind: $SNAP/gpu-2404/libdrm
license: AGPL-3.0-only
name: lxd
parts:
    amd-ctk:
        build-snaps:
            - go/1.26/stable
        plugin: go
        prime:
            - bin/amd-ctk
        source: https://github.com/ROCm/container-toolkit
        source-commit: 3ab0394f71220e693ae016fa6581fbd04a51ed44
        source-depth: 1
        source-type: git
    btrfs:
        organize:
            sbin/: bin/
        plugin: nil
        prime:
            - bin/btrfs
            - bin/btrfstune
            - bin/mkfs.btrfs
        stage-packages:
            - btrfs-progs
    ceph:
        after:
            - libatomic
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - bin/ceph
            - bin/radosgw-admin
            - bin/rbd
            - lib/*/ceph
            - lib/*/libcephfs*
            - lib/python3
            - lib/*/libboost_context.so*
            - lib/*/libboost_filesystem.so*
            - lib/*/libboost_iostreams.so*
            - lib/*/libboost_program_options.so*
            - lib/*/libboost_thread.so*
            - lib/*/libboost_url.so*
            - lib/*/libbrotlicommon.so*
            - lib/*/libbrotlidec.so*
            - lib/*/libcurl-gnutls.so*
            - lib/*/libdaxctl.so*
            - lib/*/libibverbs.so*
            - lib/*/libicudata.so*
            - lib/*/libicuuc.so*
            - lib/*/liblber-2.5.so*
            - lib/*/liblber.so*
            - lib/*/libldap-2.5.so*
            - lib/*/libldap.so*
            - lib/*/liblmdb.so*
            - lib/*/liblua5.4.so*
            - lib/*/libncurses.so*
            - lib/*/libndctl.so*
            - lib/*/libnghttp2.so*
            - lib/*/liboath.so*
            - lib/*/libpmemobj.so*
            - lib/*/libpmem.so*
            - lib/*/libpsl.so*
            - lib/*/librabbitmq.so*
            - lib/*/librados.so*
            - lib/*/librbd.so*
            - lib/*/librdmacm.so*
            - lib/*/librtmp.so*
            - lib/*/libsasl2.so*
            - lib/*/libsnappy.so*
            - lib/*/libssh.so*
            - lib/*/libtcmalloc.so*
            - lib/*/libunwind.so*
        stage-packages:
            - to armhf: []
            - else:
                - ceph-common
                - libsnappy1v5
    dqlite:
        autotools-configure-parameters:
            - --prefix=
            - --enable-build-raft
        build-packages:
            - liblz4-dev
            - libsqlite3-dev
            - libuv1-dev
            - xfslibs-dev
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
        plugin: autotools
        prime:
            - bin/sqlite3
            - lib/libdqlite*so*
            - lib/*/libsqlite3*so*
            - lib/*/libuv*
        source: https://github.com/canonical/dqlite
        source-commit: f6058ba74838f89b3720c74b7bb4a944bfc36a09
        source-depth: 1
        source-type: git
        stage-packages:
            - liblz4-1
            - libuv1t64
            - sqlite3
    edk2:
        after:
            - qemu
        build-packages:
            - to amd64:
                - acpica-tools
                - bc
                - debhelper
                - dosfstools
                - g++
                - grub-efi-amd64-signed
                - jq
                - lsb-release
                - mtools
                - nasm
                - openssl
                - python3
                - python3-pexpect
                - python3-virt-firmware
                - quilt
                - rsync
                - sbsigntool
                - shim-signed
                - uuid-dev
                - xorriso
            - to arm64:
                - acpica-tools
                - bc
                - debhelper
                - dosfstools
                - g++
                - grub-efi-arm64-signed
                - jq
                - lsb-release
                - mtools
                - nasm
                - openssl
                - python3
                - python3-pexpect
                - python3-virt-firmware
                - quilt
                - rsync
                - sbsigntool
                - shim-signed
                - uuid-dev
                - xorriso
        override-build: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            set -eux

            # Ensure staged libraries are found (needed for qemu to generate secure boot vars)
            export LD_LIBRARY_PATH="${CRAFT_STAGE}/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH):${CRAFT_STAGE}/lib:${LD_LIBRARY_PATH:-}"

            # Apply patches from Ubuntu sources.
            QUILT_PATCHES=debian/patches quilt push -a

            # Secboot firmware (SECURE_BOOT_ENABLE=TRUE) enforces strict W^X memory (NX protection)
            # protection via EFI_MEMORY_ATTRIBUTE_PROTOCOL (new in EDK2 2025.11+).
            # Older bootloaders might be unusable:
            # * https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/2149400 (Synchronous Exception)
            # * https://github.com/canonical/lxd/issues/18187 (Exception Type - 0E(#PF - Page-Fault))
            # Workaround: add $(NO_STRICTNX_COMMON_FLAGS) (i.e. --pcd PcdUninstallMemAttrProtocol=TRUE)
            # to OVMF_4M_SECBOOT_FLAGS and AAVMF_SECBOOT_FLAGS so the protocol is
            # uninstalled before the bootloader runs.
            # Secure Boot signature verification (SECURE_BOOT_ENABLE=TRUE) remains active; only
            # the W^X enforcement is disabled as if
            # lxc config set <inst> raw.qemu="-fw_cfg name=opt/org.tianocore/UninstallMemAttrProtocol,string=y"
            # had been used.
            # The longer term plan is to stop disabling this protection and instead document that older guests
            # require `boot.mode=uefi-nosecureboot`.
            sed -i 's/^\(\(AAVMF\|OVMF_4M\)_SECBOOT_FLAGS = .*\)$/\1 $(NO_STRICTNX_COMMON_FLAGS)/' debian/rules

            # Apply patches
            patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0001-force-DUID-LLT.patch"
            cp "${CRAFT_PROJECT_DIR}/patches/edk2-0002-logo.bmp" MdeModulePkg/Logo/Logo.bmp
            patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0003-boot-delay.patch"

            # Install files destination
            mkdir -p "${CRAFT_PART_INSTALL}/share/qemu/"

            if [ "$(uname -m)" = "x86_64" ]; then
                DSC="OvmfPkg/OvmfPkgX64.dsc"
                BUILD_TARGET="install-ovmf"
                SRC_DIR="debian/tmp/usr/share/OVMF"
                SRC_CODE="OVMF_CODE_4M.secboot.fd"
                SRC_VARS="OVMF_VARS_4M.fd"
                SRC_VARS_MS="OVMF_VARS_4M.ms.fd"
                # Add DEBUG_VERBOSE to print error level for DEBUG build
                # * 0x80000000 (DEBUG_ERROR)
                # * 0x00000040 (DEBUG_INFO)
                # * 0x0000000F (Bits 0-3: DEBUG_INIT, DEBUG_WARN, DEBUG_LOAD, DEBUG_FS)
                # = 0x8000004F
                # Adding 0x00400000 (DEBUG_VERBOSE) gives 0x8040004F
                SED_EXPR="s#PcdDebugPrintErrorLevel|0x8000004F#PcdDebugPrintErrorLevel|0x8040004F#g"
            elif [ "$(uname -m)" = "aarch64" ]; then
                DSC="ArmVirtPkg/ArmVirt.dsc.inc"
                BUILD_TARGET="install-qemu-efi-aarch64"
                SRC_DIR="debian/tmp/usr/share/AAVMF"
                SRC_CODE="AAVMF_CODE.secboot.fd"
                SRC_VARS="AAVMF_VARS.fd"
                SRC_VARS_MS="AAVMF_VARS.ms.fd"
                # See note in `x86_64` section for DEBUG_VERBOSE explanation
                SED_EXPR="s#DEBUG_PRINT_ERROR_LEVEL = 0x8000004F#DEBUG_PRINT_ERROR_LEVEL = 0x8040004F#g"
            fi

            # Function to run build and install
            run_build() {
                local TYPE="${1}"
                local SUFFIX="${2}"

                # Clean up previous build stamps/artifacts to ensure clean rebuild with new TYPE
                rm -f debian/setup-build-stamp
                rm -rf debian/*-install debian/tmp
                rm -rf Build

                if [ "${TYPE}" = "DEBUG" ]; then
                    # Add `DEBUG_VERBOSE` to print error level for DEBUG build
                    sed --in-place=.bak "${SED_EXPR}" "${DSC}"
                fi

                /usr/bin/make -f debian/rules "${BUILD_TARGET}" BUILD_TYPE="${TYPE}"

                if [ "${TYPE}" = "DEBUG" ] && [ -f "${DSC}.bak" ]; then
                    mv "${DSC}.bak" "${DSC}"
                fi

                cp "${SRC_DIR}/${SRC_CODE}" "${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB${SUFFIX}.fd"
                cp "${SRC_DIR}/${SRC_VARS}" "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB${SUFFIX}.fd"

                if [ "${TYPE}" = "RELEASE" ]; then
                     cp "${SRC_DIR}/${SRC_VARS_MS}" "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.ms.fd"
                fi
            }

            # Build Release
            run_build RELEASE ""

            # Build Debug
            run_build DEBUG ".debug"

            # Cleanup debug vars
            rm "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.debug.fd"
        override-prime: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - share/qemu/*
        source: https://git.launchpad.net/ubuntu/+source/edk2
        source-commit: b922ebea8da4ddf4a59a652ac570f018672f4872
        source-depth: 1
        source-type: git
    gpu-2404:
        after:
            - lxd
            - qemu
        override-prime: |
            ${CRAFT_PART_SRC}/bin/gpu-2404-cleanup mesa-2404 nvidia-2404
        plugin: dump
        source: https://github.com/canonical/gpu-snap.git
    libatomic:
        organize:
            usr/lib/: lib/
        override-prime: |-
            [ "$(uname -m)" != "s390x" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" != "s390x" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - lib/*/libatomic.so*
        stage-packages:
            - to s390x:
                - libatomic1
    logrotate:
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
            usr/sbin/: bin/
        plugin: nil
        prime:
            - bin/logrotate
        stage:
            - bin/logrotate
        stage-packages:
            - logrotate
    lvm:
        organize:
            sbin/: bin/
            usr/lib/: lib/
            usr/sbin/: bin/
        override-build: |-
            # Patch lvm.conf to:
            # 1) Disable bits that don't apply in a snap'ed env. Handle commented
            #    out variants that represent builtin values.
            #    * udev_sync
            #    * udev_rules
            #    * use_lvmetad
            #    * monitoring
            # 2) Uncomment all executable directives to override their builtin
            #    values. Replace paths in /usr/bin, /usr/sbin, /bin and /sbin
            #    by /snap/lxd/current/bin to use executables from the snap.
            sed -i \
              -e "s%\(# \)\?udev_sync = 1%udev_sync = 0%" \
              -e "s%\(# \)\?udev_rules = 1%udev_rules = 0%" \
              -e "s%\(# \)\?use_lvmetad = 1%use_lvmetad = 0%" \
              -e "s%\(# \)\?monitoring = 1%monitoring = 0%" \
              -e "/# .*_\?executable =/s/# //" \
              -e "s%\(/usr\)\?/s\?bin/%/snap/lxd/current/bin/%" \
              "${CRAFT_PART_INSTALL}/etc/lvm/lvm.conf"

            craftctl default
        plugin: nil
        prime:
            - bin/cache_*
            - bin/dmeventd
            - bin/era_*
            - bin/lv*
            - bin/pdata_tools
            - bin/pv*
            - bin/thin_*
            - bin/vg*
            - -bin/vgimportclone
            - -bin/lvmconf
            - -bin/lvmdump
            - -bin/lvmetad
            - -bin/lvmpolld
            - etc/lvm/lvm.conf
            - etc/lvm/profile/*
            - lib/*/device-mapper/*
            - lib/*/libaio.so*
            - lib/*/libdevmapper*
            - lib/*/liblvm*
            - lib/*/libreadline.so*
        stage-packages:
            - dmeventd
            - lvm2
            - thin-provisioning-tools
    lxc:
        build-packages:
            - libapparmor-dev
            - libcap-dev
            - libseccomp-dev
            - pkg-config
            - meson
            - ninja-build
        meson-parameters:
            - --buildtype=release
            - -Dapparmor=true
            - -Dcapabilities=true
            - -Dcommands=false
            - -Ddbus=false
            - -Dexamples=false
            - -Dinstall-init-files=false
            - -Dinstall-state-dirs=false
            - -Dlibdir=lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}
            - -Dman=false
            - -Dmemfd-rexec=false
            - -Dopenssl=false
            - -Dprefix=/
            - -Drootfs-mount-path=/var/snap/lxd/common/lxc/
            - -Dseccomp=true
            - -Dselinux=false
            - -Dspecfile=false
            - -Dtests=false
            - -Dtools=false
        organize:
            share/lxc/hooks: lxc/hooks
            snap/lxd/current/lxc: lxc
        override-build: |
            set -ex

            # Git cherry-picks
            cd ../src
            git config user.email "noreply@lists.canonical.com"
            git config user.name "LXD snap builder"

            # lxc-checkconfig.in does not need any preprocessing
            mkdir -p "${CRAFT_PART_INSTALL}/bin/"
            install --mode=0755 src/lxc/cmd/lxc-checkconfig.in "${CRAFT_PART_INSTALL}/bin/lxc-checkconfig"

            cd ../build

            set +ex
            craftctl default
            set -ex

            mkdir -p "${CRAFT_PART_INSTALL}/lxc/config/common.conf.d/"
            ln -s /var/snap/lxd/common/lxc/local.conf "${CRAFT_PART_INSTALL}/lxc/config/common.conf.d/01-local.conf"
        plugin: meson
        prime:
            - bin/lxc-checkconfig
            - lib/*/liblxc.so.1
            - lib/*/liblxc.so.1.*
            - lxc/config/common.conf.d
            - lxc/hooks/nvidia
        source: https://github.com/lxc/lxc
        source-commit: 2597434ae2472114c70ad2bdf4ae5580c9e22717
        source-depth: 1
        source-type: git
    lxcfs:
        build-packages:
            - libfuse3-dev
            - pkg-config
            - python3-jinja2
            - meson
            - ninja-build
        meson-parameters:
            - --prefix=/
            - --datadir=/snap/lxd/current/
            - --localstatedir=/var/snap/lxd/common/var/
            - -Ddocs=false
            - -Dinit-script=
            - -Dtests=false
        organize:
            lib/*/lxcfs/liblxcfs.so: lib/
            snap/lxd/current/lxc/config/common.conf.d/*: lxc/config/common.conf.d/
            snap/lxd/current/lxcfs/: lxcfs/
            usr/lib/: lib/
        override-build: |
            set -ex

            # Git cherry-picks
            cd ../src
            git config user.email "noreply@lists.canonical.com"
            git config user.name "LXD snap builder"

            set +ex
            craftctl default
            set -ex

            patch -p1 "${CRAFT_PART_INSTALL}/snap/lxd/current/lxcfs/lxc.mount.hook" < "${CRAFT_PROJECT_DIR}/patches/lxcfs-0001-hook.patch"
        plugin: meson
        prime:
            - bin/fusermount
            - bin/fusermount3
            - lib/*/libfuse3.so.*
            - lib/*/libSegFault.so
            - bin/lxcfs
            - lib/liblxcfs.so
            - lxc/config/common.conf.d/00-lxcfs.conf
            - lxcfs/
        source: https://github.com/lxc/lxcfs
        source-commit: 7ff173bfdb01bc10ab92c3d083a868d8f7fdd94d
        source-depth: 1
        source-type: git
        stage-packages:
            - fuse3
            - glibc-tools
    lxd:
        after:
            - lxc
            - dqlite
        build-packages:
            - cmake
            - libacl1-dev
            - libudev-dev
            - libxml2-dev
            - libxslt1-dev
            - libblas-dev
            - libopenblas-dev
            - liblapack-dev
            - pkg-config
            - pypy3-dev
            - python3-dev
            - python3-pip
            - python3-venv
        build-snaps:
            - go/1.26/stable
        organize:
            sbin/sgdisk: bin/
            usr/bin/: bin/
            usr/lib/: lib/
            usr/sbin/: bin/
            usr/share/misc/: share/misc/
            var/lib/usbutils/usb.ids: share/misc/
        override-build: |
            set -ex

            # Git cherry-picks
            cd ../src
            git config user.email "noreply@lists.canonical.com"
            git config user.name "LXD snap builder"

            git cherry-pick -x 38dc234e940d2392c95c922f95a65fb85aa9534d # test/suites/clustering: use storage_backend in replicator tests
            git cherry-pick -x 861755dd1f66d471e618fd68da93d12c323f5824 # test/includes/test-groups: run replicator tests against all storage drivers
            git cherry-pick -x 35f18ffe6f4fd829af4acd4566fe1856850cd943 # test/suites/migration: refresh zfs clone via pull mode suceeds when no shared snapshots exist
            git cherry-pick -x 611da07cf67749be9cee4e604799128c9a6bfc17 # lxd/storage/drivers: Delete ZFS clone volume before refresh migration
            git cherry-pick -x 532039ff489c1fa0dadf3e9ff56bd5bd0d1b58e3 # lxd/api_replicators: Use Required validator for cluster config key
            git cherry-pick -x 0b0fa6f2c34be5fa611ffeb07699c738ce3e6dcb # lxd/api_replicators: Restrict config merge to PATCH operations
            git cherry-pick -x 993f7cf87ddb8b922cbc49104339d06ac1f2f126 # doc: Update metadata
            git cherry-pick -x 88acf0535d7cdecb958e5a640a75badc37eab884 # lxd/api_replicators: Simplify operation scheduling conditional
            git cherry-pick -x e940291dabd71f82b5a5c5ac8859c61100ff078c # lxd/cluster: Fix standBys parameter naming in test helper
            git cherry-pick -x 59f48a8df4717e21431cce28875bb810f0ec92ac # lxd/db/cluster: add GetClusterLinkUsedBy
            git cherry-pick -x bb1854de71e2e0ee77a09deec07ce56f02148265 # lxd/api_cluster_link: Prevent deletion and rename of in-use cluster links
            git cherry-pick -x 490900913b3b3dab5fa464e548a5123f8b1b3924 # test/suites/clustering: verify cluster link cannot be deleted while referenced by a replicator
            git cherry-pick -x cb0ffffd151e6a4b4e14dac35952faa99de28155 # lxd: use s.Endpoints.NetworkCert() when loading cluster cert for cluster links
            git cherry-pick -x 1444c3fba8bb76ce8ae3d36cf7e11c20d058a648 # lxd/api: Don't mention node in error messages
            git cherry-pick -x d94d0cba1512372959ffe9ecc6b89692edf07fed # lxd/api: Return HTTP 400 when trying to change cluster.https_address
            git cherry-pick -x d3d59fa22c238e8e4de25619f270bb504da9436f # lxd/api: Only setup reverter if local config changed in doAPI10Update
            git cherry-pick -x 8643250eeffbd9589829e75c9a57b84b00022d62 # lxd/api: Only setup reverter and cluster notification if global config changed
            git cherry-pick -x c88b945f58d3c764ff9866877890360e6bf5677f # lxd/api: Remove unnecessary map.Copy in api10Put
            git cherry-pick -x 38721c87b67607e9debc73e3b97959b1f3fc1490 # lxd/api: Remove unnecessary map.Copy in doAPI10Update
            git cherry-pick -x 15a7c08914af1a5be54220a0abd1ddef7457f6f8 # lxd/api: Remove unnecessary map initialisation in doAPI10Update
            git cherry-pick -x 6bf53893746bb3931a13f524eda661918df6b1fb # lxd/api: Use old config in revert rather than partial local config in PATCH requests
            git cherry-pick -x 31bd70f472f05ea59be136abb13cf0af604705be # lxd/api: Use local var scope for reverters in doAPI10Update
            git cherry-pick -x 98b01a30a979973424a27dd98bc77899a954b3f6 # lxd/api: Fix typo
            git cherry-pick -x 3db81137d2ef5c35bdab9cd07b66c02e0c7754e5 # lxd/cluster/config/config: Fix incorrect mention of node config
            git cherry-pick -x 77444b64a908d446c2ddbedd90c63f2d9defdcb8 # lxd: Don't mention node in errors
            git cherry-pick -x e1bd711fc30b74538c1b6a4cd7a0aed56dd384ff # lxd/db/cluster/update: Remove trailing whitespace
            git cherry-pick -x 41cfad1c05ccaa2f8a15f9d4b107ab803a6217db # test: Test that a covering core.https_address can be unset and the cluster.https_address is reinstated
            git cherry-pick -x 116e7a2c3dfc1fe12eb14eadd35d6a0682da113b # lxd/api: Re-activate the cluster HTTPS address listener if a previously covering core.https_address is unset
            git cherry-pick -x 5ee3f52c29e4263de165bcdb7787adcb4fa51fb6 # lxd/api: Fix potential crash if non string config sent as notification in api10Put
            git cherry-pick -x a3f8ade2edadbd5826a73e5960b23aa7cfecb171 # lxd/endpoints: Improve logging of changes
            git cherry-pick -x f8aa72ebc8efba4e9055b06648ed6fca5542f4c1 # lxd/endpoints/pprof: Fix incorrect address comparison when changing address
            git cherry-pick -x 090fca5b6c11cd8494cd9dc967dbcc9ebb088fe8 # lxd: Add snapshot, backup, and "full name" to storage volume details.
            git cherry-pick -x 5dc8db822a81fc44873140cd596a17967528a7a4 # lxd: Use storage volume details to decide auth check URL.
            git cherry-pick -x 34acb8f44c963375e8019c93dcfc17ae57211562 # lxd: Use storage volume details for DevLXD handlers.
            git cherry-pick -x e34b374d2ca84f94e9a9cb1fe085d84edecc2617 # lxd: Use storage volume details for backup handlers.
            git cherry-pick -x 27566c17b7aa2ac3c1a2432849f1b4871db4632d # lxd: Use storage volume details for snapshot handlers.
            git cherry-pick -x 709859c8734cccd1cd38e91c954edbf7a49a092c # lxd: If not clustered, shortcut remote volume check.
            git cherry-pick -x eea862106f6a4e150372a728d613a8c78063c169 # lxd: Indicate that the location is the current member if clustered.
            git cherry-pick -x 1db46aa76a429bb22e0a366deb9d8a4822569f3d # lxd: Set location on refresh based on source pool.
            git cherry-pick -x f0a0e8fe32875cc7b1834aee52c3e26d1a06a35f # lxd: Set location on copy operation URLs based on source pool.
            git cherry-pick -x e1eb53ed66a4bc9bf417da9460adac1793e49818 # lxd: Set project on copy operation URLs.
            git cherry-pick -x ed8b95537286b87332194ce8faed8d4b720f8568 # lxd: Fix project and entity URL for migration.
            git cherry-pick -x 03bfde0d34ff340aefb7aa510be563b3ba44246f # lxd: Update volume POST migration function.
            git cherry-pick -x 8c01eb8e4287a0a1cd47d3f27c99589e0aac0362 # lxd: Update volume POST rename function.
            git cherry-pick -x 62b7071397e8fdbb492e5eb3d56c02be9fc85463 # lxd: Update volume POST move function.
            git cherry-pick -x 9ac5c7d575ea0cb1d010f64caab3e21373205e69 # lxd: Update calls to refactored volume helpers.
            git cherry-pick -x 39cba2bb769bb4d85434e7b573fe94c2bc7590df # lxd: Set target parameter on volume migration operation URL.
            git cherry-pick -x 20aa40854921acb71d09993ed0066ea3470ffa4a # lxd: Indicate why `details.location` is not used as target in volume deletion helper.
            git cherry-pick -x 5e0923c2bacc6491df377a4ff61652256d61a75d # lxd: Fix operation URLs for backup creation.
            git cherry-pick -x 054338fcb4557fb637189454b17882d68c0f05d7 # lxd: Fix operation URLs for backup rename.
            git cherry-pick -x f1f322e1e9a479ca77a55188870b04246a94e88d # lxd: Fix operation URLs for snapshot rename.
            git cherry-pick -x cb4e37d04acd0296620f7ab809a9821b075e5567 # lxd: Simplify operation URLs for snapshot edit/delete.
            git cherry-pick -x 6287fb3397ee8c6ff9b8528c821b9909f594ae01 # lxd: Add missing error message override when getting volume over devlxd.
            git cherry-pick -x f6d8b412c2e346afe84a244665ac9c35a30b635c # lxd/db/cluster: Allow an error return in identity group filter.
            git cherry-pick -x 6a9868581d246143f240e7c0d869e834f9b3a629 # lxd: Update calls to get identity groups.
            git cherry-pick -x 342030ff8c9f256ade381276e2cf86f24d469619 # lxd: Fix how groups are set on identity patch.
            git cherry-pick -x dccd70fab8f7f0bd6698798b2e90b62893509093 # lxd: Enforce that editor can view all of an identities' groups.
            git cherry-pick -x 3cb4628a9c899da96aaff16d0ccd630bcdf5f4b6 # test/suites: Test group management when not all groups are visible.
            git cherry-pick -x b3ae1fd21bac9605bfa41d7bbe97051e1bed1ac0 # lxd/auth/drivers: Update entitlement comments.
            git cherry-pick -x 4e1369b515bfc5e8e1a64e1be3cfcd1b5c838436 # lxd/auth: Update auth
            git cherry-pick -x 2bd9741fa5e65770d5647cb3d74a1a7674f6fe43 # doc: Update metadata
            git cherry-pick -x b014fe2187d1211646bb13f707eb097664a6cb90 # lxd/sys/os: check if the kernel is supports the modern CephFS mount syntax (5.17+)
            git cherry-pick -x 2cdf9bfb8afcfda7f2e1c8bf08acf64937a8d608 # lxd/storage/drivers/utils_ceph: use legacy CephFS mount syntax on kernel < 5.17
            git cherry-pick -x 8e8bef60a7b6361767f2016ebaf44f5ec93fc551 # lxd/storage/drivers/utils_ceph_test: extend test cases
            git cherry-pick -x 03b6dc0ab69acaca7ffbef51d18ff5dc7940e597 # lxd/device/device_utils_disk: accept a new parameter for modern mount syntax
            git cherry-pick -x c0f5da928edc9448efc92f869bc229329051d415 # lxd/device/disk: pass a new parameter for modern mount syntax
            git cherry-pick -x 540b15680592efedb9d7baa6ab19281e7150b82e # lxd/instance/drivers: Fix backup file error handling for refresh
            git cherry-pick -x e6843d8b8ea36b4d214bf7141430a80acecff011 # lxd/backup: Check for missing .Config in GetInfo
            git cherry-pick -x 8cc93d51af3f49b87aa5166b9ed9b45a29b5d0d7 # lxd/backup: Validate all backup config slices for nil values
            git cherry-pick -x 83685628089e431c7633cc4b03fa8e583d350f01 # lxd/backup: Perform a defensive check against the config itself before trying to convert

            # Setup build environment
            export GOTOOLCHAIN="local"
            export GOPATH="$(realpath ./.go)"
            export CGO_CFLAGS="-I${CRAFT_STAGE}/include/ -I${CRAFT_STAGE}/usr/local/include/"
            export CGO_LDFLAGS="-L${CRAFT_STAGE}/lib/ -L${CRAFT_STAGE}/usr/local/lib/"
            export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"

            # Build the binaries
            go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxc" github.com/canonical/lxd/lxc

            # Build LXD server binary into ${CRAFT_PART_INSTALL}/sbin/lxd so that it does not conflict with the
            # lxd-stophook wrapper script which is stored in ${CRAFT_PART_INSTALL}/bin/lxd.
            # This way when a container stops it will call "/snap/lxd/current/bin/lxd callhook" which is handled by the
            # lxd-stophook script, which in turn will execute "/snap/lxd/current/bin/lxd-user callhook" to notify LXD.
            go build -trimpath -o "${CRAFT_PART_INSTALL}/sbin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd

            # Build static binaries
            CGO_ENABLED=0 go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/canonical/lxd/lxd-agent
            CGO_ENABLED=0 go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/lxd-user" -tags netgo github.com/canonical/lxd/lxd-user

            # Check which Go version was used to compile each of the lxc/lxd binaries
            # XXX: fail if an unexpected version (like a Go toolchain) was used
            GOVER="$(snap list go | awk '{if ($1 == "go") print $2}')"
            UNEXPECTED_GO_VER="$(go version -v "${CRAFT_PART_INSTALL}/bin/lxc"* "${CRAFT_PART_INSTALL}/bin/lxd"* | grep -vF ": go${GOVER}" || true)"
            if [ -n "${UNEXPECTED_GO_VER:-}" ]; then
              echo "Some binaries were compiled with an unexpected Go version (!= ${GOVER}):"
              echo "${UNEXPECTED_GO_VER}"
              exit 1
            fi

            # Some python dependencies are not available for armhf/riscv64 or just require a build from source.
            # Not worth the effort for now.
            if [ "$(uname -m)" != "armv7l" ] && [ "$(uname -m)" != "riscv64" ]; then
              # Build the static website
              make doc

              # Remove unneeded bits
              rm doc/_build/objects.inv    # only objects.inv.txt is used
              # not needed once built
              rm doc/_build/.buildinfo
              rm -rf doc/_build/_sphinx_design_static/

              # Copy the static website
              mkdir -p "${CRAFT_PART_INSTALL}/share/lxd-documentation"
              cp -a doc/_build/. "${CRAFT_PART_INSTALL}/share/lxd-documentation/"
            fi

            # Setup bash completion
            mkdir -p "${CRAFT_PART_INSTALL}/etc/bash_completion.d/"
            # Snapd requires the unaliased command `lxd.lxc` to be supplied as the first command for completion to be detected
            set_cmds='s/^\s*complete.*__start_lxc /&lxd.lxc /'
            # When executed by snapd, the COLUMNS shell value is unset, so use $(tput cols) instead
            set_cols='s/# $COLUMNS.*/COLUMN="$(tput cols)"  \# store the current shell width./'
            # When executed by snapd, the `compopt` support detection doesn't work so fake that it is always `builtin`
            set_compopt='s|$(type -t compopt)|"builtin"|'
            # Modify requestComp variable to use lxc based on context ($SNAP/bin/lxc in Snap environment)
            set_request_comp='s|requestComp="${words\[0\]} __complete ${args\[\*\]}"|requestComp="/snap/lxd/current/commands/lxc __complete ${args[*]}"|'
            # Generate completions script
            "${CRAFT_PART_INSTALL}/bin/lxc" completion bash | sed -e "${set_cmds}" -e "${set_cols}" -e "${set_compopt}" -e "${set_request_comp}" > "${CRAFT_PART_INSTALL}/lxc-completer.sh"
            chmod +x "${CRAFT_PART_INSTALL}/lxc-completer.sh"
        override-pull: |
            craftctl default
            set -ex

            # Setup build environment
            export GOTOOLCHAIN="local"
            export GOPATH="$(realpath ./.go)"

            # Setup the GOPATH
            rm -Rf "${GOPATH}"
            mkdir -p "${GOPATH}/src/github.com/canonical"
            ln -s "$(pwd)" "${GOPATH}/src/github.com/canonical/lxd"

            # Download the dependencies
            go get -v ./...
        plugin: nil
        prime:
            - bin/dnsmasq
            - bin/getfattr
            - bin/setfattr
            - bin/iw
            - bin/pigz
            - bin/rsync
            - bin/setfacl
            - bin/sgdisk
            - bin/xdelta3
            - lib/*/libidn.so.*
            - lxc-completer.sh
            - share/lxd-documentation*
            - share/misc/pci.ids
            - share/misc/usb.ids
            - bin/lxc
            - bin/lxd-agent
            - bin/lxd-user
            - sbin/lxd
        source: https://github.com/canonical/lxd
        source-commit: 84705553d17aeb8e15032611c321127a06c2f2ff
        source-depth: 0
        source-type: git
        stage-packages:
            - acl
            - attr
            - dnsmasq-base
            - gdisk
            - iw
            - lshw
            - pci.ids
            - pigz
            - rsync
            - usb.ids
            - xdelta3
    lxd-ui:
        override-build: |
            [ "$(uname -m)" = "riscv64" ] && exit 0

            craftctl default

            npm install yarn --global
            yarn install
            yarn build

            mkdir -p "${CRAFT_PART_INSTALL}/share"
            cp -R build/ui "${CRAFT_PART_INSTALL}/share/lxd-ui/"
        override-prime: |-
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "riscv64" ] && exit 0

            snap install node --channel=22/stable --classic
            craftctl default
        plugin: nil
        prime:
            - share/lxd-ui*
        source: https://github.com/canonical/lxd-ui
        source-commit: 9cbb82d985479d35c8fbf16816a3275996dd941b
        source-depth: 1
        source-type: git
    nftables:
        organize:
            usr/lib/: lib/
            usr/sbin/: bin/
        plugin: nil
        prime:
            - bin/nft
            - lib/*/libjansson*so*
            - lib/*/libnftables*so*
        stage-packages:
            - nftables
    nvidia-container:
        build-environment:
            - GIT_TAG: 1.19.0
        build-packages:
            - to amd64:
                - bmake
                - curl
                - libelf-dev
                - libseccomp-dev
                - lsb-release
                - libtirpc-dev
            - to arm64:
                - bmake
                - curl
                - libelf-dev
                - libseccomp-dev
                - lsb-release
                - libtirpc-dev
        build-snaps:
            - go/1.26/stable
        organize:
            usr/local/bin/nvidia-container-cli: bin/nvidia-container-cli.real
            usr/local/lib: lib/
        override-build: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            set -ex

            # Setup build environment
            export GOTOOLCHAIN="local"

            # Git cherry-picks
            git config user.email "noreply@lists.canonical.com"
            git config user.name "LXD snap builder"

            patch -p1 < "${CRAFT_PROJECT_DIR}/patches/nvidia-0001-Fix-for-22.04-build.patch"
            patch -p1 < "${CRAFT_PROJECT_DIR}/patches/nvidia-0002-pre-load-libdl.patch"

            mkdir -p "${CRAFT_PART_INSTALL}/bin/"
            cp "${CRAFT_PROJECT_DIR}/snapcraft/wrappers/nvidia-container-cli" "${CRAFT_PART_INSTALL}/bin/"

            set +ex
            craftctl default
        override-prime: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        plugin: make
        prime:
            - bin/nvidia-container-cli*
            - lib/libnvidia-container.so*
            - lib/libnvidia-container-go.so*
        source: https://github.com/NVIDIA/libnvidia-container
        source-commit: 7585946c6471402577e14474d7c56ca5be0348d7
        source-depth: 1
        source-type: git
    nvidia-container-toolkit:
        build-snaps:
            - go/1.26/stable
        organize:
            usr/bin/: bin/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            set -ex

            # Setup build environment
            export GOTOOLCHAIN="local"

            make binaries
            mkdir -p "${CRAFT_PART_INSTALL}/bin/"
            cp nvidia-ctk "${CRAFT_PART_INSTALL}/bin/"
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: make
        prime:
            - bin/nvidia-ctk
        source: https://github.com/NVIDIA/nvidia-container-toolkit
        source-commit: ec7b4e2fa2caecad6d89be4a26029b831fe7503a
        source-depth: 1
        source-type: git
    nvme:
        organize:
            usr/lib/: lib/
            usr/sbin/: bin/
        plugin: nil
        prime:
            - bin/nvme
            - lib/*/libnvme*
        stage-packages:
            - nvme-cli
    openvswitch:
        organize:
            sbin/: bin/
            usr/bin/: bin/
            usr/lib/: lib/
            usr/share/: share/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - bin/ovs-vsctl
            - lib/*/libunbound*so*
            - share/openvswitch/vswitch.ovsschema
        stage-packages:
            - to armhf: []
            - else:
                - openvswitch-common
                - openvswitch-switch
    ovn:
        after:
            - openvswitch
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - bin/ovn-nbctl
            - bin/ovn-sbctl
            - lib/*/libunbound*so*
        stage-packages:
            - to armhf: []
            - else:
                - ovn-common
    qemu:
        after:
            - libatomic
            - spice-server
        autotools-configure-parameters:
            - --disable-auth-pam
            - --disable-bochs
            - --disable-brlapi
            - --disable-cloop
            - --disable-curl
            - --disable-dmg
            - --disable-docs
            - --disable-fuse
            - --disable-glusterfs
            - --disable-gnutls
            - --disable-gtk
            - --disable-guest-agent
            - --disable-libiscsi
            - --disable-libnfs
            - --disable-libpmem
            - --disable-libssh
            - --disable-nettle
            - --disable-oss
            - --disable-parallels
            - --disable-qed
            - --disable-sdl
            - --disable-slirp
            - --disable-tcg
            - --disable-user
            - --disable-vde
            - --disable-vdi
            - --disable-vmnet
            - --disable-vnc
            - --disable-vvfat
            - --disable-xen
            - --disable-xkbcommon
            - --enable-attr
            - --enable-cap-ng
            - --enable-kvm
            - --enable-libusb
            - --enable-usb-redir
            - --enable-linux-aio
            - --enable-linux-io-uring
            - --enable-numa
            - --enable-pie
            - --enable-rbd
            - --enable-seccomp
            - --enable-spice
            - --enable-system
            - --enable-tools
            - --enable-vhost-crypto
            - --enable-vhost-kernel
            - --enable-vhost-net
            - --enable-vhost-user
            - --firmwarepath=/snap/lxd/current/share/qemu/
            - --localstatedir=/var/
            - --disable-install-blobs
        build-packages:
            - to armhf: []
            - else:
                - bison
                - bzip2
                - flex
                - pkg-config
                - libaio-dev
                - libcap-ng-dev
                - libfdt-dev
                - libglib2.0-dev
                - libnuma-dev
                - libpixman-1-dev
                - libseccomp-dev
                - liburing-dev
                - libusb-1.0-0-dev
                - libusbredirparser-dev
                - python3-pip
                - quilt
                - librbd-dev
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
            usr/local/bin/: bin/
            usr/local/lib/: lib/
            usr/local/libexec/: bin/
            usr/local/share/: share/
            usr/share/qemu/kvmvapic.bin: share/qemu/
            usr/share/qemu/s390-ccw.img: share/qemu/
            usr/share/qemu/slof.bin: share/qemu/
            usr/share/seabios/bios-256k.bin: share/qemu/
            usr/share/seabios/vgabios-*: share/qemu/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            set -ex
            # Mangle the configure a bit
            QEMUARCH="$(uname -m)"
            [ "${QEMUARCH}" = "ppc64le" ] && QEMUARCH="ppc64"

            # Apply patches from Ubuntu sources.
            QUILT_PATCHES=debian/patches quilt push -a

            sed -i "s/^unset target_list$/target_list=\"${QEMUARCH}-softmmu\"/" configure
            sed -i 's#libseccomp_minver=".*#libseccomp_minver="0.0"#g' configure

            # Extract efi-virtio.rom from ipxe-qemu.
            # This doesn't work in the organize section below.
            mkdir -p "${CRAFT_PART_INSTALL}"/share/qemu
            mv "${CRAFT_PART_INSTALL}"/usr/lib/ipxe/qemu/efi-virtio.rom "${CRAFT_PART_INSTALL}"/share/qemu/

            set +ex
            craftctl default
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default

            set -eux

            # Download meson Python wheel (normally shipped in upstream tarballs)
            pip download --dest python/wheels meson==1.9.0

            # Ensure the wheels were downloaded
            [ "$(sha256sum python/wheels/meson-1.9.0-py3-none-any.whl | awk '{print $1}')" = "45e51ddc41e37d961582d06e78c48e0f9039011587f3495c4d6b0781dad92357" ] || { echo "Invalid sha256sum for meson"; exit 1; }
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: autotools
        prime:
            - bin/genisoimage*
            - bin/mkisofs*
            - bin/qemu-system-*
            - bin/qemu-img*
            - lib/*/libatomic.so*
            - lib/*/libmagic*so*
            - lib/*/libnuma*so*
            - lib/*/libpixman*so*
            - lib/*/liburing.so*
            - lib/*/libusbredir*so*
            - lib/*/libusb*so*
            - lib/*/libfdt*.so*
            - share/qemu/keymaps/*
            - share/qemu/bios-256k.bin
            - share/qemu/efi-virtio.rom
            - share/qemu/kvmvapic.bin
            - share/qemu/s390-ccw.img
            - share/qemu/slof.bin
            - share/qemu/vgabios-bochs-display.bin
            - share/qemu/vgabios-qxl.bin
            - share/qemu/vgabios-ramfb.bin
            - share/qemu/vgabios-stdvga.bin
            - share/qemu/vgabios-virtio.bin
        source: https://git.launchpad.net/ubuntu/+source/qemu
        source-commit: 96cda2bbb2f530d08f6bda1f0dc186a0e0ce9674
        source-depth: 1
        source-type: git
        stage-packages:
            - to armhf: []
            - else:
                - genisoimage
                - ipxe-qemu
                - libfdt1
                - libmagic1t64
                - libnuma1
                - libpixman-1-0
                - libusb-1.0-0
                - libusbredirparser1t64
                - liburing2
                - seabios
                - qemu-system-data
    shmounts:
        plugin: make
        prime:
            - bin/setup-shmounts
        source: shmounts/
    spice-server:
        build-packages:
            - to armhf: []
            - else:
                - libspice-protocol-dev
                - libjpeg-turbo8-dev
                - python3-pyparsing
                - python3-six
                - meson
                - ninja-build
        meson-parameters:
            - --prefix=/
            - -Dgstreamer=no
            - -Dmanual=false
            - -Dlz4=false
            - -Dsasl=false
            - -Dopus=disabled
            - -Dsmartcard=disabled
            - -Dtests=false
        organize:
            sbin/: bin/
            usr/lib: lib/
            usr/local/lib/: lib/
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0

            # Apply patches from Ubuntu sources.
            cd ../src
            QUILT_PATCHES=debian/patches quilt push -a
            cd ../build

            craftctl default
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: meson
        prime:
            - lib/*/libjpeg*so*
            - lib/*/libspice-server*so*
            - lib/*/libpixman*so*
        source: https://git.launchpad.net/ubuntu/+source/spice
        source-commit: 085ca6b2bf58014ad8be571f3b601465c85ae931
        source-depth: 1
        source-type: git
        stage-packages:
            - to armhf: []
            - else:
                - libjpeg-turbo8
                - libpixman-1-0
    squashfs-tools-ng:
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
        plugin: nil
        prime:
            - bin/sqfs2tar
            - bin/tar2sqfs
            - lib/*/libsquashfs.so*
        stage-packages:
            - squashfs-tools-ng
    strip:
        after:
            - amd-ctk
            - btrfs
            - ceph
            - dqlite
            - logrotate
            - lvm
            - nvidia-container
            - openvswitch
            - ovn
            - spice-server
            - squashfs-tools-ng
            - swtpm
            - virtiofsd
            - xfs
            - xz
            - wrappers
            - xtables
            - zfs-2-2
            - zfs-2-3
            - zfs-2-4
            - zstd
            - lxc
            - lxcfs
            - lxd
            - shmounts
            - nvidia-container-toolkit
        override-prime: |
            set -x

            # XXX: remove unneeded files/directories
            rm -rf "${CRAFT_PRIME}/lib/systemd/"
            rm -rf "${CRAFT_PRIME}/lib/udev/"
            rm -rf "${CRAFT_PRIME}/usr/local/"
            rm -rf "${CRAFT_PRIME}/usr/share/"

            # Strip binaries (excluding shell scripts and LXCFS)
            # The "${CRAFT_PRIME}/bin/lxd" file is ignored as that is the lxd-stophook wrapper script.
            find "${CRAFT_PRIME}"/bin -type f \
              -not -path "${CRAFT_PRIME}/bin/ceph" \
              -not -path "${CRAFT_PRIME}/bin/editor" \
              -not -path "${CRAFT_PRIME}/bin/lxc-checkconfig" \
              -not -path "${CRAFT_PRIME}/bin/lxd" \
              -not -path "${CRAFT_PRIME}/bin/nvidia-container-cli" \
              -not -path "${CRAFT_PRIME}/bin/remote-viewer" \
              -not -path "${CRAFT_PRIME}/bin/snap-query" \
              -not -path "${CRAFT_PRIME}/bin/sshfs" \
              -not -path "${CRAFT_PRIME}/bin/virt-v2v-in-place" \
              -not -path "${CRAFT_PRIME}/bin/xfs_admin" \
              -not -path "${CRAFT_PRIME}/bin/uefivars.py" \
              -not -path "${CRAFT_PRIME}/bin/lxcfs" \
              -not -path "${CRAFT_PRIME}/bin/gpu-2404-custom-wrapper" \
              -exec strip --strip-all {} +

            # This is the actual LXD binary.
            strip --strip-all "${CRAFT_PRIME}/sbin/lxd"

            # Strip binaries not under bin/ due to being dynamically

            # Strip all versions of zfs utils
            for v in "${CRAFT_PRIME}"/zfs-*; do
              [ -d "${v}" ] || continue
              find "${v}/" -type f -exec strip -s {} +
            done

            # Strip libraries (excluding python3 scripts and liblxcfs)
            find "${CRAFT_PRIME}"/lib -type f \
              -not -path "${CRAFT_PRIME}/lib/python3/*" \
              -not -path "${CRAFT_PRIME}/lib/liblxcfs.so" \
              -exec strip -s {} +

            # Delete empty directories
            find "${CRAFT_PRIME}/" -type d -empty -print -delete

            # XXX: look for broken symlinks indicating missing/invalid prime
            broken_symlinks="$(find "${CRAFT_PRIME}/" -xtype l \
                                 -not -path "${CRAFT_PRIME}/lxc/config/common.conf.d/*")"
            if [ -n "${broken_symlinks}" ]; then
                echo "Found broken symlinks:"
                echo "${broken_symlinks}"
                exit 1
            fi

            # Fixup logrotate.conf permissions to not be group writable
            chmod g-w "${CRAFT_PRIME}/etc/logrotate.conf"

            # XXX: do not keep the duplicated and often outdated CA certificates
            # store from Python `certifi`. This file is not even used as the
            # `python3-certifi` package providing it is patched to always use:
            # `/etc/ssl/certs/ca-certificates.crt`
            truncate --no-create --size=0 "${CRAFT_PRIME}/lib/python3/dist-packages/certifi/cacert.pem"

            exit 0
        plugin: nil
    swtpm:
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
        plugin: nil
        prime:
            - bin/swtpm
            - lib/*/swtpm/libswtpm*so*
            - lib/*/libtpms*so*
        stage-packages:
            - swtpm
    uefivars:
        after:
            - spice-server
            - edk2
            - nftables
        build-packages:
            - quilt
        organize:
            bin/uefivars: bin/uefivars.py
            lib/python3.12/site-packages/: lib/python3/dist-packages/
        override-build: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0

            # Apply patches from Ubuntu sources.
            QUILT_PATCHES=debian/patches quilt push -a

            craftctl default
        override-prime: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
            craftctl default
        plugin: python
        prime:
            - bin/uefivars.py
            - lib/python3/dist-packages/crc32c*
            - lib/python3/dist-packages/pyuefivars*
        source: https://git.launchpad.net/ubuntu/+source/python-uefivars
        source-commit: f5390dfa5df2c99da84a471fe5b322020d78cb15
        source-depth: 1
        source-type: git
        stage-packages:
            - to amd64:
                - python3-crc32c
            - to arm64:
                - python3-crc32c
    virtiofsd:
        organize:
            usr/libexec/: bin/
        override-build: |-
            [ "$(uname -m)" != "x86_64" ] && exit 0
            craftctl default
        override-prime: |-
            [ "$(uname -m)" != "x86_64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" != "x86_64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" != "x86_64" ] && exit 0
            craftctl default
        plugin: nil
        prime:
            - bin/virtiofsd*
        stage-packages:
            - to amd64:
                - virtiofsd
    wrappers:
        organize:
            commands/snap-query: bin/
            hooks/: snap/hooks/
            wrappers/editor: bin/
            wrappers/gpu-2404-custom-wrapper: bin/
            wrappers/lxd-stophook: bin/lxd
            wrappers/remote-viewer: bin/
            wrappers/sshfs: bin/
            wrappers/virt-v2v-in-place: bin/
        plugin: dump
        source: snapcraft/
    xfs:
        organize:
            sbin/: bin/
            usr/lib/: lib/
            usr/sbin/: bin/
        plugin: nil
        prime:
            - bin/xfs_admin
            - bin/xfs_db
            - bin/xfs_growfs
            - bin/xfs_repair
            - bin/mkfs.xfs
            - lib/*/libinih.so*
            - lib/*/liburcu.so*
        stage-packages:
            - xfsprogs
    xtables:
        organize:
            usr/lib/ebtables/: lib/
            usr/sbin/: bin/
        plugin: nil
        prime:
            - bin/arptables-legacy
            - bin/ebtables-legacy
            - lib/libebtc.so.*
        stage-packages:
            - arptables
            - ebtables
            - netbase
    xz:
        organize:
            usr/bin/: bin/
            usr/lib/: lib/
            usr/sbin/: bin/
        override-build: |
            craftctl default

            # Include the lzma symlink
            ln -s xz "${CRAFT_PART_INSTALL}/usr/bin/lzma"
        plugin: nil
        prime:
            - bin/lzma
            - bin/xz
            - lib/*/liblzma*so*
        stage-packages:
            - xz-utils
    zfs-2-2:
        autotools-configure-parameters:
            - --prefix=/
            - --with-config=user
        build-packages:
            - to armhf: []
            - else:
                - libblkid-dev
                - libssl-dev
                - uuid-dev
                - zlib1g-dev
                - libtirpc-dev
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
            set -ex

            ZFS_VER="2.2"

            mv "${CRAFT_PART_INSTALL}" "${CRAFT_PART_INSTALL}.tmp"
            mkdir -p "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zfs" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zpool" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/"*so* "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/"
            rm -Rf "${CRAFT_PART_INSTALL}.tmp"

            # unused .so
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzfsbootenv.so"*
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzpool.so"*
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: autotools
        source: https://github.com/openzfs/zfs
        source-commit: 079ba86d71571bf997ff688da061d8c4aa2fd052
        source-depth: 1
        source-type: git
    zfs-2-3:
        autotools-configure-parameters:
            - --prefix=/
            - --with-config=user
        build-packages:
            - to armhf: []
            - else:
                - libblkid-dev
                - libssl-dev
                - uuid-dev
                - zlib1g-dev
                - libtirpc-dev
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
            set -ex

            ZFS_VER="2.3"

            mv "${CRAFT_PART_INSTALL}" "${CRAFT_PART_INSTALL}.tmp"
            mkdir -p "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zfs" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zpool" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/"*so* "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/"
            rm -Rf "${CRAFT_PART_INSTALL}.tmp"

            # unused .so
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzfsbootenv.so"*
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzpool.so"*
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: autotools
        source: https://github.com/openzfs/zfs
        source-commit: c840612ee1af993b835d3b3e59baee631970a781
        source-depth: 1
        source-type: git
    zfs-2-4:
        autotools-configure-parameters:
            - --prefix=/
            - --with-config=user
        build-packages:
            - to armhf: []
            - else:
                - libblkid-dev
                - libssl-dev
                - uuid-dev
                - zlib1g-dev
                - libtirpc-dev
        override-build: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
            set -ex

            ZFS_VER="2.4"

            mv "${CRAFT_PART_INSTALL}" "${CRAFT_PART_INSTALL}.tmp"
            mkdir -p "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zfs" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/sbin/zpool" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/"
            mv "${CRAFT_PART_INSTALL}.tmp/lib/"*so* "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/"
            rm -Rf "${CRAFT_PART_INSTALL}.tmp"

            # unused .so
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzfsbootenv.so"*
            rm "${CRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/libzpool.so"*
        override-prime: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-pull: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        override-stage: |-
            [ "$(uname -m)" = "armv7l" ] && exit 0
            [ "$(uname -m)" = "riscv64" ] && exit 0
            craftctl default
        plugin: autotools
        source: https://github.com/openzfs/zfs
        source-commit: 1c702dda346a59e05cfd3029569bbb1d5d91c54b
        source-depth: 1
        source-type: git
    zstd:
        organize:
            usr/bin/: bin/
        plugin: nil
        prime:
            - bin/pzstd
            - bin/zstd
        stage-packages:
            - zstd
plugs:
    ceph-conf:
        interface: content
        target: $SNAP_DATA/microceph
    gpu-2404:
        interface: content
        target: $SNAP/gpu-2404
    ovn-certificates:
        interface: content
        target: $SNAP_DATA/microovn/certificates
    ovn-chassis:
        interface: content
        target: $SNAP_DATA/microovn/chassis
    ovn-env:
        interface: content
        target: $SNAP_DATA/microovn/ovn-env
    qemu-external:
        content: qemu-external-binaries
        interface: content
        target: $SNAP/external/qemu
source-code: https://github.com/canonical/lxd
summary: LXD - container and VM manager
title: LXD
version: 6.8-5a1a287
website: https://ubuntu.com/lxd