Skip to content

Commit

Permalink
fix: failed to create microvm if machine id is too long (#406)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
richardcase authored Mar 4, 2022
1 parent 194618b commit 8fcb8aa
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions infrastructure/firecracker/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"os"
"os/exec"
"strings"

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

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

Expand Down

0 comments on commit 8fcb8aa

Please sign in to comment.