cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [12/50] [abbrv] git commit: updated refs/heads/ui-restyle to 500c798
Date Thu, 24 Oct 2013 18:30:50 GMT
Merge remote-tracking branch 'origin/txn-refactor'

Conflicts:
	engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java
	server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
	server/src/com/cloud/vm/UserVmManagerImpl.java


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

Branch: refs/heads/ui-restyle
Commit: 205a77a5bbd82cc95c2c635286c1ab5f353c8fb7
Parents: 1f0dd7c edeaf98
Author: Darren Shepherd <darren.s.shepherd@gmail.com>
Authored: Wed Oct 23 10:40:44 2013 -0700
Committer: Darren Shepherd <darren.s.shepherd@gmail.com>
Committed: Wed Oct 23 10:40:44 2013 -0700

----------------------------------------------------------------------
 .../exception/ConcurrentOperationException.java |    3 +-
 .../bridge/persist/dao/BucketPolicyDaoImpl.java |    6 +-
 .../persist/dao/CloudStackAccountDaoImpl.java   |    3 +-
 .../dao/CloudStackConfigurationDaoImpl.java     |    3 +-
 .../dao/CloudStackSvcOfferingDaoImpl.java       |    5 +-
 .../persist/dao/CloudStackUserDaoImpl.java      |    3 +-
 .../cloud/bridge/persist/dao/MHostDaoImpl.java  |    5 +-
 .../bridge/persist/dao/MHostMountDaoImpl.java   |    3 +-
 .../persist/dao/MultiPartPartsDaoImpl.java      |    9 +-
 .../persist/dao/MultiPartUploadsDaoImpl.java    |   15 +-
 .../bridge/persist/dao/MultipartLoadDao.java    |    9 +-
 .../persist/dao/MultipartMetaDaoImpl.java       |    3 +-
 .../bridge/persist/dao/OfferingDaoImpl.java     |   11 +-
 .../cloud/bridge/persist/dao/SAclDaoImpl.java   |    7 +-
 .../bridge/persist/dao/SBucketDaoImpl.java      |    5 +-
 .../cloud/bridge/persist/dao/SHostDaoImpl.java  |    5 +-
 .../cloud/bridge/persist/dao/SMetaDaoImpl.java  |    5 +-
 .../bridge/persist/dao/SObjectDaoImpl.java      |    7 +-
 .../bridge/persist/dao/SObjectItemDaoImpl.java  |    5 +-
 .../persist/dao/UserCredentialsDaoImpl.java     |    5 +-
 .../cloud/bridge/service/EC2RestServlet.java    |   13 +-
 .../com/cloud/bridge/service/S3RestServlet.java |    5 +-
 .../service/controller/s3/S3BucketAction.java   |    3 +-
 .../service/controller/s3/ServiceProvider.java  |    7 +-
 .../cloud/bridge/service/core/s3/S3Engine.java  |   23 +-
 .../cloud/agent/manager/AgentManagerImpl.java   |    5 +-
 .../manager/ClusteredAgentManagerImpl.java      |    4 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  120 +-
 .../entity/api/db/dao/DcDetailsDaoImpl.java     |    4 +-
 .../entity/api/db/dao/EngineClusterDaoImpl.java |    6 +-
 .../api/db/dao/EngineDataCenterDaoImpl.java     |    6 +-
 .../entity/api/db/dao/EngineHostDaoImpl.java    |   14 +-
 .../entity/api/db/dao/EngineHostPodDaoImpl.java |    6 +-
 .../entity/api/db/dao/HostDetailsDaoImpl.java   |    4 +-
 .../entity/api/db/dao/HostTagsDaoImpl.java      |    4 +-
 .../orchestration/NetworkOrchestrator.java      |  896 ++++++-------
 .../orchestration/VolumeOrchestrator.java       |   88 +-
 .../src/com/cloud/alert/dao/AlertDaoImpl.java   |    4 +-
 .../com/cloud/capacity/dao/CapacityDaoImpl.java |   26 +-
 .../configuration/dao/ResourceCountDaoImpl.java |    4 +-
 .../src/com/cloud/dc/ClusterDetailsDaoImpl.java |    6 +-
 .../src/com/cloud/dc/dao/ClusterDaoImpl.java    |    6 +-
 .../com/cloud/dc/dao/ClusterVSMMapDaoImpl.java  |    4 +-
 .../src/com/cloud/dc/dao/DataCenterDaoImpl.java |    6 +-
 .../dc/dao/DataCenterIpAddressDaoImpl.java      |    8 +-
 .../DataCenterLinkLocalIpAddressDaoImpl.java    |    6 +-
 .../src/com/cloud/dc/dao/DataCenterVnetDao.java |    3 +-
 .../com/cloud/dc/dao/DataCenterVnetDaoImpl.java |    8 +-
 .../src/com/cloud/dc/dao/DcDetailsDaoImpl.java  |    4 +-
 .../src/com/cloud/dc/dao/HostPodDaoImpl.java    |    6 +-
 .../src/com/cloud/dc/dao/PodVlanDaoImpl.java    |    8 +-
 .../dc/dao/StorageNetworkIpAddressDaoImpl.java  |    6 +-
 .../src/com/cloud/dc/dao/VlanDaoImpl.java       |    4 +-
 .../src/com/cloud/domain/dao/DomainDaoImpl.java |    6 +-
 .../src/com/cloud/event/dao/EventDaoImpl.java   |    4 +-
 .../com/cloud/event/dao/UsageEventDaoImpl.java  |   10 +-
 .../src/com/cloud/host/dao/HostDaoImpl.java     |   14 +-
 .../com/cloud/host/dao/HostDetailsDaoImpl.java  |    4 +-
 .../src/com/cloud/host/dao/HostTagsDaoImpl.java |    4 +-
 .../src/com/cloud/keystore/KeystoreDaoImpl.java |    4 +-
 .../network/dao/FirewallRulesCidrsDaoImpl.java  |    4 +-
 .../cloud/network/dao/FirewallRulesDaoImpl.java |    6 +-
 .../com/cloud/network/dao/IPAddressDaoImpl.java |    6 +-
 .../com/cloud/network/dao/NetworkDaoImpl.java   |   10 +-
 .../cloud/network/dao/PortProfileDaoImpl.java   |    4 +-
 .../security/dao/SecurityGroupDaoImpl.java      |    6 +-
 .../security/dao/SecurityGroupWorkDaoImpl.java  |    8 +-
 .../security/dao/VmRulesetLogDaoImpl.java       |    8 +-
 .../cloud/network/vpc/dao/PrivateIpDaoImpl.java |    4 +-
 .../network/vpc/dao/StaticRouteDaoImpl.java     |    4 +-
 .../com/cloud/network/vpc/dao/VpcDaoImpl.java   |    8 +-
 .../network/vpc/dao/VpcOfferingDaoImpl.java     |    4 +-
 .../offerings/dao/NetworkOfferingDaoImpl.java   |    6 +-
 .../com/cloud/projects/dao/ProjectDaoImpl.java  |    4 +-
 .../dao/ServiceOfferingDetailsDaoImpl.java      |    4 +-
 .../storage/dao/LaunchPermissionDaoImpl.java    |    6 +-
 .../com/cloud/storage/dao/SnapshotDaoImpl.java  |   14 +-
 .../storage/dao/StoragePoolDetailsDaoImpl.java  |    4 +-
 .../storage/dao/StoragePoolHostDaoImpl.java     |   10 +-
 .../storage/dao/StoragePoolWorkDaoImpl.java     |    4 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    |   14 +-
 .../storage/dao/VMTemplateDetailsDaoImpl.java   |    4 +-
 .../storage/dao/VMTemplateHostDaoImpl.java      |    8 +-
 .../storage/dao/VMTemplatePoolDaoImpl.java      |    8 +-
 .../storage/dao/VMTemplateZoneDaoImpl.java      |    4 +-
 .../com/cloud/storage/dao/VolumeDaoImpl.java    |   12 +-
 .../cloud/storage/dao/VolumeDetailsDaoImpl.java |    4 +-
 .../src/com/cloud/upgrade/DatabaseCreator.java  |    8 +-
 .../cloud/upgrade/DatabaseIntegrityChecker.java |    7 +-
 .../cloud/upgrade/DatabaseUpgradeChecker.java   |    6 +-
 .../com/cloud/upgrade/dao/Upgrade307to410.java  |    1 -
 .../com/cloud/upgrade/dao/VersionDaoImpl.java   |    4 +-
 .../src/com/cloud/usage/dao/UsageDaoImpl.java   |   26 +-
 .../cloud/usage/dao/UsageIPAddressDaoImpl.java  |    6 +-
 .../com/cloud/usage/dao/UsageJobDaoImpl.java    |    8 +-
 .../dao/UsageLoadBalancerPolicyDaoImpl.java     |    8 +-
 .../cloud/usage/dao/UsageNetworkDaoImpl.java    |    8 +-
 .../usage/dao/UsageNetworkOfferingDaoImpl.java  |    6 +-
 .../dao/UsagePortForwardingRuleDaoImpl.java     |    8 +-
 .../usage/dao/UsageSecurityGroupDaoImpl.java    |    6 +-
 .../cloud/usage/dao/UsageStorageDaoImpl.java    |    8 +-
 .../cloud/usage/dao/UsageVMInstanceDaoImpl.java |    8 +-
 .../cloud/usage/dao/UsageVMSnapshotDaoImpl.java |    8 +-
 .../cloud/usage/dao/UsageVPNUserDaoImpl.java    |    6 +-
 .../com/cloud/usage/dao/UsageVmDiskDaoImpl.java |    8 +-
 .../com/cloud/usage/dao/UsageVolumeDaoImpl.java |    8 +-
 .../com/cloud/user/AccountDetailsDaoImpl.java   |    4 +-
 .../src/com/cloud/user/dao/AccountDaoImpl.java  |    4 +-
 .../cloud/user/dao/UserStatisticsDaoImpl.java   |    6 +-
 .../cloud/user/dao/VmDiskStatisticsDaoImpl.java |    6 +-
 .../com/cloud/vm/dao/ConsoleProxyDaoImpl.java   |   16 +-
 .../com/cloud/vm/dao/DomainRouterDaoImpl.java   |    8 +-
 .../src/com/cloud/vm/dao/NicDetailDaoImpl.java  |    4 +-
 .../cloud/vm/dao/SecondaryStorageVmDaoImpl.java |    8 +-
 .../src/com/cloud/vm/dao/UserVmDaoImpl.java     |    8 +-
 .../com/cloud/vm/dao/UserVmDetailsDaoImpl.java  |    4 +-
 .../src/com/cloud/vm/dao/VMInstanceDaoImpl.java |   12 +-
 .../affinity/dao/AffinityGroupVMMapDaoImpl.java |    4 +-
 .../entity/api/db/dao/VMComputeTagDaoImpl.java  |    4 +-
 .../entity/api/db/dao/VMEntityDaoImpl.java      |    4 +-
 .../entity/api/db/dao/VMNetworkMapDaoImpl.java  |    4 +-
 .../entity/api/db/dao/VMReservationDaoImpl.java |    4 +-
 .../entity/api/db/dao/VMRootDiskTagDaoImpl.java |    4 +-
 .../datastore/db/PrimaryDataStoreDaoImpl.java   |   10 +-
 .../endpoint/DefaultEndPointSelector.java       |    3 +-
 .../image/db/ImageStoreDetailsDaoImpl.java      |    4 +-
 .../image/db/SnapshotDataStoreDaoImpl.java      |    6 +-
 .../image/db/TemplateDataStoreDaoImpl.java      |    6 +-
 .../image/db/VolumeDataStoreDaoImpl.java        |    4 +-
 .../datastore/PrimaryDataStoreHelper.java       |    4 +-
 .../db/PrimaryDataStoreDetailsDaoImpl.java      |    4 +-
 .../com/cloud/cluster/ClusterManagerImpl.java   |  102 +-
 .../dao/ManagementServerHostDaoImpl.java        |   16 +-
 .../dao/ManagementServerHostPeerDaoImpl.java    |    4 +-
 .../config/dao/ConfigurationDaoImpl.java        |    6 +-
 .../utils/crypt/EncryptionSecretKeyChanger.java |    3 +-
 .../com/cloud/utils/db/ConnectionConcierge.java |    2 +-
 framework/db/src/com/cloud/utils/db/DbUtil.java |    2 +-
 .../src/com/cloud/utils/db/GenericDaoBase.java  |   36 +-
 .../db/src/com/cloud/utils/db/Merovingian2.java |    2 +-
 .../src/com/cloud/utils/db/SequenceFetcher.java |    2 +-
 .../db/src/com/cloud/utils/db/Transaction.java  | 1165 +----------------
 .../com/cloud/utils/db/TransactionCallback.java |    7 +
 .../utils/db/TransactionCallbackNoReturn.java   |   13 +
 .../db/TransactionCallbackWithException.java    |    7 +
 ...ransactionCallbackWithExceptionNoReturn.java |   32 +
 .../utils/db/TransactionContextBuilder.java     |    6 +-
 .../com/cloud/utils/db/TransactionLegacy.java   | 1192 ++++++++++++++++++
 .../cloud/utils/db/TransactionMBeanImpl.java    |   18 +-
 .../com/cloud/utils/db/TransactionStatus.java   |    7 +
 .../db/test/com/cloud/utils/db/DbTestDao.java   |    4 +-
 .../db/test/com/cloud/utils/db/DbTestUtils.java |    4 +-
 .../com/cloud/utils/db/TestTransaction.java     |  154 +++
 .../com/cloud/utils/db/TransactionTest.java     |   26 +-
 framework/db/test/db.properties                 |   18 +
 .../framework/jobs/dao/AsyncJobDaoImpl.java     |    4 +-
 .../jobs/dao/AsyncJobJoinMapDaoImpl.java        |   10 +-
 .../framework/jobs/dao/SyncQueueDaoImpl.java    |    4 +-
 .../jobs/dao/SyncQueueItemDaoImpl.java          |    4 +-
 .../jobs/impl/AsyncJobManagerImpl.java          |  286 ++---
 .../jobs/impl/SyncQueueManagerImpl.java         |  271 ++--
 .../affinity/ExplicitDedicationProcessor.java   |   32 +-
 .../dedicated/DedicatedResourceManagerImpl.java |  273 ++--
 .../src/com/cloud/netapp/NetappManagerImpl.java |   10 +-
 .../BareMetalPingServiceImpl.java               |    3 -
 .../networkservice/BaremetaNetworkGuru.java     |   21 +-
 .../networkservice/BaremetalDhcpElement.java    |    4 -
 .../BaremetalDhcpManagerImpl.java               |    4 -
 .../BaremetalKickStartServiceImpl.java          |    7 +-
 .../networkservice/BaremetalPxeElement.java     |    4 -
 .../agent/manager/MockAgentManagerImpl.java     |   27 +-
 .../agent/manager/MockStorageManagerImpl.java   |  170 +--
 .../cloud/agent/manager/MockVmManagerImpl.java  |   46 +-
 .../agent/manager/SimulatorManagerImpl.java     |   10 +-
 .../simulator/dao/MockConfigurationDaoImpl.java |    4 +-
 .../com/cloud/ucs/manager/UcsManagerImpl.java   |    3 -
 .../vmware/manager/VmwareManagerImpl.java       |   53 +-
 .../network/CiscoNexusVSMDeviceManagerImpl.java |   68 +-
 .../network/element/CiscoNexusVSMElement.java   |   50 +-
 .../network/element/BigSwitchVnsElement.java    |   45 +-
 .../cloud/network/element/CiscoVnmcElement.java |  263 ++--
 .../lb/ElasticLoadBalancerManagerImpl.java      |   32 +-
 .../network/guru/MidoNetPublicNetworkGuru.java  |   19 +-
 .../cloud/network/element/NetscalerElement.java |   52 +-
 .../cloud/network/element/NiciraNvpElement.java |   45 +-
 .../cloudstack/storage/test/AopTestAdvice.java  |    4 +-
 server/src/com/cloud/api/ApiServer.java         |   66 +-
 .../com/cloud/capacity/CapacityManagerImpl.java |  321 ++---
 .../configuration/ConfigurationManagerImpl.java |  882 +++++++------
 .../consoleproxy/ConsoleProxyManagerImpl.java   |   34 +-
 .../cloud/dc/dao/DedicatedResourceDaoImpl.java  |    3 +-
 .../deploy/DeploymentPlanningManagerImpl.java   |  157 +--
 .../ha/HighAvailabilityManagerExtImpl.java      |    7 +-
 .../cloud/ha/dao/HighAvailabilityDaoImpl.java   |    3 +-
 .../metadata/ResourceMetaDataManagerImpl.java   |   86 +-
 .../network/ExternalDeviceUsageManagerImpl.java |  155 +--
 .../ExternalFirewallDeviceManagerImpl.java      |   46 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java  |  171 ++-
 .../com/cloud/network/IpAddressManagerImpl.java |  988 ++++++++-------
 .../com/cloud/network/NetworkServiceImpl.java   |  605 ++++-----
 .../cloud/network/NetworkUsageManagerImpl.java  |   50 +-
 .../cloud/network/PortProfileManagerImpl.java   |   39 +-
 .../network/StorageNetworkManagerImpl.java      |  169 +--
 .../cloud/network/as/AutoScaleManagerImpl.java  |  191 +--
 .../network/firewall/FirewallManagerImpl.java   |   93 +-
 .../cloud/network/guru/DirectNetworkGuru.java   |  121 +-
 .../network/guru/DirectPodBasedNetworkGuru.java |  113 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   17 +-
 .../cloud/network/guru/PublicNetworkGuru.java   |   20 +-
 .../lb/LoadBalancingRulesManagerImpl.java       |  395 +++---
 .../VirtualNetworkApplianceManagerImpl.java     |  347 +++--
 .../cloud/network/rules/RulesManagerImpl.java   |  227 ++--
 .../security/SecurityGroupManagerImpl.java      |  526 ++++----
 .../network/vpc/NetworkACLManagerImpl.java      |   40 +-
 .../com/cloud/network/vpc/VpcManagerImpl.java   |  634 +++++-----
 .../network/vpn/RemoteAccessVpnManagerImpl.java |  224 ++--
 .../com/cloud/projects/ProjectManagerImpl.java  |  365 +++---
 .../com/cloud/resource/ResourceManagerImpl.java |  297 +++--
 .../resourcelimit/ResourceLimitManagerImpl.java |  333 ++---
 .../cloud/server/ConfigurationServerImpl.java   |  557 ++++----
 .../com/cloud/server/ManagementServerImpl.java  |  101 +-
 server/src/com/cloud/server/StatsCollector.java |  247 ++--
 .../com/cloud/servlet/CloudStartupServlet.java  |    3 +-
 .../com/cloud/servlet/ConsoleProxyServlet.java  |    3 +-
 .../com/cloud/storage/StorageManagerImpl.java   |   62 +-
 .../com/cloud/storage/VolumeApiServiceImpl.java |  144 ++-
 .../cloud/tags/TaggedResourceManagerImpl.java   |  110 +-
 .../com/cloud/template/TemplateManagerImpl.java |  100 +-
 server/src/com/cloud/test/DatabaseConfig.java   |   67 +-
 server/src/com/cloud/test/IPRangeConfig.java    |   15 +-
 server/src/com/cloud/test/PodZoneConfig.java    |    7 +-
 .../src/com/cloud/usage/UsageServiceImpl.java   |   10 +-
 .../src/com/cloud/user/AccountManagerImpl.java  |  190 +--
 .../src/com/cloud/user/DomainManagerImpl.java   |   70 +-
 .../cloud/uuididentity/dao/IdentityDaoImpl.java |   13 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |  690 +++++-----
 .../vm/snapshot/VMSnapshotManagerImpl.java      |   45 +-
 .../affinity/AffinityGroupServiceImpl.java      |  107 +-
 .../lb/ApplicationLoadBalancerManagerImpl.java  |   52 +-
 .../GlobalLoadBalancingRulesServiceImpl.java    |  219 ++--
 .../configuration/ConfigurationManagerTest.java |   20 +-
 .../cloud/network/CreatePrivateNetworkTest.java |    6 +-
 .../network/DedicateGuestVlanRangesTest.java    |   18 +-
 .../network/UpdatePhysicalNetworkTest.java      |    5 +-
 ...GlobalLoadBalancingRulesServiceImplTest.java |   28 +-
 usage/src/com/cloud/usage/UsageManagerImpl.java |   16 +-
 .../src/com/cloud/usage/UsageSanityChecker.java |    4 +-
 .../cloud/utils/exception/ExceptionUtil.java    |   12 +
 .../utils/exception/ExceptionUtilTest.java      |   48 +
 249 files changed, 9041 insertions(+), 8260 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --cc engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 8ba3fdf,dbc0714..5636e07
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@@ -401,133 -405,134 +405,134 @@@ public class NetworkOrchestrator extend
          defaultVPCOffProviders.put(Service.PortForwarding, defaultProviders);
          defaultVPCOffProviders.put(Service.Vpn, defaultProviders);
  
