[lxc-devel] [lxd/master] Network: Improve error message when parent 'network' option not specified for OVN networks
tomponline on Github
lxc-bot at linuxcontainers.org
Mon Sep 21 08:58:44 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200921/144b8ff1/attachment.bin>
-------------- next part --------------
From e036ffc0f0da58b431905ab85d0b36b7de42c050 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 21 Sep 2020 09:57:51 +0100
Subject: [PATCH] lxd/network/driver/ovn: Improve error message when parent
'network' option not specified
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/network/driver_ovn.go | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lxd/network/driver_ovn.go b/lxd/network/driver_ovn.go
index 1c0f15230d..d136d47c46 100644
--- a/lxd/network/driver_ovn.go
+++ b/lxd/network/driver_ovn.go
@@ -73,13 +73,7 @@ func (n *ovn) Info() Info {
// Validate network config.
func (n *ovn) Validate(config map[string]string) error {
rules := map[string]func(value string) error{
- "network": func(value string) error {
- if err := validInterfaceName(value); err != nil {
- return errors.Wrapf(err, "Invalid network name %q", value)
- }
-
- return nil
- },
+ "network": validate.IsNotEmpty,
"bridge.hwaddr": validate.Optional(validate.IsNetworkMAC),
"bridge.mtu": validate.Optional(validate.IsNetworkMTU),
"ipv4.address": func(value string) error {
@@ -272,7 +266,7 @@ func (n *ovn) setupParentPort(routerMAC net.HardwareAddr) (*ovnParentVars, error
// Parent network must be in default project.
parentNet, err := LoadByName(n.state, project.Default, n.config["network"])
if err != nil {
- return nil, errors.Wrapf(err, "Failed loading parent network")
+ return nil, errors.Wrapf(err, "Failed loading parent network %q", n.config["network"])
}
switch parentNet.Type() {
More information about the lxc-devel
mailing list