Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions pkg/infrastructure/baremetal/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,17 @@ func newDomain(name string) libvirtxml.Domain {
Port: &targetPort,
},
}

domainDef.Devices.Consoles = append(domainDef.Devices.Consoles, console)

serialLogPath := fmt.Sprintf("/var/log/libvirt/qemu/%s-serial0.log", name)
serial := libvirtxml.DomainSerial{
Log: &libvirtxml.DomainChardevLog{
File: serialLogPath,
Append: "on",
},
}
domainDef.Devices.Serials = append(domainDef.Devices.Serials, serial)

domainDef.Devices.Graphics = []libvirtxml.DomainGraphic{
{
VNC: &libvirtxml.DomainGraphicVNC{
Expand Down Expand Up @@ -233,7 +241,8 @@ func createLiveVolume(virConn *libvirt.Libvirt, config baremetalConfig, pool lib
return libvirt.StorageVol{}, fmt.Errorf("failed to get libvirt capabilities: %w", err)
}

isoFile, err := getLiveISO(config, capabilities.Host.CPU.Arch)
arch := capabilities.Host.CPU.Arch
isoFile, err := getLiveISO(config, arch)
if err != nil {
return libvirt.StorageVol{}, err
}
Expand All @@ -243,7 +252,16 @@ func createLiveVolume(virConn *libvirt.Libvirt, config baremetalConfig, pool lib
if err != nil {
return libvirt.StorageVol{}, err
}
consoleDevice := map[string]string{
"x86_64": "ttyS0",
"aarch64": "ttyAMA0",
"s390x": "ttysclp0",
"ppc64le": "hvc0",
}
var kargs string
if dev, ok := consoleDevice[arch]; ok {
kargs += " console=" + dev
}
if config.FIPS {
kargs += " fips=1"
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/infrastructure/baremetal/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func TestNewDomain(t *testing.T) {
assert.NotEmpty(t, dom.Devices.RNGs, "RNG device should be configured")
assert.NotEmpty(t, dom.Devices.Graphics, "graphics should be configured")
assert.NotEmpty(t, dom.Devices.Consoles, "console should be configured")
assert.NotEmpty(t, dom.Devices.Serials, "serial device should be configured")
assert.NotNil(t, dom.Devices.Serials[0].Log, "serial device should have a log file configured")
assert.Equal(t, "/var/log/libvirt/qemu/test-bootstrap-serial0.log", dom.Devices.Serials[0].Log.File)
assert.Equal(t, "on", dom.Devices.Serials[0].Log.Append)
assert.Nil(t, dom.Devices.Serials[0].Target, "serial target should not be set by newDomain")
}

func TestConfigureDomainArch(t *testing.T) {
Expand Down Expand Up @@ -76,6 +81,8 @@ func TestConfigureDomainArch(t *testing.T) {
} else {
assert.Nil(t, dom.Devices.Graphics, "graphics should be removed for %s", tc.arch)
}

assert.NotEmpty(t, dom.Devices.Serials, "serial device should be present for %s", tc.arch)
})
}
}
Expand Down