@@ -126,7 +126,7 @@ public VmwareServerDiscoverer() {
126126
127127 @ Override
128128 public Map <? extends ServerResource , Map <String , String >>
129- find (long dcId , Long podId , Long clusterId , URI url , String username , String password , List <String > hostTags ) throws DiscoveryException {
129+ find (long dcId , Long podId , Long clusterId , URI url , String username , String password , List <String > hostTags ) throws DiscoveryException {
130130
131131 if (s_logger .isInfoEnabled ())
132132 s_logger .info ("Discover host. dc: " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + url .getHost ());
@@ -158,7 +158,7 @@ public VmwareServerDiscoverer() {
158158 if (usernameNotProvided || passwordNotProvided ) {
159159 // Retrieve credentials associated with VMware DC
160160 s_logger .info ("Username and/or Password not provided while adding cluster to cloudstack zone. "
161- + "Hence using both username & password provided while adding VMware DC to CloudStack zone." );
161+ + "Hence using both username & password provided while adding VMware DC to CloudStack zone." );
162162 username = vmwareDc .getUser ();
163163 password = vmwareDc .getPassword ();
164164 clusterDetails .put ("username" , username );
@@ -252,7 +252,7 @@ public VmwareServerDiscoverer() {
252252
253253 // Process traffic label information provided at zone level and cluster level
254254 publicTrafficLabelObj =
255- getTrafficInfo (TrafficType .Public , publicTrafficLabel , defaultVirtualSwitchType , paramPublicVswitchType , paramPublicVswitchName , clusterId );
255+ getTrafficInfo (TrafficType .Public , publicTrafficLabel , defaultVirtualSwitchType , paramPublicVswitchType , paramPublicVswitchName , clusterId );
256256
257257 // Configuration Check: A physical network cannot be shared by different types of virtual switches.
258258 //
@@ -272,7 +272,7 @@ public VmwareServerDiscoverer() {
272272 if (pNetworkListGuestTraffic .contains (pNetworkPublic )) {
273273 if (publicTrafficLabelObj .getVirtualSwitchType () != guestTrafficLabelObj .getVirtualSwitchType ()) {
274274 String msg =
275- "Both public traffic and guest traffic is over same physical network " + pNetworkPublic +
275+ "Both public traffic and guest traffic is over same physical network " + pNetworkPublic +
276276 ". And virtual switch type chosen for each traffic is different" +
277277 ". A physical network cannot be shared by different types of virtual switches." ;
278278 s_logger .error (msg );
@@ -295,7 +295,7 @@ public VmwareServerDiscoverer() {
295295 }
296296 Pair <Boolean , Long > vsmInfo = new Pair <Boolean , Long >(false , 0L );
297297 if (nexusDVS && (guestTrafficLabelObj .getVirtualSwitchType () == VirtualSwitchType .NexusDistributedVirtualSwitch ) ||
298- ((zoneType == NetworkType .Advanced ) && (publicTrafficLabelObj .getVirtualSwitchType () == VirtualSwitchType .NexusDistributedVirtualSwitch ))) {
298+ ((zoneType == NetworkType .Advanced ) && (publicTrafficLabelObj .getVirtualSwitchType () == VirtualSwitchType .NexusDistributedVirtualSwitch ))) {
299299 // Expect Cisco Nexus VSM details only if following 2 condition met
300300 // 1) The global config parameter vmware.use.nexus.vswitch
301301 // 2) Atleast 1 traffic type uses Nexus distributed virtual switch as backend.
@@ -335,22 +335,22 @@ public VmwareServerDiscoverer() {
335335 context .registerStockObject ("vsmcredentials" , vsmCredentials );
336336 }
337337 }
338- List <ManagedObjectReference > morHosts = _vmwareMgr .addHostToPodCluster (context , dcId , podId , clusterId , URLDecoder .decode (url .getPath ()));
338+ List <ManagedObjectReference > morHosts = _vmwareMgr .addHostToPodCluster (context , dcId , podId , clusterId , URLDecoder .decode (url .getPath (), "UTF-8" ));
339339 if (morHosts == null )
340340 s_logger .info ("Found 0 hosts." );
341341 if (privateTrafficLabel != null )
342342 context .uregisterStockObject ("privateTrafficLabel" );
343343
344344 if (morHosts == null ) {
345- s_logger .error ("Unable to find host or cluster based on url: " + URLDecoder .decode (url .getPath ()));
345+ s_logger .error ("Unable to find host or cluster based on url: " + URLDecoder .decode (url .getPath (), "UTF-8" ));
346346 return null ;
347347 }
348348
349349 ManagedObjectReference morCluster = null ;
350350 clusterDetails = _clusterDetailsDao .findDetails (clusterId );
351351 if (clusterDetails .get ("url" ) != null ) {
352352 URI uriFromCluster = new URI (UriUtils .encodeURIComponent (clusterDetails .get ("url" )));
353- morCluster = context .getHostMorByPath (URLDecoder .decode (uriFromCluster .getPath ()));
353+ morCluster = context .getHostMorByPath (URLDecoder .decode (uriFromCluster .getPath (), "UTF-8" ));
354354
355355 if (morCluster == null || !morCluster .getType ().equalsIgnoreCase ("ClusterComputeResource" )) {
356356 s_logger .warn ("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails .get ("url" ));
@@ -491,13 +491,13 @@ private String validateCluster(URI url, VmwareDatacenterVO vmwareDc) throws Disc
491491
492492 if (!vCenterHost .equalsIgnoreCase (url .getHost ())) {
493493 msg =
494- "This cluster " + clusterName + " belongs to vCenter " + url .getHost () + ". But this zone is associated with VMware DC from vCenter " + vCenterHost +
494+ "This cluster " + clusterName + " belongs to vCenter " + url .getHost () + ". But this zone is associated with VMware DC from vCenter " + vCenterHost +
495495 ". Make sure the cluster being added belongs to vCenter " + vCenterHost + " and VMware DC " + vmwareDcNameFromDb ;
496496 s_logger .error (msg );
497497 throw new DiscoveryException (msg );
498498 } else if (!vmwareDcNameFromDb .equalsIgnoreCase (vmwareDcNameFromApi )) {
499499 msg =
500- "This cluster " + clusterName + " belongs to VMware DC " + vmwareDcNameFromApi + " .But this zone is associated with VMware DC " + vmwareDcNameFromDb +
500+ "This cluster " + clusterName + " belongs to VMware DC " + vmwareDcNameFromApi + " .But this zone is associated with VMware DC " + vmwareDcNameFromDb +
501501 ". Make sure the cluster being added belongs to VMware DC " + vmwareDcNameFromDb + " in vCenter " + vCenterHost ;
502502 s_logger .error (msg );
503503 throw new DiscoveryException (msg );
@@ -567,8 +567,8 @@ private void createVmwareToolsIso() {
567567 if (tmplt == null ) {
568568 id = _tmpltDao .getNextInSequence (Long .class , "id" );
569569 VMTemplateVO template =
570- VMTemplateVO .createPreHostIso (id , isoName , isoName , ImageFormat .ISO , true , true , TemplateType .PERHOST , null , null , true , 64 , Account .ACCOUNT_ID_SYSTEM ,
571- null , "VMware Tools Installer ISO" , false , 1 , false , HypervisorType .VMware );
570+ VMTemplateVO .createPreHostIso (id , isoName , isoName , ImageFormat .ISO , true , true , TemplateType .PERHOST , null , null , true , 64 , Account .ACCOUNT_ID_SYSTEM ,
571+ null , "VMware Tools Installer ISO" , false , 1 , false , HypervisorType .VMware );
572572 _tmpltDao .persist (template );
573573 } else {
574574 id = tmplt .getId ();
@@ -627,7 +627,7 @@ public boolean stop() {
627627 }
628628
629629 private VmwareTrafficLabel getTrafficInfo (TrafficType trafficType , String zoneWideTrafficLabel , VirtualSwitchType defaultVirtualSwitchType , String vSwitchType ,
630- String vSwitchName , Long clusterId ) {
630+ String vSwitchName , Long clusterId ) {
631631 VmwareTrafficLabel trafficLabelObj = null ;
632632 Map <String , String > clusterDetails = null ;
633633 try {
@@ -664,7 +664,7 @@ private VmwareTrafficLabel getTrafficInfo(TrafficType trafficType, String zoneWi
664664 }
665665
666666 private VmwareTrafficLabel getTrafficInfo (TrafficType trafficType , String zoneWideTrafficLabel , Map <String , String > clusterDetails ,
667- VirtualSwitchType defVirtualSwitchType ) {
667+ VirtualSwitchType defVirtualSwitchType ) {
668668 VmwareTrafficLabel trafficLabelObj = null ;
669669 try {
670670 trafficLabelObj = new VmwareTrafficLabel (zoneWideTrafficLabel , trafficType , defVirtualSwitchType );
0 commit comments