-         Transaction txn = Transaction.currentTxn();
-         txn.start();
- 
-         NetworkOfferingVO offering = null;
-         //#1 - quick cloud network offering
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
-                 Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true, false, null,
+         Transaction.execute(new TransactionCallbackNoReturn() {
+             @Override
+             public void doInTransactionWithoutResult(TransactionStatus status) {
+                 NetworkOfferingVO offering = null;
+                 //#1 - quick cloud network offering
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
+                         Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true, false, null,
 -                        false, null);
 +                false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#2 - SG enabled network offering
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
-                 TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#2 - SG enabled network offering
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
+                         TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true,
 -                        false, null, false, null);
 +                false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#3 - shared network offering with no SG service
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#3 - shared network offering with no SG service
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
 -                        Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false, null);
 +                Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#4 - default isolated offering with Source nat service
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
-                 "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#4 - default isolated offering with Source nat service
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
+                         "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
 -                        defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null);
 +                defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true);
- 
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#5 - default vpc offering with LB service
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
-                 "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null, defaultVPCOffProviders, true,
+         
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#5 - default vpc offering with LB service
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
+                         "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null, defaultVPCOffProviders, true,
 -                        Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null);
 +                Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#6 - default vpc offering with no LB service
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB) == null) {
-             //remove LB service
-             defaultVPCOffProviders.remove(Service.Lb);
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
-                 "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional, null,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#6 - default vpc offering with no LB service
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB) == null) {
+                     //remove LB service
+                     defaultVPCOffProviders.remove(Service.Lb);
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
+                         "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional, null,
 -                        defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null);
 +                defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#7 - isolated offering with source nat disabled
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
-                 TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#7 - isolated offering with source nat disabled
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
+                         TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null,
 -                        true, false, null, false, null);
 +                true, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         //#8 - network offering with internal lb service
