clear qcow on rebuild, update fs mounting
This commit is contained in:
parent
cbe9b7241a
commit
08236f04a0
4 changed files with 101 additions and 15 deletions
|
|
@ -7,8 +7,18 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
// HotplugSlots is the number of PCIe root ports reserved for hot-plugging
|
||||
// workspace mounts into a running VM. Each hot-mounted virtiofs device needs
|
||||
// its own root port since pcie.0 does not support hotplug.
|
||||
const HotplugSlots = 16
|
||||
|
||||
// HotplugBusPrefix is the bus ID prefix for hotplug-capable PCIe root ports.
|
||||
// Slots are named hotplug0, hotplug1, ..., hotplugN.
|
||||
const HotplugBusPrefix = "hotplug"
|
||||
|
||||
// buildQEMUCommand builds the QEMU command line for virtiofsd-based mounts.
|
||||
// Uses vhost-user-fs-pci devices which support hot-plugging.
|
||||
// Uses vhost-user-fs-pci devices for boot-time mounts and provisions empty
|
||||
// PCIe root ports for hot-plugging additional mounts at runtime.
|
||||
func buildQEMUCommand(cfg *config.Config, sshPort int, mounts []virtiofsd.Mount) []string {
|
||||
memSize := cfg.VM.Memory
|
||||
|
||||
|
|
@ -31,7 +41,7 @@ func buildQEMUCommand(cfg *config.Config, sshPort int, mounts []virtiofsd.Mount)
|
|||
"-qmp", fmt.Sprintf("unix:%s,server,nowait", config.QMPSocket),
|
||||
}
|
||||
|
||||
// Add vhost-user-fs devices for each mount
|
||||
// Add vhost-user-fs devices for each boot-time mount
|
||||
for _, mount := range mounts {
|
||||
args = append(args,
|
||||
"-chardev", fmt.Sprintf("socket,id=%s,path=%s", mount.Tag, mount.SocketPath),
|
||||
|
|
@ -39,5 +49,15 @@ func buildQEMUCommand(cfg *config.Config, sshPort int, mounts []virtiofsd.Mount)
|
|||
)
|
||||
}
|
||||
|
||||
// Provision empty PCIe root ports for hot-plugging workspace mounts.
|
||||
// The q35 root bus (pcie.0) does not support hotplug, so we need
|
||||
// dedicated root ports that accept device_add at runtime.
|
||||
for i := 0; i < HotplugSlots; i++ {
|
||||
busID := fmt.Sprintf("%s%d", HotplugBusPrefix, i)
|
||||
args = append(args,
|
||||
"-device", fmt.Sprintf("pcie-root-port,id=%s,slot=%d", busID, i+1),
|
||||
)
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue