Skip to content

Commit 8f0df49

Browse files
authored
Merge pull request #469 from vvejell1/arm
Adding requirements to support ARM instance
2 parents 49c8370 + ec1c16c commit 8f0df49

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

.hack/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ go 1.11
1212
require (
1313
github.com/awslabs/tc-redirect-tap v0.0.0-20220715050423-f2af44521093 // indirect
1414
github.com/containernetworking/plugins v1.1.1 // indirect
15+
github.com/kunalkushwaha/ltag v0.2.3 // indirect
1516
)

.hack/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
393393
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
394394
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
395395
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
396+
github.com/kunalkushwaha/ltag v0.2.3 h1:5rwJiC1oQ/OiamZ8JNCHQGUe7OkHTFrRtyNon3VYPok=
397+
github.com/kunalkushwaha/ltag v0.2.3/go.mod h1:w1hVMWOh870f+WAv/UIoZAy0bHCbPP4+W6JxNcPUiQA=
396398
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
397399
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
398400
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ DISABLE_ROOT_TESTS?=1
1717
DOCKER_IMAGE_TAG?=latest
1818
EXTRAGOARGS:=
1919
FIRECRACKER_DIR=build/firecracker
20-
FIRECRACKER_TARGET?=x86_64-unknown-linux-musl
20+
arch=$(shell uname -m)
21+
FIRECRACKER_TARGET?=$(arch)-unknown-linux-musl
2122

2223
FC_TEST_DATA_PATH?=testdata
2324
FC_TEST_BIN_PATH:=$(FC_TEST_DATA_PATH)/bin
@@ -28,7 +29,6 @@ UID = $(shell id -u)
2829
GID = $(shell id -g)
2930

3031
firecracker_version=v1.0.0
31-
arch=$(shell uname -m)
3232

3333
# The below files are needed and can be downloaded from the internet
3434
release_url=https://github.com/firecracker-microvm/firecracker/releases/download/$(firecracker_version)/firecracker-$(firecracker_version)-$(arch).tgz

machine.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"os/exec"
2525
"os/signal"
2626
"path/filepath"
27+
"runtime"
2728
"strconv"
2829
"strings"
2930
"sync"
@@ -65,6 +66,9 @@ type SeccompConfig struct {
6566
// be started again.
6667
var ErrAlreadyStarted = errors.New("firecracker: machine already started")
6768

69+
// ErrGraceShutdown signifies that the Machine will shutdown gracefully and SendCtrlAltDelete is unable to send
70+
//var ErrGraceShutdown = errors.New("Shutdown gracefully: SendCtrlAltDelete is not supported if the arch is ARM64")
71+
6872
type MMDSVersion string
6973

7074
const (
@@ -456,7 +460,11 @@ func (m *Machine) Start(ctx context.Context) error {
456460
// Shutdown requests a clean shutdown of the VM by sending CtrlAltDelete on the virtual keyboard
457461
func (m *Machine) Shutdown(ctx context.Context) error {
458462
m.logger.Debug("Called machine.Shutdown()")
459-
return m.sendCtrlAltDel(ctx)
463+
if runtime.GOARCH != "arm64" {
464+
return m.sendCtrlAltDel(ctx)
465+
} else {
466+
return m.StopVMM()
467+
}
460468
}
461469

462470
// Wait will wait until the firecracker process has finished. Wait is safe to

network_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"net"
2121
"os"
2222
"path/filepath"
23+
"runtime"
2324
"sync"
2425
"testing"
2526
"time"
@@ -253,7 +254,7 @@ func testNetworkMachineCNI(t *testing.T, useConfFile bool) {
253254
}
254255
fctesting.RequiresRoot(t)
255256

256-
cniBinPath := []string{"/opt/cni/bin", testDataBin}
257+
cniBinPath := []string{testDataBin, "/opt/cni/bin"}
257258

258259
dir, err := ioutil.TempDir("", fsSafeTestName.Replace(t.Name()))
259260
require.NoError(t, err)
@@ -312,6 +313,9 @@ func testNetworkMachineCNI(t *testing.T, useConfFile bool) {
312313
require.NoError(t, err, "cni conf should parse")
313314
}
314315

316+
if runtime.GOARCH == "arm64" {
317+
return
318+
}
315319
numVMs := 10
316320
vmIPs := make(chan string, numVMs)
317321

@@ -405,7 +409,6 @@ func newCNIMachine(t *testing.T,
405409
MachineCfg: models.MachineConfiguration{
406410
VcpuCount: Int64(2),
407411
MemSizeMib: Int64(256),
408-
Smt: Bool(true),
409412
},
410413
Drives: []models.Drive{
411414
{

0 commit comments

Comments
 (0)