-         Map<Network.Service, Set<Network.Provider>> internalLbOffProviders = new HashMap<Network.Service, Set<Network.Provider>>();
-         Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
-         defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
- 
-         Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
-         defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
- 
-         internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
-         internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
-         internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
-         internalLbOffProviders.put(Service.NetworkACL, defaultVpcProvider);
-         internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
-         internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
-         internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
- 
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
-                 "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders, true,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 //#8 - network offering with internal lb service
+                 Map<Network.Service, Set<Network.Provider>> internalLbOffProviders = new HashMap<Network.Service, Set<Network.Provider>>();
+                 Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
+                 defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
+         
+                 Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
+                 defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
+         
+                 internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
+                 internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
+                 internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
+                 internalLbOffProviders.put(Service.NetworkACL, defaultVpcProvider);
+                 internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
+                 internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
+                 internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
+         
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
+                         "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders, true,
 -                        Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null);
 +                Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             offering.setInternalLb(true);
-             offering.setPublicLb(false);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
- 
-         Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
-         Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
-         vrProvider.add(Provider.VirtualRouter);
-         Set<Network.Provider> sgProvider = new HashSet<Network.Provider>();
-         sgProvider.add(Provider.SecurityGroupProvider);
-         Set<Network.Provider> nsProvider = new HashSet<Network.Provider>();
-         nsProvider.add(Provider.Netscaler);
-         netscalerServiceProviders.put(Service.Dhcp, vrProvider);
-         netscalerServiceProviders.put(Service.Dns, vrProvider);
-         netscalerServiceProviders.put(Service.UserData, vrProvider);
-         netscalerServiceProviders.put(Service.SecurityGroup, sgProvider);
-         netscalerServiceProviders.put(Service.StaticNat, nsProvider);
-         netscalerServiceProviders.put(Service.Lb, nsProvider);
- 
-         Map<Service, Map<Capability, String>> serviceCapabilityMap = new HashMap<Service, Map<Capability, String>>();
-         Map<Capability, String> elb = new HashMap<Capability, String>();
-         elb.put(Capability.ElasticLb, "true");
-         Map<Capability, String> eip = new HashMap<Capability, String>();
-         eip.put(Capability.ElasticIp, "true");
-         serviceCapabilityMap.put(Service.Lb, elb);
-         serviceCapabilityMap.put(Service.StaticNat, eip);
- 
-         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
-             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
-                 "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null, netscalerServiceProviders,
+                     offering.setState(NetworkOffering.State.Enabled);
+                     offering.setInternalLb(true);
+                     offering.setPublicLb(false);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+         
+                 Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
+                 Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
+                 vrProvider.add(Provider.VirtualRouter);
+                 Set<Network.Provider> sgProvider = new HashSet<Network.Provider>();
+                 sgProvider.add(Provider.SecurityGroupProvider);
+                 Set<Network.Provider> nsProvider = new HashSet<Network.Provider>();
+                 nsProvider.add(Provider.Netscaler);
+                 netscalerServiceProviders.put(Service.Dhcp, vrProvider);
+                 netscalerServiceProviders.put(Service.Dns, vrProvider);
+                 netscalerServiceProviders.put(Service.UserData, vrProvider);
+                 netscalerServiceProviders.put(Service.SecurityGroup, sgProvider);
+                 netscalerServiceProviders.put(Service.StaticNat, nsProvider);
+                 netscalerServiceProviders.put(Service.Lb, nsProvider);
+         
+                 Map<Service, Map<Capability, String>> serviceCapabilityMap = new HashMap<Service, Map<Capability, String>>();
+                 Map<Capability, String> elb = new HashMap<Capability, String>();
+                 elb.put(Capability.ElasticLb, "true");
+                 Map<Capability, String> eip = new HashMap<Capability, String>();
+                 eip.put(Capability.ElasticIp, "true");
+                 serviceCapabilityMap.put(Service.Lb, elb);
+                 serviceCapabilityMap.put(Service.StaticNat, eip);
+         
+                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
+                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
+                         "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null, netscalerServiceProviders,
 -                        true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null);
 +                true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
