Skip to content

Publishing image fails on an LXD cluster member #47

@rnalrd

Description

@rnalrd

Overview of the Issue

Publishing an image fails on an LXD cluster member, because the container might not run on the same node where packer is running. The images are replicated between cluster nodes but there's an obvious lag. Packer does not wait for the image to be replicated before checking if it was successfully published.

Another possible approach would be to add an "lxc launch" option "--target" where you can specify where to run the container, in the same node where you are running packer.

Reproduction Steps

Just build any image on an LXD cluster member and wait for it to be built and published

Plugin and Packer version

Packer: 1.8.2
packer-plugin-lxd_v1.0.1

Simplified Packer Buildfile

Operating system and Environment details

Log Fragments and crash.log files

2022/07/15 14:23:26 ui: ==> lxd.debian-ubuntu-base: Publishing container...
2022/07/15 14:23:26 packer-plugin-lxd_v1.0.1_x5.0_linux_amd64 plugin: 2022/07/15 14:23:26 Executing lxc command: []string{"publish", "packer-debian-ubuntu-base", "", "--alias", "ubuntu-focal-base", "name=ubuntu-focal-base-x86_64", "os=ubuntu", "release=focal", "serial=2022071500", "architecture=x86_64", "description=ubuntu focal base image"}
Publishing instance: Image pack: 100% (15.54MB/s) linux_amd64 plugin: 2022/07/15 14:24:53 stdout: Publishing instance: Image pack: 1% (11.69MB/s)
2022/07/15 14:24:53 packer-plugin-lxd_v1.0.1_x5.0_linux_amd64 plugin: 2022/07/15 14:24:53 stderr: Error: Failed syncing image between nodes: Failed to get nodes for the image synchronization: No such object
2022/07/15 14:24:53 ui error: ==> lxd.debian-ubuntu-base: Error publishing container: LXD command error: Error: Failed syncing image between nodes: Failed to get nodes for the image synchronization: No such object
2022/07/15 14:24:53 ui: ==> lxd.debian-ubuntu-base: Unregistering and deleting deleting container...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions