Fixed agent code to handle untagged public vlan while parsing the vlan id
(cherry picked from commit 7df148c762510f669b60edff9d8d690c800b1f95)

Signed-off-by: Animesh Chaturvedi <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3c891fcf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3c891fcf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3c891fcf

Branch: refs/heads/4.3
Commit: 3c891fcf66531b96e74ce98d57faa1713928d9ca
Parents: f93be7b
Author: Rajesh Battala <[email protected]>
Authored: Wed Feb 5 23:44:14 2014 +0530
Committer: Animesh Chaturvedi <[email protected]>
Committed: Fri Feb 7 13:17:16 2014 -0800

----------------------------------------------------------------------
 .../DotNet/ServerResource/HypervResource/WmiCallsV2.cs       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c891fcf/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs 
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index 2e3aca5..f5a04dc 100644
--- 
a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ 
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -391,7 +391,7 @@ namespace HypervResource
                     string vlan = null;
                     string isolationUri = nic.isolationUri;
                     string broadcastUri = nic.broadcastUri;
-                    if ( (broadcastUri != null ) || (isolationUri != null && 
isolationUri.StartsWith("vlan://")) && !isolationUri.Equals("vlan://untagged"))
+                    if ( (broadcastUri != null ) || (isolationUri != null && 
isolationUri.StartsWith("vlan://")))
                     {
                         if (broadcastUri != null && 
broadcastUri.StartsWith("storage"))
                         {
@@ -402,7 +402,11 @@ namespace HypervResource
                             vlan = isolationUri.Substring("vlan://".Length);
                         }
                         int tmp;
-                        if (!int.TryParse(vlan, out tmp))
+                        if (vlan.Equals("untagged", 
StringComparison.CurrentCultureIgnoreCase) ) {
+                            // recevied vlan is untagged, don't parse for the 
vlan in the isolation uri
+                            vlan = null;
+                        }
+                        else if (!int.TryParse(vlan, out tmp))
                         {
                             // TODO: double check exception type
                             errMsg = string.Format("Invalid VLAN value {0} for 
on vm {1} for nic uuid {2}", isolationUri, vmName, nic.uuid);

Reply via email to