The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7416
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 7aee4b362ca311c1c8e591a9382064aadcc110ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 22 May 2020 15:33:18 -0400 Subject: [PATCH] lxd/qemu: Cleanup arch checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/instance/drivers/driver_qemu.go | 11 ++++++----- lxd/instance/drivers/driver_qemu_templates.go | 14 +++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index 5b4878e312..b35749df36 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -734,7 +734,8 @@ func (vm *qemu) Start(stateful bool) error { "-chroot", vm.Path(), } - if vm.architecture != osarch.ARCH_64BIT_POWERPC_LITTLE_ENDIAN { + // SMBIOS only on x86_64 and aarch64. + if shared.IntInSlice(vm.architecture, []int{osarch.ARCH_64BIT_INTEL_X86, osarch.ARCH_64BIT_ARMV8_LITTLE_ENDIAN}) { qemuCmd = append(qemuCmd, "-smbios", "type=2,manufacturer=Canonical Ltd.,product=LXD") } @@ -964,8 +965,8 @@ func (vm *qemu) openUnixSocket(sockPath string) (*net.UnixConn, error) { } func (vm *qemu) setupNvram() error { - // No UEFI nvram for ppc64le. - if vm.architecture == osarch.ARCH_64BIT_POWERPC_LITTLE_ENDIAN { + // UEFI only on x86_64 and aarch64. + if shared.IntInSlice(vm.architecture, []int{osarch.ARCH_64BIT_INTEL_X86, osarch.ARCH_64BIT_ARMV8_LITTLE_ENDIAN}) { return nil } @@ -1754,8 +1755,8 @@ func (vm *qemu) addMonitorConfig(sb *strings.Builder) error { // addFirmwareConfig adds the qemu config required for adding a secure boot compatible EFI firmware. func (vm *qemu) addFirmwareConfig(sb *strings.Builder) error { - // No UEFI nvram for ppc64le. - if vm.architecture == osarch.ARCH_64BIT_POWERPC_LITTLE_ENDIAN { + // UEFI only on x86_64 and aarch64. + if !shared.IntInSlice(vm.architecture, []int{osarch.ARCH_64BIT_INTEL_X86, osarch.ARCH_64BIT_ARMV8_LITTLE_ENDIAN}) { return nil } diff --git a/lxd/instance/drivers/driver_qemu_templates.go b/lxd/instance/drivers/driver_qemu_templates.go index b56e0a7238..83f552272b 100644 --- a/lxd/instance/drivers/driver_qemu_templates.go +++ b/lxd/instance/drivers/driver_qemu_templates.go @@ -52,7 +52,7 @@ backend = "ringbuf" size = "{{.ringbufSizeBytes}}B" # SCSI controller -{{- if ne .architecture "ppc64le"}} +{{- if eq .architecture "x86_64" "aarch64" }} [device "qemu_pcie1"] driver = "pcie-root-port" port = "0x10" @@ -64,7 +64,7 @@ addr = "0x2" [device "qemu_scsi"] driver = "virtio-scsi-pci" -{{- if eq .architecture "ppc64le"}} +{{- if eq .architecture "ppc64le" }} bus = "pci.0" {{- else}} bus = "qemu_pcie1" @@ -72,7 +72,7 @@ addr = "0x0" {{- end}} # Balloon driver -{{- if ne .architecture "ppc64le"}} +{{- if eq .architecture "x86_64" "aarch64" }} [device "qemu_pcie2"] driver = "pcie-root-port" port = "0x11" @@ -83,7 +83,7 @@ addr = "0x2.0x1" [device "qemu_ballon"] driver = "virtio-balloon-pci" -{{- if eq .architecture "ppc64le"}} +{{- if eq .architecture "ppc64le" }} bus = "pci.0" {{- else}} bus = "qemu_pcie2" @@ -95,7 +95,7 @@ addr = "0x0" qom-type = "rng-random" filename = "/dev/urandom" -{{if ne .architecture "ppc64le" -}} +{{if eq .architecture "x86_64" "aarch64" -}} [device "qemu_pcie3"] driver = "pcie-root-port" port = "0x12" @@ -127,7 +127,7 @@ size = "{{.memSizeBytes}}B" var qemuVsock = template.Must(template.New("qemuVsock").Parse(` # Vsock -{{if ne .architecture "ppc64le" -}} +{{if eq .architecture "x86_64" "aarch64" -}} [device "qemu_pcie4"] driver = "pcie-root-port" port = "0x13" @@ -271,7 +271,7 @@ bootindex = "{{.bootIndex}}" // qemuDevTapCommon is common PCI device template for tap based netdevs. // Use 0x4.0x as the PCIe address prefix for nic devices to allow up to 8 devices of this type. var qemuDevTapCommon = template.Must(template.New("qemuDevTapCommon").Parse(` -{{if ne .architecture "ppc64le" -}} +{{if eq .architecture "x86_64" "aarch64" -}} [device "qemu_pcie{{.chassisIndex}}"] driver = "pcie-root-port" port = "0x{{.nicIndex}}"
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel