Package com.cloud.utils.db

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


                storagePool.setStorageType(sf.getType());
                storagePool = _mockStoragePoolDao.persist(storagePool);
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when modifying storage pool " + cmd.getPool().getPath(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here


                storagePool.setStorageType(sf.getType());
                storagePool = _mockStoragePoolDao.persist(storagePool);
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when creating storage pool " + cmd.getPool().getPath(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            if (storage == null) {
                return new Answer(cmd, false, "can't find the storage");
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when setting up sec storage" + cmd.getSecUrl(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            if (storage == null) {
                return new Answer(cmd, false, "Failed to get secondary storage");
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                    new TemplateProp(volume.getName(), volume.getPath().replaceAll(storage.getMountPoint(), ""), volume.getSize(), volume.getSize(), true, false));
            }
            txn.commit();
            return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                templateInfos.put(template.getName(), new TemplateProp(template.getName(), template.getPath().replaceAll(storage.getMountPoint(), ""),
                    template.getSize(), template.getSize(), true, false));
            }
            return new ListTemplateAnswer(nfsUrl, templateInfos);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                    _mockVMDao.update(vm.getId(), vmVo);
                }
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when destroying volume " + cmd.getVolume().getPath(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

            if (ssvo == null) {
                return new DownloadAnswer("can't find secondary storage", VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR);
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error accessing secondary storage " + cmd.getSecUrl(), ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

        try {
            txn.start();
            volume = _mockVolumeDao.persist(volume);
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when saving volume " + volume, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
View Full Code Here

                txn.commit();
                return new DownloadAnswer(cmd.getJobId(), (int)(pct * 100.0), cmd, com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS,
                    volume.getPath(), volume.getName());
            }
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error during download job " + cmd.getJobId(), 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.