Merge pull request #9790 from gkurz/kill-some-dead-runtime-code

Kill some dead runtime code
This commit is contained in:
Greg Kurz
2024-06-13 15:45:51 +02:00
committed by GitHub
3 changed files with 5 additions and 27 deletions

View File

@@ -2684,9 +2684,6 @@ type Knobs struct {
// NoGraphic completely disables graphic output. // NoGraphic completely disables graphic output.
NoGraphic bool NoGraphic bool
// Daemonize will turn the qemu process into a daemon
Daemonize bool
// Both HugePages and MemPrealloc require the Memory.Size of the VM // Both HugePages and MemPrealloc require the Memory.Size of the VM
// to be set, as they need to reserve the memory upfront in order // to be set, as they need to reserve the memory upfront in order
// for the VM to boot without errors. // for the VM to boot without errors.
@@ -2717,9 +2714,6 @@ type Knobs struct {
// Prevents QEMU from rebooting in the event of a Triple Fault. // Prevents QEMU from rebooting in the event of a Triple Fault.
NoReboot bool NoReboot bool
// Dont exit QEMU on guest shutdown, but instead only stop the emulation.
NoShutdown bool
// IOMMUPlatform will enable IOMMU for supported devices // IOMMUPlatform will enable IOMMU for supported devices
IOMMUPlatform bool IOMMUPlatform bool
} }
@@ -3121,14 +3115,6 @@ func (config *Config) appendKnobs() {
config.qemuParams = append(config.qemuParams, "--no-reboot") config.qemuParams = append(config.qemuParams, "--no-reboot")
} }
if config.Knobs.NoShutdown {
config.qemuParams = append(config.qemuParams, "--no-shutdown")
}
if config.Knobs.Daemonize {
config.qemuParams = append(config.qemuParams, "-daemonize")
}
config.appendMemoryKnobs() config.appendMemoryKnobs()
if config.Knobs.Mlock { if config.Knobs.Mlock {

View File

@@ -445,13 +445,12 @@ func TestAppendEmptyDevice(t *testing.T) {
} }
func TestAppendKnobsAllTrue(t *testing.T) { func TestAppendKnobsAllTrue(t *testing.T) {
var knobsString = "-no-user-config -nodefaults -nographic --no-reboot -daemonize -overcommit mem-lock=on -S" var knobsString = "-no-user-config -nodefaults -nographic --no-reboot -overcommit mem-lock=on -S"
knobs := Knobs{ knobs := Knobs{
NoUserConfig: true, NoUserConfig: true,
NoDefaults: true, NoDefaults: true,
NoGraphic: true, NoGraphic: true,
NoReboot: true, NoReboot: true,
Daemonize: true,
MemPrealloc: true, MemPrealloc: true,
FileBackedMem: true, FileBackedMem: true,
MemShared: true, MemShared: true,

View File

@@ -569,7 +569,6 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi
NoDefaults: true, NoDefaults: true,
NoGraphic: true, NoGraphic: true,
NoReboot: true, NoReboot: true,
Daemonize: false,
MemPrealloc: q.config.MemPrealloc, MemPrealloc: q.config.MemPrealloc,
HugePages: q.config.HugePages, HugePages: q.config.HugePages,
IOMMUPlatform: q.config.IOMMUPlatform, IOMMUPlatform: q.config.IOMMUPlatform,
@@ -1105,16 +1104,10 @@ func (q *qemu) StartVM(ctx context.Context, timeout int) error {
q.Logger().WithError(err).Error("failed to launch qemu") q.Logger().WithError(err).Error("failed to launch qemu")
return fmt.Errorf("failed to launch qemu: %s", err) return fmt.Errorf("failed to launch qemu: %s", err)
} }
if q.qemuConfig.Knobs.Daemonize {
// LaunchQemu returns a handle on the upper QEMU process. // Log QEMU errors and ensure the QEMU process is reaped after
// Wait for it to exit to assume that the QEMU daemon was // termination.
// actually started. go q.LogAndWait(qemuCmd, reader)
qemuCmd.Wait()
} else {
// Log QEMU errors and ensure the QEMU process is reaped after
// termination.
go q.LogAndWait(qemuCmd, reader)
}
err = q.waitVM(ctx, qmpConn, timeout) err = q.waitVM(ctx, qmpConn, timeout)
if err != nil { if err != nil {