Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Aug 2, 2024
1 parent 8d23e2b commit 863f7e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
33 changes: 19 additions & 14 deletions cmd/microcloud/ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,10 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
}

// Ask the user if they want OVN.
wantsOVN, err := c.asker.AskBool("Configure distributed networking? (yes/no) [default=yes]: ", "yes")
q := "Would you like to set up distributed networking? (yes/no) [default=yes]: "
wantsOVN, err := c.asker.AskBool(q, "yes")
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", q, err)
}

if !wantsOVN {
Expand All @@ -862,9 +863,10 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
}

if len(state.AvailableUplinkInterfaces) == 0 {
wantsContinue, err := c.asker.AskBool("Some systems are ineligible for distributed networking, which requires either an interface with no IPs assigned or a bridge. Continue anyway? (yes/no) [default=yes]: ", "yes")
q = "Some systems are ineligible for distributed networking, which requires either an interface with no IPs assigned or a bridge. Continue anyway? (yes/no) [default=yes]: "
wantsContinue, err := c.asker.AskBool(q, "yes")
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", q, err)
}

if wantsContinue {
Expand Down Expand Up @@ -964,19 +966,21 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
msg := fmt.Sprintf("Specify the %s gateway (CIDR) on the uplink network (empty to skip %s): ", ip, ip)
gateway, err := c.asker.AskString(msg, "", validator)
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", msg, err)
}

if gateway != "" {
if ip == "IPv4" {
rangeStart, err := c.asker.AskString(fmt.Sprintf("Specify the first %s address in the range to use on the uplink network: ", ip), "", validate.Required(validate.IsNetworkAddressV4))
msg = fmt.Sprintf("Specify the first %s address in the range to use on the uplink network: ", ip)
rangeStart, err := c.asker.AskString(msg, "", validate.Required(validate.IsNetworkAddressV4))
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", msg, err)
}

rangeEnd, err := c.asker.AskString(fmt.Sprintf("Specify the last %s address in the range to use on the uplink network: ", ip), "", validate.Required(validate.IsNetworkAddressV4))
msg = fmt.Sprintf("Specify the last %s address in the range to use on the uplink network: ", ip)
rangeEnd, err := c.asker.AskString(msg, "", validate.Required(validate.IsNetworkAddressV4))
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", msg, err)
}

ipConfig[gateway] = fmt.Sprintf("%s-%s", rangeStart, rangeEnd)
Expand All @@ -997,9 +1001,10 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
}

gatewayAddrs := strings.Join(gateways, ",")
dnsAddresses, err = c.asker.AskString(fmt.Sprintf("Specify the DNS addresses (comma-separated IPv4 / IPv6 addresses) for the distributed network (default: %s): ", gatewayAddrs), gatewayAddrs, validate.Optional(validate.IsListOf(validate.IsNetworkAddress)))
msg := fmt.Sprintf("Specify the DNS addresses (comma-separated IPv4 / IPv6 addresses) for the distributed network (default: %s): ", gatewayAddrs)
dnsAddresses, err = c.asker.AskString(msg, gatewayAddrs, validate.Optional(validate.IsListOf(validate.IsNetworkAddress)))
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", msg, err)
}
}

Expand Down Expand Up @@ -1051,10 +1056,10 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
if canOVNUnderlay {
// TODO: Call `sh.Services[types.MicroOVN].(*service.OVNService).SupportsFeature(context.Background(), "custom_encapsulation_ip")`
// when MicroCloud will be updated with microcluster/v2

wantsDedicatedUnderlay, err := c.asker.AskBool("Configure dedicated underlay networking? (yes/no) [default=no]: ", "no")
msg := "Configure dedicated underlay networking? (yes/no) [default=no]: "
wantsDedicatedUnderlay, err := c.asker.AskBool(msg, "no")
if err != nil {
return err
return fmt.Errorf("Error for %q: %w", msg, err)
}

if wantsDedicatedUnderlay {
Expand Down
2 changes: 2 additions & 0 deletions test/suites/add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ test_add_interactive() {
export IPV4_END="10.1.123.254"
export IPV6_SUBNET="fd42:1:1234:1234::1/64"
export DNS_ADDRESSES="10.1.123.1,fd42:1:1234:1234::1"
export OVN_UNDERLAY_NETWORK="no"
microcloud_interactive | lxc exec micro01 -- sh -c "microcloud init > out"
lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q

Expand All @@ -159,6 +160,7 @@ test_add_interactive() {
export CEPH_ENCRYPT="no"
export SETUP_OVN="yes"
export OVN_FILTER="enp6s0"
export OVN_UNDERLAY_NETWORK="no"
microcloud_interactive | lxc exec micro01 -- sh -c "microcloud add > out"
lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q

Expand Down
3 changes: 3 additions & 0 deletions test/suites/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ test_interactive() {
export IPV6_SUBNET="fd42:1:1234:1234::1/64"
export DNS_ADDRESSES="10.1.123.1,8.8.8.8"
export CEPH_CLUSTER_NETWORK="${microcloud_internal_net_addr}"
export OVN_UNDERLAY_NETWORK="no"
microcloud_interactive | lxc exec micro01 -- sh -c "microcloud init > out"

lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q
Expand Down Expand Up @@ -1108,6 +1109,7 @@ test_reuse_cluster() {
export IPV4_END="10.1.123.254"
export DNS_ADDRESSES="10.1.123.1,8.8.8.8"
export IPV6_SUBNET="fd42:1:1234:1234::1/64"
export OVN_UNDERLAY_NETWORK="no"

reset_systems 3 3 3
echo "Create a MicroCloud that re-uses an existing service"
Expand Down Expand Up @@ -1234,6 +1236,7 @@ test_remove_cluster_member() {
export IPV4_END="10.1.123.254"
export DNS_ADDRESSES="10.1.123.1,8.8.8.8"
export IPV6_SUBNET="fd42:1:1234:1234::1/64"
export OVN_UNDERLAY_NETWORK="no"

reset_systems 3 3 3
echo "Fail to remove member from MicroCeph and LXD until OSDs are removed"
Expand Down

0 comments on commit 863f7e7

Please sign in to comment.