// StartCmd takes path to stage1, name of the machine, path to kernel, network describers, memory in megabytes // and quantity of cpus and prepares command line to run QEMU process func StartCmd(wdPath, name, kernelPath string, nds []kvm.NetDescriber, cpu, mem int64, debug bool) []string { var ( driverConfiguration = hypervisor.KvmHypervisor{ Bin: "./qemu", KernelParams: []string{ "root=/dev/root", "rootfstype=9p", "rootflags=trans=virtio,version=9p2000.L,cache=mmap", "rw", "systemd.default_standard_error=journal+console", "systemd.default_standard_output=journal+console", }, } ) driverConfiguration.InitKernelParams(debug) cmd := []string{ filepath.Join(wdPath, driverConfiguration.Bin), "-L", wdPath, "-no-reboot", "-display", "none", "-enable-kvm", "-smp", strconv.FormatInt(cpu, 10), "-m", strconv.FormatInt(mem, 10), "-kernel", kernelPath, "-fsdev", "local,id=root,path=stage1/rootfs,security_model=none", "-device", "virtio-9p-pci,fsdev=root,mount_tag=/dev/root", "-append", fmt.Sprintf("%s", strings.Join(driverConfiguration.KernelParams, " ")), "-chardev", "stdio,id=virtiocon0,signal=off", "-device", "virtio-serial", "-device", "virtconsole,chardev=virtiocon0", } return append(cmd, kvmNetArgs(nds)...) }
// StartCmd takes path to stage1, UUID of the pod, path to kernel, network // describers, memory in megabytes and quantity of cpus and prepares command // line to run LKVM process func StartCmd(wdPath, uuid, kernelPath string, nds []kvm.NetDescriber, cpu, mem int64, debug bool) []string { machineID := strings.Replace(uuid, "-", "", -1) driverConfiguration := hypervisor.KvmHypervisor{ Bin: "./lkvm", KernelParams: []string{ "systemd.default_standard_error=journal+console", "systemd.default_standard_output=journal+console", "systemd.machine_id=" + machineID, }, } driverConfiguration.InitKernelParams(debug) startCmd := []string{ filepath.Join(wdPath, driverConfiguration.Bin), "run", "--name", "rkt-" + uuid, "--no-dhcp", "--cpu", strconv.Itoa(int(cpu)), "--mem", strconv.Itoa(int(mem)), "--console=virtio", "--kernel", kernelPath, "--disk", "stage1/rootfs", // relative to run/pods/uuid dir this is a place where systemd resides "--params", strings.Join(driverConfiguration.KernelParams, " "), } return append(startCmd, kvmNetArgs(nds)...) }