diff --git a/.gitmodules b/.gitmodules index 78f932a86..eb358d687 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/opencontainers/runc [submodule "firecracker"] path = _submodules/firecracker - url = https://github.com/firecracker-microvm/firecracker.git + url = https://github.com/ease-lab/firecracker.git diff --git a/Makefile b/Makefile index 667d21cde..cacdedb3d 100644 --- a/Makefile +++ b/Makefile @@ -281,7 +281,8 @@ demo-network: install-cni-bins $(FCNET_CONFIG) # Firecracker submodule ########################## .PHONY: firecracker -firecracker: $(FIRECRACKER_BIN) +firecracker: + _submodules/firecracker/tools/devtool build --release .PHONY: install-firecracker install-firecracker: firecracker diff --git a/_submodules/firecracker b/_submodules/firecracker index fc2a7ed50..c6c93f3b4 160000 --- a/_submodules/firecracker +++ b/_submodules/firecracker @@ -1 +1 @@ -Subproject commit fc2a7ed50e2c5c6df9572f54bcf2a1cc161dd321 +Subproject commit c6c93f3b48dc0396b8a93db522c9340e93743d61 diff --git a/_submodules/runc b/_submodules/runc index b9ee9c631..12644e614 160000 --- a/_submodules/runc +++ b/_submodules/runc @@ -1 +1 @@ -Subproject commit b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7 +Subproject commit 12644e614e25b05da6fd08a38ffa0cfe1903fdec diff --git a/firecracker-control/local.go b/firecracker-control/local.go index fca73143d..9cb5647f8 100644 --- a/firecracker-control/local.go +++ b/firecracker-control/local.go @@ -248,42 +248,6 @@ func (s *local) StopVM(requestCtx context.Context, req *proto.StopVMRequest) (*e return resp, multierror.Append(shimErr, waitErr).ErrorOrNil() } -// PauseVM pauses a VM -func (s *local) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empty.Empty, error) { - client, err := s.shimFirecrackerClient(ctx, req.VMID) - if err != nil { - return nil, err - } - - defer client.Close() - - resp, err := client.PauseVM(ctx, req) - if err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - return resp, nil -} - -// ResumeVM resumes a VM -func (s *local) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*empty.Empty, error) { - client, err := s.shimFirecrackerClient(ctx, req.VMID) - if err != nil { - return nil, err - } - - defer client.Close() - - resp, err := client.ResumeVM(ctx, req) - if err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - return resp, nil -} - func (s *local) waitForShimToExit(ctx context.Context, vmID string) error { socketAddr, err := shim.SocketAddress(ctx, s.containerdAddress, vmID) if err != nil { @@ -596,3 +560,95 @@ func setShimOOMScore(shimPid int) error { return nil } + +// PauseVM Pauses a VM +func (s *local) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empty.Empty, error) { + client, err := s.shimFirecrackerClient(ctx, req.VMID) + if err != nil { + return nil, err + } + + defer client.Close() + + resp, err := client.PauseVM(ctx, req) + if err != nil { + s.logger.WithError(err).Error() + return nil, err + } + + return resp, nil +} + +// ResumeVM Resumes a VM +func (s *local) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*empty.Empty, error) { + client, err := s.shimFirecrackerClient(ctx, req.VMID) + if err != nil { + return nil, err + } + + defer client.Close() + + resp, err := client.ResumeVM(ctx, req) + if err != nil { + s.logger.WithError(err).Error() + return nil, err + } + + return resp, nil +} + +// CreateSnapshot Creates a snapshot of a VM +func (s *local) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotRequest) (*empty.Empty, error) { + client, err := s.shimFirecrackerClient(ctx, req.VMID) + if err != nil { + return nil, err + } + + defer client.Close() + + resp, err := client.CreateSnapshot(ctx, req) + if err != nil { + s.logger.WithError(err).Error() + return nil, err + } + + return resp, nil +} + +// LoadSnapshot Loads a snapshot of a VM +func (s *local) LoadSnapshot(ctx context.Context, req *proto.LoadSnapshotRequest) (*proto.LoadResponse, error) { + client, err := s.shimFirecrackerClient(ctx, req.VMID) + if err != nil { + return nil, err + } + + defer client.Close() + + resp, err := client.LoadSnapshot(ctx, req) + if err != nil { + s.logger.WithError(err).Error() + return nil, err + } + + return resp, nil +} + +// Offload Shuts down a VM started through the firecracker go sdk and deletes +// the corresponding firecracker socket. All of the other resources (shim, other sockets) +// will persist. +func (s *local) Offload(ctx context.Context, req *proto.OffloadRequest) (*empty.Empty, error) { + client, err := s.shimFirecrackerClient(ctx, req.VMID) + if err != nil { + return nil, err + } + + defer client.Close() + + resp, err := client.Offload(ctx, req) + if err != nil { + s.logger.WithError(err).Error() + return nil, err + } + + return resp, nil +} diff --git a/firecracker-control/service.go b/firecracker-control/service.go index 4d9c80422..32f2d5fde 100644 --- a/firecracker-control/service.go +++ b/firecracker-control/service.go @@ -126,3 +126,18 @@ func (s *service) UpdateBalloonStats(ctx context.Context, req *proto.UpdateBallo log.G(ctx).Debug("Updating balloon device statistics polling interval") return s.local.UpdateBalloonStats(ctx, req) } + +func (s *service) LoadSnapshot(ctx context.Context, req *proto.LoadSnapshotRequest) (*proto.LoadResponse, error) { + log.G(ctx).Debugf("load snapshot request: %+v", req) + return s.local.LoadSnapshot(ctx, req) +} + +func (s *service) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotRequest) (*empty.Empty, error) { + log.G(ctx).Debugf("create snapshot request: %+v", req) + return s.local.CreateSnapshot(ctx, req) +} + +func (s *service) Offload(ctx context.Context, req *proto.OffloadRequest) (*empty.Empty, error) { + log.G(ctx).Debugf("offload request: %+v", req) + return s.local.Offload(ctx, req) +} diff --git a/go.mod b/go.mod index 9647fa5c8..530d9eae7 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect github.com/sirupsen/logrus v1.8.0 github.com/stretchr/testify v1.6.1 + github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852 golang.org/x/sync v0.0.0-20201207232520-09787c993a3a golang.org/x/sys v0.0.0-20210324051608-47abb6519492 diff --git a/go.sum b/go.sum index fbc25741f..25ff474d4 100644 --- a/go.sum +++ b/go.sum @@ -42,7 +42,6 @@ github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17 h1:iT12IBVClFevaf8PuVyi3UmZOVh4OqnaLxDTW2O6j3w= github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= @@ -62,7 +61,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 h1:UUppSQnhf4Yc6xGxSkoQpPhb7RVzuv5Nb1mwJ5VId9s= github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -266,10 +264,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/firecracker-microvm/firecracker-go-sdk v0.22.1-0.20210520223842-abd0815b8bf9 h1:IKjNicWBHpNyJ/vWO+yPYjFQ0ma2W6+hQrGkNGSzsIQ= github.com/firecracker-microvm/firecracker-go-sdk v0.22.1-0.20210520223842-abd0815b8bf9/go.mod h1:Dbh2OFp/p0Obqp7An+3ktnfC6/a5DKUkMQ5zA/Qmb+0= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= @@ -287,7 +283,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -403,13 +398,11 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -428,7 +421,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -510,12 +502,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g= github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= @@ -567,9 +557,7 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -579,13 +567,11 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.3 h1:gph6h/qe9GSUw1NhH1gp+qb+h8rXD8Cy60Z32Qw3ELA= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -674,7 +660,6 @@ github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvW github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM= github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -692,7 +677,6 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/sparrc/go-ping v0.0.0-20190613174326-4e5b6552494c h1:gqEdF4VwBu3lTKGHS9rXE9x1/pEaSwCXRLOZRF6qtlw= github.com/sparrc/go-ping v0.0.0-20190613174326-4e5b6552494c/go.mod h1:eMyUVp6f/5jnzM+3zahzl7q6UXLbgSc3MKg/+ow9QW0= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -722,10 +706,11 @@ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -771,7 +756,6 @@ go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvS go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1000,7 +984,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -1029,7 +1012,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1041,7 +1023,6 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1056,10 +1037,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/common.go b/internal/common.go index 9e7a78b48..0f90bf868 100644 --- a/internal/common.go +++ b/internal/common.go @@ -34,6 +34,8 @@ const ( // FirecrackerVSockName is the name of the Firecracker VSock unix path used for communication // between the runtime and the agent FirecrackerVSockName = "firecracker.vsock" + // FirecrackerUPFSockName is the name of the Firecracker UPF socket + FirecrackerUPFSockName = "firecracker.upfsock" // FirecrackerLogFifoName is the name of the Firecracker VMM log FIFO FirecrackerLogFifoName = "fc-logs.fifo" // FirecrackerMetricsFifoName is the name of the Firecracker VMM metrics FIFO diff --git a/internal/vm/dir.go b/internal/vm/dir.go index 228350a35..0550a71c0 100644 --- a/internal/vm/dir.go +++ b/internal/vm/dir.go @@ -95,6 +95,12 @@ func (d Dir) FirecrackerSockRelPath() (string, error) { return relPathTo(d.FirecrackerSockPath()) } +// FirecrackerUPFSockPath returns the path to the user page faults +// socket of the firecracker process +func (d Dir) FirecrackerUPFSockPath() string { + return filepath.Join(d.RootPath(), internal.FirecrackerUPFSockName) +} + // FirecrackerVSockPath returns the path to the vsock unix socket that the runtime uses // to communicate with the VM agent. func (d Dir) FirecrackerVSockPath() string { diff --git a/proto/firecracker.pb.go b/proto/firecracker.pb.go index 4cd8c2f56..935ea59ba 100644 --- a/proto/firecracker.pb.go +++ b/proto/firecracker.pb.go @@ -207,6 +207,8 @@ type CreateVMResponse struct { LogFifoPath string `protobuf:"bytes,3,opt,name=LogFifoPath,json=logFifoPath,proto3" json:"LogFifoPath,omitempty"` MetricsFifoPath string `protobuf:"bytes,4,opt,name=MetricsFifoPath,json=metricsFifoPath,proto3" json:"MetricsFifoPath,omitempty"` CgroupPath string `protobuf:"bytes,5,opt,name=CgroupPath,json=cgroupPath,proto3" json:"CgroupPath,omitempty"` + UPFSockPath string `protobuf:"bytes,6,opt,name=UPFSockPath,json=uPFSockPath,proto3" json:"UPFSockPath,omitempty"` + FirecrackerPID string `protobuf:"bytes,7,opt,name=FirecrackerPID,json=firecrackerPID,proto3" json:"FirecrackerPID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -271,6 +273,20 @@ func (m *CreateVMResponse) GetCgroupPath() string { return "" } +func (m *CreateVMResponse) GetUPFSockPath() string { + if m != nil { + return m.UPFSockPath + } + return "" +} + +func (m *CreateVMResponse) GetFirecrackerPID() string { + if m != nil { + return m.FirecrackerPID + } + return "" +} + type PauseVMRequest struct { VMID string `protobuf:"bytes,1,opt,name=VMID,json=vMID,proto3" json:"VMID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -669,6 +685,198 @@ func (m *GetVMMetadataResponse) GetMetadata() string { return "" } +type CreateSnapshotRequest struct { + VMID string `protobuf:"bytes,1,opt,name=VMID,json=vMID,proto3" json:"VMID,omitempty"` + SnapshotFilePath string `protobuf:"bytes,2,opt,name=SnapshotFilePath,json=snapshotFilePath,proto3" json:"SnapshotFilePath,omitempty"` + MemFilePath string `protobuf:"bytes,3,opt,name=MemFilePath,json=memFilePath,proto3" json:"MemFilePath,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateSnapshotRequest) Reset() { *m = CreateSnapshotRequest{} } +func (m *CreateSnapshotRequest) String() string { return proto.CompactTextString(m) } +func (*CreateSnapshotRequest) ProtoMessage() {} +func (*CreateSnapshotRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a73317e9fb8da571, []int{11} +} +func (m *CreateSnapshotRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateSnapshotRequest.Unmarshal(m, b) +} +func (m *CreateSnapshotRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateSnapshotRequest.Marshal(b, m, deterministic) +} +func (m *CreateSnapshotRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateSnapshotRequest.Merge(m, src) +} +func (m *CreateSnapshotRequest) XXX_Size() int { + return xxx_messageInfo_CreateSnapshotRequest.Size(m) +} +func (m *CreateSnapshotRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateSnapshotRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateSnapshotRequest proto.InternalMessageInfo + +func (m *CreateSnapshotRequest) GetVMID() string { + if m != nil { + return m.VMID + } + return "" +} + +func (m *CreateSnapshotRequest) GetSnapshotFilePath() string { + if m != nil { + return m.SnapshotFilePath + } + return "" +} + +func (m *CreateSnapshotRequest) GetMemFilePath() string { + if m != nil { + return m.MemFilePath + } + return "" +} + +type LoadSnapshotRequest struct { + VMID string `protobuf:"bytes,1,opt,name=VMID,json=vMID,proto3" json:"VMID,omitempty"` + SnapshotFilePath string `protobuf:"bytes,2,opt,name=SnapshotFilePath,json=snapshotFilePath,proto3" json:"SnapshotFilePath,omitempty"` + MemFilePath string `protobuf:"bytes,3,opt,name=MemFilePath,json=memFilePath,proto3" json:"MemFilePath,omitempty"` + EnableUserPF bool `protobuf:"varint,4,opt,name=EnableUserPF,json=enableUserPF,proto3" json:"EnableUserPF,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoadSnapshotRequest) Reset() { *m = LoadSnapshotRequest{} } +func (m *LoadSnapshotRequest) String() string { return proto.CompactTextString(m) } +func (*LoadSnapshotRequest) ProtoMessage() {} +func (*LoadSnapshotRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a73317e9fb8da571, []int{12} +} +func (m *LoadSnapshotRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadSnapshotRequest.Unmarshal(m, b) +} +func (m *LoadSnapshotRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadSnapshotRequest.Marshal(b, m, deterministic) +} +func (m *LoadSnapshotRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadSnapshotRequest.Merge(m, src) +} +func (m *LoadSnapshotRequest) XXX_Size() int { + return xxx_messageInfo_LoadSnapshotRequest.Size(m) +} +func (m *LoadSnapshotRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LoadSnapshotRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadSnapshotRequest proto.InternalMessageInfo + +func (m *LoadSnapshotRequest) GetVMID() string { + if m != nil { + return m.VMID + } + return "" +} + +func (m *LoadSnapshotRequest) GetSnapshotFilePath() string { + if m != nil { + return m.SnapshotFilePath + } + return "" +} + +func (m *LoadSnapshotRequest) GetMemFilePath() string { + if m != nil { + return m.MemFilePath + } + return "" +} + +func (m *LoadSnapshotRequest) GetEnableUserPF() bool { + if m != nil { + return m.EnableUserPF + } + return false +} + +type LoadResponse struct { + FirecrackerPID string `protobuf:"bytes,1,opt,name=FirecrackerPID,json=firecrackerPID,proto3" json:"FirecrackerPID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoadResponse) Reset() { *m = LoadResponse{} } +func (m *LoadResponse) String() string { return proto.CompactTextString(m) } +func (*LoadResponse) ProtoMessage() {} +func (*LoadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a73317e9fb8da571, []int{13} +} +func (m *LoadResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadResponse.Unmarshal(m, b) +} +func (m *LoadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadResponse.Marshal(b, m, deterministic) +} +func (m *LoadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadResponse.Merge(m, src) +} +func (m *LoadResponse) XXX_Size() int { + return xxx_messageInfo_LoadResponse.Size(m) +} +func (m *LoadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LoadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadResponse proto.InternalMessageInfo + +func (m *LoadResponse) GetFirecrackerPID() string { + if m != nil { + return m.FirecrackerPID + } + return "" +} + +type OffloadRequest struct { + VMID string `protobuf:"bytes,1,opt,name=VMID,json=vMID,proto3" json:"VMID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OffloadRequest) Reset() { *m = OffloadRequest{} } +func (m *OffloadRequest) String() string { return proto.CompactTextString(m) } +func (*OffloadRequest) ProtoMessage() {} +func (*OffloadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a73317e9fb8da571, []int{14} +} +func (m *OffloadRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OffloadRequest.Unmarshal(m, b) +} +func (m *OffloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OffloadRequest.Marshal(b, m, deterministic) +} +func (m *OffloadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_OffloadRequest.Merge(m, src) +} +func (m *OffloadRequest) XXX_Size() int { + return xxx_messageInfo_OffloadRequest.Size(m) +} +func (m *OffloadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_OffloadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_OffloadRequest proto.InternalMessageInfo + +func (m *OffloadRequest) GetVMID() string { + if m != nil { + return m.VMID + } + return "" +} + type JailerConfig struct { NetNS string `protobuf:"bytes,1,opt,name=NetNS,json=netNS,proto3" json:"NetNS,omitempty"` // List of the physical numbers of the CPUs on which processes in that @@ -709,7 +917,7 @@ func (m *JailerConfig) Reset() { *m = JailerConfig{} } func (m *JailerConfig) String() string { return proto.CompactTextString(m) } func (*JailerConfig) ProtoMessage() {} func (*JailerConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{11} + return fileDescriptor_a73317e9fb8da571, []int{15} } func (m *JailerConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JailerConfig.Unmarshal(m, b) @@ -790,7 +998,7 @@ func (m *UpdateBalloonRequest) Reset() { *m = UpdateBalloonRequest{} } func (m *UpdateBalloonRequest) String() string { return proto.CompactTextString(m) } func (*UpdateBalloonRequest) ProtoMessage() {} func (*UpdateBalloonRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{12} + return fileDescriptor_a73317e9fb8da571, []int{16} } func (m *UpdateBalloonRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateBalloonRequest.Unmarshal(m, b) @@ -835,7 +1043,7 @@ func (m *GetBalloonConfigRequest) Reset() { *m = GetBalloonConfigRequest func (m *GetBalloonConfigRequest) String() string { return proto.CompactTextString(m) } func (*GetBalloonConfigRequest) ProtoMessage() {} func (*GetBalloonConfigRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{13} + return fileDescriptor_a73317e9fb8da571, []int{17} } func (m *GetBalloonConfigRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBalloonConfigRequest.Unmarshal(m, b) @@ -873,7 +1081,7 @@ func (m *GetBalloonConfigResponse) Reset() { *m = GetBalloonConfigRespon func (m *GetBalloonConfigResponse) String() string { return proto.CompactTextString(m) } func (*GetBalloonConfigResponse) ProtoMessage() {} func (*GetBalloonConfigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{14} + return fileDescriptor_a73317e9fb8da571, []int{18} } func (m *GetBalloonConfigResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBalloonConfigResponse.Unmarshal(m, b) @@ -911,7 +1119,7 @@ func (m *GetBalloonStatsRequest) Reset() { *m = GetBalloonStatsRequest{} func (m *GetBalloonStatsRequest) String() string { return proto.CompactTextString(m) } func (*GetBalloonStatsRequest) ProtoMessage() {} func (*GetBalloonStatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{15} + return fileDescriptor_a73317e9fb8da571, []int{19} } func (m *GetBalloonStatsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBalloonStatsRequest.Unmarshal(m, b) @@ -977,7 +1185,7 @@ func (m *GetBalloonStatsResponse) Reset() { *m = GetBalloonStatsResponse func (m *GetBalloonStatsResponse) String() string { return proto.CompactTextString(m) } func (*GetBalloonStatsResponse) ProtoMessage() {} func (*GetBalloonStatsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{16} + return fileDescriptor_a73317e9fb8da571, []int{20} } func (m *GetBalloonStatsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBalloonStatsResponse.Unmarshal(m, b) @@ -1107,7 +1315,7 @@ func (m *UpdateBalloonStatsRequest) Reset() { *m = UpdateBalloonStatsReq func (m *UpdateBalloonStatsRequest) String() string { return proto.CompactTextString(m) } func (*UpdateBalloonStatsRequest) ProtoMessage() {} func (*UpdateBalloonStatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a73317e9fb8da571, []int{17} + return fileDescriptor_a73317e9fb8da571, []int{21} } func (m *UpdateBalloonStatsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateBalloonStatsRequest.Unmarshal(m, b) @@ -1154,6 +1362,10 @@ func init() { proto.RegisterType((*UpdateVMMetadataRequest)(nil), "UpdateVMMetadataRequest") proto.RegisterType((*GetVMMetadataRequest)(nil), "GetVMMetadataRequest") proto.RegisterType((*GetVMMetadataResponse)(nil), "GetVMMetadataResponse") + proto.RegisterType((*CreateSnapshotRequest)(nil), "CreateSnapshotRequest") + proto.RegisterType((*LoadSnapshotRequest)(nil), "LoadSnapshotRequest") + proto.RegisterType((*LoadResponse)(nil), "LoadResponse") + proto.RegisterType((*OffloadRequest)(nil), "OffloadRequest") proto.RegisterType((*JailerConfig)(nil), "JailerConfig") proto.RegisterType((*UpdateBalloonRequest)(nil), "UpdateBalloonRequest") proto.RegisterType((*GetBalloonConfigRequest)(nil), "GetBalloonConfigRequest") @@ -1166,70 +1378,77 @@ func init() { func init() { proto.RegisterFile("firecracker.proto", fileDescriptor_a73317e9fb8da571) } var fileDescriptor_a73317e9fb8da571 = []byte{ - // 1032 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdf, 0x6e, 0xdb, 0xb6, - 0x17, 0xfe, 0xa9, 0xb2, 0x93, 0xf8, 0x38, 0x76, 0x62, 0x22, 0x69, 0xd5, 0xa2, 0x08, 0x0c, 0xe1, - 0xb7, 0xce, 0x28, 0xb6, 0x00, 0x4b, 0x76, 0x31, 0xec, 0x66, 0x75, 0xec, 0x3a, 0x55, 0x3b, 0xa5, - 0x06, 0x9d, 0x04, 0xd8, 0x76, 0xc5, 0xc8, 0xc7, 0x8a, 0x6a, 0x49, 0xf4, 0x44, 0x2a, 0x6d, 0x5e, - 0x6b, 0xbb, 0xd9, 0x73, 0xec, 0x5d, 0x76, 0x3f, 0x90, 0x92, 0x2d, 0xd9, 0xc9, 0xdc, 0x00, 0xbb, - 0xda, 0x95, 0xcd, 0xef, 0x7c, 0xe4, 0xf9, 0xf3, 0x1d, 0x1e, 0x0a, 0x5a, 0x93, 0x20, 0x41, 0x2f, - 0x61, 0xde, 0x14, 0x93, 0xc3, 0x59, 0xc2, 0x25, 0x7f, 0x56, 0x97, 0xb7, 0x33, 0x14, 0xd9, 0xc2, - 0xfe, 0xa3, 0x0a, 0x3b, 0xbd, 0x04, 0x99, 0xc4, 0x4b, 0x97, 0xe2, 0xaf, 0x29, 0x0a, 0x49, 0x08, - 0x54, 0x2e, 0x5d, 0xa7, 0x6f, 0x19, 0x6d, 0xa3, 0x53, 0xa3, 0x95, 0x1b, 0xd7, 0xe9, 0x93, 0x57, - 0x00, 0x2e, 0xf3, 0xae, 0x83, 0x18, 0x7b, 0x13, 0xdf, 0x7a, 0xd4, 0x36, 0x3a, 0xf5, 0xa3, 0xf6, - 0xe1, 0xa0, 0x38, 0x7c, 0x6e, 0xe5, 0xf1, 0x24, 0xf0, 0x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x86, 0x8d, - 0xd1, 0x47, 0x36, 0x73, 0x62, 0xfd, 0x7e, 0x9a, 0x74, 0x43, 0xe8, 0x15, 0xb1, 0x60, 0x53, 0xe1, - 0xef, 0x53, 0xa9, 0xdf, 0x48, 0x93, 0x6e, 0x8a, 0x6c, 0xa9, 0x2a, 0x7f, 0xce, 0x12, 0x1f, 0x75, - 0xb7, 0x6d, 0x67, 0x95, 0x97, 0x73, 0x40, 0x79, 0xcc, 0xac, 0x59, 0xe5, 0x1b, 0x99, 0x47, 0x59, - 0x40, 0x9a, 0xc1, 0x25, 0x0b, 0xf3, 0x82, 0x35, 0x73, 0x46, 0x01, 0xd9, 0x08, 0x4f, 0x97, 0x7a, - 0xff, 0x73, 0x8d, 0x42, 0xbe, 0x85, 0x7d, 0xcd, 0x19, 0xf2, 0x30, 0x0c, 0x62, 0x5f, 0x7f, 0x88, - 0xdc, 0xb0, 0x70, 0x2e, 0xfc, 0xbe, 0xb8, 0xcf, 0xf8, 0xf2, 0xcb, 0x7b, 0x2e, 0x29, 0xd9, 0x82, - 0x4a, 0xef, 0xfd, 0xf0, 0xa7, 0xdd, 0xff, 0xa9, 0x7f, 0x27, 0xce, 0x59, 0x7f, 0xd7, 0x38, 0xd9, - 0xfc, 0xb9, 0xaa, 0xbf, 0x22, 0xaf, 0x36, 0xf4, 0xcf, 0xf1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x28, 0xec, 0xce, 0x6b, 0x6e, 0x0a, 0x00, 0x00, + // 1150 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xdd, 0x8e, 0xda, 0x46, + 0x1b, 0xfe, 0x1c, 0xc3, 0xee, 0xf2, 0xf2, 0xb3, 0xec, 0x7c, 0xbb, 0x89, 0x13, 0x45, 0x11, 0xb2, + 0xda, 0x14, 0x45, 0xed, 0x4a, 0x4d, 0xaa, 0xaa, 0xea, 0x49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0x9e, 0xfe, 0x79, 0xf4, + 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x23, 0x18, 0xaf, 0x2f, 0x0c, 0x00, 0x00, } diff --git a/proto/firecracker.proto b/proto/firecracker.proto index 7d42aefeb..e2304d35c 100644 --- a/proto/firecracker.proto +++ b/proto/firecracker.proto @@ -49,6 +49,8 @@ message CreateVMResponse { string LogFifoPath = 3; string MetricsFifoPath = 4; string CgroupPath = 5; + string UPFSockPath = 6; + string FirecrackerPID = 7; } message PauseVMRequest { @@ -103,6 +105,28 @@ enum DriveExposePolicy { BIND = 1; } +message CreateSnapshotRequest { + string VMID = 1; + string SnapshotFilePath = 2; + string MemFilePath = 3; +} + +message LoadSnapshotRequest { + string VMID = 1; + string SnapshotFilePath = 2; + string MemFilePath = 3; + bool EnableUserPF = 4; +} + +message LoadResponse { + string FirecrackerPID = 1; +} + +message OffloadRequest { + string VMID = 1; +} + + message JailerConfig { string NetNS = 1; // List of the physical numbers of the CPUs on which processes in that diff --git a/proto/service/fccontrol/fccontrol.proto b/proto/service/fccontrol/fccontrol.proto index 8306e7ca3..7481a4ed7 100644 --- a/proto/service/fccontrol/fccontrol.proto +++ b/proto/service/fccontrol/fccontrol.proto @@ -15,7 +15,7 @@ service Firecracker { // Resumes a VM rpc ResumeVM(ResumeVMRequest) returns (google.protobuf.Empty); - + // Stops existing Firecracker instance by VM ID rpc StopVM(StopVMRequest) returns (google.protobuf.Empty); @@ -42,4 +42,13 @@ service Firecracker { // Updates a balloon device statistics polling interval. rpc UpdateBalloonStats(UpdateBalloonStatsRequest) returns(google.protobuf.Empty); + + // Loads VM from snapshot + rpc LoadSnapshot(LoadSnapshotRequest) returns (LoadResponse); + + // Make a snapshot of a VM + rpc CreateSnapshot(CreateSnapshotRequest) returns (google.protobuf.Empty); + + // Offload a snapshotted VM + rpc Offload(OffloadRequest) returns (google.protobuf.Empty); } diff --git a/proto/service/fccontrol/ttrpc/fccontrol.pb.go b/proto/service/fccontrol/ttrpc/fccontrol.pb.go index c6409dca9..f15bbb880 100644 --- a/proto/service/fccontrol/ttrpc/fccontrol.pb.go +++ b/proto/service/fccontrol/ttrpc/fccontrol.pb.go @@ -27,30 +27,33 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func init() { proto.RegisterFile("fccontrol.proto", fileDescriptor_b99f53e2bf82c5ef) } var fileDescriptor_b99f53e2bf82c5ef = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x3f, 0x4f, 0xf2, 0x50, - 0x14, 0xc6, 0xe9, 0xf0, 0xf2, 0xc2, 0x35, 0x08, 0xdc, 0x04, 0x45, 0x4c, 0xba, 0xb8, 0x1f, 0x0c, - 0x3a, 0x33, 0x80, 0x5a, 0x1d, 0x9a, 0x18, 0x88, 0x0c, 0x6e, 0x97, 0x72, 0x4a, 0x88, 0xa5, 0xb7, - 0xb6, 0xa7, 0x83, 0x9b, 0x1f, 0x8f, 0xd1, 0xd1, 0x51, 0xba, 0xfb, 0x1d, 0x0c, 0xb4, 0x97, 0x3f, - 0x85, 0xe4, 0x6e, 0xcf, 0xf9, 0x9d, 0x9e, 0xe7, 0x3c, 0xf7, 0x24, 0x65, 0x55, 0xd7, 0x71, 0xa4, - 0x4f, 0xa1, 0xf4, 0x20, 0x08, 0x25, 0xc9, 0xd6, 0xe5, 0x54, 0xca, 0xa9, 0x87, 0xed, 0x75, 0x35, - 0x8e, 0xdd, 0x36, 0xce, 0x03, 0xfa, 0xc8, 0x9a, 0x75, 0x77, 0x16, 0xa2, 0x13, 0x0a, 0xe7, 0x0d, - 0xc3, 0x14, 0x75, 0x7e, 0xff, 0xb1, 0x93, 0x87, 0x2d, 0xe5, 0x6d, 0x56, 0xea, 0x87, 0x28, 0x08, - 0x47, 0x36, 0xaf, 0x81, 0x92, 0x03, 0x7c, 0x8f, 0x31, 0xa2, 0x56, 0x7d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0x67, 0x62, 0x1a, 0x8b, 0xc4, 0x34, 0xbe, 0x12, 0xd3, 0xf8, 0x49, 0x4c, 0xe3, 0xb5, 0xbc, - 0xf9, 0x95, 0xc6, 0xc5, 0xf5, 0xd0, 0xcd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0x43, 0x0c, - 0x39, 0x5e, 0x03, 0x00, 0x00, + // 406 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xbf, 0x6e, 0xe2, 0x40, + 0x10, 0xc6, 0x71, 0xc3, 0x9f, 0xbd, 0x03, 0xc3, 0xea, 0xe0, 0x38, 0x4e, 0x72, 0x73, 0xfd, 0x70, + 0x82, 0xab, 0xd1, 0x09, 0xee, 0xe2, 0x44, 0x8a, 0x95, 0x08, 0x2b, 0x14, 0xe9, 0x16, 0x7b, 0x4d, + 0x50, 0x8c, 0xd7, 0xb1, 0xd7, 0x45, 0xba, 0x3c, 0x46, 0x1e, 0x89, 0x32, 0x65, 0xca, 0xe0, 0x27, + 0x89, 0xb0, 0xbd, 0x06, 0x1b, 0xa4, 0xed, 0x66, 0x7e, 0xe3, 0xef, 0x9b, 0x6f, 0x57, 0x6b, 0xa4, + 0x3a, 0x96, 0xc5, 0x3c, 0x1e, 0x30, 0x17, 0xfc, 0x80, 0x71, 0x36, 0xf8, 0xb9, 0x62, 0x6c, 0xe5, + 0xd2, 0x61, 0xd2, 0x2d, 0x23, 0x67, 0x48, 0x37, 0x3e, 0x7f, 0xce, 0x86, 0x1d, 0x67, 0x1d, 0x50, + 0x2b, 0x20, 0xd6, 0x23, 0x0d, 0x52, 0x34, 0x7a, 0xad, 0xa1, 0x2f, 0x17, 0x07, 0x8a, 0x87, 0xa8, + 0x3e, 0x0b, 0x28, 0xe1, 0x74, 0x61, 0xe0, 0x36, 0x88, 0x72, 0x4e, 0x9f, 0x22, 0x1a, 0xf2, 0x41, + 0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1, 0xc3, 0x07, 0xc6, 0xf1, 0x37, 0x38, 0x6e, 0x85, 0xba, 0x99, + 0xd0, 0x7c, 0xfd, 0x5f, 0xd4, 0x4a, 0xdf, 0x7d, 0x2e, 0xeb, 0x41, 0x11, 0xc8, 0x5f, 0x62, 0xed, + 0xc6, 0x71, 0x5c, 0x46, 0x6c, 0xac, 0x42, 0x56, 0x49, 0x34, 0xd3, 0x5f, 0xdb, 0x9d, 0x56, 0x79, + 0xdf, 0x69, 0x95, 0x97, 0x58, 0x53, 0xb6, 0xb1, 0xa6, 0xbc, 0xc5, 0x9a, 0xf2, 0x11, 0x6b, 0xca, + 0x7d, 0x23, 0xff, 0xeb, 0x97, 0xd5, 0x44, 0x34, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x3e, + 0x14, 0xd9, 0x09, 0x04, 0x00, 0x00, } type FirecrackerService interface { @@ -66,6 +69,9 @@ type FirecrackerService interface { UpdateBalloon(ctx context.Context, req *proto1.UpdateBalloonRequest) (*empty.Empty, error) GetBalloonStats(ctx context.Context, req *proto1.GetBalloonStatsRequest) (*proto1.GetBalloonStatsResponse, error) UpdateBalloonStats(ctx context.Context, req *proto1.UpdateBalloonStatsRequest) (*empty.Empty, error) + LoadSnapshot(ctx context.Context, req *proto1.LoadSnapshotRequest) (*proto1.LoadResponse, error) + CreateSnapshot(ctx context.Context, req *proto1.CreateSnapshotRequest) (*empty.Empty, error) + Offload(ctx context.Context, req *proto1.OffloadRequest) (*empty.Empty, error) } func RegisterFirecrackerService(srv *github_com_containerd_ttrpc.Server, svc FirecrackerService) { @@ -154,6 +160,27 @@ func RegisterFirecrackerService(srv *github_com_containerd_ttrpc.Server, svc Fir } return svc.UpdateBalloonStats(ctx, &req) }, + "LoadSnapshot": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req proto1.LoadSnapshotRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.LoadSnapshot(ctx, &req) + }, + "CreateSnapshot": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req proto1.CreateSnapshotRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.CreateSnapshot(ctx, &req) + }, + "Offload": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req proto1.OffloadRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.Offload(ctx, &req) + }, }) } @@ -262,3 +289,27 @@ func (c *firecrackerClient) UpdateBalloonStats(ctx context.Context, req *proto1. } return &resp, nil } + +func (c *firecrackerClient) LoadSnapshot(ctx context.Context, req *proto1.LoadSnapshotRequest) (*proto1.LoadResponse, error) { + var resp proto1.LoadResponse + if err := c.client.Call(ctx, "Firecracker", "LoadSnapshot", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *firecrackerClient) CreateSnapshot(ctx context.Context, req *proto1.CreateSnapshotRequest) (*empty.Empty, error) { + var resp empty.Empty + if err := c.client.Call(ctx, "Firecracker", "CreateSnapshot", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *firecrackerClient) Offload(ctx context.Context, req *proto1.OffloadRequest) (*empty.Empty, error) { + var resp empty.Empty + if err := c.client.Call(ctx, "Firecracker", "Offload", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} diff --git a/runtime/service.go b/runtime/service.go index 8f05ce2c4..5d6c6f648 100644 --- a/runtime/service.go +++ b/runtime/service.go @@ -14,12 +14,15 @@ package main import ( + "bytes" "context" "encoding/json" "fmt" "math" "net" + "net/http" "os" + "os/exec" "runtime/debug" "strconv" "strings" @@ -64,6 +67,7 @@ import ( drivemount "github.com/firecracker-microvm/firecracker-containerd/proto/service/drivemount/ttrpc" fccontrolTtrpc "github.com/firecracker-microvm/firecracker-containerd/proto/service/fccontrol/ttrpc" ioproxy "github.com/firecracker-microvm/firecracker-containerd/proto/service/ioproxy/ttrpc" + "github.com/tv42/httpunix" ) func init() { @@ -102,6 +106,13 @@ var ( _ shim.Init = NewService ) +type loadSnapReq struct { + SnapshotPath string `json:"snapshot_path"` + MemFilePath string `json:"mem_file_path"` + SendSockAddr string `json:"sock_file_path"` + EnableUserPageFaults bool `json:"enable_user_page_faults"` +} + // implements shimapi type service struct { taskManager vm.TaskManager @@ -157,6 +168,11 @@ type service struct { // fifos have stdio FIFOs containerd passed to the shim. The key is [taskID][execID]. fifos map[string]map[string]cio.Config fifosMu sync.Mutex + + // httpControlClient is to send pause/resume/snapshot commands to the microVM + httpControlClient *http.Client + firecrackerPid int + taskDrivePathOnHost string } func shimOpts(shimCtx context.Context) (*shim.Opts, error) { @@ -494,7 +510,11 @@ func (s *service) CreateVM(requestCtx context.Context, request *proto.CreateVMRe s.logger.WithError(err).Error("failed to publish start VM event") } - go s.monitorVMExit() + // Commented out because its execution cancels the shim, and + // it would get executed on Offload if we leave it, killing the shim, + // and making snapshots impossible. + //go s.monitorVMExit() + // let all the other methods know that the VM is ready for tasks close(s.vmReady) @@ -502,6 +522,8 @@ func (s *service) CreateVM(requestCtx context.Context, request *proto.CreateVMRe resp.MetricsFifoPath = s.machineConfig.MetricsFifo resp.LogFifoPath = s.machineConfig.LogFifo resp.SocketPath = s.shimDir.FirecrackerSockPath() + resp.FirecrackerPID = strconv.Itoa(s.firecrackerPid) + resp.UPFSockPath = s.shimDir.FirecrackerUPFSockPath() if c, ok := s.jailer.(cgroupPather); ok { resp.CgroupPath = c.CgroupPath() } @@ -620,7 +642,18 @@ func (s *service) createVM(requestCtx context.Context, request *proto.CreateVMRe return err } + s.createHTTPControlClient() + + pid, err := s.machine.PID() + if err != nil { + s.logger.WithError(err).Error("Failed to get PID of firecracker process") + return err + } + + s.firecrackerPid = pid + s.logger.Info("successfully started the VM") + return nil } @@ -657,42 +690,6 @@ func (s *service) StopVM(requestCtx context.Context, request *proto.StopVMReques return &empty.Empty{}, nil } -// ResumeVM resumes a VM -func (s *service) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*empty.Empty, error) { - defer logPanicAndDie(s.logger) - - err := s.waitVMReady() - if err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - if err := s.machine.ResumeVM(ctx); err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - return &empty.Empty{}, nil -} - -// PauseVM pauses a VM -func (s *service) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empty.Empty, error) { - defer logPanicAndDie(s.logger) - - err := s.waitVMReady() - if err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - if err := s.machine.PauseVM(ctx); err != nil { - s.logger.WithError(err).Error() - return nil, err - } - - return &empty.Empty{}, nil -} - // GetVMInfo returns metadata for the VM being managed by this shim. If the VM has not been created yet, this // method will wait for up to a hardcoded timeout for it to exist, returning an error if the timeout is reached. func (s *service) GetVMInfo(requestCtx context.Context, request *proto.GetVMInfoRequest) (*proto.GetVMInfoResponse, error) { @@ -1170,6 +1167,8 @@ func (s *service) Create(requestCtx context.Context, request *taskAPI.CreateTask } rootfsMnt := request.Rootfs[0] + s.taskDrivePathOnHost = rootfsMnt.Source + err = s.containerStubHandler.Reserve(requestCtx, request.ID, rootfsMnt.Source, vmBundleDir.RootfsPath(), "ext4", nil, s.driveMountClient, s.machine) if err != nil { @@ -1702,6 +1701,8 @@ func (s *service) cleanup() error { } // monitorVMExit watches the VM and cleanup resources when it terminates. +// Comment out because unused +/* func (s *service) monitorVMExit() { // Block until the VM exits if err := s.machine.Wait(s.shimCtx); err != nil && err != context.Canceled { @@ -1712,3 +1713,315 @@ func (s *service) monitorVMExit() { s.logger.WithError(err).Error("failed to clean up the VM") } } +*/ + +func (s *service) createHTTPControlClient() { + u := &httpunix.Transport{ + DialTimeout: 100 * time.Millisecond, + RequestTimeout: 10 * time.Second, + ResponseHeaderTimeout: 10 * time.Second, + } + u.RegisterLocation("firecracker", s.shimDir.FirecrackerSockPath()) + + t := &http.Transport{} + t.RegisterProtocol(httpunix.Scheme, u) + + var client = http.Client{ + Transport: t, + } + + s.httpControlClient = &client +} + +func formResumeReq() (*http.Request, error) { + var req *http.Request + + data := map[string]string{ + "state": "Resumed", + } + json, err := json.Marshal(data) + if err != nil { + logrus.WithError(err).Error("Failed to marshal json data") + return nil, err + } + + req, err = http.NewRequest("PATCH", "http+unix://firecracker/vm", bytes.NewBuffer(json)) + if err != nil { + logrus.WithError(err).Error("Failed to create new HTTP request in formResumeReq") + return nil, err + } + req.Header.Add("accept", "application/json") + req.Header.Add("Content-Type", "application/json") + + return req, nil +} + +func formPauseReq() (*http.Request, error) { + var req *http.Request + + data := map[string]string{ + "state": "Paused", + } + json, err := json.Marshal(data) + if err != nil { + logrus.WithError(err).Error("Failed to marshal json data") + return nil, err + } + + req, err = http.NewRequest("PATCH", "http+unix://firecracker/vm", bytes.NewBuffer(json)) + if err != nil { + logrus.WithError(err).Error("Failed to create new HTTP request in formPauseReq") + return nil, err + } + req.Header.Add("accept", "application/json") + req.Header.Add("Content-Type", "application/json") + + return req, nil +} + +func formLoadSnapReq(snapshotPath, memPath, sendSockAddr string, isUpf bool) (*http.Request, error) { + var req *http.Request + + data := loadSnapReq{ + SnapshotPath: snapshotPath, + MemFilePath: memPath, + SendSockAddr: sendSockAddr, + EnableUserPageFaults: isUpf, + } + + json, err := json.Marshal(data) + if err != nil { + logrus.WithError(err).Error("Failed to marshal json data") + return nil, err + } + + req, err = http.NewRequest("PUT", "http+unix://firecracker/snapshot/load", bytes.NewBuffer(json)) + if err != nil { + logrus.WithError(err).Error("Failed to create new HTTP request in formLoadSnapReq") + return nil, err + } + req.Header.Add("accept", "application/json") + req.Header.Add("Content-Type", "application/json") + + return req, nil +} + +func formCreateSnapReq(snapshotPath, memPath string) (*http.Request, error) { + var req *http.Request + + data := map[string]string{ + "snapshot_type": "Full", + "snapshot_path": snapshotPath, + "mem_file_path": memPath, + } + json, err := json.Marshal(data) + if err != nil { + logrus.WithError(err).Error("Failed to marshal json data") + return nil, err + } + + req, err = http.NewRequest("PUT", "http+unix://firecracker/snapshot/create", bytes.NewBuffer(json)) + if err != nil { + logrus.WithError(err).Error("Failed to create new HTTP request in formCreateSnapReq") + return nil, err + } + req.Header.Add("accept", "application/json") + req.Header.Add("Content-Type", "application/json") + + return req, nil +} + +func (s *service) startFirecrackerProcess() error { + firecPath, err := exec.LookPath("firecracker") + if err != nil { + logrus.WithError(err).Error("failed to look up firecracker binary") + return err + } + + // TODO: Remove hardcoding and make a parameter + logFilePath := fmt.Sprintf("/tmp/log_%s_after.logs", s.vmID) + if err := os.RemoveAll(logFilePath); err != nil { + s.logger.WithError(err).Errorf("Failed to delete %s", logFilePath) + return err + } + if _, err := os.OpenFile(logFilePath, os.O_RDONLY|os.O_CREATE, 0600); err != nil { + s.logger.WithError(err).Errorf("Failed to create %s", logFilePath) + return err + } + + args := []string{ + "--api-sock", s.shimDir.FirecrackerSockPath(), + "--log-path", logFilePath, + "--level", s.config.DebugHelper.GetFirecrackerLogLevel(), + "--show-level", + "--show-log-origin", + } + + firecrackerCmd := exec.Command(firecPath, args...) + firecrackerCmd.Dir = s.shimDir.RootPath() + + if err := firecrackerCmd.Start(); err != nil { + logrus.WithError(err).Error("Failed to start firecracker process") + } + + go firecrackerCmd.Wait() + + s.firecrackerPid = firecrackerCmd.Process.Pid + + return nil +} + +func (s *service) dialFirecrackerSocket() error { + for { + var d net.Dialer + ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) + defer cancel() + + c, err := d.DialContext(ctx, "unix", s.shimDir.FirecrackerSockPath()) + if err != nil { + if ctx.Err() != nil { + s.logger.WithError(ctx.Err()).Error("timed out while waiting for firecracker socket") + return ctx.Err() + } + + time.Sleep(1 * time.Millisecond) + continue + } + + c.Close() + + break + } + + return nil +} + +// PauseVM Pauses a VM +func (s *service) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empty.Empty, error) { + pauseReq, err := formPauseReq() + if err != nil { + s.logger.WithError(err).Error("Failed to create pause vm request") + return nil, err + } + + err = s.waitVMReady() + if err != nil { + return nil, err + } + + resp, err := s.httpControlClient.Do(pauseReq) + if err != nil { + s.logger.WithError(err).Error("Failed to send pause VM request") + return nil, err + } + if !strings.Contains(resp.Status, "204") { + s.logger.WithError(err).Error("Failed to pause VM") + return nil, errors.New("Failed to pause VM") + } + + return &empty.Empty{}, nil +} + +// ResumeVM Resumes a VM +func (s *service) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*empty.Empty, error) { + resumeReq, err := formResumeReq() + if err != nil { + s.logger.WithError(err).Error("Failed to create resume vm request") + return nil, err + } + + resp, err := s.httpControlClient.Do(resumeReq) + if err != nil { + s.logger.WithError(err).Error("Failed to send resume VM request") + return nil, err + } + if !strings.Contains(resp.Status, "204") { + s.logger.WithError(err).Error("Failed to resume VM") + return nil, errors.New("Failed to resume VM") + } + return &empty.Empty{}, nil +} + +// LoadSnapshot Loads a VM from a snapshot +func (s *service) LoadSnapshot(ctx context.Context, req *proto.LoadSnapshotRequest) (*proto.LoadResponse, error) { + if err := s.startFirecrackerProcess(); err != nil { + s.logger.WithError(err).Error("startFirecrackerProcess returned an error") + return nil, err + } + + if err := s.dialFirecrackerSocket(); err != nil { + s.logger.WithError(err).Error("Failed to wait for firecracker socket") + } + s.createHTTPControlClient() + + sendSockAddr := s.shimDir.FirecrackerUPFSockPath() + if !req.EnableUserPF { + sendSockAddr = "dummy" + } + + loadSnapReq, err := formLoadSnapReq(req.SnapshotFilePath, req.MemFilePath, sendSockAddr, req.EnableUserPF) + if err != nil { + s.logger.WithError(err).Error("Failed to create load snapshot request") + return nil, err + } + + resp, err := s.httpControlClient.Do(loadSnapReq) + if err != nil { + s.logger.WithError(err).Error("Failed to send load snapshot request") + return nil, err + } + if !strings.Contains(resp.Status, "204") { + s.logger.WithError(err).Error("Failed to load VM from snapshot") + s.logger.WithError(err).Errorf("Status of request: %s", resp.Status) + return nil, errors.New("Failed to load VM from snapshot") + } + + return &proto.LoadResponse{FirecrackerPID: strconv.Itoa(s.firecrackerPid)}, nil +} + +// CreateSnapshot Creates a snapshot of a VM +func (s *service) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotRequest) (*empty.Empty, error) { + createSnapReq, err := formCreateSnapReq(req.SnapshotFilePath, req.MemFilePath) + if err != nil { + s.logger.WithError(err).Error("Failed to create make snapshot request") + return nil, err + } + + resp, err := s.httpControlClient.Do(createSnapReq) + if err != nil { + s.logger.WithError(err).Error("Failed to send make snapshot request") + return nil, err + } + if !strings.Contains(resp.Status, "204") { + s.logger.WithError(err).Error("Failed to make snapshot of VM") + return nil, errors.New("Failed to make snapshot of VM") + } + + return &empty.Empty{}, nil +} + +// Offload Shuts down a VM and deletes the corresponding firecracker socket +// and vsock. All of the other resources will persist +func (s *service) Offload(ctx context.Context, req *proto.OffloadRequest) (*empty.Empty, error) { + if err := syscall.Kill(s.firecrackerPid, 9); err != nil { + s.logger.WithError(err).Error("Failed to kill firecracker process") + return nil, err + } + + if err := os.RemoveAll(s.shimDir.FirecrackerSockPath()); err != nil { + s.logger.WithError(err).Error("Failed to delete firecracker socket") + return nil, err + } + + if err := os.RemoveAll(s.shimDir.FirecrackerVSockPath()); err != nil { + s.logger.WithError(err).Error("Failed to delete firecracker vsock") + return nil, err + } + + if err := os.RemoveAll(s.shimDir.FirecrackerUPFSockPath()); err != nil { + s.logger.WithError(err).Error("Failed to delete firecracker UPF socket") + return nil, err + } + + return &empty.Empty{}, nil +}