4242import com .cloud .utils .concurrency .NamedThreadFactory ;
4343import com .cloud .utils .db .DB ;
4444import com .cloud .utils .db .Transaction ;
45+ import com .cloud .utils .db .TransactionLegacy ;
4546import com .cloud .utils .exception .CloudRuntimeException ;
4647import com .cloud .utils .net .NetUtils ;
48+
4749import org .apache .cloudstack .api .command .admin .host .AddSecondaryStorageCmd ;
4850import org .apache .log4j .Logger ;
4951import org .springframework .stereotype .Component ;
5052
5153import javax .ejb .Local ;
5254import javax .inject .Inject ;
5355import javax .naming .ConfigurationException ;
56+
5457import java .security .NoSuchAlgorithmException ;
5558import java .security .SecureRandom ;
5659import java .util .HashMap ;
@@ -159,7 +162,7 @@ public Map<AgentResourceBase, Map<String, String>> createServerResources(Map<Str
159162 mockHost .setVersion (this .getClass ().getPackage ().getImplementationVersion ());
160163 mockHost .setResource ("com.cloud.agent.AgentRoutingResource" );
161164
162- Transaction txn = Transaction .open (Transaction .SIMULATOR_DB );
165+ TransactionLegacy txn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
163166 try {
164167 txn .start ();
165168 mockHost = _mockHostDao .persist (mockHost );
@@ -170,7 +173,7 @@ public Map<AgentResourceBase, Map<String, String>> createServerResources(Map<Str
170173 throw new CloudRuntimeException ("Error configuring agent" , ex );
171174 } finally {
172175 txn .close ();
173- txn = Transaction .open (Transaction .CLOUD_DB );
176+ txn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
174177 txn .close ();
175178 }
176179
@@ -256,7 +259,7 @@ public SystemVMHandler(long vmId) {
256259
257260
258261 private void handleSystemVMStop () {
259- Transaction txn = Transaction .open (Transaction .SIMULATOR_DB );
262+ TransactionLegacy txn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
260263 try {
261264 if (this .mode .equalsIgnoreCase ("Stop" )) {
262265 txn .start ();
@@ -279,7 +282,7 @@ private void handleSystemVMStop() {
279282 throw new CloudRuntimeException ("Unable to get host " + guid + " due to " + ex .getMessage (), ex );
280283 } finally {
281284 txn .close ();
282- txn = Transaction .open (Transaction .CLOUD_DB );
285+ txn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
283286 txn .close ();
284287 }
285288
@@ -323,7 +326,7 @@ public void run() {
323326 mockHost .setVersion (this .getClass ().getPackage ().getImplementationVersion ());
324327 mockHost .setResource (resource );
325328 mockHost .setVmId (vmId );
326- Transaction simtxn = Transaction .open (Transaction .SIMULATOR_DB );
329+ TransactionLegacy simtxn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
327330 try {
328331 simtxn .start ();
329332 mockHost = _mockHostDao .persist (mockHost );
@@ -334,7 +337,7 @@ public void run() {
334337 + ex .getMessage (), ex );
335338 } finally {
336339 simtxn .close ();
337- simtxn = Transaction .open (Transaction .CLOUD_DB );
340+ simtxn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
338341 simtxn .close ();
339342 }
340343
@@ -366,7 +369,7 @@ public void run() {
366369
367370 @ Override
368371 public MockHost getHost (String guid ) {
369- Transaction txn = Transaction .open (Transaction .SIMULATOR_DB );
372+ TransactionLegacy txn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
370373 try {
371374 txn .start ();
372375 MockHost _host = _mockHostDao .findByGuid (guid );
@@ -382,7 +385,7 @@ public MockHost getHost(String guid) {
382385 throw new CloudRuntimeException ("Unable to get host " + guid + " due to " + ex .getMessage (), ex );
383386 } finally {
384387 txn .close ();
385- txn = Transaction .open (Transaction .CLOUD_DB );
388+ txn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
386389 txn .close ();
387390 }
388391 }
@@ -391,7 +394,7 @@ public MockHost getHost(String guid) {
391394 public GetHostStatsAnswer getHostStatistic (GetHostStatsCommand cmd ) {
392395 String hostGuid = cmd .getHostGuid ();
393396 MockHost host = null ;
394- Transaction txn = Transaction .open (Transaction .SIMULATOR_DB );
397+ TransactionLegacy txn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
395398 try {
396399 txn .start ();
397400 host = _mockHostDao .findByGuid (hostGuid );
@@ -404,11 +407,11 @@ public GetHostStatsAnswer getHostStatistic(GetHostStatsCommand cmd) {
404407 throw new CloudRuntimeException ("Unable to get host " + hostGuid + " due to " + ex .getMessage (), ex );
405408 } finally {
406409 txn .close ();
407- txn = Transaction .open (Transaction .CLOUD_DB );
410+ txn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
408411 txn .close ();
409412 }
410413
411- Transaction vmtxn = Transaction .open (Transaction .SIMULATOR_DB );
414+ TransactionLegacy vmtxn = TransactionLegacy .open (TransactionLegacy .SIMULATOR_DB );
412415 try {
413416 vmtxn .start ();
414417 List <MockVMVO > vms = _mockVmDao .findByHostId (host .getId ());
@@ -435,7 +438,7 @@ public GetHostStatsAnswer getHostStatistic(GetHostStatsCommand cmd) {
435438 + ex .getMessage (), ex );
436439 } finally {
437440 vmtxn .close ();
438- vmtxn = Transaction .open (Transaction .CLOUD_DB );
441+ vmtxn = TransactionLegacy .open (TransactionLegacy .CLOUD_DB );
439442 vmtxn .close ();
440443 }
441444 }
0 commit comments