An open-source, faster Devin alternative
TypeScript
live migration wip
Brian Reardon9998c83a3571
diff --git a/cmd/worker/main.go b/cmd/worker/main.goindex d2189606..2c696eea 100644--- a/cmd/worker/main.go+++ b/cmd/worker/main.go@@ -264,6 +264,11 @@ func main() {// gRPC server (nil builder — template building via podman not needed for QEMU)grpcServer := worker.NewGRPCServer(mgr, ptyMgr, execMgr, sandboxDBMgr, checkpointStore, sbRouter, nil, store)+ // Wire up live migration if using QEMU manager+ if migrator, ok := mgr.(worker.LiveMigrator); ok {+ grpcServer.SetMigrator(migrator)+ log.Println("opensandbox-worker: live migration enabled")+ }grpcAddr := ":9090"log.Printf("opensandbox-worker: starting gRPC server on %s", grpcAddr)go func() {diff --git a/internal/api/router.go b/internal/api/router.goindex 84f886e9..4f3a023b 100644--- a/internal/api/router.go+++ b/internal/api/router.go@@ -155,6 +155,9 @@ func NewServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string, oapi.POST("/sandboxes/:id/hibernate", s.hibernateSandbox)api.POST("/sandboxes/:id/wake", s.wakeSandbox)+ // Live migration+ api.POST("/sandboxes/:id/migrate", s.migrateSandbox)+// Resource limitsapi.PUT("/sandboxes/:id/limits", s.setLimits)api.POST("/sandboxes/:id/scale", s.scaleSandbox)diff --git a/internal/api/sandbox.go b/internal/api/sandbox.goindex bb482065..0436e827 100644--- a/internal/api/sandbox.go+++ b/internal/api/sandbox.go@@ -607,6 +607,99 @@ func (s *Server) setTimeout(c echo.Context) error {return c.NoContent(http.StatusNoContent)}+// migrateSandbox performs live migration of a sandbox to a different worker.+// POST /api/sandboxes/:id/migrate {"targetWorker": "w-azure-osb-worker-xxx"}+func (s *Server) migrateSandbox(c echo.Context) error {+ id := c.Param("id")+ ctx := c.Request().Context()++ var req struct {+ TargetWorker string `json:"targetWorker"`+ }+ if err := c.Bind(&req); err != nil || req.TargetWorker == "" {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "targetWorker is required"})+ }++ if s.workerRegistry == nil || s.store == nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": "migration requires server mode with worker registry"})+ }++ // Look up sandbox to find source worker+ session, err := s.store.GetSandboxSession(ctx, id)+ if err != nil {+ return c.JSON(http.StatusNotFound, map[string]string{"error": "sandbox not found"})+ }+ if session.Status != "running" {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "sandbox must be running to migrate"})+ }++ // Get source and target worker gRPC clients+ sourceClient, err := s.workerRegistry.GetWorkerClient(session.WorkerID)+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": "source worker unreachable: " + err.Error()})+ }+ targetClient, err := s.workerRegistry.GetWorkerClient(req.TargetWorker)+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": "target worker unreachable: " + err.Error()})+ }++ t0 := time.Now()++ // Step 1: Prepare target worker — starts QEMU with -incoming tcp+ // Use session config for VM parameters. Drives are created fresh on target;+ // memory contents (including filesystem cache) migrate via QMP tcp.+ prepCtx, prepCancel := context.WithTimeout(ctx, 2*time.Minute)+ defer prepCancel()+ prepResp, err := targetClient.PrepareMigrationIncoming(prepCtx, &pb.PrepareMigrationIncomingRequest{+ SandboxId: id,+ CpuCount: 1,+ MemoryMb: 1024,+ GuestPort: 80,+ Template: session.Template,+ })+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{"error": "prepare target: " + err.Error()})+ }++ log.Printf("migrate %s: target prepared at %s (host port %d)", id, prepResp.IncomingAddr, prepResp.HostPort)++ // Step 3: Live migrate from source to target+ migrateCtx, migrateCancel := context.WithTimeout(ctx, 5*time.Minute)+ defer migrateCancel()+ _, err = sourceClient.LiveMigrate(migrateCtx, &pb.LiveMigrateRequest{+ SandboxId: id,+ IncomingAddr: prepResp.IncomingAddr,+ })+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{"error": "live migrate: " + err.Error()})+ }++ log.Printf("migrate %s: QMP migration complete (%dms)", id, time.Since(t0).Milliseconds())++ // Step 4: Complete migration on target (reconnect agent, patch network)+ completeCtx, completeCancel := context.WithTimeout(ctx, 30*time.Second)+ defer completeCancel()+ _, err = targetClient.CompleteMigrationIncoming(completeCtx, &pb.CompleteMigrationIncomingRequest{+ SandboxId: id,+ })+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{"error": "complete migration: " + err.Error()})+ }++ // Step 5: Update DB — sandbox now on target worker+ _, _ = s.store.Pool().Exec(ctx, "UPDATE sandbox_sessions SET worker_id = $1 WHERE sandbox_id = $2", req.TargetWorker, id)++ elapsed := time.Since(t0).Milliseconds()+ log.Printf("migrate %s: complete in %dms (source=%s target=%s)", id, elapsed, session.WorkerID, req.TargetWorker)++ return c.JSON(http.StatusOK, map[string]interface{}{+ "sandboxID": id,+ "sourceWorker": session.WorkerID,+ "targetWorker": req.TargetWorker,+ "elapsedMs": elapsed,+ })+}+func (s *Server) setLimits(c echo.Context) error {id := c.Param("id")ctx := c.Request().Context()diff --git a/internal/qemu/migration.go b/internal/qemu/migration.goindex 15788ed0..5e1b6ff1 100644--- a/internal/qemu/migration.go+++ b/internal/qemu/migration.go@@ -359,6 +359,15 @@ func (m *Manager) CompleteIncomingMigration(ctx context.Context, sandboxID strinreturn nil}+// LiveMigrate on Manager delegates to a MigrationCoordinator.+func (m *Manager) LiveMigrate(ctx context.Context, sandboxID, incomingAddr string) error {+ mc := &MigrationCoordinator{+ manager: m,+ migrations: make(map[string]*MigrationState),+ }+ return mc.LiveMigrate(ctx, sandboxID, incomingAddr)+}+// uploadFile uploads a local file to S3.func (mc *MigrationCoordinator) uploadFile(ctx context.Context, localPath, s3Key string) (int64, error) {info, err := os.Stat(localPath)diff --git a/internal/worker/grpc_server.go b/internal/worker/grpc_server.goindex c249f98b..d06d4921 100644--- a/internal/worker/grpc_server.go+++ b/internal/worker/grpc_server.go@@ -28,9 +28,17 @@ import ()// GRPCServer implements the SandboxWorker gRPC service for control plane communication.+// LiveMigrator is implemented by VM managers that support live migration (e.g. QEMU).+type LiveMigrator interface {+ PrepareIncomingMigration(ctx context.Context, sandboxID, rootfsPath, workspacePath string, cpus, memMB, guestPort int, template string) (incomingAddr string, hostPort int, err error)+ CompleteIncomingMigration(ctx context.Context, sandboxID string) error+ LiveMigrate(ctx context.Context, sandboxID, incomingAddr string) error+}+type GRPCServer struct {pb.UnimplementedSandboxWorkerServermanager sandbox.Manager+ migrator LiveMigrator // optional, set if manager supports live migrationrouter *sandbox.SandboxRouterptyManager *sandbox.PTYManagerexecSessionManager *sandbox.ExecSessionManager@@ -824,6 +832,47 @@ func (s *GRPCServer) SetSandboxLimits(ctx context.Context, req *pb.SetSandboxLimreturn &pb.SetSandboxLimitsResponse{}, nil}+// SetMigrator sets the live migration handler (call after NewGRPCServer if the manager supports it).+func (s *GRPCServer) SetMigrator(m LiveMigrator) {+ s.migrator = m+}++func (s *GRPCServer) PrepareMigrationIncoming(ctx context.Context, req *pb.PrepareMigrationIncomingRequest) (*pb.PrepareMigrationIncomingResponse, error) {+ if s.migrator == nil {+ return nil, fmt.Errorf("live migration not supported on this worker")+ }+ addr, hostPort, err := s.migrator.PrepareIncomingMigration(ctx,+ req.SandboxId, req.RootfsPath, req.WorkspacePath,+ int(req.CpuCount), int(req.MemoryMb), int(req.GuestPort), req.Template)+ if err != nil {+ return nil, fmt.Errorf("prepare incoming migration: %w", err)+ }+ return &pb.PrepareMigrationIncomingResponse{+ IncomingAddr: addr,+ HostPort: int32(hostPort),+ }, nil+}++func (s *GRPCServer) LiveMigrate(ctx context.Context, req *pb.LiveMigrateRequest) (*pb.LiveMigrateResponse, error) {+ if s.migrator == nil {+ return nil, fmt.Errorf("live migration not supported on this worker")+ }+ if err := s.migrator.LiveMigrate(ctx, req.SandboxId, req.IncomingAddr); err != nil {+ return nil, fmt.Errorf("live migrate: %w", err)+ }+ return &pb.LiveMigrateResponse{}, nil+}++func (s *GRPCServer) CompleteMigrationIncoming(ctx context.Context, req *pb.CompleteMigrationIncomingRequest) (*pb.CompleteMigrationIncomingResponse, error) {+ if s.migrator == nil {+ return nil, fmt.Errorf("live migration not supported on this worker")+ }+ if err := s.migrator.CompleteIncomingMigration(ctx, req.SandboxId); err != nil {+ return nil, fmt.Errorf("complete incoming migration: %w", err)+ }+ return &pb.CompleteMigrationIncomingResponse{}, nil+}+func (s *GRPCServer) GetSandboxStats(ctx context.Context, req *pb.GetSandboxStatsRequest) (*pb.GetSandboxStatsResponse, error) {stats, err := s.manager.Stats(ctx, req.SandboxId)if err != nil {diff --git a/proto/worker/worker.pb.go b/proto/worker/worker.pb.goindex c2796429..973d0dee 100644--- a/proto/worker/worker.pb.go+++ b/proto/worker/worker.pb.go@@ -2710,6 +2710,319 @@ func (*SetSandboxLimitsResponse) Descriptor() ([]byte, []int) {return file_proto_worker_worker_proto_rawDescGZIP(), []int{45}}+// Live migration messages+type PrepareMigrationIncomingRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ SandboxId string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`+ RootfsPath string `protobuf:"bytes,2,opt,name=rootfs_path,json=rootfsPath,proto3" json:"rootfs_path,omitempty"` // local path to rootfs on target (pre-copied)+ WorkspacePath string `protobuf:"bytes,3,opt,name=workspace_path,json=workspacePath,proto3" json:"workspace_path,omitempty"` // local path to workspace on target (pre-copied)+ CpuCount int32 `protobuf:"varint,4,opt,name=cpu_count,json=cpuCount,proto3" json:"cpu_count,omitempty"`+ MemoryMb int32 `protobuf:"varint,5,opt,name=memory_mb,json=memoryMb,proto3" json:"memory_mb,omitempty"`+ GuestPort int32 `protobuf:"varint,6,opt,name=guest_port,json=guestPort,proto3" json:"guest_port,omitempty"`+ Template string `protobuf:"bytes,7,opt,name=template,proto3" json:"template,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *PrepareMigrationIncomingRequest) Reset() {+ *x = PrepareMigrationIncomingRequest{}+ mi := &file_proto_worker_worker_proto_msgTypes[46]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *PrepareMigrationIncomingRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PrepareMigrationIncomingRequest) ProtoMessage() {}++func (x *PrepareMigrationIncomingRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[46]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PrepareMigrationIncomingRequest.ProtoReflect.Descriptor instead.+func (*PrepareMigrationIncomingRequest) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{46}+}++func (x *PrepareMigrationIncomingRequest) GetSandboxId() string {+ if x != nil {+ return x.SandboxId+ }+ return ""+}++func (x *PrepareMigrationIncomingRequest) GetRootfsPath() string {+ if x != nil {+ return x.RootfsPath+ }+ return ""+}++func (x *PrepareMigrationIncomingRequest) GetWorkspacePath() string {+ if x != nil {+ return x.WorkspacePath+ }+ return ""+}++func (x *PrepareMigrationIncomingRequest) GetCpuCount() int32 {+ if x != nil {+ return x.CpuCount+ }+ return 0+}++func (x *PrepareMigrationIncomingRequest) GetMemoryMb() int32 {+ if x != nil {+ return x.MemoryMb+ }+ return 0+}++func (x *PrepareMigrationIncomingRequest) GetGuestPort() int32 {+ if x != nil {+ return x.GuestPort+ }+ return 0+}++func (x *PrepareMigrationIncomingRequest) GetTemplate() string {+ if x != nil {+ return x.Template+ }+ return ""+}++type PrepareMigrationIncomingResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ IncomingAddr string `protobuf:"bytes,1,opt,name=incoming_addr,json=incomingAddr,proto3" json:"incoming_addr,omitempty"` // TCP address for source to migrate to (e.g. "10.100.1.7:49152")+ HostPort int32 `protobuf:"varint,2,opt,name=host_port,json=hostPort,proto3" json:"host_port,omitempty"` // mapped host port on target worker+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *PrepareMigrationIncomingResponse) Reset() {+ *x = PrepareMigrationIncomingResponse{}+ mi := &file_proto_worker_worker_proto_msgTypes[47]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *PrepareMigrationIncomingResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*PrepareMigrationIncomingResponse) ProtoMessage() {}++func (x *PrepareMigrationIncomingResponse) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[47]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use PrepareMigrationIncomingResponse.ProtoReflect.Descriptor instead.+func (*PrepareMigrationIncomingResponse) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{47}+}++func (x *PrepareMigrationIncomingResponse) GetIncomingAddr() string {+ if x != nil {+ return x.IncomingAddr+ }+ return ""+}++func (x *PrepareMigrationIncomingResponse) GetHostPort() int32 {+ if x != nil {+ return x.HostPort+ }+ return 0+}++type LiveMigrateRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ SandboxId string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`+ IncomingAddr string `protobuf:"bytes,2,opt,name=incoming_addr,json=incomingAddr,proto3" json:"incoming_addr,omitempty"` // TCP address from PrepareMigrationIncoming+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *LiveMigrateRequest) Reset() {+ *x = LiveMigrateRequest{}+ mi := &file_proto_worker_worker_proto_msgTypes[48]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *LiveMigrateRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*LiveMigrateRequest) ProtoMessage() {}++func (x *LiveMigrateRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[48]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use LiveMigrateRequest.ProtoReflect.Descriptor instead.+func (*LiveMigrateRequest) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{48}+}++func (x *LiveMigrateRequest) GetSandboxId() string {+ if x != nil {+ return x.SandboxId+ }+ return ""+}++func (x *LiveMigrateRequest) GetIncomingAddr() string {+ if x != nil {+ return x.IncomingAddr+ }+ return ""+}++type LiveMigrateResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *LiveMigrateResponse) Reset() {+ *x = LiveMigrateResponse{}+ mi := &file_proto_worker_worker_proto_msgTypes[49]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *LiveMigrateResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*LiveMigrateResponse) ProtoMessage() {}++func (x *LiveMigrateResponse) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[49]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use LiveMigrateResponse.ProtoReflect.Descriptor instead.+func (*LiveMigrateResponse) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{49}+}++type CompleteMigrationIncomingRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ SandboxId string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *CompleteMigrationIncomingRequest) Reset() {+ *x = CompleteMigrationIncomingRequest{}+ mi := &file_proto_worker_worker_proto_msgTypes[50]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *CompleteMigrationIncomingRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*CompleteMigrationIncomingRequest) ProtoMessage() {}++func (x *CompleteMigrationIncomingRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[50]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use CompleteMigrationIncomingRequest.ProtoReflect.Descriptor instead.+func (*CompleteMigrationIncomingRequest) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{50}+}++func (x *CompleteMigrationIncomingRequest) GetSandboxId() string {+ if x != nil {+ return x.SandboxId+ }+ return ""+}++type CompleteMigrationIncomingResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *CompleteMigrationIncomingResponse) Reset() {+ *x = CompleteMigrationIncomingResponse{}+ mi := &file_proto_worker_worker_proto_msgTypes[51]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *CompleteMigrationIncomingResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*CompleteMigrationIncomingResponse) ProtoMessage() {}++func (x *CompleteMigrationIncomingResponse) ProtoReflect() protoreflect.Message {+ mi := &file_proto_worker_worker_proto_msgTypes[51]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use CompleteMigrationIncomingResponse.ProtoReflect.Descriptor instead.+func (*CompleteMigrationIncomingResponse) Descriptor() ([]byte, []int) {+ return file_proto_worker_worker_proto_rawDescGZIP(), []int{51}+}+var File_proto_worker_worker_proto protoreflect.FileDescriptorconst file_proto_worker_worker_proto_rawDesc = "" +@@ -2935,7 +3248,30 @@ const file_proto_worker_worker_proto_rawDesc = "" +"\fcpu_max_usec\x18\x04 \x01(\x03R\n" +"cpuMaxUsec\x12&\n" +"\x0fcpu_period_usec\x18\x05 \x01(\x03R\rcpuPeriodUsec\"\x1a\n" +- "\x18SetSandboxLimitsResponse2\xa6\r\n" ++ "\x18SetSandboxLimitsResponse\"\xfd\x01\n" ++ "\x1fPrepareMigrationIncomingRequest\x12\x1d\n" ++ "\n" ++ "sandbox_id\x18\x01 \x01(\tR\tsandboxId\x12\x1f\n" ++ "\vrootfs_path\x18\x02 \x01(\tR\n" ++ "rootfsPath\x12%\n" ++ "\x0eworkspace_path\x18\x03 \x01(\tR\rworkspacePath\x12\x1b\n" ++ "\tcpu_count\x18\x04 \x01(\x05R\bcpuCount\x12\x1b\n" ++ "\tmemory_mb\x18\x05 \x01(\x05R\bmemoryMb\x12\x1d\n" ++ "\n" ++ "guest_port\x18\x06 \x01(\x05R\tguestPort\x12\x1a\n" ++ "\btemplate\x18\a \x01(\tR\btemplate\"d\n" ++ " PrepareMigrationIncomingResponse\x12#\n" ++ "\rincoming_addr\x18\x01 \x01(\tR\fincomingAddr\x12\x1b\n" ++ "\thost_port\x18\x02 \x01(\x05R\bhostPort\"X\n" ++ "\x12LiveMigrateRequest\x12\x1d\n" ++ "\n" ++ "sandbox_id\x18\x01 \x01(\tR\tsandboxId\x12#\n" ++ "\rincoming_addr\x18\x02 \x01(\tR\fincomingAddr\"\x15\n" ++ "\x13LiveMigrateResponse\"A\n" ++ " CompleteMigrationIncomingRequest\x12\x1d\n" ++ "\n" ++ "sandbox_id\x18\x01 \x01(\tR\tsandboxId\"#\n" ++ "!CompleteMigrationIncomingResponse2\xcf\x0f\n" +"\rSandboxWorker\x12L\n" +"\rCreateSandbox\x12\x1c.worker.CreateSandboxRequest\x1a\x1d.worker.CreateSandboxResponse\x12O\n" +"\x0eDestroySandbox\x12\x1d.worker.DestroySandboxRequest\x1a\x1e.worker.DestroySandboxResponse\x12C\n" +@@ -2959,7 +3295,10 @@ const file_proto_worker_worker_proto_rawDesc = "" +"\x11RestoreCheckpoint\x12 .worker.RestoreCheckpointRequest\x1a!.worker.RestoreCheckpointResponse\x12L\n" +"\rBuildTemplate\x12\x1c.worker.BuildTemplateRequest\x1a\x1d.worker.BuildTemplateResponse\x12R\n" +"\x0fGetSandboxStats\x12\x1e.worker.GetSandboxStatsRequest\x1a\x1f.worker.GetSandboxStatsResponse\x12U\n" +- "\x10SetSandboxLimits\x12\x1f.worker.SetSandboxLimitsRequest\x1a .worker.SetSandboxLimitsResponseB1Z/github.com/opensandbox/opensandbox/proto/workerb\x06proto3"+ "\x10SetSandboxLimits\x12\x1f.worker.SetSandboxLimitsRequest\x1a .worker.SetSandboxLimitsResponse\x12m\n" ++ "\x18PrepareMigrationIncoming\x12'.worker.PrepareMigrationIncomingRequest\x1a(.worker.PrepareMigrationIncomingResponse\x12F\n" ++ "\vLiveMigrate\x12\x1a.worker.LiveMigrateRequest\x1a\x1b.worker.LiveMigrateResponse\x12p\n" ++ "\x19CompleteMigrationIncoming\x12(.worker.CompleteMigrationIncomingRequest\x1a).worker.CompleteMigrationIncomingResponseB1Z/github.com/opensandbox/opensandbox/proto/workerb\x06proto3"var (file_proto_worker_worker_proto_rawDescOnce sync.Once@@ -2974,69 +3313,75 @@ func file_proto_worker_worker_proto_rawDescGZIP() []byte {}var file_proto_worker_worker_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_proto_worker_worker_proto_msgTypes = make([]protoimpl.MessageInfo, 50)+var file_proto_worker_worker_proto_msgTypes = make([]protoimpl.MessageInfo, 56)var file_proto_worker_worker_proto_goTypes = []any{- (ExecOutputChunk_Stream)(0), // 0: worker.ExecOutputChunk.Stream- (*CreateSandboxRequest)(nil), // 1: worker.CreateSandboxRequest- (*CreateSandboxResponse)(nil), // 2: worker.CreateSandboxResponse- (*DestroySandboxRequest)(nil), // 3: worker.DestroySandboxRequest- (*DestroySandboxResponse)(nil), // 4: worker.DestroySandboxResponse- (*GetSandboxRequest)(nil), // 5: worker.GetSandboxRequest- (*GetSandboxResponse)(nil), // 6: worker.GetSandboxResponse- (*ListSandboxesRequest)(nil), // 7: worker.ListSandboxesRequest- (*ListSandboxesResponse)(nil), // 8: worker.ListSandboxesResponse- (*ExecCommandRequest)(nil), // 9: worker.ExecCommandRequest- (*ExecCommandResponse)(nil), // 10: worker.ExecCommandResponse- (*ExecOutputChunk)(nil), // 11: worker.ExecOutputChunk- (*ReadFileRequest)(nil), // 12: worker.ReadFileRequest- (*ReadFileResponse)(nil), // 13: worker.ReadFileResponse- (*WriteFileRequest)(nil), // 14: worker.WriteFileRequest- (*WriteFileResponse)(nil), // 15: worker.WriteFileResponse- (*ListDirRequest)(nil), // 16: worker.ListDirRequest- (*DirEntry)(nil), // 17: worker.DirEntry- (*ListDirResponse)(nil), // 18: worker.ListDirResponse- (*CreatePTYRequest)(nil), // 19: worker.CreatePTYRequest- (*CreatePTYResponse)(nil), // 20: worker.CreatePTYResponse- (*PTYInput)(nil), // 21: worker.PTYInput- (*PTYResize)(nil), // 22: worker.PTYResize- (*PTYOutput)(nil), // 23: worker.PTYOutput- (*HibernateSandboxRequest)(nil), // 24: worker.HibernateSandboxRequest- (*HibernateSandboxResponse)(nil), // 25: worker.HibernateSandboxResponse- (*WakeSandboxRequest)(nil), // 26: worker.WakeSandboxRequest- (*WakeSandboxResponse)(nil), // 27: worker.WakeSandboxResponse- (*SaveAsTemplateRequest)(nil), // 28: worker.SaveAsTemplateRequest- (*SaveAsTemplateResponse)(nil), // 29: worker.SaveAsTemplateResponse- (*BuildTemplateRequest)(nil), // 30: worker.BuildTemplateRequest- (*BuildTemplateResponse)(nil), // 31: worker.BuildTemplateResponse- (*ExecSessionCreateRequest)(nil), // 32: worker.ExecSessionCreateRequest- (*ExecSessionCreateResponse)(nil), // 33: worker.ExecSessionCreateResponse- (*ExecSessionListRequest)(nil), // 34: worker.ExecSessionListRequest- (*ExecSessionListResponse)(nil), // 35: worker.ExecSessionListResponse- (*ExecSessionInfoEntry)(nil), // 36: worker.ExecSessionInfoEntry- (*ExecSessionKillRequest)(nil), // 37: worker.ExecSessionKillRequest- (*ExecSessionKillResponse)(nil), // 38: worker.ExecSessionKillResponse- (*GetSandboxStatsRequest)(nil), // 39: worker.GetSandboxStatsRequest- (*GetSandboxStatsResponse)(nil), // 40: worker.GetSandboxStatsResponse- (*CreateCheckpointRequest)(nil), // 41: worker.CreateCheckpointRequest- (*CreateCheckpointResponse)(nil), // 42: worker.CreateCheckpointResponse- (*RestoreCheckpointRequest)(nil), // 43: worker.RestoreCheckpointRequest- (*RestoreCheckpointResponse)(nil), // 44: worker.RestoreCheckpointResponse- (*SetSandboxLimitsRequest)(nil), // 45: worker.SetSandboxLimitsRequest- (*SetSandboxLimitsResponse)(nil), // 46: worker.SetSandboxLimitsResponse- nil, // 47: worker.CreateSandboxRequest.EnvsEntry- nil, // 48: worker.CreateSandboxRequest.SecretAllowedHostsEntry- nil, // 49: worker.ExecCommandRequest.EnvsEntry- nil, // 50: worker.ExecSessionCreateRequest.EnvsEntry+ (ExecOutputChunk_Stream)(0), // 0: worker.ExecOutputChunk.Stream+ (*CreateSandboxRequest)(nil), // 1: worker.CreateSandboxRequest+ (*CreateSandboxResponse)(nil), // 2: worker.CreateSandboxResponse+ (*DestroySandboxRequest)(nil), // 3: worker.DestroySandboxRequest+ (*DestroySandboxResponse)(nil), // 4: worker.DestroySandboxResponse+ (*GetSandboxRequest)(nil), // 5: worker.GetSandboxRequest+ (*GetSandboxResponse)(nil), // 6: worker.GetSandboxResponse+ (*ListSandboxesRequest)(nil), // 7: worker.ListSandboxesRequest+ (*ListSandboxesResponse)(nil), // 8: worker.ListSandboxesResponse+ (*ExecCommandRequest)(nil), // 9: worker.ExecCommandRequest+ (*ExecCommandResponse)(nil), // 10: worker.ExecCommandResponse+ (*ExecOutputChunk)(nil), // 11: worker.ExecOutputChunk+ (*ReadFileRequest)(nil), // 12: worker.ReadFileRequest+ (*ReadFileResponse)(nil), // 13: worker.ReadFileResponse+ (*WriteFileRequest)(nil), // 14: worker.WriteFileRequest+ (*WriteFileResponse)(nil), // 15: worker.WriteFileResponse+ (*ListDirRequest)(nil), // 16: worker.ListDirRequest+ (*DirEntry)(nil), // 17: worker.DirEntry+ (*ListDirResponse)(nil), // 18: worker.ListDirResponse+ (*CreatePTYRequest)(nil), // 19: worker.CreatePTYRequest+ (*CreatePTYResponse)(nil), // 20: worker.CreatePTYResponse+ (*PTYInput)(nil), // 21: worker.PTYInput+ (*PTYResize)(nil), // 22: worker.PTYResize+ (*PTYOutput)(nil), // 23: worker.PTYOutput+ (*HibernateSandboxRequest)(nil), // 24: worker.HibernateSandboxRequest+ (*HibernateSandboxResponse)(nil), // 25: worker.HibernateSandboxResponse+ (*WakeSandboxRequest)(nil), // 26: worker.WakeSandboxRequest+ (*WakeSandboxResponse)(nil), // 27: worker.WakeSandboxResponse+ (*SaveAsTemplateRequest)(nil), // 28: worker.SaveAsTemplateRequest+ (*SaveAsTemplateResponse)(nil), // 29: worker.SaveAsTemplateResponse+ (*BuildTemplateRequest)(nil), // 30: worker.BuildTemplateRequest+ (*BuildTemplateResponse)(nil), // 31: worker.BuildTemplateResponse+ (*ExecSessionCreateRequest)(nil), // 32: worker.ExecSessionCreateRequest+ (*ExecSessionCreateResponse)(nil), // 33: worker.ExecSessionCreateResponse+ (*ExecSessionListRequest)(nil), // 34: worker.ExecSessionListRequest+ (*ExecSessionListResponse)(nil), // 35: worker.ExecSessionListResponse+ (*ExecSessionInfoEntry)(nil), // 36: worker.ExecSessionInfoEntry+ (*ExecSessionKillRequest)(nil), // 37: worker.ExecSessionKillRequest+ (*ExecSessionKillResponse)(nil), // 38: worker.ExecSessionKillResponse+ (*GetSandboxStatsRequest)(nil), // 39: worker.GetSandboxStatsRequest+ (*GetSandboxStatsResponse)(nil), // 40: worker.GetSandboxStatsResponse+ (*CreateCheckpointRequest)(nil), // 41: worker.CreateCheckpointRequest+ (*CreateCheckpointResponse)(nil), // 42: worker.CreateCheckpointResponse+ (*RestoreCheckpointRequest)(nil), // 43: worker.RestoreCheckpointRequest+ (*RestoreCheckpointResponse)(nil), // 44: worker.RestoreCheckpointResponse+ (*SetSandboxLimitsRequest)(nil), // 45: worker.SetSandboxLimitsRequest+ (*SetSandboxLimitsResponse)(nil), // 46: worker.SetSandboxLimitsResponse+ (*PrepareMigrationIncomingRequest)(nil), // 47: worker.PrepareMigrationIncomingRequest+ (*PrepareMigrationIncomingResponse)(nil), // 48: worker.PrepareMigrationIncomingResponse+ (*LiveMigrateRequest)(nil), // 49: worker.LiveMigrateRequest+ (*LiveMigrateResponse)(nil), // 50: worker.LiveMigrateResponse+ (*CompleteMigrationIncomingRequest)(nil), // 51: worker.CompleteMigrationIncomingRequest+ (*CompleteMigrationIncomingResponse)(nil), // 52: worker.CompleteMigrationIncomingResponse+ nil, // 53: worker.CreateSandboxRequest.EnvsEntry+ nil, // 54: worker.CreateSandboxRequest.SecretAllowedHostsEntry+ nil, // 55: worker.ExecCommandRequest.EnvsEntry+ nil, // 56: worker.ExecSessionCreateRequest.EnvsEntry}var file_proto_worker_worker_proto_depIdxs = []int32{- 47, // 0: worker.CreateSandboxRequest.envs:type_name -> worker.CreateSandboxRequest.EnvsEntry- 48, // 1: worker.CreateSandboxRequest.secret_allowed_hosts:type_name -> worker.CreateSandboxRequest.SecretAllowedHostsEntry+ 53, // 0: worker.CreateSandboxRequest.envs:type_name -> worker.CreateSandboxRequest.EnvsEntry+ 54, // 1: worker.CreateSandboxRequest.secret_allowed_hosts:type_name -> worker.CreateSandboxRequest.SecretAllowedHostsEntry6, // 2: worker.ListSandboxesResponse.sandboxes:type_name -> worker.GetSandboxResponse- 49, // 3: worker.ExecCommandRequest.envs:type_name -> worker.ExecCommandRequest.EnvsEntry+ 55, // 3: worker.ExecCommandRequest.envs:type_name -> worker.ExecCommandRequest.EnvsEntry0, // 4: worker.ExecOutputChunk.stream:type_name -> worker.ExecOutputChunk.Stream17, // 5: worker.ListDirResponse.entries:type_name -> worker.DirEntry22, // 6: worker.PTYInput.resize:type_name -> worker.PTYResize- 50, // 7: worker.ExecSessionCreateRequest.envs:type_name -> worker.ExecSessionCreateRequest.EnvsEntry+ 56, // 7: worker.ExecSessionCreateRequest.envs:type_name -> worker.ExecSessionCreateRequest.EnvsEntry36, // 8: worker.ExecSessionListResponse.sessions:type_name -> worker.ExecSessionInfoEntry1, // 9: worker.SandboxWorker.CreateSandbox:input_type -> worker.CreateSandboxRequest3, // 10: worker.SandboxWorker.DestroySandbox:input_type -> worker.DestroySandboxRequest@@ -3060,30 +3405,36 @@ var file_proto_worker_worker_proto_depIdxs = []int32{30, // 28: worker.SandboxWorker.BuildTemplate:input_type -> worker.BuildTemplateRequest39, // 29: worker.SandboxWorker.GetSandboxStats:input_type -> worker.GetSandboxStatsRequest45, // 30: worker.SandboxWorker.SetSandboxLimits:input_type -> worker.SetSandboxLimitsRequest- 2, // 31: worker.SandboxWorker.CreateSandbox:output_type -> worker.CreateSandboxResponse- 4, // 32: worker.SandboxWorker.DestroySandbox:output_type -> worker.DestroySandboxResponse- 6, // 33: worker.SandboxWorker.GetSandbox:output_type -> worker.GetSandboxResponse- 8, // 34: worker.SandboxWorker.ListSandboxes:output_type -> worker.ListSandboxesResponse- 10, // 35: worker.SandboxWorker.ExecCommand:output_type -> worker.ExecCommandResponse- 11, // 36: worker.SandboxWorker.ExecCommandStream:output_type -> worker.ExecOutputChunk- 13, // 37: worker.SandboxWorker.ReadFile:output_type -> worker.ReadFileResponse- 15, // 38: worker.SandboxWorker.WriteFile:output_type -> worker.WriteFileResponse- 18, // 39: worker.SandboxWorker.ListDir:output_type -> worker.ListDirResponse- 20, // 40: worker.SandboxWorker.CreatePTY:output_type -> worker.CreatePTYResponse- 23, // 41: worker.SandboxWorker.PTYStream:output_type -> worker.PTYOutput- 33, // 42: worker.SandboxWorker.ExecSessionCreate:output_type -> worker.ExecSessionCreateResponse- 35, // 43: worker.SandboxWorker.ExecSessionList:output_type -> worker.ExecSessionListResponse- 38, // 44: worker.SandboxWorker.ExecSessionKill:output_type -> worker.ExecSessionKillResponse- 25, // 45: worker.SandboxWorker.HibernateSandbox:output_type -> worker.HibernateSandboxResponse- 27, // 46: worker.SandboxWorker.WakeSandbox:output_type -> worker.WakeSandboxResponse- 29, // 47: worker.SandboxWorker.SaveAsTemplate:output_type -> worker.SaveAsTemplateResponse- 42, // 48: worker.SandboxWorker.CreateCheckpoint:output_type -> worker.CreateCheckpointResponse- 44, // 49: worker.SandboxWorker.RestoreCheckpoint:output_type -> worker.RestoreCheckpointResponse- 31, // 50: worker.SandboxWorker.BuildTemplate:output_type -> worker.BuildTemplateResponse- 40, // 51: worker.SandboxWorker.GetSandboxStats:output_type -> worker.GetSandboxStatsResponse- 46, // 52: worker.SandboxWorker.SetSandboxLimits:output_type -> worker.SetSandboxLimitsResponse- 31, // [31:53] is the sub-list for method output_type- 9, // [9:31] is the sub-list for method input_type+ 47, // 31: worker.SandboxWorker.PrepareMigrationIncoming:input_type -> worker.PrepareMigrationIncomingRequest+ 49, // 32: worker.SandboxWorker.LiveMigrate:input_type -> worker.LiveMigrateRequest+ 51, // 33: worker.SandboxWorker.CompleteMigrationIncoming:input_type -> worker.CompleteMigrationIncomingRequest+ 2, // 34: worker.SandboxWorker.CreateSandbox:output_type -> worker.CreateSandboxResponse+ 4, // 35: worker.SandboxWorker.DestroySandbox:output_type -> worker.DestroySandboxResponse+ 6, // 36: worker.SandboxWorker.GetSandbox:output_type -> worker.GetSandboxResponse+ 8, // 37: worker.SandboxWorker.ListSandboxes:output_type -> worker.ListSandboxesResponse+ 10, // 38: worker.SandboxWorker.ExecCommand:output_type -> worker.ExecCommandResponse+ 11, // 39: worker.SandboxWorker.ExecCommandStream:output_type -> worker.ExecOutputChunk+ 13, // 40: worker.SandboxWorker.ReadFile:output_type -> worker.ReadFileResponse+ 15, // 41: worker.SandboxWorker.WriteFile:output_type -> worker.WriteFileResponse+ 18, // 42: worker.SandboxWorker.ListDir:output_type -> worker.ListDirResponse+ 20, // 43: worker.SandboxWorker.CreatePTY:output_type -> worker.CreatePTYResponse+ 23, // 44: worker.SandboxWorker.PTYStream:output_type -> worker.PTYOutput+ 33, // 45: worker.SandboxWorker.ExecSessionCreate:output_type -> worker.ExecSessionCreateResponse+ 35, // 46: worker.SandboxWorker.ExecSessionList:output_type -> worker.ExecSessionListResponse+ 38, // 47: worker.SandboxWorker.ExecSessionKill:output_type -> worker.ExecSessionKillResponse+ 25, // 48: worker.SandboxWorker.HibernateSandbox:output_type -> worker.HibernateSandboxResponse+ 27, // 49: worker.SandboxWorker.WakeSandbox:output_type -> worker.WakeSandboxResponse+ 29, // 50: worker.SandboxWorker.SaveAsTemplate:output_type -> worker.SaveAsTemplateResponse+ 42, // 51: worker.SandboxWorker.CreateCheckpoint:output_type -> worker.CreateCheckpointResponse+ 44, // 52: worker.SandboxWorker.RestoreCheckpoint:output_type -> worker.RestoreCheckpointResponse+ 31, // 53: worker.SandboxWorker.BuildTemplate:output_type -> worker.BuildTemplateResponse+ 40, // 54: worker.SandboxWorker.GetSandboxStats:output_type -> worker.GetSandboxStatsResponse+ 46, // 55: worker.SandboxWorker.SetSandboxLimits:output_type -> worker.SetSandboxLimitsResponse+ 48, // 56: worker.SandboxWorker.PrepareMigrationIncoming:output_type -> worker.PrepareMigrationIncomingResponse+ 50, // 57: worker.SandboxWorker.LiveMigrate:output_type -> worker.LiveMigrateResponse+ 52, // 58: worker.SandboxWorker.CompleteMigrationIncoming:output_type -> worker.CompleteMigrationIncomingResponse+ 34, // [34:59] is the sub-list for method output_type+ 9, // [9:34] is the sub-list for method input_type9, // [9:9] is the sub-list for extension type_name9, // [9:9] is the sub-list for extension extendee0, // [0:9] is the sub-list for field type_name@@ -3104,7 +3455,7 @@ func file_proto_worker_worker_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_worker_worker_proto_rawDesc), len(file_proto_worker_worker_proto_rawDesc)),NumEnums: 1,- NumMessages: 50,+ NumMessages: 56,NumExtensions: 0,NumServices: 1,},diff --git a/proto/worker/worker.proto b/proto/worker/worker.protoindex 6acec57c..4eda2233 100644--- a/proto/worker/worker.proto+++ b/proto/worker/worker.proto@@ -37,6 +37,11 @@ service SandboxWorker {rpc GetSandboxStats(GetSandboxStatsRequest) returns (GetSandboxStatsResponse);rpc SetSandboxLimits(SetSandboxLimitsRequest) returns (SetSandboxLimitsResponse);++ // Live migration between workers+ rpc PrepareMigrationIncoming(PrepareMigrationIncomingRequest) returns (PrepareMigrationIncomingResponse);+ rpc LiveMigrate(LiveMigrateRequest) returns (LiveMigrateResponse);+ rpc CompleteMigrationIncoming(CompleteMigrationIncomingRequest) returns (CompleteMigrationIncomingResponse);}message CreateSandboxRequest {@@ -305,3 +310,32 @@ message SetSandboxLimitsRequest {}message SetSandboxLimitsResponse {}++// Live migration messages+message PrepareMigrationIncomingRequest {+ string sandbox_id = 1;+ string rootfs_path = 2; // local path to rootfs on target (pre-copied)+ string workspace_path = 3; // local path to workspace on target (pre-copied)+ int32 cpu_count = 4;+ int32 memory_mb = 5;+ int32 guest_port = 6;+ string template = 7;+}++message PrepareMigrationIncomingResponse {+ string incoming_addr = 1; // TCP address for source to migrate to (e.g. "10.100.1.7:49152")+ int32 host_port = 2; // mapped host port on target worker+}++message LiveMigrateRequest {+ string sandbox_id = 1;+ string incoming_addr = 2; // TCP address from PrepareMigrationIncoming+}++message LiveMigrateResponse {}++message CompleteMigrationIncomingRequest {+ string sandbox_id = 1;+}++message CompleteMigrationIncomingResponse {}diff --git a/proto/worker/worker_grpc.pb.go b/proto/worker/worker_grpc.pb.goindex 226178bd..8df2045a 100644--- a/proto/worker/worker_grpc.pb.go+++ b/proto/worker/worker_grpc.pb.go@@ -19,28 +19,31 @@ import (const _ = grpc.SupportPackageIsVersion9const (- SandboxWorker_CreateSandbox_FullMethodName = "/worker.SandboxWorker/CreateSandbox"- SandboxWorker_DestroySandbox_FullMethodName = "/worker.SandboxWorker/DestroySandbox"- SandboxWorker_GetSandbox_FullMethodName = "/worker.SandboxWorker/GetSandbox"- SandboxWorker_ListSandboxes_FullMethodName = "/worker.SandboxWorker/ListSandboxes"- SandboxWorker_ExecCommand_FullMethodName = "/worker.SandboxWorker/ExecCommand"- SandboxWorker_ExecCommandStream_FullMethodName = "/worker.SandboxWorker/ExecCommandStream"- SandboxWorker_ReadFile_FullMethodName = "/worker.SandboxWorker/ReadFile"- SandboxWorker_WriteFile_FullMethodName = "/worker.SandboxWorker/WriteFile"- SandboxWorker_ListDir_FullMethodName = "/worker.SandboxWorker/ListDir"- SandboxWorker_CreatePTY_FullMethodName = "/worker.SandboxWorker/CreatePTY"- SandboxWorker_PTYStream_FullMethodName = "/worker.SandboxWorker/PTYStream"- SandboxWorker_ExecSessionCreate_FullMethodName = "/worker.SandboxWorker/ExecSessionCreate"- SandboxWorker_ExecSessionList_FullMethodName = "/worker.SandboxWorker/ExecSessionList"- SandboxWorker_ExecSessionKill_FullMethodName = "/worker.SandboxWorker/ExecSessionKill"- SandboxWorker_HibernateSandbox_FullMethodName = "/worker.SandboxWorker/HibernateSandbox"- SandboxWorker_WakeSandbox_FullMethodName = "/worker.SandboxWorker/WakeSandbox"- SandboxWorker_SaveAsTemplate_FullMethodName = "/worker.SandboxWorker/SaveAsTemplate"- SandboxWorker_CreateCheckpoint_FullMethodName = "/worker.SandboxWorker/CreateCheckpoint"- SandboxWorker_RestoreCheckpoint_FullMethodName = "/worker.SandboxWorker/RestoreCheckpoint"- SandboxWorker_BuildTemplate_FullMethodName = "/worker.SandboxWorker/BuildTemplate"- SandboxWorker_GetSandboxStats_FullMethodName = "/worker.SandboxWorker/GetSandboxStats"- SandboxWorker_SetSandboxLimits_FullMethodName = "/worker.SandboxWorker/SetSandboxLimits"+ SandboxWorker_CreateSandbox_FullMethodName = "/worker.SandboxWorker/CreateSandbox"+ SandboxWorker_DestroySandbox_FullMethodName = "/worker.SandboxWorker/DestroySandbox"+ SandboxWorker_GetSandbox_FullMethodName = "/worker.SandboxWorker/GetSandbox"+ SandboxWorker_ListSandboxes_FullMethodName = "/worker.SandboxWorker/ListSandboxes"+ SandboxWorker_ExecCommand_FullMethodName = "/worker.SandboxWorker/ExecCommand"+ SandboxWorker_ExecCommandStream_FullMethodName = "/worker.SandboxWorker/ExecCommandStream"+ SandboxWorker_ReadFile_FullMethodName = "/worker.SandboxWorker/ReadFile"+ SandboxWorker_WriteFile_FullMethodName = "/worker.SandboxWorker/WriteFile"+ SandboxWorker_ListDir_FullMethodName = "/worker.SandboxWorker/ListDir"+ SandboxWorker_CreatePTY_FullMethodName = "/worker.SandboxWorker/CreatePTY"+ SandboxWorker_PTYStream_FullMethodName = "/worker.SandboxWorker/PTYStream"+ SandboxWorker_ExecSessionCreate_FullMethodName = "/worker.SandboxWorker/ExecSessionCreate"+ SandboxWorker_ExecSessionList_FullMethodName = "/worker.SandboxWorker/ExecSessionList"+ SandboxWorker_ExecSessionKill_FullMethodName = "/worker.SandboxWorker/ExecSessionKill"+ SandboxWorker_HibernateSandbox_FullMethodName = "/worker.SandboxWorker/HibernateSandbox"+ SandboxWorker_WakeSandbox_FullMethodName = "/worker.SandboxWorker/WakeSandbox"+ SandboxWorker_SaveAsTemplate_FullMethodName = "/worker.SandboxWorker/SaveAsTemplate"+ SandboxWorker_CreateCheckpoint_FullMethodName = "/worker.SandboxWorker/CreateCheckpoint"+ SandboxWorker_RestoreCheckpoint_FullMethodName = "/worker.SandboxWorker/RestoreCheckpoint"+ SandboxWorker_BuildTemplate_FullMethodName = "/worker.SandboxWorker/BuildTemplate"+ SandboxWorker_GetSandboxStats_FullMethodName = "/worker.SandboxWorker/GetSandboxStats"+ SandboxWorker_SetSandboxLimits_FullMethodName = "/worker.SandboxWorker/SetSandboxLimits"+ SandboxWorker_PrepareMigrationIncoming_FullMethodName = "/worker.SandboxWorker/PrepareMigrationIncoming"+ SandboxWorker_LiveMigrate_FullMethodName = "/worker.SandboxWorker/LiveMigrate"+ SandboxWorker_CompleteMigrationIncoming_FullMethodName = "/worker.SandboxWorker/CompleteMigrationIncoming")// SandboxWorkerClient is the client API for SandboxWorker service.@@ -69,6 +72,10 @@ type SandboxWorkerClient interface {BuildTemplate(ctx context.Context, in *BuildTemplateRequest, opts ...grpc.CallOption) (*BuildTemplateResponse, error)GetSandboxStats(ctx context.Context, in *GetSandboxStatsRequest, opts ...grpc.CallOption) (*GetSandboxStatsResponse, error)SetSandboxLimits(ctx context.Context, in *SetSandboxLimitsRequest, opts ...grpc.CallOption) (*SetSandboxLimitsResponse, error)+ // Live migration between workers+ PrepareMigrationIncoming(ctx context.Context, in *PrepareMigrationIncomingRequest, opts ...grpc.CallOption) (*PrepareMigrationIncomingResponse, error)+ LiveMigrate(ctx context.Context, in *LiveMigrateRequest, opts ...grpc.CallOption) (*LiveMigrateResponse, error)+ CompleteMigrationIncoming(ctx context.Context, in *CompleteMigrationIncomingRequest, opts ...grpc.CallOption) (*CompleteMigrationIncomingResponse, error)}type sandboxWorkerClient struct {@@ -311,6 +318,36 @@ func (c *sandboxWorkerClient) SetSandboxLimits(ctx context.Context, in *SetSandbreturn out, nil}+func (c *sandboxWorkerClient) PrepareMigrationIncoming(ctx context.Context, in *PrepareMigrationIncomingRequest, opts ...grpc.CallOption) (*PrepareMigrationIncomingResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(PrepareMigrationIncomingResponse)+ err := c.cc.Invoke(ctx, SandboxWorker_PrepareMigrationIncoming_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *sandboxWorkerClient) LiveMigrate(ctx context.Context, in *LiveMigrateRequest, opts ...grpc.CallOption) (*LiveMigrateResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(LiveMigrateResponse)+ err := c.cc.Invoke(ctx, SandboxWorker_LiveMigrate_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *sandboxWorkerClient) CompleteMigrationIncoming(ctx context.Context, in *CompleteMigrationIncomingRequest, opts ...grpc.CallOption) (*CompleteMigrationIncomingResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(CompleteMigrationIncomingResponse)+ err := c.cc.Invoke(ctx, SandboxWorker_CompleteMigrationIncoming_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+// SandboxWorkerServer is the server API for SandboxWorker service.// All implementations must embed UnimplementedSandboxWorkerServer// for forward compatibility.@@ -337,6 +374,10 @@ type SandboxWorkerServer interface {BuildTemplate(context.Context, *BuildTemplateRequest) (*BuildTemplateResponse, error)GetSandboxStats(context.Context, *GetSandboxStatsRequest) (*GetSandboxStatsResponse, error)SetSandboxLimits(context.Context, *SetSandboxLimitsRequest) (*SetSandboxLimitsResponse, error)+ // Live migration between workers+ PrepareMigrationIncoming(context.Context, *PrepareMigrationIncomingRequest) (*PrepareMigrationIncomingResponse, error)+ LiveMigrate(context.Context, *LiveMigrateRequest) (*LiveMigrateResponse, error)+ CompleteMigrationIncoming(context.Context, *CompleteMigrationIncomingRequest) (*CompleteMigrationIncomingResponse, error)mustEmbedUnimplementedSandboxWorkerServer()}@@ -413,6 +454,15 @@ func (UnimplementedSandboxWorkerServer) GetSandboxStats(context.Context, *GetSanfunc (UnimplementedSandboxWorkerServer) SetSandboxLimits(context.Context, *SetSandboxLimitsRequest) (*SetSandboxLimitsResponse, error) {return nil, status.Error(codes.Unimplemented, "method SetSandboxLimits not implemented")}+func (UnimplementedSandboxWorkerServer) PrepareMigrationIncoming(context.Context, *PrepareMigrationIncomingRequest) (*PrepareMigrationIncomingResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method PrepareMigrationIncoming not implemented")+}+func (UnimplementedSandboxWorkerServer) LiveMigrate(context.Context, *LiveMigrateRequest) (*LiveMigrateResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method LiveMigrate not implemented")+}+func (UnimplementedSandboxWorkerServer) CompleteMigrationIncoming(context.Context, *CompleteMigrationIncomingRequest) (*CompleteMigrationIncomingResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method CompleteMigrationIncoming not implemented")+}func (UnimplementedSandboxWorkerServer) mustEmbedUnimplementedSandboxWorkerServer() {}func (UnimplementedSandboxWorkerServer) testEmbeddedByValue() {}@@ -812,6 +862,60 @@ func _SandboxWorker_SetSandboxLimits_Handler(srv interface{}, ctx context.Contexreturn interceptor(ctx, in, info, handler)}+func _SandboxWorker_PrepareMigrationIncoming_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(PrepareMigrationIncomingRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(SandboxWorkerServer).PrepareMigrationIncoming(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: SandboxWorker_PrepareMigrationIncoming_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(SandboxWorkerServer).PrepareMigrationIncoming(ctx, req.(*PrepareMigrationIncomingRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _SandboxWorker_LiveMigrate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(LiveMigrateRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(SandboxWorkerServer).LiveMigrate(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: SandboxWorker_LiveMigrate_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(SandboxWorkerServer).LiveMigrate(ctx, req.(*LiveMigrateRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _SandboxWorker_CompleteMigrationIncoming_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(CompleteMigrationIncomingRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(SandboxWorkerServer).CompleteMigrationIncoming(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: SandboxWorker_CompleteMigrationIncoming_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(SandboxWorkerServer).CompleteMigrationIncoming(ctx, req.(*CompleteMigrationIncomingRequest))+ }+ return interceptor(ctx, in, info, handler)+}+// SandboxWorker_ServiceDesc is the grpc.ServiceDesc for SandboxWorker service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -899,6 +1003,18 @@ var SandboxWorker_ServiceDesc = grpc.ServiceDesc{MethodName: "SetSandboxLimits",Handler: _SandboxWorker_SetSandboxLimits_Handler,},+ {+ MethodName: "PrepareMigrationIncoming",+ Handler: _SandboxWorker_PrepareMigrationIncoming_Handler,+ },+ {+ MethodName: "LiveMigrate",+ Handler: _SandboxWorker_LiveMigrate_Handler,+ },+ {+ MethodName: "CompleteMigrationIncoming",+ Handler: _SandboxWorker_CompleteMigrationIncoming_Handler,+ },},Streams: []grpc.StreamDesc{{