mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 00:07:16 +00:00
Merge pull request #5720 from YchauWang/wyc-docs-test-22
runtime: add log record to the qemu config method `appendDevices` for…
This commit is contained in:
commit
06a604b753
@ -2705,9 +2705,14 @@ func (config *Config) appendQMPSockets() {
|
||||
}
|
||||
}
|
||||
|
||||
func (config *Config) appendDevices() {
|
||||
func (config *Config) appendDevices(logger QMPLog) {
|
||||
if logger == nil {
|
||||
logger = qmpNullLogger{}
|
||||
}
|
||||
|
||||
for _, d := range config.Devices {
|
||||
if !d.Valid() {
|
||||
logger.Errorf("vm device is not valid: %+v", config.Devices)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -2982,7 +2987,7 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
||||
config.appendCPUModel()
|
||||
config.appendQMPSockets()
|
||||
config.appendMemory()
|
||||
config.appendDevices()
|
||||
config.appendDevices(logger)
|
||||
config.appendRTC()
|
||||
config.appendGlobalParam()
|
||||
config.appendPFlashParam()
|
||||
|
@ -34,7 +34,7 @@ func testConfigAppend(config *Config, structure interface{}, expected string, t
|
||||
|
||||
case Device:
|
||||
config.Devices = []Device{s}
|
||||
config.appendDevices()
|
||||
config.appendDevices(nil)
|
||||
|
||||
case Knobs:
|
||||
config.Knobs = s
|
||||
@ -889,7 +889,7 @@ func TestBadQMPSockets(t *testing.T) {
|
||||
|
||||
func TestBadDevices(t *testing.T) {
|
||||
c := &Config{}
|
||||
c.appendDevices()
|
||||
c.appendDevices(nil)
|
||||
if len(c.qemuParams) != 0 {
|
||||
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
|
||||
}
|
||||
@ -941,7 +941,7 @@ func TestBadDevices(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
c.appendDevices()
|
||||
c.appendDevices(nil)
|
||||
if len(c.qemuParams) != 0 {
|
||||
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user