summary refs log tree commit diff
path: root/cmd/c2vm
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-05-15 20:01:44 -0700
committerFranck Cuny <franck@fcuny.net>2021-05-15 20:01:44 -0700
commit96ad3eada1ba10d40638c45c04df47633f1ab24d (patch)
tree7073bdcccd3211a402aa545fd5d1bd632577d0c5 /cmd/c2vm
parentMakefile: install binaries and configs (diff)
downloadcontainerd-to-vm-main.tar.gz
publish firecracker metrics in a FIFO HEAD main
We add a new argument to the CLI to collect the path where we want to
publish the firecracker metrics.
Diffstat (limited to 'cmd/c2vm')
-rw-r--r--cmd/c2vm/main.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/c2vm/main.go b/cmd/c2vm/main.go
index 66f881b..320bc91 100644
--- a/cmd/c2vm/main.go
+++ b/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"),