Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-jmattson committed Nov 11, 2024
1 parent 75c39f0 commit 9a1879f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/TopoMojo.Hypervisor/vSphere/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public async Task Provision(VmTemplate template)
{
await Task.Delay(0);

ProvisionAll(template.Eth, template.UseUplinkSwitch).Wait();
await ProvisionAll(template.Eth, template.UseUplinkSwitch);

foreach (var eth in template.Eth)
{
Expand Down Expand Up @@ -115,6 +115,7 @@ public async Task ProvisionAll(VmNet[] nets, bool useUplinkSwitch)
.ToArray()
;

_logger.LogDebug("AddPortGroups for {count} nets...", manifest.Length);
var pgs = AddPortGroups(sw, manifest).Result;

_vlanManager.Activate(
Expand Down
9 changes: 7 additions & 2 deletions src/TopoMojo.Hypervisor/vSphere/NsxNetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public override async Task<PortGroupAllocation> AddPortGroup(string sw, VmNet et

public override async Task<PortGroupAllocation[]> AddPortGroups(string sw, VmNet[] eths)
{
if (eths.Length == 0)
return [];

await InitClient();

string tag = eths[0].Net.Tag();
Expand All @@ -192,7 +195,9 @@ public override async Task<PortGroupAllocation[]> AddPortGroups(string sw, VmNet
if (response.IsSuccessStatusCode)
names.Add(eth.Net);
else
_logger.LogDebug("Failed to add SDDC PortGroup {net}", eth.Net);
_logger.LogDebug("Failed to add SDDC PortGroup {net} {reason}", eth.Net, response.ReasonPhrase);

await Task.Delay(250);
}

int count = 10;
Expand All @@ -201,7 +206,7 @@ public override async Task<PortGroupAllocation[]> AddPortGroups(string sw, VmNet
do
{
await Task.Delay(1500);

_logger.LogDebug("SDDC resolving new portgroups [{count}]", count);
pgas = (await LoadPortGroups())
.Where(p => names.Contains(p.Net))
.ToArray()
Expand Down
4 changes: 4 additions & 0 deletions src/TopoMojo.Hypervisor/vSphere/vSphereHypervisorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,11 @@ private async Task DeployBatch(DeploymentContext ctx)
{
var eths = ctx.Templates.SelectMany(t => t.Eth).ToArray();
foreach (var eth in eths)
{
if (ctx.Privileged && _vlanman.Contains(eth.Net))
continue;
eth.Net += $"#{ctx.Id}";
}
await _hostCache.First().Value.PreDeployNets(eths, false);
}

Expand Down

0 comments on commit 9a1879f

Please sign in to comment.