Code cleanup. No need to declare runtime exceptions (CloudRuntimeException, InvalidParameterException, PermissionDenied exceptions)

This commit is contained in:
alena 2011-04-21 16:26:53 -07:00
parent b83456f895
commit 1a6d78eae4
33 changed files with 3624 additions and 3357 deletions

View File

@ -45,41 +45,43 @@ import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
public interface ConfigurationService {
/**
* Updates a configuration entry with a new value
* @param cmd - the command wrapping name and value parameters
*
* @param cmd
* - the command wrapping name and value parameters
* @return updated configuration object if successful
* @throws InvalidParameterValueException
*/
Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException;
Configuration updateConfiguration(UpdateCfgCmd cmd);
/**
* Persists a config value via the API call
*
* @return newly created Config object
*/
Configuration addConfig(CreateCfgCmd cmd);
/**
* Create a service offering through the API
* @param cmd the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service offering
*
* @param cmd
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service offering
* @return the newly created service offering if successful, null otherwise
*/
ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd);
/**
* Updates a service offering
*
* @param serviceOfferingId
* @param userId
* @param name
@ -90,32 +92,38 @@ public interface ConfigurationService {
* @return updated service offering
*/
ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd);
/**
* Deletes a service offering
*
* @param userId
* @param serviceOfferingId
*/
boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd);
/**
* Updates a disk offering
* @param cmd - the command specifying diskOfferingId, name, description, tags
*
* @param cmd
* - the command specifying diskOfferingId, name, description, tags
* @return updated disk offering
* @throws
* @throws
*/
DiskOffering updateDiskOffering(UpdateDiskOfferingCmd cmd);
/**
* Deletes a disk offering
* @param cmd - the command specifying disk offering id
*
* @param cmd
* - the command specifying disk offering id
* @return true or false
* @throws
* @throws
*/
boolean deleteDiskOffering(DeleteDiskOfferingCmd cmd);
/**
* Creates a new disk offering
*
* @param domainId
* @param name
* @param description
@ -125,41 +133,49 @@ public interface ConfigurationService {
* @return ID
*/
DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd);
/**
* Creates a new pod based on the parameters specified in the command object
* @param cmd the command object that specifies the name, zone, gateway, cidr, and ip range for the pod
*
* @param cmd
* the command object that specifies the name, zone, gateway, cidr, and ip range for the pod
* @return the new pod if successful, null otherwise
* @throws
* @throws
* @throws
* @throws
*/
Pod createPod(CreatePodCmd cmd);
/**
* Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
* @param UpdatePodCmd api command
*
* @param UpdatePodCmd
* api command
*/
Pod editPod(UpdatePodCmd cmd);
/**
* Deletes a pod from the database. Will not allow you to delete pods that are being used anywhere in the system.
* @param cmd - the command containing podId
*
* @param cmd
* - the command containing podId
* @return true or false
* @throws ,
* @throws ,
*/
boolean deletePod(DeletePodCmd cmd);
/**
* Creates a new zone
*
* @param cmd
* @return the zone if successful, null otherwise
* @throws
* @throws
* @throws
* @throws
*/
DataCenter createZone(CreateZoneCmd cmd);
/**
* Edits a zone in the database. Will not allow you to edit DNS values if there are VMs in the specified zone.
*
* @param UpdateZoneCmd
* @return Updated zone
*/
@ -167,16 +183,20 @@ public interface ConfigurationService {
/**
* Deletes a zone from the database. Will not allow you to delete zones that are being used anywhere in the system.
*
* @param userId
* @param zoneId
*/
boolean deleteZone(DeleteZoneCmd cmd);
/**
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the
* virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
*
* @param userId
* @param vlanType - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly attached to UserVMs)
* @param vlanType
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly
* attached to UserVMs)
* @param zoneId
* @param accountId
* @param podId
@ -185,35 +205,35 @@ public interface ConfigurationService {
* @param gateway
* @param startIP
* @param endIP
* @throws
* @throws
* @return The new Vlan object
*/
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException;
boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd);
NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd);
NetworkOffering updateNetworkOffering(UpdateNetworkOfferingCmd cmd);
List<? extends NetworkOffering> searchForNetworkOfferings(ListNetworkOfferingsCmd cmd);
boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd);
NetworkOffering getNetworkOffering(long id);
Integer getNetworkOfferingNetworkRate(long networkOfferingId);
Account getVlanAccount(long vlanId);
List<? extends NetworkOffering> listNetworkOfferings(TrafficType trafficType, boolean systemOnly);
DataCenter getZone(long id);
ServiceOffering getServiceOffering(long serviceOfferingId);
Long getDefaultPageSize();
Integer getServiceOfferingNetworkRate(long serviceOfferingId);
}

View File

