Add qvm doctor command to diagnose and fix common issues
This commit is contained in:
parent
2aec01b3b2
commit
eb469f1cd8
8 changed files with 660 additions and 170 deletions
|
|
@ -7,42 +7,30 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
// buildQEMUCommand builds the QEMU command line for virtiofsd-based mounts.
|
||||
// Uses vhost-user-fs-pci devices which support hot-plugging.
|
||||
func buildQEMUCommand(cfg *config.Config, sshPort int, mounts []virtiofsd.Mount) []string {
|
||||
args := []string{
|
||||
"qemu-system-x86_64",
|
||||
"-enable-kvm",
|
||||
}
|
||||
|
||||
memSize := cfg.VM.Memory
|
||||
args = append(args,
|
||||
|
||||
// vhost-user-fs requires shared memory backend
|
||||
args := []string{
|
||||
"-machine", "q35",
|
||||
"-accel", "kvm",
|
||||
"-cpu", "host",
|
||||
"-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%s,share=on", memSize),
|
||||
"-numa", "node,memdev=mem",
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-smp", strconv.Itoa(cfg.VM.CPUs),
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-drive", fmt.Sprintf("if=virtio,file=%s,format=qcow2", config.Overlay),
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-nic", fmt.Sprintf("user,model=virtio-net-pci,hostfwd=tcp::%d-:22", sshPort),
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-serial", fmt.Sprintf("file:%s", config.SerialLog),
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-qmp", fmt.Sprintf("unix:%s,server,nowait", config.QMPSocket),
|
||||
)
|
||||
|
||||
args = append(args,
|
||||
"-display", "none",
|
||||
)
|
||||
"-daemonize",
|
||||
"-pidfile", config.PIDFile,
|
||||
"-drive", fmt.Sprintf("file=%s,if=virtio,format=qcow2", config.Overlay),
|
||||
"-netdev", fmt.Sprintf("user,id=n0,hostfwd=tcp::%d-:22", sshPort),
|
||||
"-device", "virtio-net-pci,netdev=n0",
|
||||
"-serial", fmt.Sprintf("file:%s", config.SerialLog),
|
||||
"-qmp", fmt.Sprintf("unix:%s,server,nowait", config.QMPSocket),
|
||||
}
|
||||
|
||||
// Add vhost-user-fs devices for each mount
|
||||
for _, mount := range mounts {
|
||||
args = append(args,
|
||||
"-chardev", fmt.Sprintf("socket,id=%s,path=%s", mount.Tag, mount.SocketPath),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue