Skip to content

Commit

Permalink
support both mycelium + yggdrasil (#2208)
Browse files Browse the repository at this point in the history
now VMs can has both ygg and mycelium at the same time
  • Loading branch information
muhamadazmy authored Feb 26, 2024
1 parent 29412f5 commit 2981284
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bins/packages/mycelium/mycelium.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MYCELIUM_VERSION="0.3.0"
MYCELIUM_CHECKSUM="68ac250b23057a18f351a9aa4bc0ef6d"
MYCELIUM_VERSION="0.4.0"
MYCELIUM_CHECKSUM="b8be89c10d5a25d2796740fd78c6e9c9"
MYCELIUM_LINK="https://github.com/threefoldtech/mycelium/releases/download/v${MYCELIUM_VERSION}/mycelium-x86_64-unknown-linux-musl.tar.gz"

download_mycelium() {
Expand Down
1 change: 1 addition & 0 deletions pkg/gridtypes/zos/zmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ type ZMachineResult struct {
ID string `json:"id"`
IP string `json:"ip"`
PlanetaryIP string `json:"planetary_ip"`
MyceliumIP string `json:"mycelium_ip"`
ConsoleURL string `json:"console_url"`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/primitives/vm/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (p *Manager) newMyceliumNetworkInterface(ctx context.Context, dl gridtypes.
Routes: []pkg.Route{
{
Net: net.IPNet{
IP: net.ParseIP("200::"),
IP: net.ParseIP("400::"),
Mask: net.CIDRMask(7, 128),
},
Gateway: iface.Gateway.IP,
Expand Down
27 changes: 14 additions & 13 deletions pkg/primitives/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,26 @@ func (p *Manager) virtualMachineProvisionImpl(ctx context.Context, wl *gridtypes
}

if config.Network.Planetary {
var inf pkg.VMIface
if config.Network.Mycelium == nil {
inf, err = p.newYggNetworkInterface(ctx, wl)
if err != nil {
return result, err
}
ifs = append(ifs, wl.ID.Unique("ygg"))
} else {
inf, err = p.newMyceliumNetworkInterface(ctx, deployment, wl, config.Network.Mycelium)
if err != nil {
return result, err
}
ifs = append(ifs, wl.ID.Unique("mycelium"))
inf, err := p.newYggNetworkInterface(ctx, wl)
if err != nil {
return result, err
}
ifs = append(ifs, wl.ID.Unique("ygg"))

log.Debug().Msgf("Planetary: %+v", inf)
networkInfo.Ifaces = append(networkInfo.Ifaces, inf)
result.PlanetaryIP = inf.IPs[0].IP.String()
}

if config.Network.Mycelium != nil {
inf, err := p.newMyceliumNetworkInterface(ctx, deployment, wl, config.Network.Mycelium)
if err != nil {
return result, err
}
ifs = append(ifs, wl.ID.Unique("mycelium"))
networkInfo.Ifaces = append(networkInfo.Ifaces, inf)
result.MyceliumIP = inf.IPs[0].IP.String()
}
// - mount flist RO
mnt, err := flist.Mount(ctx, wl.ID.String(), config.FList, pkg.ReadOnlyMountOptions)
if err != nil {
Expand Down

0 comments on commit 2981284

Please sign in to comment.