-             offering.setState(NetworkOffering.State.Enabled);
-             offering.setDedicatedLB(false);
-             _networkOfferingDao.update(offering.getId(), offering);
-         }
+                     offering.setState(NetworkOffering.State.Enabled);
+                     offering.setDedicatedLB(false);
+                     _networkOfferingDao.update(offering.getId(), offering);
+                 }
+             }
+         });
  
-         txn.commit();
  
          AssignIpAddressSearch = _ipAddressDao.createSearchBuilder();
          AssignIpAddressSearch.and("dc", AssignIpAddressSearch.entity().getDataCenterId(), Op.EQ);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 6460276,9131fa6..32459bc
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@@ -3988,10 -3993,10 +4024,10 @@@ public class ConfigurationManagerImpl e
      @DB
      public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType,
              String tags, boolean specifyVlan, Availability availability, Integer networkRate,
-             Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type,
+             final Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type,
              boolean systemOnly, Long serviceOfferingId, boolean conserveMode,
              Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
-             Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive) {
 -            final Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, final Integer maxconn) {
++            final Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive) {
  
          String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
          int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
@@@ -4145,47 -4150,49 +4181,50 @@@
              validateNtwkOffDetails(details, serviceProviderMap);
          }
  
-         Transaction txn = Transaction.currentTxn();
-         txn.start();
-         // 1) create network offering object
-         s_logger.debug("Adding network offering " + offering);
-         offering.setConcurrentConnections(maxconn);
-         offering.setKeepAliveEnabled(enableKeepAlive);
-         offering = _networkOfferingDao.persist(offering, details);
-         // 2) populate services and providers
-         if (serviceProviderMap != null) {
-             for (Network.Service service : serviceProviderMap.keySet()) {
-                 Set<Provider> providers = serviceProviderMap.get(service);
-                 if (providers != null && !providers.isEmpty()) {
-                     boolean vpcOff = false;
-                     for (Network.Provider provider : providers) {
-                         if (provider == Provider.VPCVirtualRouter) {
-                             vpcOff = true;
+         return Transaction.execute(new TransactionCallback<NetworkOfferingVO>() {
+             @Override
+             public NetworkOfferingVO doInTransaction(TransactionStatus status) {
+                 NetworkOfferingVO offering = offeringFinal;
+ 
+                 // 1) create network offering object
+                 s_logger.debug("Adding network offering " + offering);
+                 offering.setConcurrentConnections(maxconn);
++                offering.setKeepAliveEnabled(enableKeepAlive);
+                 offering = _networkOfferingDao.persist(offering, details);
+                 // 2) populate services and providers
+                 if (serviceProviderMap != null) {
+                     for (Network.Service service : serviceProviderMap.keySet()) {
+                         Set<Provider> providers = serviceProviderMap.get(service);
+                         if (providers != null && !providers.isEmpty()) {
+                             boolean vpcOff = false;
+                             for (Network.Provider provider : providers) {
+                                 if (provider == Provider.VPCVirtualRouter) {
+                                     vpcOff = true;
+                                 }
+                                 NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(offering.getId(),
+                                         service, provider);
+                                 _ntwkOffServiceMapDao.persist(offService);
+                                 s_logger.trace("Added service for the network offering: " + offService + " with provider "
+                                         + provider.getName());
+                             }
+ 
+                             if (vpcOff) {
+                                 List<Service> supportedSvcs = new ArrayList<Service>();
+                                 supportedSvcs.addAll(serviceProviderMap.keySet());
+                                 _vpcMgr.validateNtwkOffForVpc(offering, supportedSvcs);
+                             }
+                         } else {
+                             NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(offering.getId(), service,
+                                     null);
+                             _ntwkOffServiceMapDao.persist(offService);
+                             s_logger.trace("Added service for the network offering: " + offService + " with null provider");
                          }
-                         NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(offering.getId(),
-                                 service, provider);
-                         _ntwkOffServiceMapDao.persist(offService);
-                         s_logger.trace("Added service for the network offering: " + offService + " with provider "
-                                 + provider.getName());
-                     }
- 
-                     if (vpcOff) {
-                         List<Service> supportedSvcs = new ArrayList<Service>();
-                         supportedSvcs.addAll(serviceProviderMap.keySet());
-                         _vpcMgr.validateNtwkOffForVpc(offering, supportedSvcs);
                      }
-                 } else {
-                     NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(offering.getId(), service,
-                             null);
-                     _ntwkOffServiceMapDao.persist(offService);
-                     s_logger.trace("Added service for the network offering: " + offService + " with null provider");
                  }
-             }
-         }
- 
-         txn.commit();
  
-         return offering;
+                 return offering;
+             }
+         });
      }
  
      protected void validateNtwkOffDetails(Map<Detail, String> details, Map<Service, Set<Provider>> serviceProviderMap) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
index 444650b,6f43c96..875bfac
--- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
@@@ -62,12 -67,10 +62,14 @@@ import com.cloud.utils.component.Manage
  import com.cloud.utils.db.DB;
  import com.cloud.utils.db.GenericDao;
  import com.cloud.utils.db.Transaction;
+ import com.cloud.utils.db.TransactionCallback;
+ import com.cloud.utils.db.TransactionStatus;
  import com.cloud.uuididentity.dao.IdentityDao;
 +import com.cloud.vm.NicDetailVO;
 +import com.cloud.vm.dao.NicDao;
 +import com.cloud.vm.dao.NicDetailDao;
  import com.cloud.vm.dao.UserVmDao;
 +import com.cloud.vm.dao.UserVmDetailsDao;
  import com.cloud.vm.snapshot.dao.VMSnapshotDao;
  
  
@@@ -192,51 -193,50 +194,51 @@@ public class ResourceMetaDataManagerImp
      @Override
      @DB
      @ActionEvent(eventType = EventTypes.EVENT_RESOURCE_DETAILS_CREATE, eventDescription = "creating resource meta data")
-     public boolean addResourceMetaData(String resourceId, TaggedResourceType resourceType, Map<String, String> details){
+     public boolean addResourceMetaData(final String resourceId, final TaggedResourceType resourceType, final Map<String, String> details){
+         return Transaction.execute(new TransactionCallback<Boolean>() {
+             @Override
+             public Boolean doInTransaction(TransactionStatus status) {
+                 for (String key : details.keySet()) {
+                         Long id = _taggedResourceMgr.getResourceId(resourceId, resourceType);
+ 
+                         //check if object exists
+                         if (_daoMap.get(resourceType).findById(id) == null) {
+                             throw new InvalidParameterValueException("Unable to find resource by id " + resourceId +
+                                     " and type " + resourceType);
+                         }
+ 
+                         String value = details.get(key);
+ 
+                         if (value == null || value.isEmpty()) {
+                             throw new InvalidParameterValueException("Value for the key " + key + " is either null or empty");
+                         }
+ 
+                         // TODO - Have a better design here.
+                         if(resourceType == TaggedResourceType.Volume){
+                             VolumeDetailVO v = new VolumeDetailVO(id, key, value);
+                             _volumeDetailDao.persist(v);
+                         } else if (resourceType == TaggedResourceType.Nic){
+                             NicDetailVO n = new NicDetailVO(id, key, value);
+                             _nicDetailDao.persist(n);
 -                        }else if (resourceType == TaggedResourceType.UserVm){
 -                            UserVmDetailVO userVmDetail = new UserVmDetailVO(id, key, value);
 -                            _userVmDetailDao.persist(userVmDetail);
+                         } else if (resourceType == TaggedResourceType.Zone){
+                              DcDetailVO dataCenterDetail = new DcDetailVO(id, key, value);
+                              _dcDetailsDao.persist(dataCenterDetail);
+                         } else if (resourceType == TaggedResourceType.Network){
+                             NetworkDetailVO networkDetail = new NetworkDetailVO(id, key, value);
+                             _networkDetailsDao.persist(networkDetail);
 -                        } else {
++                        } else if (resourceType == TaggedResourceType.UserVm) {
++                            _userVmDetailsDao.addVmDetail(id, key, value);
++                        } else if (resourceType == TaggedResourceType.Template) {
++                            _templateDetailsDao.addTemplateDetail(id, key, value);
++                        } else{
+                             throw new InvalidParameterValueException("The resource type " + resourceType + " is not supported by the API yet");
+                         }
  
-         Transaction txn = Transaction.currentTxn();
-         txn.start();
- 
-         for (String key : details.keySet()) {
-                 Long id = _taggedResourceMgr.getResourceId(resourceId, resourceType);
- 
-                 //check if object exists
-                 if (_daoMap.get(resourceType).findById(id) == null) {
-                     throw new InvalidParameterValueException("Unable to find resource by id " + resourceId +
-                             " and type " + resourceType);
-                 }
- 
-                 String value = details.get(key);
- 
-                 if (value == null || value.isEmpty()) {
-                     throw new InvalidParameterValueException("Value for the key " + key + " is either null or empty");
                  }
  
-                 // TODO - Have a better design here.
-                 if (resourceType == TaggedResourceType.Volume){
-                     VolumeDetailVO v = new VolumeDetailVO(id, key, value);
-                     _volumeDetailDao.persist(v);
-                 } else if (resourceType == TaggedResourceType.Nic){
-                     NicDetailVO n = new NicDetailVO(id, key, value);
-                     _nicDetailDao.persist(n);
-                 } else if (resourceType == TaggedResourceType.Zone){
-                      DcDetailVO dataCenterDetail = new DcDetailVO(id, key, value);
-                      _dcDetailsDao.persist(dataCenterDetail);
-                 } else if (resourceType == TaggedResourceType.Network){
-                     NetworkDetailVO networkDetail = new NetworkDetailVO(id, key, value);
-                     _networkDetailsDao.persist(networkDetail);
-                 } else if (resourceType == TaggedResourceType.UserVm) {
-                     _userVmDetailsDao.addVmDetail(id, key, value);
-                 } else if (resourceType == TaggedResourceType.Template) {
-                     _templateDetailsDao.addTemplateDetail(id, key, value);
-                 } else{
-                     throw new InvalidParameterValueException("The resource type " + resourceType + " is not supported by the API yet");
-                 }
-         }
- 
-         txn.commit();
- 
-         return true;
+                 return true;
+             }
+         });
      }
  
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ConfigurationServerImpl.java
index af1847a,f8141ee..51f99d6
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@@ -42,14 -42,13 +42,13 @@@ import javax.crypto.SecretKey
  import javax.inject.Inject;
  import javax.naming.ConfigurationException;
  
--import org.apache.commons.codec.binary.Base64;
--import org.apache.commons.io.FileUtils;
--import org.apache.log4j.Logger;
- 
  import org.apache.cloudstack.framework.config.ConfigDepot;
  import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
  import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
  import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
++import org.apache.commons.codec.binary.Base64;
++import org.apache.commons.io.FileUtils;
++import org.apache.log4j.Logger;
  
  import com.cloud.cluster.ClusterManager;
  import com.cloud.configuration.Config;
@@@ -107,6 -106,12 +106,10 @@@ import com.cloud.utils.component.Manage
  import com.cloud.utils.crypt.DBEncryptionUtil;
  import com.cloud.utils.db.DB;
  import com.cloud.utils.db.Transaction;
 -import com.cloud.utils.db.TransactionCallback;
+ import com.cloud.utils.db.TransactionCallbackNoReturn;
 -import com.cloud.utils.db.TransactionCallbackWithException;
+ import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
+ import com.cloud.utils.db.TransactionLegacy;
+ import com.cloud.utils.db.TransactionStatus;
  import com.cloud.utils.exception.CloudRuntimeException;
  import com.cloud.utils.net.NetUtils;
  import com.cloud.utils.script.Script;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/usage/UsageServiceImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/205a77a5/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/vm/UserVmManagerImpl.java
index 2ec033a,86f9855..8de494c
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@@ -2884,6 -2778,108 +2801,113 @@@ public class UserVmManagerImpl extends 
          return vm;
      }
  
+     private UserVmVO commitUserVm(final DataCenter zone, final VirtualMachineTemplate template, final String hostName,
+             final String displayName, final Account owner, final Long diskOfferingId, final Long diskSize, final String userData,
+             final HypervisorType hypervisor, final Account caller, final Boolean isDisplayVmEnabled, final String keyboard, final long accountId,
+             final ServiceOfferingVO offering, final boolean isIso, final String sshPublicKey,
+             final LinkedHashMap<String, NicProfile> networkNicMap, final long id, final String instanceName, final String uuidName,
+             final HypervisorType hypervisorType) throws InsufficientCapacityException {
+         return Transaction.execute(new TransactionCallbackWithException<UserVmVO,InsufficientCapacityException>() {
+             @Override
+             public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
+                 UserVmVO vm = new UserVmVO(id, instanceName, displayName,
+                         template.getId(), hypervisorType, template.getGuestOSId(),
+                         offering.getOfferHA(), offering.getLimitCpuUse(),
+                         owner.getDomainId(), owner.getId(), offering.getId(), userData,
+                         hostName, diskOfferingId);
+                 vm.setUuid(uuidName);
+                 vm.setDynamicallyScalable(template.isDynamicallyScalable());
+                 if (sshPublicKey != null) {
+                     vm.setDetail("SSH.PublicKey", sshPublicKey);
+                 }
+         
+                 if (keyboard != null && !keyboard.isEmpty())
+                     vm.setDetail(VmDetailConstants.KEYBOARD, keyboard);
+         
+                 if (isIso) {
+                     vm.setIsoId(template.getId());
+                 }
+         
+                 if(isDisplayVmEnabled != null){
+                     if(!_accountMgr.isRootAdmin(caller.getType())){
+                         throw new PermissionDeniedException( "Cannot update parameter displayvm, only admin permitted ");
+                     }
+                     vm.setDisplayVm(isDisplayVmEnabled);
+                 }else {
+                     vm.setDisplayVm(true);
+                 }
+         
+                 // If hypervisor is vSphere, check for clone type setting.
+                 if (hypervisorType.equals(HypervisorType.VMware)) {
+                     // retrieve clone flag.
+                     UserVmCloneType cloneType = UserVmCloneType.linked;
+                     String value = _configDao.getValue(Config.VmwareCreateFullClone.key());
+                     if (value != null) {
+                         if (Boolean.parseBoolean(value) == true)
+                             cloneType = UserVmCloneType.full;
+                     }
+                     UserVmCloneSettingVO vmCloneSettingVO = new UserVmCloneSettingVO(id, cloneType.toString());
+                     _vmCloneSettingDao.persist(vmCloneSettingVO);
+                 }
+         
+                 long guestOSId = template.getGuestOSId();
+                 GuestOSVO guestOS = _guestOSDao.findById(guestOSId);
+                 long guestOSCategoryId = guestOS.getCategoryId();
+                 GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId);
+         
+         
+                 // If hypervisor is vSphere and OS is OS X, set special settings.
+                 if (hypervisorType.equals(HypervisorType.VMware)) {
+                     if (guestOS.getDisplayName().toLowerCase().contains("apple mac os")){
+                         vm.setDetail("smc.present", "TRUE");
+                         vm.setDetail(VmDetailConstants.ROOK_DISK_CONTROLLER, "scsi");
+                         vm.setDetail("firmware", "efi");
+                         s_logger.info("guestOS is OSX : overwrite root disk controller to scsi, use smc and efi");
+                     }
+                }
+         
++                Map<String, String> details = template.getDetails();
++                if ( details != null && !details.isEmpty() ) {
++                    vm.details.putAll(details);
++                }
++
+                 _vmDao.persist(vm);
+                 _vmDao.saveDetails(vm);
+         
+                 s_logger.debug("Allocating in the DB for vm");
+                 DataCenterDeployment plan = new DataCenterDeployment(zone.getId());
+         
+                 List<String> computeTags = new ArrayList<String>();
+                 computeTags.add(offering.getHostTag());
+         
+                 List<String> rootDiskTags =	new ArrayList<String>();
+                 rootDiskTags.add(offering.getTags());
+         
+                 if(isIso){
+                     VirtualMachineEntity vmEntity = _orchSrvc.createVirtualMachineFromScratch(vm.getUuid(), Long.toString(owner.getAccountId()), vm.getIsoId().toString(), hostName, displayName, hypervisor.name(), guestOSCategory.getName(), offering.getCpu(), offering.getSpeed(), offering.getRamSize(), diskSize,  computeTags, rootDiskTags, networkNicMap, plan);
+                 }else {
+                     VirtualMachineEntity vmEntity = _orchSrvc.createVirtualMachine(vm.getUuid(), Long.toString(owner.getAccountId()), Long.toString(template.getId()), hostName, displayName, hypervisor.name(), offering.getCpu(),  offering.getSpeed(), offering.getRamSize(), diskSize, computeTags, rootDiskTags, networkNicMap, plan);
+                 }
+         
+         
+         
+                 if (s_logger.isDebugEnabled()) {
+                     s_logger.debug("Successfully allocated DB entry for " + vm);
+                 }
+                 CallContext.current().setEventDetails("Vm Id: " + vm.getId());
+         
+                 UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(),
+                         vm.getHostName(), offering.getId(), template.getId(), hypervisorType.toString(),
+                         VirtualMachine.class.getName(), vm.getUuid());
+         
+                 //Update Resource Count for the given account
+                 resourceCountIncrement(accountId, new Long(offering.getCpu()),
+                         new Long(offering.getRamSize()));
+                 return vm;
+             }
+         });
+     }
+ 
      private void validateUserData(String userData, HTTPMethod httpmethod) {
          byte[] decodedUserData = null;
          if (userData != null) {


Mime
View raw message