Skip to content

Commit

Permalink
resolve comments for pr
Browse files Browse the repository at this point in the history
Signed-off-by: Amory Hoste <[email protected]>
  • Loading branch information
amohoste committed Dec 19, 2021
1 parent 63f16b2 commit aff3d2b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 85 deletions.
130 changes: 65 additions & 65 deletions proto/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions proto/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ message IPConfiguration {
message FirecrackerMachineConfiguration {
string CPUTemplate = 1; // Specifies the cpu template. Example: "T2" or "C3"
bool HtEnabled = 2; // Specifies if hyper-threading should be enabled
bool TrackDirtyPages = 3; // Specified if dirty-page-tracking should be enabled.
// Specifies the memory size of VM
// This lets us create a Firecracker VM of up to 4096 TiB, which
// for a microVM should be large enough
uint32 MemSizeMib = 4;
uint32 VcpuCount = 5; // Specifies the number of vCPUs for the VM
uint32 MemSizeMib = 3;
uint32 VcpuCount = 4; // Specifies the number of vCPUs for the VM
bool TrackDirtyPages = 5; // Specified if dirty-page-tracking should be enabled.

}

// Message to specify the block device config for a Firecracker VM
Expand Down
36 changes: 19 additions & 17 deletions runtime/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,24 @@ func (s *service) startEventForwarders(remotePublisher shim.Publisher) {
go func() {
<-s.vmReady

if ! s.snapLoaded {
// Once the VM is ready, also start forwarding events from it to our exchange
attachCh := eventbridge.Attach(ctx, s.eventBridgeClient, s.eventExchange)
if s.snapLoaded {
return
}

err := <-attachCh
if err != nil && err != context.Canceled && !strings.Contains(err.Error(), "context canceled") {
s.logger.WithError(err).Error("error while forwarding events from VM agent")
}
// Once the VM is ready, also start forwarding events from it to our exchange
attachCh := eventbridge.Attach(ctx, s.eventBridgeClient, s.eventExchange)

err = <-republishCh
if err != nil && err != context.Canceled {
s.logger.WithError(err).Error("error while republishing events")
}
err := <-attachCh
if err != nil && err != context.Canceled && !strings.Contains(err.Error(), "context canceled") {
s.logger.WithError(err).Error("error while forwarding events from VM agent")
}

remotePublisher.Close()
err = <-republishCh
if err != nil && err != context.Canceled {
s.logger.WithError(err).Error("error while republishing events")
}

remotePublisher.Close()
}()
}

Expand Down Expand Up @@ -736,7 +738,7 @@ func (s *service) StopVM(requestCtx context.Context, request *proto.StopVMReques

// shutdownSnapLoadedVm shuts down a vm that has been loaded from a snapshot
func (s *service) shutdownSnapLoadedVm() error {
// Kill firecracker process and its shild processes
// Kill firecracker process and its child processes
if err := syscall.Kill(-s.firecrackerPid, 9); err != nil {
s.logger.WithError(err).Error("Failed to kill firecracker process")
return err
Expand Down Expand Up @@ -1799,9 +1801,9 @@ func (s *service) monitorVMExit() {

func (s *service) createHTTPControlClient() {
u := &httpunix.Transport{
DialTimeout: 1000 * time.Millisecond,
RequestTimeout: 60 * time.Second,
ResponseHeaderTimeout: 60 * time.Second,
DialTimeout: 500 * time.Millisecond,
RequestTimeout: 15 * time.Second,
ResponseHeaderTimeout: 15 * time.Second,
}
u.RegisterLocation("firecracker", s.shimDir.FirecrackerSockPath())

Expand Down Expand Up @@ -2178,7 +2180,7 @@ func (s *service) SendCreateSnapRequest(createSnapReq *http.Request) error {
}

// Offload Shuts down a VM and deletes the corresponding firecracker socket
// and vsock. All of the other resources will persist. Depracated!
// and vsock. All of the other resources will persist. DEPRECATED!
func (s *service) Offload(ctx context.Context, req *proto.OffloadRequest) (*empty.Empty, error) {

if !s.snapLoaded {
Expand Down

0 comments on commit aff3d2b

Please sign in to comment.