@@ -402,23 +402,23 @@ public void updateConfiguration(long userId, String name, String category, Strin
402402 s_logger .debug ("Config 'system.vm.use.local.storage' changed to value:" + value + ", need to update System VM offerings" );
403403 }
404404 boolean useLocalStorage = Boolean .parseBoolean (_configDao .getValue (Config .SystemVMUseLocalStorage .key ()));
405- ServiceOfferingVO serviceOffering = _serviceOfferingDao .findByName ("Cloud.com-ConsoleProxy" );
405+ ServiceOfferingVO serviceOffering = _serviceOfferingDao .findByName (ServiceOffering . consoleProxyDefaultOffUniqueName );
406406 if (serviceOffering != null ) {
407407 serviceOffering .setUseLocalStorage (useLocalStorage );
408408 if (!_serviceOfferingDao .update (serviceOffering .getId (), serviceOffering )) {
409409 throw new CloudRuntimeException ("Failed to update ConsoleProxy offering's use_local_storage option to value:" + useLocalStorage );
410410 }
411411 }
412412
413- serviceOffering = _serviceOfferingDao .findByName ("Cloud.Com-SoftwareRouter" );
413+ serviceOffering = _serviceOfferingDao .findByName (ServiceOffering . routerDefaultOffUniqueName );
414414 if (serviceOffering != null ) {
415415 serviceOffering .setUseLocalStorage (useLocalStorage );
416416 if (!_serviceOfferingDao .update (serviceOffering .getId (), serviceOffering )) {
417417 throw new CloudRuntimeException ("Failed to update SoftwareRouter offering's use_local_storage option to value:" + useLocalStorage );
418418 }
419419 }
420420
421- serviceOffering = _serviceOfferingDao .findByName ("Cloud.com-SecondaryStorage" );
421+ serviceOffering = _serviceOfferingDao .findByName (ServiceOffering . ssvmDefaultOffUniqueName );
422422 if (serviceOffering != null ) {
423423 serviceOffering .setUseLocalStorage (useLocalStorage );
424424 if (!_serviceOfferingDao .update (serviceOffering .getId (), serviceOffering )) {
@@ -447,7 +447,7 @@ public Configuration updateConfiguration(UpdateCfgCmd cmd) {
447447 if (value == null ) {
448448 return _configDao .findByName (name );
449449 }
450-
450+
451451 if (value .trim ().isEmpty () || value .equals ("null" )) {
452452 value = null ;
453453 }
@@ -463,23 +463,23 @@ public Configuration updateConfiguration(UpdateCfgCmd cmd) {
463463 }
464464
465465 private String validateConfigurationValue (String name , String value ) {
466-
466+
467467 Config c = Config .getConfig (name );
468468 if (c == null ) {
469469 s_logger .error ("Missing configuration variable " + name + " in configuration table" );
470470 return "Invalid configuration variable." ;
471471 }
472472
473473 Class <?> type = c .getType ();
474-
474+
475475 if (value == null ) {
476476 if (type .equals (Boolean .class )) {
477477 return "Please enter either 'true' or 'false'." ;
478478 }
479479 return null ;
480480 }
481481 value = value .trim ();
482-
482+
483483 if (type .equals (Boolean .class )) {
484484 if (!(value .equals ("true" ) || value .equals ("false" ))) {
485485 s_logger .error ("Configuration variable " + name + " is expecting true or false in stead of " + value );
@@ -1253,7 +1253,7 @@ public boolean removeLDAP(LDAPRemoveCmd cmd) {
12531253 _configDao .expunge (LDAPParams .passwd .toString ());
12541254 _configDao .expunge (LDAPParams .truststore .toString ());
12551255 _configDao .expunge (LDAPParams .truststorepass .toString ());
1256- return true ;
1256+ return true ;
12571257 }
12581258
12591259 @ Override
@@ -1274,23 +1274,23 @@ public boolean updateLDAP(LDAPConfigCmd cmd) {
12741274 if (bindDN != null && bindPasswd == null ) {
12751275 throw new InvalidParameterValueException ("If you specify a bind name then you need to provide bind password too." );
12761276 }
1277-
1277+
12781278 // check if the info is correct
12791279 Hashtable <String , String > env = new Hashtable <String , String >(11 );
12801280 env .put (Context .INITIAL_CONTEXT_FACTORY , "com.sun.jndi.ldap.LdapCtxFactory" );
12811281 String protocol = "ldap://" ;
12821282 if (new Boolean (useSSL )) {
12831283 env .put (Context .SECURITY_PROTOCOL , "ssl" );
12841284 protocol = "ldaps://" ;
1285- if (trustStore == null || trustStorePassword == null ) {
1286- throw new InvalidParameterValueException ("If you plan to use SSL then you need to configure the trust store." );
1285+ if (trustStore == null || trustStorePassword == null ) {
1286+ throw new InvalidParameterValueException ("If you plan to use SSL then you need to configure the trust store." );
12871287 }
12881288 System .setProperty ("javax.net.ssl.trustStore" , trustStore );
12891289 System .setProperty ("javax.net.ssl.trustStorePassword" , trustStorePassword );
12901290 }
12911291 env .put (Context .PROVIDER_URL , protocol + hostname + ":" + port );
12921292 if (bindDN != null && bindPasswd != null ) {
1293- env .put (Context .SECURITY_AUTHENTICATION , "simple" );
1293+ env .put (Context .SECURITY_AUTHENTICATION , "simple" );
12941294 env .put (Context .SECURITY_PRINCIPAL , bindDN );
12951295 env .put (Context .SECURITY_CREDENTIALS , bindPasswd );
12961296 }
@@ -1363,16 +1363,15 @@ public boolean updateLDAP(LDAPConfigCmd cmd) {
13631363 }
13641364 cvo .setValue (DBEncryptionUtil .encrypt (trustStorePassword ));
13651365 _configDao .persist (cvo );
1366-
1366+
13671367 s_logger .debug ("The ldap server is configured: " + hostname );
13681368 } catch (NamingException ne ) {
13691369 ne .printStackTrace ();
13701370 throw new InvalidParameterValueException ("Naming Exception, check you ldap data ! " + ne .getMessage () + (ne .getCause () != null ? ("Caused by:" + ne .getCause ().getMessage ()) : "" ));
13711371 }
13721372 return true ;
13731373 }
1374-
1375-
1374+
13761375 @ Override
13771376 @ DB
13781377 @ ActionEvent (eventType = EventTypes .EVENT_ZONE_EDIT , eventDescription = "editing zone" , async = false )
@@ -3138,7 +3137,7 @@ public NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd) {
31383137 if (provider == Provider .JuniperSRX ) {
31393138 isSrx = true ;
31403139 }
3141-
3140+
31423141 providers .add (provider );
31433142
31443143 Set <Service > serviceSet = null ;
@@ -3186,9 +3185,10 @@ public NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd) {
31863185 serviceCapabilityMap .put (Service .Lb , lbServiceCapabilityMap );
31873186 serviceCapabilityMap .put (Service .SourceNat , sourceNatServiceCapabilityMap );
31883187 serviceCapabilityMap .put (Service .StaticNat , staticNatServiceCapabilityMap );
3189-
3190- //if Firewall service is missing, and Juniper is a provider for any other service, add Firewall service/provider combination
3191- if (isSrx ) {
3188+
3189+ // if Firewall service is missing, and Juniper is a provider for any other service, add Firewall
3190+ // service/provider combination
3191+ if (isSrx ) {
31923192 s_logger .debug ("Adding Firewall service with provider " + Provider .JuniperSRX .getName ());
31933193 Set <Provider > firewallProvider = new HashSet <Provider >();
31943194 firewallProvider .add (Provider .JuniperSRX );
@@ -3510,11 +3510,11 @@ public List<? extends NetworkOffering> searchForNetworkOfferings(ListNetworkOffe
35103510 if (id != null ) {
35113511 sc .addAnd ("id" , SearchCriteria .Op .EQ , id );
35123512 }
3513-
3513+
35143514 if (tags != null ) {
35153515 sc .addAnd ("tags" , SearchCriteria .Op .EQ , tags );
35163516 }
3517-
3517+
35183518 if (isTagged != null ) {
35193519 if (isTagged ) {
35203520 sc .addAnd ("tags" , SearchCriteria .Op .NNULL );
@@ -3531,7 +3531,7 @@ public List<? extends NetworkOffering> searchForNetworkOfferings(ListNetworkOffe
35313531 List <PhysicalNetworkVO > pNtwks = _physicalNetworkDao .listByZoneAndTrafficType (zoneId , TrafficType .Guest );
35323532 if (pNtwks .size () > 1 ) {
35333533 checkForTags = true ;
3534- //go through tags
3534+ // go through tags
35353535 for (PhysicalNetworkVO pNtwk : pNtwks ) {
35363536 List <String > pNtwkTag = pNtwk .getTags ();
35373537 if (pNtwkTag == null || pNtwkTag .isEmpty ()) {
@@ -3568,13 +3568,13 @@ public List<? extends NetworkOffering> searchForNetworkOfferings(ListNetworkOffe
35683568 for (NetworkOfferingVO offering : offerings ) {
35693569 boolean addOffering = true ;
35703570 List <Service > checkForProviders = new ArrayList <Service >();
3571-
3571+
35723572 if (checkForTags ) {
35733573 if (!pNtwkTags .contains (offering .getTags ())) {
35743574 continue ;
35753575 }
35763576 }
3577-
3577+
35783578 if (listBySupportedServices ) {
35793579 addOffering = addOffering && _networkMgr .areServicesSupportedByNetworkOffering (offering .getId (), supportedServices );
35803580 }
@@ -3592,14 +3592,11 @@ public List<? extends NetworkOffering> searchForNetworkOfferings(ListNetworkOffe
35923592 if (sourceNatSupported != null ) {
35933593 addOffering = addOffering && (_networkMgr .areServicesSupportedByNetworkOffering (offering .getId (), Network .Service .SourceNat ) == sourceNatSupported );
35943594 }
3595-
3596-
35973595
35983596 if (addOffering ) {
35993597 supportedOfferings .add (offering );
36003598 }
3601-
3602-
3599+
36033600 }
36043601
36053602 return supportedOfferings ;
@@ -3626,12 +3623,13 @@ public boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd) {
36263623 if (offering .isDefault () == true ) {
36273624 throw new InvalidParameterValueException ("Default network offering can't be deleted" );
36283625 }
3629-
3630- //don't allow to delete network offering if it's in use by existing networks (the offering can be disabled though)
3626+
3627+ // don't allow to delete network offering if it's in use by existing networks (the offering can be disabled
3628+ // though)
36313629 int networkCount = _networkDao .getNetworkCountByNetworkOffId (offeringId );
36323630 if (networkCount > 0 ) {
36333631 throw new InvalidParameterValueException ("Can't delete network offering " + offeringId + " as its used by " + networkCount + " networks. " +
3634- "To make the network offering unavaiable, disable it" );
3632+ "To make the network offering unavaiable, disable it" );
36353633 }
36363634
36373635 if (_networkOfferingDao .remove (offeringId )) {
0 commit comments