The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6608
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) === Ensures dnsmasq host entries are created with generated MAC address. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 04c776b5d5a1cf76ca903c92a1cedeec112ac1a9 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Thu, 12 Dec 2019 15:25:25 +0000 Subject: [PATCH] lxd/instance/qemu/vm/qemu: Implements deviceAdd and deviceRemove Ensures dnsmasq host entries are created with generated MAC address. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/instance/qemu/vm_qemu.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lxd/instance/qemu/vm_qemu.go b/lxd/instance/qemu/vm_qemu.go index f0c18f58ff..ac106c323c 100644 --- a/lxd/instance/qemu/vm_qemu.go +++ b/lxd/instance/qemu/vm_qemu.go @@ -2199,11 +2199,30 @@ func (vm *Qemu) Delete() error { } func (vm *Qemu) deviceAdd(deviceName string, rawConfig deviceConfig.Device) error { - return nil + d, _, err := vm.deviceLoad(deviceName, rawConfig) + if err != nil { + return err + } + + return d.Add() } func (vm *Qemu) deviceRemove(deviceName string, rawConfig deviceConfig.Device) error { - return nil + d, _, err := vm.deviceLoad(deviceName, rawConfig) + + // If deviceLoad fails with unsupported device type then return. + if err == device.ErrUnsupportedDevType { + return err + } + + // If deviceLoad fails for any other reason then just log the error and proceed, as in the + // scenario that a new version of LXD has additional validation restrictions than older + // versions we still need to allow previously valid devices to be stopped. + if err != nil { + logger.Errorf("Device remove validation failed for '%s': %v", deviceName, err) + } + + return d.Remove() } // Export publishes the instance.
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel