Examples of CreateObjectAnswer


Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

                        vol.setSize(newVol.getSize());
                    }
                    vol.setPoolId(this.getDataStore().getId());
                    volumeDao.update(vol.getId(), vol);
                } else if (answer instanceof CreateObjectAnswer) {
                    CreateObjectAnswer createAnswer = (CreateObjectAnswer) answer;
                    VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
                    VolumeVO vol = this.volumeDao.findById(this.getId());
                    vol.setPath(newVol.getPath());
                    if (newVol.getSize() != null) {
                        vol.setSize(newVol.getSize());
                    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

                }

                VolumeObjectTO newVol = new VolumeObjectTO();
                newVol.setPath(volumeUuid);
                newVol.setSize(volume.getSize());
                return new CreateObjectAnswer(newVol);
            } finally {
                s_logger.info("Destroy dummy VM after volume creation");
                if (vmMo != null) {
                    vmMo.detachAllDisks();
                    vmMo.destroy();
                }
            }
        } catch (Throwable e) {
            if (e instanceof RemoteException) {
                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
                hostService.invalidateServiceContext(null);
            }

            String msg = "create volume failed due to " + VmwareHelper.getExceptionMessage(e);
            s_logger.error(msg, e);
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

        // snapshot operation (create or destroy) is handled inside BackupSnapshotCommand(), we just fake
        // a success return here
        String snapshotUUID = UUID.randomUUID().toString();
        SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
        newSnapshot.setPath(snapshotUUID);
        return new CreateObjectAnswer(newSnapshot);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

                    s_logger.debug("Failed to get parent snapshot", e);
                }
            }
            SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
            newSnapshot.setPath(snapshotUUID);
            return new CreateObjectAnswer(newSnapshot);
        } catch (XenAPIException e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        } catch (Exception e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        }

        return new CreateObjectAnswer(details);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

            VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setName(vdir.nameLabel);
            newVol.setSize(vdir.virtualSize);
            newVol.setPath(vdir.uuid);

            return new CreateObjectAnswer(newVol);
        } catch (Exception e) {
            s_logger.debug("create volume failed: " + e.toString());
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

                    s_logger.debug("Failed to get parent snapshot", e);
                }
            }
            SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
            newSnapshot.setPath(snapshotUUID);
            return new CreateObjectAnswer(newSnapshot);
        } catch (XenAPIException e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        } catch (Exception e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        }

        return new CreateObjectAnswer(details);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

            VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setName(vdir.nameLabel);
            newVol.setSize(vdir.virtualSize);
            newVol.setPath(vdir.uuid);

            return new CreateObjectAnswer(newVol);
        } catch (Exception e) {
            s_logger.debug("create volume failed: " + e.toString());
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

    }
   
    protected CreateObjectAnswer getTemplateSize(CreateObjectCommand cmd, String templateUrl) {
        Connection conn = hypervisorResource.getConnection();
        long size = this.getTemplateSize(conn, templateUrl);
        return new CreateObjectAnswer(cmd, templateUrl, size);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

            String storeUuid = store.getUuid();
            SR primaryDataStoreSR = getSRByNameLabel(conn, storeUuid);
            vdi = createVdi(conn, name, primaryDataStoreSR, size);
            VDI.Record record = vdi.getRecord(conn);
            result = true;
            return new CreateObjectAnswer(cmd, record.uuid, record.virtualSize);
        } catch (BadServerResponse e) {
            s_logger.debug("Failed to create volume", e);
            errorMsg = e.toString();
        } catch (XenAPIException e) {
            s_logger.debug("Failed to create volume", e);
            errorMsg = e.toString();
        } catch (XmlRpcException e) {
            s_logger.debug("Failed to create volume", e);
            errorMsg = e.toString();
        } catch (URISyntaxException e) {
            s_logger.debug("Failed to create volume", e);
            errorMsg = e.toString();
        } finally {
            if (!result && vdi != null) {
                try {
                    deleteVDI(conn, vdi);
                } catch (Exception e) {
                    s_logger.debug("Faled to delete vdi: " + vdi.toString());
                }
            }
        }
       
        return new CreateObjectAnswer(cmd, false, errorMsg);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer

       
        try {
            VDI baseVdi = VDI.getByUuid(conn, baseImage.getPathOnPrimaryDataStore());
            VDI newVol = baseVdi.createClone(conn, new HashMap<String, String>());
            newVol.setNameLabel(conn, volume.getName());
            return new CreateObjectAnswer(cmd, newVol.getUuid(conn), newVol.getVirtualSize(conn));
        } catch (BadServerResponse e) {
            return new Answer(cmd, false, e.toString());
        } catch (XenAPIException e) {
            return new Answer(cmd, false, e.toString());
        } catch (XmlRpcException e) {
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.