From dff6543729bdd30103011f7d5dca664f75d504d2 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Wed, 29 Jan 2025 10:13:02 +0200 Subject: [PATCH] Include proper iso volume label when running docker run eve installer_iso The mkimage-iso-efi can override the default iso volume label based on the env variable VOLUME_LABEL. We use this when we call tools/makeiso.sh to set the label to EVEISO. The installer in turn looks for this label to find its installer iso to use for installs. This label-setting did not, however, get carried over to eve/runme.sh, which means that `docker run lfedge/eve installer_iso` creates an iso with the wrong volume label, and thus install fails. This fixes it so that it sets the volume label correctly. Signed-off-by: Avi Deitcher fix wrong comment update PR, adding unknown state to the map --- pkg/eve/runme.sh | 2 +- pkg/pillar/containerd/containerd.go | 2 -- pkg/pillar/hypervisor/containerd.go | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pkg/eve/runme.sh b/pkg/eve/runme.sh index 1b41ec46b4..49c7736323 100755 --- a/pkg/eve/runme.sh +++ b/pkg/eve/runme.sh @@ -162,7 +162,7 @@ do_installer_raw() { create_installer_iso() { mkdir -p /installer_root unsquashfs -f -d /installer_root /bits/installer.img 1>&2 - tar -C /installer_root -cf - . | /make-efi installer + tar -C /installer_root -cf - . | VOLUME_LABEL=EVEISO /make-efi installer rm -rf /installer_root } diff --git a/pkg/pillar/containerd/containerd.go b/pkg/pillar/containerd/containerd.go index 32103f58da..a7cca0a0e9 100644 --- a/pkg/pillar/containerd/containerd.go +++ b/pkg/pillar/containerd/containerd.go @@ -493,8 +493,6 @@ func (client *Client) CtrGetContainerMetrics(ctx context.Context, containerID st // For tasks that are in the running, pausing or paused state the PID is also provided // and the exit code is set to 0. For tasks in the stopped state, exit code is provided // and the PID is set to 0. - -// cperakis sos func (client *Client) CtrContainerInfo(ctx context.Context, name string) (int, int, string, error) { if err := client.verifyCtr(ctx, true); err != nil { return 0, 0, "", fmt.Errorf("CtrContainerInfo: exception while verifying ctrd client: %s", err.Error()) diff --git a/pkg/pillar/hypervisor/containerd.go b/pkg/pillar/hypervisor/containerd.go index 555890a5f1..e0e8c708c6 100644 --- a/pkg/pillar/hypervisor/containerd.go +++ b/pkg/pillar/hypervisor/containerd.go @@ -237,14 +237,6 @@ func (ctx ctrdContext) Info(domainName string) (int, types.SwState, error) { return 0, types.UNKNOWN, logError("containerd looking up domain %s resulted in %v", domainName, err) } - stateMap := map[string]types.SwState{ - "created": types.INSTALLED, - "running": types.RUNNING, - "pausing": types.PAUSING, - "paused": types.PAUSED, - "stopped": types.HALTED, - } - // if the VM state is unknown, we will retry 10 times to get the state. This is to handle the case // where the VM is in a transient state. if status == "unknown" { @@ -256,7 +248,7 @@ func (ctx ctrdContext) Info(domainName string) (int, types.SwState, error) { return 0, types.UNKNOWN, logError("containerd looking up domain %s resulted in %v", domainName, err) } // if the VM state will change, we exit the loop. - if _, matched := stateMap[status]; matched { + if status != "unknown" { break } } @@ -272,7 +264,15 @@ func (ctx ctrdContext) Info(domainName string) (int, types.SwState, error) { if status == "unknown" { logrus.Errorf("task %s is in %s state, after %d retries", domainName, status, retryCount) } - stateMap["unknown"] = types.UNKNOWN + + stateMap := map[string]types.SwState{ + "created": types.INSTALLED, + "running": types.RUNNING, + "pausing": types.PAUSING, + "paused": types.PAUSED, + "stopped": types.HALTED, + "unknown": types.UNKNOWN, + } if effectiveDomainState, matched := stateMap[status]; !matched { err := fmt.Errorf("task %s happens to be in an unexpected state %s",