@ -28,8 +28,6 @@ import com.cloud.api.commands.RestartNetworkCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network.Capability;
@ -37,49 +35,54 @@ import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine.Type;
public interface NetworkService {
List<? extends Network> getVirtualNetworksOwnedByAccountInZone(String accountName, long domainId, long zoneId);
List<? extends NetworkOffering> listNetworkOfferings();
IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* Associates a public IP address for a router.
* @param cmd - the command specifying ipAddress
*
* @param cmd
* - the command specifying ipAddress
* @return ip address object
* @throws ResourceAllocationException, InsufficientCapacityException
* @throws ResourceAllocationException
* , InsufficientCapacityException
*/
IpAddress associateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException, ResourceUnavailableException;
IpAddress associateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException, ResourceUnavailableException;
boolean disassociateIpAddress(DisassociateIPAddrCmd cmd);
Network createNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException;
List<? extends Network> searchForNetworks(ListNetworksCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
boolean deleteNetwork(long networkId) throws InvalidParameterValueException, PermissionDeniedException;
List<? extends Network> searchForNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId);
boolean restartNetwork(RestartNetworkCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
int getActiveNicsInNetwork(long networkId);
Network getNetwork(long networkId);
IpAddress getIp(long id);
NetworkProfile convertNetworkToNetworkProfile(long networkId);
Map<Service, Map<Capability, String>> getZoneCapabilities(long zoneId);
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
boolean isNetworkAvailableInDomain(long networkId, long domainId);
Long getDedicatedNetworkDomain(long networkId);
Network updateNetwork(long networkId, String name, String displayText, Account caller);
Integer getNetworkRate(long networkId, Long vmId);
Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);

View File

@ -20,8 +20,6 @@ package com.cloud.network;
import com.cloud.api.commands.UpgradeRouterCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
@ -30,17 +28,15 @@ public interface VirtualNetworkApplianceService{
* Starts domain router
* @param cmd the command specifying router's id
* @return DomainRouter object
* @throws InvalidParameterValueException, PermissionDeniedException
*/
VirtualRouter startRouter(long routerId, boolean restartNetwork) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter startRouter(long routerId, boolean restartNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
/**
* Reboots domain router
* @param cmd the command specifying router's id
* @return router if successful
* @throws InvalidParameterValueException, PermissionDeniedException
*/
VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter upgradeRouter(UpgradeRouterCmd cmd);
@ -49,10 +45,9 @@ public interface VirtualNetworkApplianceService{
* @param id of the router
* @param forced just do it. caller knows best.
* @return router if successful, null otherwise
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
* @throws InvalidParameterValueException, PermissionDeniedException
* @throws ConcurrentOperationException
*/
VirtualRouter stopRouter(long routerId, boolean forced) throws InvalidParameterValueException, PermissionDeniedException, ResourceUnavailableException, ConcurrentOperationException;
VirtualRouter stopRouter(long routerId, boolean forced) throws ResourceUnavailableException, ConcurrentOperationException;
}

View File

@ -46,7 +46,7 @@ public interface SecurityGroupService {
*/
public List<? extends SecurityGroupRules> searchForSecurityGroupRules(ListSecurityGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException;
public List<? extends IngressRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
public List<? extends IngressRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd);
}

View File

@ -36,43 +36,51 @@ import com.cloud.org.Cluster;
public interface ResourceService {
/**
* Updates a host
* @param cmd - the command specifying hostId
*
* @param cmd
* - the command specifying hostId
* @return hostObject
* @throws InvalidParameterValueException
*/
Host updateHost(UpdateHostCmd cmd) throws InvalidParameterValueException;
Host updateHost(UpdateHostCmd cmd);
Host cancelMaintenance(CancelMaintenanceCmd cmd) throws InvalidParameterValueException;
Host cancelMaintenance(CancelMaintenanceCmd cmd);
Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException;
/**
* We will automatically create a cloud.com cluster to attach to the external cluster and return a hyper host to perform
* We will automatically create a cloud.com cluster to attach to the external cluster and return a hyper host to perform
* host related operation within the cluster
*
* @param cmd
* @return
* @throws IllegalArgumentException
* @throws DiscoveryException
* @throws InvalidParameterValueException
*/
List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
boolean deleteCluster(DeleteClusterCmd cmd) throws InvalidParameterValueException;
Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState) throws InvalidParameterValueException;
List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException;
boolean deleteCluster(DeleteClusterCmd cmd);
Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState);
List<? extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
Host maintain(PrepareForMaintenanceCmd cmd) throws InvalidParameterValueException;
Host maintain(PrepareForMaintenanceCmd cmd);
/**
* Deletes a host
* @param hostId TODO
* @param isForced TODO
*
* @param hostId
* TODO
* @param isForced
* TODO
*
* @param true if deleted, false otherwise
*/
boolean deleteHost(long hostId, boolean isForced);
boolean deleteHost(long hostId, boolean isForced);
Host getHost(long hostId);
Cluster getCluster(Long clusterId);
Cluster getCluster(Long clusterId);
}

View File

@ -85,7 +85,6 @@ import com.cloud.domain.Domain;
import com.cloud.event.Event;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.Host;
@ -110,165 +109,183 @@ import com.cloud.vm.VirtualMachine.Type;
/**
* Hopefull this is temporary.
*
*
*/
public interface ManagementService {
static final String Name = "management-server";
/**
* Retrieves the list of data centers with search criteria.
* Currently the only search criteria is "available" zones for the account that invokes the API. By specifying
* available=true all zones which the account can access. By specifying available=false the zones where the
* account has virtual machine instances will be returned.
* Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones for the
* account that invokes the API. By specifying available=true all zones which the account can access. By specifying
* available=false the zones where the account has virtual machine instances will be returned.
*
* @return a list of DataCenters
*/
List<? extends DataCenter> listDataCenters(ListZonesByCmd cmd);
/**
* returns the a map of the names/values in the configuraton table
*
* @return map of configuration name/values
*/
List<? extends Configuration> searchForConfigurations(ListCfgsByCmd c);
/** revisit
* Searches for users by the specified search criteria
* Can search by: "id", "username", "account", "domainId", "type"
/**
* revisit Searches for users by the specified search criteria Can search by: "id", "username", "account", "domainId",
* "type"
*
* @param cmd
* @return List of UserAccounts
*/
List<? extends UserAccount> searchForUsers(ListUsersCmd cmd);
/**
* Searches for Service Offerings by the specified search criteria
* Can search by: "name"
* Searches for Service Offerings by the specified search criteria Can search by: "name"
*
* @param cmd
* @return List of ServiceOfferings
*/
List<? extends ServiceOffering> searchForServiceOfferings(ListServiceOfferingsCmd cmd);
/**
* Searches for Clusters by the specified search criteria
*
* @param c
* @return
*/
List<? extends Cluster> searchForClusters(ListClustersCmd c);
/**
* Searches for Pods by the specified search criteria
* Can search by: pod name and/or zone name
* Searches for Pods by the specified search criteria Can search by: pod name and/or zone name
*
* @param cmd
* @return List of Pods
*/
List<? extends Pod> searchForPods(ListPodsByCmd cmd);
/**
* Searches for servers by the specified search criteria
* Can search by: "name", "type", "state", "dataCenterId", "podId"
* Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId", "podId"
*
* @param cmd
* @return List of Hosts
*/
List<? extends Host> searchForServers(ListHostsCmd cmd);
/**
* Creates a new template
*
* @param cmd
* @return updated template
* @throws InvalidParameterValueException, PermissionDeniedException
*/
VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd);
VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd);
/**
* Obtains a list of events by the specified search criteria.
* Can search by: "username", "type", "level", "startDate", "endDate"
* Obtains a list of events by the specified search criteria. Can search by: "username", "type", "level", "startDate",
* "endDate"
*
* @param c
* @return List of Events.
*/
List<? extends Event> searchForEvents(ListEventsCmd c);
/**
* Obtains a list of routers by the specified search criteria.
* Can search by: "userId", "name", "state", "dataCenterId", "podId", "hostId"
* Obtains a list of routers by the specified search criteria. Can search by: "userId", "name", "state", "dataCenterId",
* "podId", "hostId"
*
* @param cmd
* @return List of DomainRouters.
*/
List<? extends VirtualRouter> searchForRouters(ListRoutersCmd cmd);
/** revisit
* Obtains a list of storage volumes by the specified search criteria.
* Can search by: "userId", "vType", "instanceId", "dataCenterId", "podId", "hostId"
/**
* revisit Obtains a list of storage volumes by the specified search criteria. Can search by: "userId", "vType",
* "instanceId", "dataCenterId", "podId", "hostId"
*
* @param cmd
* @return List of Volumes.
*/
List<? extends Volume> searchForVolumes(ListVolumesCmd cmd);
/**
* Obtains a list of IP Addresses by the specified search criteria.
* Can search by: "userId", "dataCenterId", "address"
* @param cmd the command that wraps the search criteria
* Obtains a list of IP Addresses by the specified search criteria. Can search by: "userId", "dataCenterId", "address"
*
* @param cmd
* the command that wraps the search criteria
* @return List of IPAddresses
*/
List<? extends IpAddress> searchForIPAddresses(ListPublicIpAddressesCmd cmd);
/**
* Obtains a list of all guest OS.
*
* @return list of GuestOS
*/
List<? extends GuestOS> listGuestOSByCriteria(ListGuestOsCmd cmd);
/**
* Obtains a list of all guest OS categories.
*
* @return list of GuestOSCategories
*/
List<? extends GuestOsCategory> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd);
VirtualMachine stopSystemVM(StopSystemVmCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
VirtualMachine startSystemVM(StartSystemVMCmd cmd);
VirtualMachine rebootSystemVM(RebootSystemVmCmd cmd);
VirtualMachine destroySystemVM(DestroySystemVmCmd cmd);
/**
* Search for domains owned by the given domainId/domainName (those parameters are wrapped
* in a command object.
* Search for domains owned by the given domainId/domainName (those parameters are wrapped in a command object.
*
* @return list of domains owned by the given user
*/
List<? extends Domain> searchForDomains(ListDomainsCmd c);
List<? extends Domain> searchForDomainChildren(ListDomainChildrenCmd cmd);
/**
* create a new domain
* @param command - the create command defining the name to use and the id of the parent domain under which to create the new domain.
*
* @param command
* - the create command defining the name to use and the id of the parent domain under which to create the new
* domain.
*/
Domain createDomain(CreateDomainCmd command);
/**
* delete a domain with the given domainId
* @param cmd the command wrapping the delete parameters
* - domainId
* - ownerId
* - cleanup: whether or not to delete all accounts/VMs/sub-domains when deleting the domain
*
* @param cmd
* the command wrapping the delete parameters - domainId - ownerId - cleanup: whether or not to delete all
* accounts/VMs/sub-domains when deleting the domain
*/
boolean deleteDomain(DeleteDomainCmd cmd);
/**
* update an existing domain
* @param cmd - the command containing domainId and new domainName
*
* @param cmd
* - the command containing domainId and new domainName
* @return Domain object if the command succeeded
* @throws InvalidParameterValueException, PermissionDeniedException
*/
Domain updateDomain(UpdateDomainCmd cmd);
/**
* Searches for accounts by the specified search criteria
* Can search by: "id", "name", "domainid", "type"
* Searches for accounts by the specified search criteria Can search by: "id", "name", "domainid", "type"
*
* @param cmd
* @return List of Accounts
*/
List<? extends Account> searchForAccounts(ListAccountsCmd cmd);
/**
* Searches for alerts
*
* @param c
* @return List of Alerts
*/
@ -276,62 +293,82 @@ public interface ManagementService {
/**
* list all the capacity rows in capacity operations table
*
* @param cmd
* @return List of capacities
*/
List<? extends Capacity> listCapacities(ListCapacityCmd cmd);
/**
* List the permissions on a template. This will return a list of account names that have been granted permission to launch instances from the template.
* @param cmd the command wrapping the search criteria (template id)
* List the permissions on a template. This will return a list of account names that have been granted permission to launch
* instances from the template.
*
* @param cmd
* the command wrapping the search criteria (template id)
* @return list of account names that have been granted permission to launch instances from the template
*/
List<String> listTemplatePermissions(ListTemplateOrIsoPermissionsCmd cmd);
/**
* List ISOs that match the specified criteria.
* @param cmd The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId parameters.
* List ISOs that match the specified criteria.
*
* @param cmd
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
* parameters.
* @return list of ISOs
*/
Set<Pair<Long, Long>> listIsos(ListIsosCmd cmd);
/**
* List templates that match the specified criteria.
* @param cmd The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId parameters.
* List templates that match the specified criteria.
*
* @param cmd
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account, and zoneId
* parameters.
* @return list of ISOs
*/
Set<Pair<Long, Long>> listTemplates(ListTemplatesCmd cmd);
/**
* Search for disk offerings based on search criteria
* @param cmd the command containing the criteria to use for searching for disk offerings
*
* @param cmd
* the command containing the criteria to use for searching for disk offerings
* @return a list of disk offerings that match the given criteria
*/
List<? extends DiskOffering> searchForDiskOfferings(ListDiskOfferingsCmd cmd);
/**
* List storage pools that match the given criteria
* @param cmd the command that wraps the search criteria (zone, pod, name, IP address, path, and cluster id)
*
* @param cmd
* the command that wraps the search criteria (zone, pod, name, IP address, path, and cluster id)
* @return a list of storage pools that match the given criteria
*/
List<? extends StoragePool> searchForStoragePools(ListStoragePoolsCmd cmd);
/**
* List system VMs by the given search criteria
* @param cmd the command that wraps the search criteria (host, name, state, type, zone, pod, and/or id)
*
* @param cmd
* the command that wraps the search criteria (host, name, state, type, zone, pod, and/or id)
* @return the list of system vms that match the given criteria
*/
List<? extends VirtualMachine> searchForSystemVm(ListSystemVMsCmd cmd);
/**
* Returns back a SHA1 signed response
* @param userId -- id for the user
*
* @param userId
* -- id for the user
* @return -- ArrayList of <CloudId+Signature>
*/
ArrayList<String> getCloudIdentifierResponse(GetCloudIdentifierCmd cmd);
boolean updateTemplatePermissions(UpdateTemplatePermissionsCmd cmd);
boolean updateTemplatePermissions(UpdateIsoPermissionsCmd cmd);
String[] createApiKeyAndSecretKey(RegisterCmd cmd);
InstanceGroup updateVmGroup(UpdateVMGroupCmd cmd);
@ -342,16 +379,20 @@ public interface ManagementService {
/**
* Extracts the volume to a particular location.
* @param cmd the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume exists), id (the id of the volume)
*
* @param cmd
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume exists),
* id (the id of the volume)
* @throws URISyntaxException
* @throws InternalErrorException
* @throws PermissionDeniedException
*
* @throws PermissionDeniedException
*
*/
Long extractVolume(ExtractVolumeCmd cmd) throws URISyntaxException;
/**
* return an array of available hypervisors
*
* @param cmd
* @return an array of available hypervisors in the cloud
*/
@ -359,82 +400,100 @@ public interface ManagementService {
/**
* This method uploads a custom cert to the db, and patches every cpvm with it on the current ms
* @param cmd -- upload certificate cmd
*
* @param cmd
* -- upload certificate cmd
* @return -- returns a string on success
* @throws ServerApiException -- even if one of the console proxy patching fails, we throw back this exception
* @throws ServerApiException
* -- even if one of the console proxy patching fails, we throw back this exception
*/
String uploadCertificate(UploadCustomCertificateCmd cmd);
String getVersion();
/**
* Searches for vlan by the specified search criteria
* Can search by: "id", "vlan", "name", "zoneID"
* Searches for vlan by the specified search criteria Can search by: "id", "vlan", "name", "zoneID"
*
* @param cmd
* @return List of Vlans
*/
List<? extends Vlan> searchForVlans(ListVlanIpRangesCmd cmd);
/**
* Search for async jobs by account and/or startDate
* @param cmd the command specifying the account and start date parameters
*
* @param cmd
* the command specifying the account and start date parameters
* @return the list of async jobs that match the criteria
*/
List<? extends AsyncJob> searchForAsyncJobs(ListAsyncJobsCmd cmd);
/**
* Generates a random password that will be used (initially) by newly created and started virtual machines
*
* @return a random password
*/
String generateRandomPassword();
public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId);
public Long saveCompletedEvent(Long userId, Long accountId, String level, String type, String description, long startEventId);
/**
* Search registered key pairs for the logged in user.
* @param cmd The api command class.
* Search registered key pairs for the logged in user.
*
* @param cmd
* The api command class.
* @return The list of key pairs found.
*/
List<? extends SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsCmd cmd);
/**
* Registers a key pair for a given public key.
* @param cmd The api command class.
* @return A VO with the key pair name and a finger print for the public key.
* Registers a key pair for a given public key.
*
* @param cmd
* The api command class.
* @return A VO with the key pair name and a finger print for the public key.
*/
SSHKeyPair registerSSHKeyPair(RegisterSSHKeyPairCmd cmd);
/**
* Creates a new
* @param cmd The api command class.
* @return A VO containing the key pair name, finger print for the public key
* and the private key material of the key pair.
* Creates a new
*
* @param cmd
* The api command class.
* @return A VO containing the key pair name, finger print for the public key and the private key material of the key pair.
*/
SSHKeyPair createSSHKeyPair(CreateSSHKeyPairCmd cmd);
/**
* Deletes a key pair by name.
* @param cmd The api command class.
*
* @param cmd
* The api command class.
* @return True on success. False otherwise.
*/
boolean deleteSSHKeyPair(DeleteSSHKeyPairCmd cmd);
/**
* Finds and returns an encrypted password for a VM.
* @param cmd The api command class.
*
* @param cmd
* The api command class.
* @return The encrypted password.
*/
String getVMPassword(GetVMPasswordCmd cmd);
Type findSystemVMTypeById(long instanceId);
/**
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current host
* and also a list of hostIds that seem to have enough CPU and RAM capacity to host this VM.
* @param UserVm vm The VM to migrate
* List hosts for migrating the given VM. The API returns list of all hosts in the VM's cluster minus the current host and
* also a list of hostIds that seem to have enough CPU and RAM capacity to host this VM.
*
* @param UserVm
* vm The VM to migrate
* @return Pair<List<? extends Host>, List<Long>> List of all Hosts in VM's cluster and list of HostIds with enough capacity
*/
Pair<List<? extends Host>, List<Long>> listHostsForMigrationOfVM(UserVm vm, Long startIndex, Long pageSize);
Pair<List<? extends Host>, List<Long>> listHostsForMigrationOfVM(UserVm vm, Long startIndex, Long pageSize);
}

View File

@ -28,7 +28,6 @@ import com.cloud.api.commands.PreparePrimaryStorageForMaintenanceCmd;
import com.cloud.api.commands.UpdateStoragePoolCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
@ -55,7 +54,6 @@ public interface StorageService {
* @param cmd
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, name)
* @return the volume object
* @throws InvalidParameterValueException
* @throws PermissionDeniedException
*/
Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
@ -77,9 +75,8 @@ public interface StorageService {
* @param cmd
* - the command specifying poolId
* @return success or failure
* @throws InvalidParameterValueException
*/
boolean deletePool(DeletePoolCmd cmd) throws InvalidParameterValueException;
boolean deletePool(DeletePoolCmd cmd);
/**
* Enable maintenance for primary storage

View File

@ -26,7 +26,6 @@ import com.cloud.api.commands.DeleteSnapshotPoliciesCmd;
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
import com.cloud.api.commands.ListSnapshotPoliciesCmd;
import com.cloud.api.commands.ListSnapshotsCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.Snapshot;
@ -34,51 +33,60 @@ import com.cloud.storage.Snapshot;
public interface SnapshotService {
/**
* Create a snapshot of a volume
* @param cmd the API command wrapping the parameters for creating the snapshot (mainly volumeId)
*
* @param cmd
* the API command wrapping the parameters for creating the snapshot (mainly volumeId)
* @return the Snapshot that was created
*/
Snapshot createSnapshot(CreateSnapshotCmd cmd) throws InvalidParameterValueException;
Snapshot createSnapshot(CreateSnapshotCmd cmd);
/**
* List all snapshots of a disk volume. Optionally lists snapshots created by specified interval
* @param cmd the command containing the search criteria (order by, limit, etc.)
*
* @param cmd
* the command containing the search criteria (order by, limit, etc.)
* @return list of snapshots
* @throws InvalidParameterValueException
* @throws PermissionDeniedException
*/
List<? extends Snapshot> listSnapshots(ListSnapshotsCmd cmd);
/**
* Delete specified snapshot from the specified.
* If no other policies are assigned it calls destroy snapshot.
* This will be used for manual snapshots too.
* Delete specified snapshot from the specified. If no other policies are assigned it calls destroy snapshot. This will be
* used for manual snapshots too.
*/
boolean deleteSnapshot(DeleteSnapshotCmd cmd);
boolean deleteSnapshot(DeleteSnapshotCmd cmd);
/**
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be retained.
* If the number of snapshots go beyond maxSnaps the oldest snapshot is deleted
* @param cmd the command that
* If the number of snapshots go beyond maxSnaps the oldest snapshot is deleted
*
* @param cmd
* the command that
* @return the newly created snapshot policy if success, null otherwise
*/
SnapshotPolicy createPolicy(CreateSnapshotPolicyCmd cmd);
/**
* Get the recurring snapshots scheduled for this volume currently along with the time at which they are scheduled
* @param cmd the command wrapping the volumeId (volume for which the snapshots are required) and policyId (to show snapshots for only this policy).
* Get the recurring snapshots scheduled for this volume currently along with the time at which they are scheduled
*
* @param cmd
* the command wrapping the volumeId (volume for which the snapshots are required) and policyId (to show
* snapshots for only this policy).
* @return The list of snapshot schedules.
*/
public List<? extends SnapshotSchedule> findRecurringSnapshotSchedule(ListRecurringSnapshotScheduleCmd cmd);
/**
* list all snapshot policies assigned to the specified volume
* @param cmd the command that specifies the volume criteria
*
* @param cmd
* the command that specifies the volume criteria
* @return list of snapshot policies
*/
List<? extends SnapshotPolicy> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd);
boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd);
Snapshot allocSnapshot(CreateSnapshotCmd cmd) throws ResourceAllocationException;
}

