about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-05-15 20:01:44 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-11 13:57:43 -0700
commit5e860945d7c905fb94c7f523ce47885ce87f53d6 (patch)
treeb5e4220ddfe7c37bb3cb28324b9c821f7b2b59b1 /users
parentMakefile: install binaries and configs (diff)
downloadworld-5e860945d7c905fb94c7f523ce47885ce87f53d6.tar.gz
publish firecracker metrics in a FIFO
We add a new argument to the CLI to collect the path where we want to
publish the firecracker metrics.
Diffstat (limited to 'users')
-rw-r--r--users/fcuny/exp/containerd-to-vm/cmd/c2vm/main.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/users/fcuny/exp/containerd-to-vm/cmd/c2vm/main.go b/users/fcuny/exp/containerd-to-vm/cmd/c2vm/main.go
index 66f881b..320bc91 100644
--- a/users/fcuny/exp/containerd-to-vm/cmd/c2vm/main.go
+++ b/users/fcuny/exp/containerd-to-vm/cmd/c2vm/main.go
@@ -44,6 +44,7 @@ func main() {
 		outFile           = flag.String("out", "container.img", "Path to store the image")
 		kernel            = flag.String("kernel", "", "Path to the linux kernel image")
 		firecrackerBinary = flag.String("firecracker-binary", "", "Path to the firecracker binary")
+		metricsFifo       = flag.String("metrics-fifo", "", "FIFO to the firecracker metrics")
 	)
 
 	flag.Parse()
@@ -114,7 +115,7 @@ func main() {
 		log.Fatalf("failed to resize the image %s: %s\n", *outFile, err)
 	}
 
-	bootVM(ctx, *outFile, *kernel, *firecrackerBinary)
+	bootVM(ctx, *outFile, *kernel, *firecrackerBinary, *metricsFifo)
 }
 
 func extract(ctx context.Context, client *containerd.Client, image containerd.Image, mntDir string) error {
@@ -240,7 +241,7 @@ func writeToFile(filepath string, content string) error {
 	return nil
 }
 
-func bootVM(ctx context.Context, rawImage, kernel, firecrackerBinary string) {
+func bootVM(ctx context.Context, rawImage, kernel, firecrackerBinary, metricsFifo string) {
 	vmmCtx, vmmCancel := context.WithCancel(ctx)
 	defer vmmCancel()
 
@@ -257,6 +258,7 @@ func bootVM(ctx context.Context, rawImage, kernel, firecrackerBinary string) {
 		KernelImagePath: kernel,
 		KernelArgs:      "console=ttyS0 reboot=k panic=1 acpi=off pci=off i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd init=/init.sh random.trust_cpu=on",
 		Drives:          devices,
+		MetricsFifo:     metricsFifo,
 		MachineCfg: models.MachineConfiguration{
 			VcpuCount:   firecracker.Int64(1),
 			CPUTemplate: models.CPUTemplate("C3"),