Package com.cloud.utils.db

Examples of com.cloud.utils.db.TransactionLegacy.rollback()


                try {
                    txn.start();
                    _mockVmDao.update(vm.getId(), (MockVMVO)vm);
                    txn.commit();
                } catch (Exception ex) {
                    txn.rollback();
                    throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex);
                } finally {
                    txn.close();
                    txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
                    txn.close();
View Full Code Here


                vmMap.put(vm.getName(), vm);
            }
            txn.commit();
            return vmMap;
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to fetch vms  from host " + hostGuid, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                states.put(vm.getName(), vm.getState());
            }
            txn.commit();
            return states;
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to fetch vms  from host " + hostGuid, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            }

            txn.commit();
            return new CheckVirtualMachineAnswer(cmd, vm.getState(), vm.getVncPort());
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to fetch vm state " + cmd.getVmName(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            vm.setHostId(destHost.getId());
            _mockVmDao.update(vm.getId(), vm);
            txn.commit();
            return new MigrateAnswer(cmd, true, null, 0);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to migrate vm " + cmd.getVmName(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            MockVMVO vm = _mockVmDao.findById(vmTo.getId());
            vm.setState(State.Migrating);
            _mockVmDao.update(vm.getId(), vm);
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to find vm " + vmTo.getName(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                }
            }
            txn.commit();
            return new Answer(cmd);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to clean up rules", ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                _mockAgentMgr.handleSystemVMStop(vm.getId());
            }
            txn.commit();
            return new StopAnswer(cmd, null, true);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                _mockVmDao.update(vm.getId(), (MockVMVO)vm);
            }
            txn.commit();
            return new RebootAnswer(cmd, "Rebooted " + cmd.getVmName(), true);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                config.setValues(values);
                _mockConfigDao.update(config.getId(), config);
                txn.commit();
            }
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Unable to configure simulator because of " + ex.getMessage(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.