Skip to content

Commit 8fcb8aa

Browse files
authored
fix: failed to create microvm if machine id is too long (#406)
This changes the firecracker provider to use the unique id on the VMID for the id of the firecracker instance instead of using the namespace/name combination. The `--id` that you supply to a firecracker instance can only be a maximum of 64 characters. This is easily exceeded witgh the namespace and machine name combination. We use a ULID for the machine unique identifer internally and this is 26 characters long. Signed-off-by: Richard Case <richard@weave.works>
1 parent 194618b commit 8fcb8aa

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

infrastructure/firecracker/create.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"os"
88
"os/exec"
9-
"strings"
109

1110
"github.com/firecracker-microvm/firecracker-go-sdk"
1211
"github.com/sirupsen/logrus"
@@ -49,8 +48,7 @@ func (p *fcProvider) Create(ctx context.Context, vm *models.MicroVM) error {
4948
return fmt.Errorf("saving firecracker metadata: %w", err)
5049
}
5150

52-
id := strings.ReplaceAll(vm.ID.String(), "/", "-")
53-
args := []string{"--id", id, "--boot-timer", "--no-api"}
51+
args := []string{"--id", vm.ID.UID(), "--boot-timer", "--no-api"}
5452
args = append(args, "--config-file", vmState.ConfigPath())
5553
args = append(args, "--metadata", vmState.MetadataPath())
5654

0 commit comments

Comments
 (0)