Open Abhi4010 opened 2 years ago
hi @Abhi4010, snapshot support is not yet complete in firecracker-containerd. You can use vHive or the API that we developed vhive/ctriface
for managing MicroVMs on top of firecracker-containerd.
hi @Abhi4010, snapshot support is not yet complete in firecracker-containerd. You can use vHive or the API that we developed
vhive/ctriface
for managing MicroVMs on top of firecracker-containerd. hi @ustiugov,
I was looking at the code of vhivie/ctriface. I tried to mimic the following code from vhive:
`func (f *Function) CreateInstanceSnapshot() { logger := log.WithFields(log.Fields{"fID": f.fID})
logger.Debug("Creating instance snapshot")
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
err := orch.PauseVM(ctx, f.vmID)
if err != nil {
log.Panic(err)
}
err = orch.CreateSnapshot(ctx, f.vmID)
if err != nil {
log.Panic(err)
}
_, err = orch.ResumeVM(ctx, f.vmID)
if err != nil {
log.Panic(err)
}
}`
However, orch.CreateSnapshot(ctx, f.vmID) failed. It could not find the &proto.CreateSnapshotRequest and o.fcClient.CreateSnapshot(ctx, req) in the imported packages.
`func (o *Orchestrator) CreateSnapshot(ctx context.Context, vmID string) error { logger := log.WithFields(log.Fields{"vmID": vmID}) logger.Debug("Orchestrator received CreateSnapshot")
ctx = namespaces.WithNamespace(ctx, namespaceName)
req := &proto.CreateSnapshotRequest{
VMID: vmID,
SnapshotFilePath: o.getSnapshotFile(vmID),
MemFilePath: o.getMemoryFile(vmID),
}
if _, err := o.fcClient.CreateSnapshot(ctx, req); err != nil {
logger.WithError(err).Error("failed to create snapshot of the VM")
return err
}
return nil
} ` I also checked the repos: fcclient "github.com/firecracker-microvm/firecracker-containerd/firecracker-control/client" "github.com/firecracker-microvm/firecracker-containerd/proto"
But, could not find fcClient.CreateSnapshot(ctx, req) and proto.CreateSnapshotRequest functions there. Could you please help out on this?
I am running containers in Firecracker micro-VM using firecracker contained. I was able to create a firecracker VM and run a container inside it. However, I haven't found any APIs in firecracker-containerd to snapshot and restore a VM running container that I can directly use in my GO code. Are there any APIs there for that? I have seen APIs for snapshotting and restoring VMs in FIrecracker-microvm/firecracker repo where it sends requests to the API server for pausing/snapshotting/resuming/ restoring VMs.
https://github.com/firecracker-microvm/firecracker/blob/main/docs/snapshotting/snapshot-support.md
Is it the way to follow for snapshotting a firecracker VM running containers?