Hi all,

In lastest CS 4.2 code, I create advance zone with hypervisor vmware esxi, create public Network with vlan id 509 specified and label vSwitch0, when cs create systemvm(cpvm,ssvm), a new portgroup with name cloud.public.untagged.0.1-vSwitch0 was created, not a portgroup cloud.public.509.0.1-vSwitch0 as expected.

in database table nics, the field broadcast_uri for new systemvm is vlan:509 , and should be vlan://509

I debug the code , and found the problem in Networks.java
api/src/com/cloud/network/Networks.java  line 222

188     public enum IsolationType {
            ......
212         public <T> URI toUri(T value) {
213             try {
214                 // assert(this!=Vlan ||
215                 // value.getClass().isAssignableFrom(Integer.class)) :
216 // do we need to check that value does not contain a scheme
217                 // part?
218                 // "Why are you putting non integer into vlan url";
219                 if (value.toString().contains(":"))
220                     return new URI(value.toString());
221                 else
222                     return new URI(scheme, value.toString(), null);
223             } catch (URISyntaxException e) {
224                 throw new CloudRuntimeException(
225 "Unable to convert to isolation type URI: " + value);
226             }
227         }

line 222 should be changed to :
    return new URI(scheme,value.toString(),null,null);
or
    return new URI(scheme + "://" + value.toString());

same bug in the same file line 100,  enum BroadcastDomainType .

anyone can test and fix it?


diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java
index c76c3d4..672b69b 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -97,7 +97,7 @@ public class Networks {
                 if (value.toString().contains(":"))
                     return new URI(value.toString());
                 else
-                    return new URI(scheme, value.toString(), null);
+                    return new URI(scheme, value.toString(), null, null);
             } catch (URISyntaxException e) {
                 throw new CloudRuntimeException(
                         "Unable to convert to broadcast URI: " + value);
@@ -219,7 +219,7 @@ public class Networks {
                 if (value.toString().contains(":"))
                     return new URI(value.toString());
                 else
-                    return new URI(scheme, value.toString(), null);
+                    return new URI(scheme, value.toString(), null, null);
             } catch (URISyntaxException e) {
                 throw new CloudRuntimeException(
"Unable to convert to isolation type URI: " + value);


--
Thanks,
Jijun

Reply via email to