Skip to content
Merged
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
23 changes: 13 additions & 10 deletions cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,18 @@ func (c *initConfig) setupCluster(s *service.Handler) error {

fmt.Println("Configuring cluster-wide devices ...")

var ovnConfig string
if s.Services[types.MicroOVN] != nil {
// Update LXD's global config.
server, _, err := lxdClient.GetServer()
if err != nil {
return err
}

config := make(map[string]string)

// LXD can dynamically determine the OVN northbound DB connection string from MicroOVN's `ovn.env` file.
// This feature was added with the ovn_dynamic_northbound_connection API extension.
// Only set the connection string in case of an older LXD.
if s.Services[types.MicroOVN] != nil && !lxdClient.HasExtension("ovn_dynamic_northbound_connection") {
serviceOVN := s.Services[types.MicroOVN].(*service.OVNService)

services, err := serviceOVN.GetServices(context.Background())
Expand All @@ -911,14 +921,7 @@ func (c *initConfig) setupCluster(s *service.Handler) error {
}
}

ovnConfig = strings.Join(conns, ",")
}

config := map[string]string{"network.ovn.northbound_connection": ovnConfig}
// Update LXD's global config.
server, _, err := lxdClient.GetServer()
if err != nil {
return err
config["network.ovn.northbound_connection"] = strings.Join(conns, ",")
}

newServer := server.Writable()
Expand Down
19 changes: 11 additions & 8 deletions test/includes/microcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -550,16 +550,19 @@ validate_system_lxd_ovn() {

echo " ${name} Validating OVN network"

num_conns=3
if [ "${num_peers}" -lt "${num_conns}" ]; then
num_conns="${num_peers}"
fi
# Check if the connection string is set correctly.
if ! check_api_extension ovn_dynamic_northbound_connection "${name}"; then
num_conns=3
if [ "${num_peers}" -lt "${num_conns}" ]; then
num_conns="${num_peers}"
fi

[ "$(lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | wc -l)" = "${num_conns}" ]
[ "$(lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | wc -l)" = "${num_conns}" ]

# Make sure there's no empty addresses.
! lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | grep -q '^ssl:$' || false
! lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | grep -q '^ssl::' || false
# Make sure there's no empty addresses.
! lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | grep -q '^ssl:$' || false
! lxc config get network.ovn.northbound_connection --target "${name}" | sed -e 's/,/\n/g' | grep -q '^ssl::' || false
fi
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

# Check that the created UPLINK network has the right DNS servers.
if [ -n "${dns_namesersers}" ] ; then
Expand Down
Loading