diff --git a/cmd/microcloud/add.go b/cmd/microcloud/add.go index 2c3dbcd09..ba078381c 100644 --- a/cmd/microcloud/add.go +++ b/cmd/microcloud/add.go @@ -73,15 +73,11 @@ func (c *cmdAdd) Run(cmd *cobra.Command, args []string) error { cfg.name = status.Name cfg.address = status.Address.Addr().String() - microcloudInternalNet, err := cfg.askAddress("") + _, err = cfg.askAddress("") if err != nil { return err } - addingSystem := cfg.systems[cfg.name] - addingSystem.MicroCloudInternalNetwork = microcloudInternalNet - cfg.systems[cfg.name] = addingSystem - installedServices := []types.ServiceType{types.MicroCloud, types.LXD} optionalServices := map[types.ServiceType]string{ types.MicroCeph: api.MicroCephDir, diff --git a/cmd/microcloud/preseed.go b/cmd/microcloud/preseed.go index 6de299833..575ce7d90 100644 --- a/cmd/microcloud/preseed.go +++ b/cmd/microcloud/preseed.go @@ -713,6 +713,24 @@ func (p *Preseed) Parse(s *service.Handler, c *initConfig, installedServices map } lxd := s.Services[types.LXD].(*service.LXDService) + + if c.bootstrap { + // We need to find the interface for the lookup subnet. + microCloudSubnetInterface, err := lxd.FindInterfaceForSubnet(p.LookupSubnet) + if err != nil { + return nil, err + } + + ipLookupSubnet, lookupSubnet, err := net.ParseCIDR(p.LookupSubnet) + if err != nil { + return nil, err + } + + bootstrapSystem := c.systems[s.Name] + bootstrapSystem.MicroCloudInternalNetwork = &Network{Interface: *microCloudSubnetInterface, Subnet: lookupSubnet, IP: ipLookupSubnet} + c.systems[s.Name] = bootstrapSystem + } + ifaceByPeer := map[string]string{} ovnUnderlayNeeded := false for _, cfg := range p.Systems {