Package org.apache.cloudstack.api

Examples of org.apache.cloudstack.api.ServerApiException


                response = templateResponses.get(0);
            }
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
        }

    }
View Full Code Here


        try {
            vmwareDcList = _vmwareDatacenterService.listVmwareDatacenters(this);
        } catch (InvalidParameterValueException ie) {
            throw new InvalidParameterValueException("Invalid zone id " + getZoneId());
        } catch (Exception e) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to find associated VMware DCs associated with zone " + getZoneId());
        }

        ListResponse<VmwareDatacenterResponse> response = new ListResponse<VmwareDatacenterResponse>();
        List<VmwareDatacenterResponse> vmwareDcResponses = new ArrayList<VmwareDatacenterResponse>();
View Full Code Here

        response.setTargetIQN(returnVals[1]);
        response.setObjectName("lun");
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
      } catch (ServerException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
      } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
      }
    }
View Full Code Here

                response.setId(result.getUuid());
                response.setName(result.getVmwareDatacenterName());
                response.setResponseName(getCommandName());
                response.setObjectName("vmwaredc");
            } else {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add VMware Datacenter to zone.");
            }
            this.setResponseObject(response);
        } catch (DiscoveryException ex) {
            s_logger.warn("Exception: ", ex);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
        } catch (ResourceInUseException ex) {
            s_logger.warn("Exception: ", ex);
            ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
            for (String proxyObj : ex.getIdProxyList()) {
                e.addProxyObject(proxyObj);
            }
            throw e;
        } catch (IllegalArgumentException ex) {
            throw new IllegalArgumentException(ex.getMessage());
        } catch (CloudRuntimeException runtimeEx) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeEx.getMessage());
        }
    }
View Full Code Here

            boolean result = _vmwareDatacenterService.removeVmwareDatacenter(this);
            if (result) {
                response.setResponseName(getCommandName());
                setResponseObject(response);
            } else {
                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove VMware datacenter from zone");
            }
        } catch (ResourceInUseException ex) {
            s_logger.warn("The zone has one or more resources (like cluster), hence not able to remove VMware datacenter from zone."
                        + " Please remove all resource from zone, and retry. Exception: ", ex);
            ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
            for (String proxyObj : ex.getIdProxyList()) {
                e.addProxyObject(proxyObj);
            }
            throw e;
        } catch (IllegalArgumentException ex) {
            throw new IllegalArgumentException(ex.getMessage());
        } catch (CloudRuntimeException runtimeEx) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeEx.getMessage());
        }
    }
View Full Code Here

            response.setResponseName(getCommandName());
            response.setObjectName("ucsmanager");
            this.setResponseObject(response);
        } catch (Exception e) {
            s_logger.warn("Exception: ", e);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
        }
    }
View Full Code Here

            UcsBladeResponse rsp = mgr.associateProfileToBlade(this);
            rsp.setResponseName(getCommandName());
            this.setResponseObject(rsp);
        } catch (Exception e) {
            s_logger.warn("Exception: ", e);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
        }
    }
View Full Code Here

            response.setResponseName(getCommandName());
            response.setObjectName("ucsblade");
            this.setResponseObject(response);
        } catch (Exception e) {
            s_logger.warn(e.getMessage(), e);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
        }
    }
View Full Code Here

            rsp.setObjectName("ucsmanager");
            rsp.setResponseName(getCommandName());
            this.setResponseObject(rsp);
        } catch (Exception e) {
            s_logger.warn("Exception: ", e);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
        }
    }
View Full Code Here

      netappMgr.deletePool(poolName);
      DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse();
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    } catch (InvalidParameterValueException e) {
      throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (ResourceInUseException e) {
      throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.api.ServerApiException

Copyright © 2018 www.massapicom. 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.