View File

@ -30,48 +30,57 @@ import com.cloud.api.commands.ExtractTemplateCmd;
import com.cloud.api.commands.RegisterIsoCmd;
import com.cloud.api.commands.RegisterTemplateCmd;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.StorageUnavailableException;
public interface TemplateService {
VirtualMachineTemplate registerTemplate(RegisterTemplateCmd cmd) throws URISyntaxException, ResourceAllocationException;
VirtualMachineTemplate registerIso(RegisterIsoCmd cmd) throws IllegalArgumentException, ResourceAllocationException;
VirtualMachineTemplate registerIso(RegisterIsoCmd cmd) throws IllegalArgumentException, ResourceAllocationException;
VirtualMachineTemplate copyIso(CopyIsoCmd cmd) throws StorageUnavailableException, ResourceAllocationException;
VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd) throws StorageUnavailableException, ResourceAllocationException;
boolean detachIso(DetachIsoCmd cmd);
boolean attachIso(AttachIsoCmd cmd);
/**
* Deletes a template
* @param cmd - the command specifying templateId
*
* @param cmd
* - the command specifying templateId
*/
boolean deleteTemplate(DeleteTemplateCmd cmd);
/**
* Deletes a template
* @param cmd - the command specifying isoId
*
* @param cmd
* - the command specifying isoId
* @return true if deletion is successful, false otherwise
* @throws InvalidParameterValueException, InternalErrorException, PermissionDeniedException
*/
boolean deleteIso(DeleteIsoCmd cmd);
/**
* Extracts an ISO
* @param cmd - the command specifying the mode and id of the ISO
*
* @param cmd
* - the command specifying the mode and id of the ISO
* @return extractId.
* @throws InvalidParameterValueException, InternalErrorException, PermissionDeniedException
*/
Long extract(ExtractIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, InternalErrorException;
Long extract(ExtractIsoCmd cmd) throws InternalErrorException;
/**
* Extracts a Template
* @param cmd - the command specifying the mode and id of the template
* @return extractId.
* @throws InvalidParameterValueException, InternalErrorException, PermissionDeniedException
*
* @param cmd
* - the command specifying the mode and id of the template
* @return extractId
*/
Long extract(ExtractTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, InternalErrorException;
Long extract(ExtractTemplateCmd cmd) throws InternalErrorException;
VirtualMachineTemplate getTemplate(long templateId);
}

View File

@ -35,51 +35,59 @@ import com.cloud.api.commands.UpdateUserCmd;
import com.cloud.configuration.ResourceLimit;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
public interface AccountService {
/**
* Creates a new user, stores the password as is so encrypted passwords are recommended.
* @param cmd the create command that has the username, email, password, account name, domain, timezone, etc. for creating the user.
*
* @param cmd
* the create command that has the username, email, password, account name, domain, timezone, etc. for creating
* the user.
* @return the user if created successfully, null otherwise
*/
UserAccount createAccount(CreateAccountCmd cmd);
/**
* Deletes a user by userId
* @param cmd - the delete command defining the id of the user to be deleted.
*
* @param cmd
* - the delete command defining the id of the user to be deleted.
* @return true if delete was successful, false otherwise
*/
boolean deleteUserAccount(DeleteAccountCmd cmd);
/**
* Disables a user by userId
* @param cmd the command wrapping the userId parameter
*
* @param cmd
* the command wrapping the userId parameter
* @return UserAccount object
* @throws InvalidParameterValueException, PermissionDeniedException
*/
UserAccount disableUser(DisableUserCmd cmd);
/**
* Enables a user
* @param cmd - the command containing userId
*
* @param cmd
* - the command containing userId
* @return UserAccount object
* @throws InvalidParameterValueException, PermissionDeniedException
*/
UserAccount enableUser(EnableUserCmd cmd);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses allocated/etc.
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses allocated/etc.
*
* @param userId
* @return UserAccount object
*/
UserAccount lockUser(LockUserCmd cmd);
/**
* Update a user by userId
*
* @param userId
* @return UserAccount object
*/
@ -87,76 +95,84 @@ public interface AccountService {
/**
* Disables an account by accountName and domainId
* @param disabled account if success
*
* @param disabled
* account if success
* @return true if disable was successful, false otherwise
* @throws InvalidParameterValueException, PermissionDeniedException
*/
Account disableAccount(DisableAccountCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException;
Account disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* Enables an account by accountId
* @param cmd - the enableAccount command defining the accountId to be deleted.
*
* @param cmd
* - the enableAccount command defining the accountId to be deleted.
* @return account object
* @throws InvalidParameterValueException, PermissionDeniedException
*/
Account enableAccount(EnableAccountCmd cmd);
/**
* Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP addresses allocated/etc.
* @param cmd - the LockAccount command defining the accountId to be locked.
* Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP addresses
* allocated/etc.
*
* @param cmd
* - the LockAccount command defining the accountId to be locked.
* @return account object
*/
Account lockAccount(DisableAccountCmd cmd);
Account lockAccount(DisableAccountCmd cmd);
/**
* Updates an account name
* @param cmd - the parameter containing accountId
*
* @param cmd
* - the parameter containing accountId
* @return updated account object
* @throws InvalidParameterValueException, PermissionDeniedException
*/
Account updateAccount(UpdateAccountCmd cmd);
/**
* Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
* @param cmd the command that wraps the domainId, accountId, type, and max parameters
*
* @param cmd
* the command that wraps the domainId, accountId, type, and max parameters
* @return the updated/created resource limit
* @throws InvalidParameterValueException
*/
ResourceLimit updateResourceLimit(UpdateResourceLimitCmd cmd) throws InvalidParameterValueException;
ResourceLimit updateResourceLimit(UpdateResourceLimitCmd cmd);
/**
* Search for resource limits for the given id and/or account and/or type and/or domain.
* @param cmd the command wrapping the id, type, account, and domain
*
* @param cmd
* the command wrapping the id, type, account, and domain
* @return a list of limits that match the criteria
* @throws InvalidParameterValueException
* @throws PermissionDeniedException
*/
List<? extends ResourceLimit> searchForLimits(ListResourceLimitsCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
List<? extends ResourceLimit> searchForLimits(ListResourceLimitsCmd cmd);
Account getSystemAccount();
User getSystemUser();
User createUser(CreateUserCmd cmd);
boolean deleteUser(DeleteUserCmd deleteUserCmd);
boolean isAdmin(short accountType);
Account finalizeOwner(Account caller, String accountName, Long domainId);
Pair<String, Long> finalizeAccountDomainForList(Account caller, String accountName, Long domainId);
Account getActiveAccount(String accountName, Long domainId);
Account getActiveAccount(Long accountId);
Account getAccount(Long accountId);
User getActiveUser(long userId);
Domain getDomain(long id);
boolean isRootAdmin(short accountType);
boolean deleteUser(DeleteUserCmd deleteUserCmd);
boolean isAdmin(short accountType);
Account finalizeOwner(Account caller, String accountName, Long domainId);
Pair<String, Long> finalizeAccountDomainForList(Account caller, String accountName, Long domainId);
Account getActiveAccount(String accountName, Long domainId);
Account getActiveAccount(Long accountId);
Account getAccount(Long accountId);
User getActiveUser(long userId);
Domain getDomain(long id);
boolean isRootAdmin(short accountType);
}

View File

@ -38,213 +38,287 @@ import com.cloud.api.commands.UpgradeVMCmd;
import com.cloud.dc.DataCenter;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ManagementServerException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.exception.VirtualMachineMigrationException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
import com.cloud.host.Host;
import com.cloud.utils.exception.ExecutionException;
public interface UserVmService {
/**
* Destroys one virtual machine
* @param userId the id of the user performing the action
* @param vmId the id of the virtual machine.
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*
* @param userId
* the id of the user performing the action
* @param vmId
* the id of the virtual machine.
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
/**
* Destroys one virtual machine
* @param userId the id of the user performing the action
* @param vmId the id of the virtual machine.
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*
* @param userId
* the id of the user performing the action
* @param vmId
* the id of the virtual machine.
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException;
/**
* Resets the password of a virtual machine.
* @param cmd - the command specifying vmId, password
*
* @param cmd
* - the command specifying vmId, password
* @return the VM if reset worked successfully, null otherwise
*/
UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password) throws ResourceUnavailableException, InsufficientCapacityException;
/**
* Attaches the specified volume to the specified VM
* @param cmd - the command specifying volumeId and vmId
*
* @param cmd
* - the command specifying volumeId and vmId
* @return the Volume object if attach worked successfully.
* @throws InvalidParameterValueException, PermissionDeniedException
*/
Volume attachVolumeToVM(AttachVolumeCmd cmd);
/**
* Detaches the specified volume from the VM it is currently attached to.
* @param cmd - the command specifying volumeId
*
* @param cmd
* - the command specifying volumeId
* @return the Volume object if detach worked successfully.
* @throws InvalidParameterValueException
*/
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException;
UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException,
ResourceAllocationException;
UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
UserVm updateVirtualMachine(UpdateVMCmd cmd);
UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException;
/**
* Create a template database record in preparation for creating a private template.
* @param cmd the command object that defines the name, display text, snapshot/volume, bits, public/private, etc.
* for the private template
*
* @param cmd
* the command object that defines the name, display text, snapshot/volume, bits, public/private, etc. for the
* private template
* @return the vm template object if successful, null otherwise
* @throws ResourceAllocationException
* @throws PermissionDeniedException
* @throws InvalidParameterValueException
* @throws PermissionDeniedException
* @throws ResourceAllocationException
*/
VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, ResourceAllocationException;
VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd) throws ResourceAllocationException;
/**
* Creates a private template from a snapshot of a VM
* @param cmd - the command specifying snapshotId, name, description
*
* @param cmd
* - the command specifying snapshotId, name, description
* @return a template if successfully created, null otherwise
* @throws InvalidParameterValueException
*/
VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd cmd);
/**
* Creates a Basic Zone User VM in the database and returns the VM to the caller.
*
* @param zone - availability zone for the virtual machine
* @param serviceOffering - the service offering for the virtual machine
* @param template - the template for the virtual machine
* @param securityGroupIdList - comma separated list of security groups id that going to be applied to the virtual machine
* @param accountName - an optional account for the virtual machine. Must be used with domainId
* @param domainId - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName - host name for the virtual machine
* @param displayName - an optional user generated name for the virtual machine
* @param diskOfferingId - the ID of the disk offering for the virtual machine. If the template is of ISO format,
the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created.
If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created
* @param diskSize - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group - an optional group for the virtual machine
* @param hypervisor - the hypervisor on which to deploy the virtual machine
* @param userData - an optional binary data that can be sent to the virtual machine upon a successful deployment.
This binary data must be base64 encoded before adding it to the request.
Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair - name of the ssh key pair used to login to the virtual machine
* @param Host destinationHost to deploy the VM
*
*
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
* - the service offering for the virtual machine
* @param template
* - the template for the virtual machine
* @param securityGroupIdList
* - comma separated list of security groups id that going to be applied to the virtual machine
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
* Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* @param Host
* destinationHost to deploy the VM
*
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group,
HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the caller.
*
* @param zone - availability zone for the virtual machine
* @param serviceOffering - the service offering for the virtual machine
* @param template - the template for the virtual machine
* @param networkIdList - list of network ids used by virtual machine
* @param securityGroupIdList - comma separated list of security groups id that going to be applied to the virtual machine
* @param accountName - an optional account for the virtual machine. Must be used with domainId
* @param domainId - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName - host name for the virtual machine
* @param displayName - an optional user generated name for the virtual machine
* @param diskOfferingId - the ID of the disk offering for the virtual machine. If the template is of ISO format,
the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created.
If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created
* @param diskSize - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group - an optional group for the virtual machine
* @param hypervisor - the hypervisor on which to deploy the virtual machine
* @param userData - an optional binary data that can be sent to the virtual machine upon a successful deployment.
This binary data must be base64 encoded before adding it to the request.
Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair - name of the ssh key pair used to login to the virtual machine
* @param Host destinationHost to deploy the VM
*
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
* - the service offering for the virtual machine
* @param template
* - the template for the virtual machine
* @param networkIdList
* - list of network ids used by virtual machine
* @param securityGroupIdList
* - comma separated list of security groups id that going to be applied to the virtual machine
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
* Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* @param Host
* destinationHost to deploy the VM
*
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group,
HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the caller.
*
* @param zone - availability zone for the virtual machine
* @param serviceOffering - the service offering for the virtual machine
* @param template - the template for the virtual machine
* @param networkIdList - list of network ids used by virtual machine
* @param accountName - an optional account for the virtual machine. Must be used with domainId
* @param domainId - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName - host name for the virtual machine
* @param displayName - an optional user generated name for the virtual machine
* @param diskOfferingId - the ID of the disk offering for the virtual machine. If the template is of ISO format,
the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created.
If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created
* @param diskSize - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group - an optional group for the virtual machine
* @param hypervisor - the hypervisor on which to deploy the virtual machine
* @param userData - an optional binary data that can be sent to the virtual machine upon a successful deployment.
This binary data must be base64 encoded before adding it to the request.
Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair - name of the ssh key pair used to login to the virtual machine
* @param Host destinationHost to deploy the VM
*
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
* - the service offering for the virtual machine
* @param template
* - the template for the virtual machine
* @param networkIdList
* - list of network ids used by virtual machine
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* @param domainId
* - an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
* - the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is
* for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume.
* If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume
* created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk
* Volume created
* @param diskSize
* - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
* - an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary
* data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP
* GET (via querystring), you can send up to 2KB of data after base64 encoding
* @param sshKeyPair
* - name of the ssh key pair used to login to the virtual machine
* @param Host
* destinationHost to deploy the VM
*
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM or in the same environment.
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Host destinationHost)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Starts the virtual machine created from createVirtualMachine.
*
* @param cmd Command to deploy.
*
* @param cmd
* Command to deploy.
* @return UserVm object if successful.
* @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException if there are multiple users working on the same VM.
* @throws ResourceUnavailableException if the resources required the deploy the VM is not currently available.
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM.
* @throws ResourceUnavailableException
* if the resources required the deploy the VM is not currently available.
*/
UserVm startVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException;
/**
* Creates a vm group.
* @param name - name of the group
* @param accountId - accountId
*
* @param name
* - name of the group
* @param accountId
* - accountId
*/
InstanceGroup createVmGroup(CreateVMGroupCmd cmd);
@ -252,42 +326,53 @@ public interface UserVmService {
/**
* upgrade the service offering of the virtual machine
* @param cmd - the command specifying vmId and new serviceOfferingId
*
* @param cmd
* - the command specifying vmId and new serviceOfferingId
* @return the vm
* @throws InvalidParameterValueException
*/
UserVm upgradeVirtualMachine(UpgradeVMCmd cmd);
UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOperationException;
UserVm startVirtualMachine(long vmId) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
void deletePrivateTemplateRecord(Long templateId);
/**
* Obtains a list of virtual machines by the specified search criteria.
* Can search by: "userId", "name", "state", "dataCenterId", "podId", "hostId"
* @param cmd the API command that wraps the search criteria
* Obtains a list of virtual machines by the specified search criteria. Can search by: "userId", "name", "state",
* "dataCenterId", "podId", "hostId"
*
* @param cmd
* the API command that wraps the search criteria
* @return List of UserVMs.
*/
List<? extends UserVm> searchForUserVMs(ListVMsCmd cmd);
HypervisorType getHypervisorTypeOfUserVM(long vmid);
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
StorageUnavailableException, ResourceAllocationException;
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException,
ResourceAllocationException;
UserVm getUserVm(long vmId);
/**
* Migrate the given VM to the destination host provided. The API returns the migrated VM
* if migration succeeds. Only Root Admin can migrate a VM.
* @param UserVm vm The VM to migrate
* @param Host destinationHost to migrate the VM
* Migrate the given VM to the destination host provided. The API returns the migrated VM if migration succeeds. Only Root
* Admin can migrate a VM.
*
* @param UserVm
* vm The VM to migrate
* @param Host
* destinationHost to migrate the VM
* @return UserVm migrated VM
* @throws ManagementServerException in case we get error finding the VM or host or access errors or other internal errors.
* @throws ConcurrentOperationException if there are multiple users working on the same VM.
* @throws ResourceUnavailableException if the destination host to migrate the VM is not currently available.
* @throws VirtualMachineMigrationException if the VM to be migrated is not in Running state
* @throws ManagementServerException
* in case we get error finding the VM or host or access errors or other internal errors.
* @throws ConcurrentOperationException
* if there are multiple users working on the same VM.
* @throws ResourceUnavailableException
* if the destination host to migrate the VM is not currently available.
* @throws VirtualMachineMigrationException
* if the VM to be migrated is not in Running state
*/
UserVm migrateVirtualMachine(UserVm vm, Host destinationHost) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
}

View File

@ -558,7 +558,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
}
@Override
public List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException {
public List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException {
Long dcId = cmd.getZoneId();
Long podId = cmd.getPodId();
String clusterName = cmd.getClusterName();
@ -935,7 +935,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
@Override
@DB
public boolean deleteCluster(DeleteClusterCmd cmd) throws InvalidParameterValueException {
public boolean deleteCluster(DeleteClusterCmd cmd) {
Transaction txn = Transaction.currentTxn();
try {
txn.start();
@ -970,7 +970,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
@Override
@DB
public Cluster updateCluster(Cluster clusterToUpdate, String clusterType, String hypervisor, String allocationState) throws InvalidParameterValueException {
public Cluster updateCluster(Cluster clusterToUpdate, String clusterType, String hypervisor, String allocationState) {
ClusterVO cluster = (ClusterVO) clusterToUpdate;
// Verify cluster information and update the cluster if needed
@ -2012,7 +2012,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
}
@Override
public Host cancelMaintenance(CancelMaintenanceCmd cmd) throws InvalidParameterValueException {
public Host cancelMaintenance(CancelMaintenanceCmd cmd) {
Long hostId = cmd.getId();
// verify input parameters
@ -2113,7 +2113,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
}
@Override
public Host maintain(PrepareForMaintenanceCmd cmd) throws InvalidParameterValueException {
public Host maintain(PrepareForMaintenanceCmd cmd) {
Long hostId = cmd.getId();
HostVO host = _hostDao.findById(hostId);
@ -2455,7 +2455,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
}
@Override
public Host updateHost(UpdateHostCmd cmd) throws InvalidParameterValueException {
public Host updateHost(UpdateHostCmd cmd) {
Long hostId = cmd.getId();
Long guestOSCategoryId = cmd.getOsCategoryId();

View File

@ -504,7 +504,7 @@ public class ApiDBUtils {
return _zoneDao.listAll();
}
public static boolean volumeIsOnSharedStorage(long volumeId) throws InvalidParameterValueException {
public static boolean volumeIsOnSharedStorage(long volumeId) {
// Check that the volume is valid
VolumeVO volume = _volumeDao.findById(volumeId);
if (volume == null) {

View File

@ -503,10 +503,10 @@ public class ApiResponseHelper implements ResponseGenerator {
hostResponse.setZoneName(ApiDBUtils.findZoneById(host.getDataCenterId()).getName());
if (host.getPodId() != null) {
HostPodVO pod = ApiDBUtils.findPodById(host.getPodId());
if(pod != null){
hostResponse.setPodName(pod.getName());
}
HostPodVO pod = ApiDBUtils.findPodById(host.getPodId());
if (pod != null) {
hostResponse.setPodName(pod.getName());
}
}
DecimalFormat decimalFormat = new DecimalFormat("#.##");
@ -590,8 +590,8 @@ public class ApiResponseHelper implements ResponseGenerator {
if (podId != null) {
HostPodVO pod = ApiDBUtils.findPodById(podId);
vlanResponse.setPodId(podId);
if(pod != null){
vlanResponse.setPodName(pod.getName());
if (pod != null) {
vlanResponse.setPodName(pod.getName());
}
}
@ -891,10 +891,10 @@ public class ApiResponseHelper implements ResponseGenerator {
}
if (pool.getPodId() != null) {
poolResponse.setPodId(pool.getPodId());
HostPodVO pod = ApiDBUtils.findPodById(pool.getPodId());
if(pod != null){
poolResponse.setPodName(pod.getName());
}
HostPodVO pod = ApiDBUtils.findPodById(pool.getPodId());
if (pod != null) {
poolResponse.setPodName(pod.getName());
}
}
if (pool.getCreated() != null) {
poolResponse.setCreated(pool.getCreated());
@ -934,9 +934,9 @@ public class ApiResponseHelper implements ResponseGenerator {
clusterResponse.setClusterType(cluster.getClusterType().toString());
clusterResponse.setAllocationState(cluster.getAllocationState().toString());
HostPodVO pod = ApiDBUtils.findPodById(cluster.getPodId());
if(pod != null){
clusterResponse.setPodName(pod.getName());
}
if (pod != null) {
clusterResponse.setPodName(pod.getName());
}
DataCenterVO zone = ApiDBUtils.findZoneById(cluster.getDataCenterId());
clusterResponse.setZoneName(zone.getName());
clusterResponse.setObjectName("cluster");
@ -1511,7 +1511,7 @@ public class ApiResponseHelper implements ResponseGenerator {
if (templateSize > 0) {
templateResponse.setSize(templateSize);
}
templateResponse.setChecksum(template.getChecksum());
templateResponse.setObjectName("template");
@ -1572,7 +1572,7 @@ public class ApiResponseHelper implements ResponseGenerator {
templateResponse.setZoneId(zone.getId());
templateResponse.setZoneName(zone.getName());
templateResponse.setHypervisor(template.getHypervisorType().toString());
templateResponse.setObjectName("template");
templateResponse.setObjectName("template");
templateResponse.setChecksum(template.getChecksum());
responses.add(templateResponse);
@ -2199,10 +2199,10 @@ public class ApiResponseHelper implements ResponseGenerator {
if (summedCapacity.getPodId() != null) {
capacityResponse.setPodId(summedCapacity.getPodId());
if (summedCapacity.getPodId() > 0) {
HostPodVO pod = ApiDBUtils.findPodById(summedCapacity.getPodId());
if(pod != null){
capacityResponse.setPodName(pod.getName());
}
HostPodVO pod = ApiDBUtils.findPodById(summedCapacity.getPodId());
if (pod != null) {
capacityResponse.setPodName(pod.getName());
}
} else {
capacityResponse.setPodName("All");
}
@ -2248,7 +2248,7 @@ public class ApiResponseHelper implements ResponseGenerator {
}
@Override
public AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException {
public AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd) {
AsyncJobResult result = ApiDBUtils._asyncMgr.queryAsyncJobResult(cmd);
AsyncJobResponse response = new AsyncJobResponse();
response.setId(result.getJobId());

View File

@ -21,8 +21,6 @@ package com.cloud.async;
import java.util.List;
import com.cloud.api.commands.QueryAsyncJobResultCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.utils.component.Manager;
public interface AsyncJobManager extends Manager {
@ -50,5 +48,5 @@ public interface AsyncJobManager extends Manager {
* @param cmd the command that specifies the job id
* @return an async-call result object
*/
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd);
}

View File

@ -50,7 +50,6 @@ import com.cloud.cluster.StackMaid;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.user.dao.AccountDao;
@ -273,7 +272,7 @@ public class AsyncJobManagerImpl implements AsyncJobManager, ClusterManagerListe
}
@Override
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public AsyncJobResult queryAsyncJobResult(QueryAsyncJobResultCmd cmd) {
AsyncJobVO job = _jobDao.findById(cmd.getId());
if (job == null) {
throw new InvalidParameterValueException("Unable to find a job by id " + cmd.getId());

View File

@ -316,7 +316,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException {
public Configuration updateConfiguration(UpdateCfgCmd cmd) {
Long userId = UserContext.current().getCallerUserId();
String name = cmd.getCfgName();
String value = cmd.getValue();
@ -338,7 +338,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private String validateConfigurationValue(String name, String value) throws InvalidParameterValueException {
private String validateConfigurationValue(String name, String value) {
if (value == null) {
return null;
}
@ -506,8 +506,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private void checkPodAttributes(long podId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp, String allocationStateStr, boolean checkForDuplicates)
throws InvalidParameterValueException {
private void checkPodAttributes(long podId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp, String allocationStateStr, boolean checkForDuplicates) {
if (checkForDuplicates) {
// Check if the pod already exists
if (validPod(podName, zoneId)) {
@ -952,8 +951,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
private void checkZoneParameters(String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, boolean checkForDuplicates, Long domainId, String allocationStateStr)
throws InvalidParameterValueException {
private void checkZoneParameters(String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, boolean checkForDuplicates, Long domainId, String allocationStateStr) {
if (checkForDuplicates) {
// Check if a zone with the specified name already exists
if (validZone(zoneName)) {
@ -998,7 +996,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private void checkIpRange(String startIp, String endIp, String cidrAddress, long cidrSize) throws InvalidParameterValueException {
private void checkIpRange(String startIp, String endIp, String cidrAddress, long cidrSize) {
if (!NetUtils.isValidIp(startIp)) {
throw new InvalidParameterValueException("The start address of the IP range is not a valid IP address.");
}
@ -1537,7 +1535,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_CREATE, eventDescription = "creating disk offering")
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized) throws InvalidParameterValueException {
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized) {
long diskSize = 0;// special case for custom disk offerings
if (numGibibytes != null && (numGibibytes <= 0)) {
throw new InvalidParameterValueException("Please specify a disk size of at least 1 Gb.");
@ -1566,7 +1564,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd) throws InvalidParameterValueException {
public DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd) {
String name = cmd.getOfferingName();
String description = cmd.getDisplayText();
Long numGibibytes = cmd.getDiskSize();
@ -1585,7 +1583,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_EDIT, eventDescription = "updating disk offering")
public DiskOffering updateDiskOffering(UpdateDiskOfferingCmd cmd) throws InvalidParameterValueException {
public DiskOffering updateDiskOffering(UpdateDiskOfferingCmd cmd) {
Long diskOfferingId = cmd.getId();
String name = cmd.getDiskOfferingName();
String displayText = cmd.getDisplayText();
@ -1645,7 +1643,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_DELETE, eventDescription = "deleting disk offering")
public boolean deleteDiskOffering(DeleteDiskOfferingCmd cmd) throws InvalidParameterValueException {
public boolean deleteDiskOffering(DeleteDiskOfferingCmd cmd) {
Long diskOfferingId = cmd.getId();
DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId);
@ -1664,7 +1662,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_DELETE, eventDescription = "deleting service offering")
public boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd) throws InvalidParameterValueException {
public boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd) {
Long offeringId = cmd.getId();
Long userId = UserContext.current().getCallerUserId();
@ -1690,7 +1688,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public String changePrivateIPRange(boolean add, long podId, String startIP, String endIP) throws InvalidParameterValueException {
public String changePrivateIPRange(boolean add, long podId, String startIP, String endIP) {
checkPrivateIpRangeErrors(podId, startIP, endIP);
long zoneId = _podDao.findById(podId).getDataCenterId();
@ -2086,7 +2084,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException {
public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) {
VlanVO vlan = _vlanDao.findById(vlanDbId);
if (vlan == null) {
throw new InvalidParameterValueException("Please specify a valid IP range id.");
@ -2285,7 +2283,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private void checkPublicIpRangeErrors(long zoneId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) throws InvalidParameterValueException {
private void checkPublicIpRangeErrors(long zoneId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) {
// Check that the start and end IPs are valid
if (!NetUtils.isValidIp(startIP)) {
throw new InvalidParameterValueException("Please specify a valid start IP");
@ -2317,7 +2315,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private void checkPrivateIpRangeErrors(Long podId, String startIP, String endIP) throws InvalidParameterValueException {
private void checkPrivateIpRangeErrors(Long podId, String startIP, String endIP) {
HostPodVO pod = _podDao.findById(podId);
if (pod == null) {
throw new InvalidParameterValueException("Please specify a valid pod.");
@ -2373,7 +2371,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
return pod.getCidrSize();
}
private void checkPodCidrSubnets(long dcId, HashMap<Long, List<Object>> currentPodCidrSubnets) throws InvalidParameterValueException {
private void checkPodCidrSubnets(long dcId, HashMap<Long, List<Object>> currentPodCidrSubnets) {
// For each pod, return an error if any of the following is true:
// 1. The pod's CIDR subnet conflicts with the guest network subnet
// 2. The pod's CIDR subnet conflicts with the CIDR subnet of any other pod
@ -2494,7 +2492,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
}
private String[] getLinkLocalIPRange() throws InvalidParameterValueException {
private String[] getLinkLocalIPRange() {
String ipNums = _configDao.getValue("linkLocalIp.nums");
int nums = Integer.parseInt(ipNums);
if (nums > 16 || nums <= 0) {
@ -2529,7 +2527,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@ActionEvent(eventType = EventTypes.EVENT_VLAN_IP_RANGE_DELETE, eventDescription = "deleting vlan ip range", async = false)
public boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException {
public boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) {
Long vlanDbId = cmd.getId();
Long userId = UserContext.current().getCallerUserId();
@ -2598,7 +2596,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd) throws InvalidParameterValueException {
public NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd) {
Long userId = UserContext.current().getCallerUserId();
String name = cmd.getNetworkOfferingName();
String displayText = cmd.getDisplayText();
@ -2763,7 +2761,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
public boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd) throws InvalidParameterValueException {
public boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd) {
Long offeringId = cmd.getId();
// Verify network offering id
@ -2843,7 +2841,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
// Note: This method will be used for entity name validations in the coming releases (place holder for now)
private void validateEntityName(String str) throws InvalidParameterValueException {
private void validateEntityName(String str) {
String forbidden = "~!@#$%^&*()+=";
char[] searchChars = forbidden.toCharArray();
if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) {

View File

@ -645,7 +645,7 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager,
}
@Override
public List<LoadBalancerVO> searchForLoadBalancers(ListLoadBalancerRulesCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public List<LoadBalancerVO> searchForLoadBalancers(ListLoadBalancerRulesCmd cmd) {
Account caller = UserContext.current().getCaller();
Long ipId = cmd.getPublicIpId();
Long zoneId = cmd.getZoneId();
@ -654,7 +654,7 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager,
Pair<String, Long> accountDomainPair = _accountMgr.finalizeAccountDomainForList(caller, cmd.getAccountName(), cmd.getDomainId());
String accountName = accountDomainPair.first();
Long domainId = accountDomainPair.second();
if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
Domain domain = _accountMgr.getDomain(caller.getDomainId());
path = domain.getPath();

View File

@ -323,7 +323,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
@Override
@DB
public VirtualRouter upgradeRouter(UpgradeRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public VirtualRouter upgradeRouter(UpgradeRouterCmd cmd) {
Long routerId = cmd.getId();
Long serviceOfferingId = cmd.getServiceOfferingId();
Account account = UserContext.current().getCaller();
@ -495,8 +495,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
@Override
public VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
public VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
Account caller = UserContext.current().getCaller();
// verify parameters

View File

@ -19,9 +19,7 @@ package com.cloud.network.rules;
import java.util.List;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
@ -60,8 +58,8 @@ public interface RulesManager extends RulesService {
*/
void detectRulesConflict(FirewallRule newRule, IpAddress ipAddress) throws NetworkRuleConflictException;
void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) throws InvalidParameterValueException, PermissionDeniedException;
void checkRuleAndUserVm(FirewallRule rule, UserVm userVm, Account caller) throws InvalidParameterValueException, PermissionDeniedException;
void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller);
void checkRuleAndUserVm(FirewallRule rule, UserVm userVm, Account caller);
boolean revokeAllRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException;

View File

@ -39,7 +39,6 @@ import com.cloud.event.dao.EventDao;
import com.cloud.event.dao.UsageEventDao;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IPAddressVO;
import com.cloud.network.IpAddress;
@ -140,7 +139,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
}
@Override
public void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) throws InvalidParameterValueException, PermissionDeniedException {
public void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) {
if (ipAddress == null || ipAddress.getAllocatedTime() == null || ipAddress.getAllocatedToAccountId() == null) {
throw new InvalidParameterValueException("Unable to create ip forwarding rule on address " + ipAddress + ", invalid IP address specified.");
}
@ -169,7 +168,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
}
@Override
public void checkRuleAndUserVm(FirewallRule rule, UserVm userVm, Account caller) throws InvalidParameterValueException, PermissionDeniedException {
public void checkRuleAndUserVm(FirewallRule rule, UserVm userVm, Account caller) {
if (userVm == null || rule == null) {
return;
}

View File

@ -454,7 +454,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
}
@Override @DB @SuppressWarnings("rawtypes")
public List<IngressRuleVO> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd) throws InvalidParameterValueException, PermissionDeniedException{
public List<IngressRuleVO> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd){
Long groupId = cmd.getSecurityGroupId();
String protocol = cmd.getProtocol();
Integer startPort = cmd.getStartPort();

View File

@ -19,7 +19,6 @@
package com.cloud.server;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
/**
* ConfigurationServer is the public interface to talk to the Configuration Server.
@ -32,5 +31,5 @@ public interface ConfigurationServer {
* Persists default values for the configuration table, pods/zones, and VLANs
* @return
*/
public void persistDefaultValues() throws InvalidParameterValueException, InternalErrorException;
public void persistDefaultValues() throws InternalErrorException;
}

View File

@ -114,7 +114,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
}
@Override @DB
public void persistDefaultValues() throws InvalidParameterValueException, InternalErrorException {
public void persistDefaultValues() throws InternalErrorException {
// Create system user and admin user
saveUser();
@ -558,7 +558,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
}
@DB
protected HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp) throws InvalidParameterValueException, InternalErrorException {
protected HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp) throws InternalErrorException {
String[] cidrPair = cidr.split("\\/");
String cidrAddress = cidrPair[0];
int cidrSize = Integer.parseInt(cidrPair[1]);
@ -618,7 +618,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
return pod;
}
private DiskOfferingVO createDiskOffering(Long domainId, String name, String description, int numGibibytes, String tags) throws InvalidParameterValueException {
private DiskOfferingVO createDiskOffering(Long domainId, String name, String description, int numGibibytes, String tags) {
long diskSize = numGibibytes * 1024;
tags = cleanupTags(tags);

View File

@ -31,7 +31,6 @@ import com.cloud.dc.VlanVO;
import com.cloud.domain.DomainVO;
import com.cloud.event.EventVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.HostVO;
@ -58,11 +57,9 @@ import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
/**
* ManagementServer is the interface to talk to the Managment Server.
* This will be the line drawn between the UI and MS. If we need to build
* a wire protocol, it will be built on top of this java interface.
* ManagementServer is the interface to talk to the Managment Server. This will be the line drawn between the UI and MS. If we
* need to build a wire protocol, it will be built on top of this java interface.
*/
public interface ManagementServer extends ManagementService {
@ -85,35 +82,41 @@ public interface ManagementServer extends ManagementService {
/**
* Authenticates a user when s/he logs in.
* @param username required username for authentication
* @param password password to use for authentication, can be null for single sign-on case
* @param domainId id of domain where user with username resides
* @param requestParameters the request parameters of the login request, which should contain timestamp of when the request signature is made, and the signature itself in the single sign-on case
*
* @param username
* required username for authentication
* @param password
* password to use for authentication, can be null for single sign-on case
* @param domainId
* id of domain where user with username resides
* @param requestParameters
* the request parameters of the login request, which should contain timestamp of when the request signature is
* made, and the signature itself in the single sign-on case
* @return a user object, null if the user failed to authenticate
*/
UserAccount authenticateUser(String username, String password, Long domainId, Map<String, Object[]> requestParameters);
String updateAdminPassword(long userId, String oldPassword, String newPassword);
/**
* Locate a user by their apiKey
* @param apiKey that was created for a particular user
*
* @param apiKey
* that was created for a particular user
* @return the user/account pair if one exact match was found, null otherwise
*/
Pair<User, Account> findUserByApiKey(String apiKey);
/**
* Get an account by the accountId
*
* @param accountId
* @return the account, or null if not found
*/
Account getAccount(long accountId);
/**
* Gets Volume statistics. The array returned will contain VolumeStats in the same order
* as the array of volumes requested.
* Gets Volume statistics. The array returned will contain VolumeStats in the same order as the array of volumes requested.
*
* @param volId
* @return array of VolumeStats
@ -122,6 +125,7 @@ public interface ManagementServer extends ManagementService {
/**
* If the specified VLAN is associated with the pod, returns the pod ID. Else, returns null.
*
* @param vlanDbId
* @return pod ID, or null
*/
@ -129,16 +133,21 @@ public interface ManagementServer extends ManagementService {
/**
* Return a list of IP addresses
*
* @param accountId
* @param allocatedOnly - if true, will only list IPs that are allocated to the specified account
* @param zoneId - if specified, will list IPs in this zone
* @param vlanDbId - if specified, will list IPs in this VLAN
* @param allocatedOnly
* - if true, will only list IPs that are allocated to the specified account
* @param zoneId
* - if specified, will list IPs in this zone
* @param vlanDbId
* - if specified, will list IPs in this VLAN
* @return list of IP addresses
*/
List<IPAddressVO> listPublicIpAddressesBy(Long accountId, boolean allocatedOnly, Long zoneId, Long vlanDbId);
/**
* Return a list of private IP addresses that have been allocated to the given pod and zone
*
* @param podId
* @param zoneId
* @return list of private IP addresses
@ -147,60 +156,71 @@ public interface ManagementServer extends ManagementService {
/**
* Attaches an ISO to the virtual CDROM device of the specified VM. Will fail if the VM already has an ISO mounted.
*
* @param vmId
* @param userId
* @param isoId
* @param attach whether to attach or detach the iso from the instance
* @param attach
* whether to attach or detach the iso from the instance
* @return
*/
boolean attachISOToVM(long vmId, long userId, long isoId, boolean attach);
/**
* Retrieves a host by id
*
* @param hostId
* @return Host
*/
HostVO getHostBy(long hostId);
/**
* Retrieves all Events between the start and end date specified
*
* @param userId unique id of the user, pass in -1 to retrieve events for all users
* @param accountId unique id of the account (which could be shared by many users), pass in -1 to retrieve events for all accounts
* @param domainId the id of the domain in which to search for users (useful when -1 is passed in for userId)
* @param type the type of the event.
* @param level INFO, WARN, or ERROR
* @param startDate inclusive.
* @param endDate inclusive. If date specified is greater than the current time, the
* system will use the current time.
* @param userId
* unique id of the user, pass in -1 to retrieve events for all users
* @param accountId
* unique id of the account (which could be shared by many users), pass in -1 to retrieve events for all accounts
* @param domainId
* the id of the domain in which to search for users (useful when -1 is passed in for userId)
* @param type
* the type of the event.
* @param level
* INFO, WARN, or ERROR
* @param startDate
* inclusive.
* @param endDate
* inclusive. If date specified is greater than the current time, the system will use the current time.
* @return List of events
*/
List<EventVO> getEvents(long userId, long accountId, Long domainId, String type, String level, Date startDate, Date endDate);
/**
* returns the instance id of this management server.
*
* @return id of the management server
*/
long getId();
/**
* Searches for Zones by the specified search criteria
* Can search by: zone name
* Searches for Zones by the specified search criteria Can search by: zone name
*
* @param c
* @return List of Zones
*/
List<DataCenterVO> searchForZones(Criteria c);
/**
* Searches for servers that are either Down or in Alert state
*
* @param c
* @return List of Hosts
*/
List<HostVO> searchForAlertServers(Criteria c);
/**
* Search for templates by the specified search criteria
* Can search by: "name", "ready", "isPublic"
* Search for templates by the specified search criteria Can search by: "name", "ready", "isPublic"
*
* @param c
* @return List of VMTemplates
*/
@ -208,6 +228,7 @@ public interface ManagementServer extends ManagementService {
/**
* Obtains pods that match the data center ID
*
* @param dataCenterId
* @return List of Pods
*/
@ -215,22 +236,23 @@ public interface ManagementServer extends ManagementService {
/**
* Change a pod's private IP range
*
* @param op
* @param podId
* @param startIP
* @param endIP
* @return Message to display to user
* @throws InvalidParameterValueException if unable to add private ip range
*/
String changePrivateIPRange(boolean add, Long podId, String startIP, String endIP);
/**
* Finds a user by their user ID.
*
* @param ownerId
* @return User
*/
User findUserById(Long userId);
/**
* Gets user by id.
*
@ -239,16 +261,18 @@ public interface ManagementServer extends ManagementService {
* @return
*/
User getUser(long userId, boolean active);
/**
* Obtains a list of virtual machines that are similar to the VM with the specified name.
*
* @param vmInstanceName
* @return List of VMInstances
*/
List<VMInstanceVO> findVMInstancesLike(String vmInstanceName);
/**
* Finds a virtual machine instance with the specified Volume ID.
*
* @param volumeId
* @return VMInstance
*/
@ -256,6 +280,7 @@ public interface ManagementServer extends ManagementService {
/**
* Finds a guest virtual machine instance with the specified ID.
*
* @param userVmId
* @return UserVmVO
*/
@ -263,201 +288,238 @@ public interface ManagementServer extends ManagementService {
/**
* Finds a service offering with the specified ID.
*
* @param offeringId
* @return ServiceOffering
*/
ServiceOfferingVO findServiceOfferingById(long offeringId);
/**
* Obtains a list of all service offerings.
*
* @return List of ServiceOfferings
*/
List<ServiceOfferingVO> listAllServiceOfferings();
/**
* Obtains a list of all active hosts.
*
* @return List of Hosts.
*/
List<HostVO> listAllActiveHosts();
/**
* Finds a data center with the specified ID.
*
* @param dataCenterId
* @return DataCenter
*/
DataCenterVO findDataCenterById(long dataCenterId);
/**
* Finds a template by the specified ID.
*
* @param templateId
* @return A VMTemplate
*/
VMTemplateVO findTemplateById(long templateId);
List<EventVO> listPendingEvents(int entryTime, int duration);
/**
* Obtains a list of routers by the specified host ID.
*
* @param hostId
* @return List of DomainRouters.
*/
List<DomainRouterVO> listRoutersByHostId(long hostId);
/**
* Obtains a list of all active routers.
*
* @return List of DomainRouters
*/
List<DomainRouterVO> listAllActiveRouters();
List<ConsoleProxyVO> searchForConsoleProxy(Criteria c);
/**
* Finds a pod by the specified ID.
*
* @param podId
* @return HostPod
*/
HostPodVO findHostPodById(long podId);
/**
* Finds a secondary storage host in the specified zone
*
* @param zoneId
* @return Host
*/
HostVO findSecondaryStorageHosT(long zoneId);
/**
* Obtains a list of billing records by the specified search criteria.
* Can search by: "userId", "startDate", "endDate"
* Obtains a list of billing records by the specified search criteria. Can search by: "userId", "startDate", "endDate"
*
* @param c
* @return List of Billings.
List<UsageVO> searchForUsage(Criteria c);
* @return List of Billings. List<UsageVO> searchForUsage(Criteria c);
*/
/**
* Obtains a list of all templates.
*
* @return list of VMTemplates
*/
List<VMTemplateVO> listAllTemplates();
/**
* Logs out a user
*
* @param userId
*/
void logoutUser(Long userId);
ConsoleProxyInfo getConsoleProxy(long dataCenterId, long userVmId);
ConsoleProxyVO startConsoleProxy(long instanceId);
ConsoleProxyVO stopConsoleProxy(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException;
ConsoleProxyVO rebootConsoleProxy(long instanceId);
String getConsoleAccessUrlRoot(long vmId);
ConsoleProxyVO findConsoleProxyById(long instanceId);
VMInstanceVO findSystemVMById(long instanceId);
VirtualMachine startSystemVm(long vmId);
ConsoleProxyInfo getConsoleProxy(long dataCenterId, long userVmId);
/**
* Returns a configuration value with the specified name
* @param name
* @return configuration value
*/
String getConfigurationValue(String name);
/**
* Returns the vnc port of the vm.
*
* @param VirtualMachine vm
* @return the vnc port if found; -1 if unable to find.
*/
Pair<String, Integer> getVncPort(VirtualMachine vm);
ConsoleProxyVO startConsoleProxy(long instanceId);
ConsoleProxyVO stopConsoleProxy(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException;
ConsoleProxyVO rebootConsoleProxy(long instanceId);
String getConsoleAccessUrlRoot(long vmId);
ConsoleProxyVO findConsoleProxyById(long instanceId);
VMInstanceVO findSystemVMById(long instanceId);
VirtualMachine startSystemVm(long vmId);
/**
* Returns a configuration value with the specified name
*
* @param name
* @return configuration value
*/
String getConfigurationValue(String name);
/**
* Returns the vnc port of the vm.
*
* @param VirtualMachine
* vm
* @return the vnc port if found; -1 if unable to find.
*/
Pair<String, Integer> getVncPort(VirtualMachine vm);
/**
* find the domain Id associated with the given account
* @param accountId the id of the account to use to look up the domain
*
* @param accountId
* the id of the account to use to look up the domain
*/
Long findDomainIdByAccountId(Long accountId);
/**
* find the domain by its path
* @param domainPath the path to use to lookup a domain
*
* @param domainPath
* the path to use to lookup a domain
* @return domainVO the domain with the matching path, or null if no domain with the given path exists
*/
DomainVO findDomainByPath(String domainPath);
/**
* Finds accounts with account identifiers similar to the parameter
*
* @param accountName
* @return list of Accounts
*/
List<AccountVO> findAccountsLike(String accountName);
/**
* Finds accounts with account identifier
*
* @param accountName
* @return an account that is active (not deleted)
*/
Account findActiveAccountByName(String accountName);
/**
* Finds accounts with account identifier
* @param accountName, domainId
*
* @param accountName
* , domainId
* @return an account that is active (not deleted)
*/
Account findActiveAccount(String accountName, Long domainId);
/**
* Finds accounts with account identifier
*
* @param accountName
* @param domainId
* @return an account that may or may not have been deleted
*/
Account findAccountByName(String accountName, Long domainId);
/**
* Finds an account by the ID.
*
* @param accountId
* @return Account
*/
Account findAccountById(Long accountId);
/**
* Deletes a Limit
* @param limitId - the database ID of the Limit
*
* @param limitId
* - the database ID of the Limit
* @return true if successful, false if not
*/
boolean deleteLimit(Long limitId);
/**
* Finds limit by id
* @param limitId - the database ID of the Limit
*
* @param limitId
* - the database ID of the Limit
* @return LimitVO object
*/
ResourceLimitVO findLimitById(long limitId);
/**
* Lists ISOs that are available for the specified account ID.
*
* @param accountId
* @param accountType
* @return a list of ISOs (VMTemplateVO objects)
*/
List<VMTemplateVO> listIsos(Criteria c);
public long getMemoryUsagebyHost(Long hostId);
/**
* Finds a diskOffering by the specified ID.
*
* @param diskOfferingId
* @return A DiskOffering
*/
DiskOfferingVO findDiskOfferingById(long diskOffering);
/**
* Finds the obj associated with the private disk offering
* Finds the obj associated with the private disk offering
*
* @return -- vo obj for private disk offering
*/
List<DiskOfferingVO> findPrivateDiskOffering();
/**
* List private templates for which the given account/domain has been granted permission to launch instances
*
* @param accountId
* @return
*/
@ -465,57 +527,67 @@ public interface ManagementServer extends ManagementService {
/**
*
* @param jobId async-call job id
* @param jobId
* async-call job id
* @return async-call result object
*/
AsyncJobResult queryAsyncJobResult(long jobId);
AsyncJobVO findAsyncJobById(long jobId);
String[] getApiConfig();
StoragePoolVO findPoolById(Long id);
List<? extends StoragePoolVO> searchForStoragePools(Criteria c);
/**
* Return whether a domain is a child domain of a given domain.
* @param parentId
* @param childId
* @return True if the domainIds are equal, or if the second domain is a child of the first domain. False otherwise.
*/
StoragePoolVO findPoolById(Long id);
List<? extends StoragePoolVO> searchForStoragePools(Criteria c);
/**
* Return whether a domain is a child domain of a given domain.
*
* @param parentId
* @param childId
* @return True if the domainIds are equal, or if the second domain is a child of the first domain. False otherwise.
*/
boolean isChildDomain(Long parentId, Long childId);
List<SecondaryStorageVmVO> searchForSecondaryStorageVm(Criteria c);
List<SecondaryStorageVmVO> searchForSecondaryStorageVm(Criteria c);
SecurityGroupVO findNetworkGroupByName(Long accountId, String groupName);
/**
* Find a network group by id
* @param networkGroupId id of group to lookup
*
* @param networkGroupId
* id of group to lookup
* @return the network group if found, null otherwise
*/
SecurityGroupVO findNetworkGroupById(long networkGroupId);
List<String> searchForStoragePoolDetails(long poolId, String value);
boolean checkLocalStorageConfigVal();
List<String> searchForStoragePoolDetails(long poolId, String value);
VolumeVO findVolumeByInstanceAndDeviceId(long instanceId, long deviceId);
boolean checkLocalStorageConfigVal();
VolumeVO findVolumeByInstanceAndDeviceId(long instanceId, long deviceId);
InstanceGroupVO getGroupForVm(long vmId);
List<VlanVO> searchForZoneWideVlans(long dcId, String vlanType,String vlanId);
List<VlanVO> searchForZoneWideVlans(long dcId, String vlanType, String vlanId);
/*
* Fetches the version of cloud stack
/*
* Fetches the version of cloud stack
*/
@Override
String getVersion();
GuestOSVO getGuestOs(Long guestOsId);
VolumeVO getRootVolume(Long instanceId);
long getPsMaintenanceCount(long podId);
boolean isPoolUp(long instanceId);
boolean checkIfMaintenable(long hostId);
String getHashKey();
}

File diff suppressed because it is too large Load Diff

View File

@ -1215,7 +1215,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
@Override
@DB
public boolean deletePool(DeletePoolCmd command) throws InvalidParameterValueException {
public boolean deletePool(DeletePoolCmd command) {
Long id = command.getId();
boolean deleteFlag = false;
@ -2375,7 +2375,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
return true;
}
private boolean validateVolumeSizeRange(long size) throws InvalidParameterValueException {
private boolean validateVolumeSizeRange(long size) {
if (size < 0 || (size > 0 && size < 1)) {
throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
} else if (size > _maxVolumeSizeInGb) {

View File

@ -21,7 +21,6 @@ package com.cloud.storage.download;
import java.util.List;
import java.util.Map;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.host.HostVO;
import com.cloud.storage.VMTemplateVO;
@ -42,7 +41,7 @@ public interface DownloadMonitor extends Manager{
public void handleTemplateSync(long id, Map<String, TemplateInfo> templateInfo);
public void copyTemplate(VMTemplateVO template, HostVO sourceServer, HostVO destServer)
throws InvalidParameterValueException, StorageUnavailableException;
throws StorageUnavailableException;
/*When new host added, take a look at if there are templates needed to be downloaded for the same hypervisor as the host*/
void handleSysTemplateDownload(HostVO hostId);

View File

@ -176,7 +176,7 @@ public class DownloadMonitorImpl implements DownloadMonitor {
}
@Override
public void copyTemplate(VMTemplateVO template, HostVO sourceServer, HostVO destServer) throws InvalidParameterValueException, StorageUnavailableException{
public void copyTemplate(VMTemplateVO template, HostVO sourceServer, HostVO destServer) throws StorageUnavailableException{
boolean downloadJobExists = false;
VMTemplateHostVO destTmpltHost = null;

View File

@ -324,7 +324,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
Account owner = _accountMgr.getAccount(v.getAccountId());
SnapshotVO snapshot = null;
boolean backedUp = false;
//does the caller have the authority to act on this volume
// does the caller have the authority to act on this volume
checkAccountPermissions(v.getAccountId(), v.getDomainId(), "volume", volumeId);
try {
if (v != null && _volsDao.getHypervisorType(v.getId()).equals(HypervisorType.KVM)) {
@ -361,7 +361,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
if (userVm != null) {
if (userVm.getState().equals(State.Destroyed) || userVm.getState().equals(State.Expunging)) {
_snapshotDao.expunge(snapshotId);
throw new CloudRuntimeException("Creating snapshot failed due to volume:" + volumeId + " is associated with vm:" + userVm.getInstanceName() + " is in " + userVm.getState().toString() + " state");
throw new CloudRuntimeException("Creating snapshot failed due to volume:" + volumeId + " is associated with vm:" + userVm.getInstanceName() + " is in "
+ userVm.getState().toString() + " state");
}
}
}
@ -382,7 +383,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
if (snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) {
backedUp = backupSnapshotToSecondaryStorage(snapshot);
} else if (snapshot.getStatus() == Snapshot.Status.BackedUp) {
//For empty snapshot we set status to BackedUp in createSnapshotOnPrimary
// For empty snapshot we set status to BackedUp in createSnapshotOnPrimary
backedUp = true;
}
if (!backedUp) {
@ -397,7 +398,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
postCreateSnapshot(volumeId, snapshot.getId(), policyId, backedUp);
_volsDao.releaseFromLockTable(volumeId);
if (backedUp) {
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null, v.getSize());
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null,
v.getSize());
_usageEventDao.persist(usageEvent);
}
} else if (snapshot == null || !backedUp) {
@ -487,7 +489,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
long prevSnapshotId = snapshot.getPrevSnapshotId();
if (prevSnapshotId > 0) {
prevSnapshot = _snapshotDao.findByIdIncludingRemoved(prevSnapshotId);
if (prevSnapshot.getVersion() != null && prevSnapshot.getVersion().equals("2.2") ) {
if (prevSnapshot.getVersion() != null && prevSnapshot.getVersion().equals("2.2")) {
prevBackupUuid = prevSnapshot.getBackupSnapshotId();
if (prevBackupUuid != null) {
prevSnapshotUuid = prevSnapshot.getPath();
@ -497,8 +499,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
boolean isVolumeInactive = _storageMgr.volumeInactive(volume);
String vmName = _storageMgr.getVmNameOnVolume(volume);
BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(primaryStoragePoolNameLabel, secondaryStoragePoolUrl, dcId, accountId, volumeId, volume.getPath(), snapshotUuid, snapshot.getName(), prevSnapshotUuid, prevBackupUuid,
isVolumeInactive, vmName);
BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(primaryStoragePoolNameLabel, secondaryStoragePoolUrl, dcId, accountId, volumeId, volume.getPath(), snapshotUuid,
snapshot.getName(), prevSnapshotUuid, prevBackupUuid, isVolumeInactive, vmName);
String backedUpSnapshotUuid = null;
// By default, assume failed.
@ -590,16 +592,15 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
Account account = UserContext.current().getCaller();
if (account != null) {
/*if (!isAdmin(account.getType())) {
if (account.getId() != targetAccountId) {
throw new InvalidParameterValueException("Unable to find a " + targetDesc + " with id " + targetId + " for this account");
}
} else if (!_domainDao.isChildDomain(account.getDomainId(), targetDomainId)) {
throw new PermissionDeniedException("Unable to perform operation for " + targetDesc + " with id " + targetId + ", permission denied.");
}
accountId = account.getId();*/
_accountMgr.checkAccess(account, _domainDao.findById(targetDomainId));
/*
* if (!isAdmin(account.getType())) { if (account.getId() != targetAccountId) { throw new
* InvalidParameterValueException("Unable to find a " + targetDesc + " with id " + targetId + " for this account");
* } } else if (!_domainDao.isChildDomain(account.getDomainId(), targetDomainId)) { throw new
* PermissionDeniedException("Unable to perform operation for " + targetDesc + " with id " + targetId +
* ", permission denied."); } accountId = account.getId();
*/
_accountMgr.checkAccess(account, _domainDao.findById(targetDomainId));
}
return accountId;
@ -636,7 +637,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
return status;
}
@DB
private boolean deleteSnapshotInternal(Long snapshotId) {
if (s_logger.isDebugEnabled()) {
@ -651,7 +652,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
_snapshotDao.update(snapshot.getId(), snapshot);
}
}
Transaction txn = Transaction.currentTxn();
txn.start();
_snapshotDao.remove(snapshotId);
@ -659,7 +660,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
_usageEventDao.persist(usageEvent);
_accountMgr.decrementResourceCount(snapshot.getAccountId(), ResourceType.snapshot);
txn.commit();
long lastId = snapshotId;
boolean destroy = false;
while (true) {
@ -754,7 +755,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
}
@Override
public List<SnapshotVO> listSnapshots(ListSnapshotsCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public List<SnapshotVO> listSnapshots(ListSnapshotsCmd cmd) {
Long volumeId = cmd.getVolumeId();
Boolean isRecursive = cmd.isRecursive();
@ -937,7 +938,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
}
// Log event after successful deletion
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_DELETE, snapshot.getAccountId(), volume.getDataCenterId(), snapshot.getId(), snapshot.getName(), null, null, volume.getSize());
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_SNAPSHOT_DELETE, snapshot.getAccountId(), volume.getDataCenterId(), snapshot.getId(), snapshot.getName(), null, null,
volume.getSize());
_usageEventDao.persist(usageEvent);
}
}
@ -949,7 +951,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
@Override
@DB
public SnapshotPolicyVO createPolicy(CreateSnapshotPolicyCmd cmd) throws InvalidParameterValueException {
public SnapshotPolicyVO createPolicy(CreateSnapshotPolicyCmd cmd) {
Long volumeId = cmd.getVolumeId();
VolumeVO volume = _volsDao.findById(cmd.getVolumeId());
if (volume == null) {
@ -1014,7 +1016,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
policy = _snapshotPolicyDao.acquireInLockTable(policy.getId());
policy.setSchedule(cmd.getSchedule());
policy.setTimezone(timezoneId);
policy.setInterval((short)intvType.ordinal());
policy.setInterval((short) intvType.ordinal());
policy.setMaxSnaps(cmd.getMaxSnaps());
policy.setActive(true);
_snapshotPolicyDao.update(policy.getId(), policy);
@ -1036,7 +1038,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
}
@Override
public List<SnapshotPolicyVO> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd) throws InvalidParameterValueException {
public List<SnapshotPolicyVO> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd) {
Long volumeId = cmd.getVolumeId();
VolumeVO volume = _volsDao.findById(volumeId);
if (volume == null) {
@ -1093,7 +1095,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
* {@inheritDoc}
*/
@Override
public List<SnapshotScheduleVO> findRecurringSnapshotSchedule(ListRecurringSnapshotScheduleCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public List<SnapshotScheduleVO> findRecurringSnapshotSchedule(ListRecurringSnapshotScheduleCmd cmd) {
Long volumeId = cmd.getVolumeId();
Long policyId = cmd.getSnapshotPolicyId();
Account account = UserContext.current().getCaller();
@ -1196,8 +1198,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
// user
Type snapshotType = getSnapshotType(policyId);
HypervisorType hypervisorType = this._volsDao.getHypervisorType(volumeId);
SnapshotVO snapshotVO = new SnapshotVO(volume.getDataCenterId(), volume.getAccountId(), volume.getDomainId(), volume.getId(), volume.getDiskOfferingId(), null, snapshotName, (short) snapshotType.ordinal(), snapshotType.name(), volume.getSize(),
hypervisorType);
SnapshotVO snapshotVO = new SnapshotVO(volume.getDataCenterId(), volume.getAccountId(), volume.getDomainId(), volume.getId(), volume.getDiskOfferingId(), null, snapshotName,
(short) snapshotType.ordinal(), snapshotType.name(), volume.getSize(), hypervisorType);
SnapshotVO snapshot = _snapshotDao.persist(snapshotVO);
if (snapshot != null) {

View File

@ -21,7 +21,6 @@ import java.net.URI;
import java.util.List;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.storage.Storage.ImageFormat;
@ -33,107 +32,115 @@ import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VMTemplateVO;
/**
* TemplateManager manages the templates stored
* on secondary storage. It is responsible for
* creating private/public templates. It is
* also responsible for downloading.
* TemplateManager manages the templates stored on secondary storage. It is responsible for creating private/public templates.
* It is also responsible for downloading.
*/
public interface TemplateManager {
/**
* Creates a Template
*
* @param zoneId zone to create the template in
* @param displayText user readable name.
* @param isPublic is this a public template?
* @param featured is this template featured?
* @param isExtractable is this template extractable?
* @param format which image format is the template.
* @param fs what is the file system on the template
* @param url url to download the template from.
* @param chksum chksum to compare it to.
* @param requiresHvm does this template require hvm?
* @param bits is the os contained on the template 32 bit?
* @param enablePassword Does the template support password change.
* @param guestOSId OS that is on the template
* @param bootable true if this template will represent a bootable ISO
* @param zoneId
* zone to create the template in
* @param displayText
* user readable name.
* @param isPublic
* is this a public template?
* @param featured
* is this template featured?
* @param isExtractable
* is this template extractable?
* @param format
* which image format is the template.
* @param fs
* what is the file system on the template
* @param url
* url to download the template from.
* @param chksum
* chksum to compare it to.
* @param requiresHvm
* does this template require hvm?
* @param bits
* is the os contained on the template 32 bit?
* @param enablePassword
* Does the template support password change.
* @param guestOSId
* OS that is on the template
* @param bootable
* true if this template will represent a bootable ISO
* @return id of the template created.
*/
Long createInZone(long zoneId, long userId, String displayText, boolean isPublic, boolean featured, boolean isExtractable, ImageFormat format, TemplateType type, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable);
Long createInZone(long zoneId, long userId, String displayText, boolean isPublic, boolean featured, boolean isExtractable, ImageFormat format, TemplateType type, URI url, String chksum,
boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable);
/**
* Prepares a template for vm creation for a certain storage pool.
*
* @param template template to prepare
* @param pool pool to make sure the template is ready in.
* @param template
* template to prepare
* @param pool
* pool to make sure the template is ready in.
* @return VMTemplateStoragePoolVO if preparation is complete; null if not.
*/
VMTemplateStoragePoolVO prepareTemplateForCreate(VMTemplateVO template, StoragePool pool);
boolean resetTemplateDownloadStateOnPool(long templateStoragePoolRefId);
/**
* Copies a template from its current secondary storage server to the secondary storage server in the specified zone.
*
* @param templateId
* @param sourceZoneId
* @param destZoneId
* @return true if success
* @throws InternalErrorException URI uri = new URI(url);
if ( (uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("ftp") )) {
throw new IllegalArgumentException("Unsupported scheme for url: " + url);
}
String host = uri.getHost();
try {
InetAddress hostAddr = InetAddress.getByName(host);
if (hostAddr.isAnyLocalAddress() || hostAddr.isLinkLocalAddress() || hostAddr.isLoopbackAddress() || hostAddr.isMulticastAddress() ) {
throw new IllegalArgumentException("Illegal host specified in url");
}
if (hostAddr instanceof Inet6Address) {
throw new IllegalArgumentException("IPV6 addresses not supported (" + hostAddr.getHostAddress() + ")");
}
} catch (UnknownHostException uhe) {
throw new IllegalArgumentException("Unable to resolve " + host);
}
if (_dcDao.findById(zoneId) == null) {
throw new IllegalArgumentException("Please specify a valid zone.");
}
VMTemplateVO template = findTemplateById(templateId);
VMTemplateHostVO tmpltHostRef = findTemplateHostRef(templateId, zoneId);
if (tmpltHostRef != null && tmpltHostRef.getDownloadState() != com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED){
throw new IllegalArgumentException("The template hasnt been downloaded ");
}
* @throws StorageUnavailableException
* @throws ResourceAllocationException
* @throws InvalidParameterValueException
* @throws InternalErrorException
* URI uri = new URI(url); if ( (uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("ftp") )) {
* throw new IllegalArgumentException("Unsupported scheme for url: " + url); } String host = uri.getHost();
*
* try { InetAddress hostAddr = InetAddress.getByName(host); if (hostAddr.isAnyLocalAddress() ||
* hostAddr.isLinkLocalAddress() || hostAddr.isLoopbackAddress() || hostAddr.isMulticastAddress() ) { throw new
* IllegalArgumentException("Illegal host specified in url"); } if (hostAddr instanceof Inet6Address) { throw
* new IllegalArgumentException("IPV6 addresses not supported (" + hostAddr.getHostAddress() + ")"); } } catch
* (UnknownHostException uhe) { throw new IllegalArgumentException("Unable to resolve " + host); }
*
* if (_dcDao.findById(zoneId) == null) { throw new IllegalArgumentException("Please specify a valid zone."); }
*
* VMTemplateVO template = findTemplateById(templateId);
*
* VMTemplateHostVO tmpltHostRef = findTemplateHostRef(templateId, zoneId); if (tmpltHostRef != null &&
* tmpltHostRef.getDownloadState() != com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED){ throw
* new IllegalArgumentException("The template hasnt been downloaded "); }
* @throws StorageUnavailableException
* @throws ResourceAllocationException
*/
boolean copy(long userId, long templateId, long sourceZoneId, long destZoneId) throws StorageUnavailableException, ResourceAllocationException;
/**
* Deletes a template from secondary storage servers
*
* @param userId
* @param templateId
* @param zoneId - optional. If specified, will only delete the template from the specified zone's secondary storage server.
* @param zoneId
* - optional. If specified, will only delete the template from the specified zone's secondary storage server.
* @return true if success
*/
boolean delete(long userId, long templateId, Long zoneId);
/**
* Lists templates in the specified storage pool that are not being used by any VM.
*
* @param pool
* @return list of VMTemplateStoragePoolVO
*/
List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(StoragePoolVO pool);
/**
* Deletes a template in the specified storage pool.
*
* @param templatePoolVO
*/
void evictTemplateFromStoragePool(VMTemplateStoragePoolVO templatePoolVO);
boolean templateIsDeleteable(VMTemplateHostVO templateHostRef);
}

View File

@ -496,7 +496,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
}
@Override
public List<ResourceLimitVO> searchForLimits(ListResourceLimitsCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public List<ResourceLimitVO> searchForLimits(ListResourceLimitsCmd cmd) {
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
Long accountId = null;
@ -1230,7 +1230,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
@Override
@ActionEvent(eventType = EventTypes.EVENT_USER_UPDATE, eventDescription = "updating User")
public UserAccount updateUser(UpdateUserCmd cmd) throws InvalidParameterValueException {
public UserAccount updateUser(UpdateUserCmd cmd) {
Long id = cmd.getId();
String apiKey = cmd.getApiKey();
String firstName = cmd.getFirstname();
@ -1316,7 +1316,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
@Override
@ActionEvent(eventType = EventTypes.EVENT_USER_DISABLE, eventDescription = "disabling User", async = true)
public UserAccount disableUser(DisableUserCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public UserAccount disableUser(DisableUserCmd cmd) {
Long userId = cmd.getId();
Account adminAccount = UserContext.current().getCaller();
@ -1347,7 +1347,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
@Override
@ActionEvent(eventType = EventTypes.EVENT_USER_ENABLE, eventDescription = "enabling User")
public UserAccount enableUser(EnableUserCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public UserAccount enableUser(EnableUserCmd cmd) {
Long userId = cmd.getId();
Account adminAccount = UserContext.current().getCaller();
boolean success = false;
@ -1469,7 +1469,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
}
@Override
public AccountVO enableAccount(EnableAccountCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public AccountVO enableAccount(EnableAccountCmd cmd) {
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
boolean success = false;
@ -1530,7 +1530,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
@Override
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_DISABLE, eventDescription = "disabling account", async = true)
public AccountVO disableAccount(DisableAccountCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException {
public AccountVO disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException {
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
@ -1551,7 +1551,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
}
@Override
public AccountVO updateAccount(UpdateAccountCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
public AccountVO updateAccount(UpdateAccountCmd cmd) {
Long domainId = cmd.getDomainId();
String accountName = cmd.getAccountName();
String newAccountName = cmd.getNewName();

File diff suppressed because it is too large Load Diff