Fixed agent code to handle untagged public vlan while parsing the vlan id

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

Branch: refs/heads/rbac
Commit: 7f780f26f99aa063147c38b208eaf191ce8ccac3
Parents: adf6026
Author: Rajesh Battala <rajesh.batt...@citrix.com>
Authored: Wed Feb 5 23:44:14 2014 +0530
Committer: Rajesh Battala <rajesh.batt...@citrix.com>
Committed: Wed Feb 5 23:44:14 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f780f26/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 b9694f0..dde6e21 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