Skip to content

Commit 7df148c

Browse files
Fixed agent code to handle untagged public vlan while parsing the vlan id
1 parent 2e00487 commit 7df148c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource

‎plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso)
391391
string vlan = null;
392392
string isolationUri = nic.isolationUri;
393393
string broadcastUri = nic.broadcastUri;
394-
if ( (broadcastUri != null ) || (isolationUri != null && isolationUri.StartsWith("vlan://")) && !isolationUri.Equals("vlan://untagged"))
394+
if ( (broadcastUri != null ) || (isolationUri != null && isolationUri.StartsWith("vlan://")))
395395
{
396396
if (broadcastUri != null && broadcastUri.StartsWith("storage"))
397397
{
@@ -402,7 +402,11 @@ public ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso)
402402
vlan = isolationUri.Substring("vlan://".Length);
403403
}
404404
int tmp;
405-
if (!int.TryParse(vlan, out tmp))
405+
if (vlan.Equals("untagged", StringComparison.CurrentCultureIgnoreCase) ) {
406+
// recevied vlan is untagged, don't parse for the vlan in the isolation uri
407+
vlan = null;
408+
}
409+
else if (!int.TryParse(vlan, out tmp))
406410
{
407411
// TODO: double check exception type
408412
errMsg = string.Format("Invalid VLAN value {0} for on vm {1} for nic uuid {2}", isolationUri, vmName, nic.uuid);

0 commit comments

Comments
 (0)