hashicorp / hashicorp/packer-plugin-lxd

Publishing image fails on an LXD cluster member

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
14
Forks
20
PR merge metrics
No merged PRs in 30d

Description

#### 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...

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the logged `lxc publish` command on an LXD cluster member, using the issue's reproduction steps and environment details. Trace how the plugin invokes publishing and determines success; done means publishing works despite replication lag or the intended node-targeting behavior is implemented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.