Updated Branches: refs/heads/javelin 3423c5d74 -> 4b9990408
Changes in the API Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/4b999040 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4b999040 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4b999040 Branch: refs/heads/javelin Commit: 4b9990408dfb2af442276598a7cb798ad2544a84 Parents: 50f175e Author: Alex Huang <[email protected]> Authored: Thu Nov 1 13:39:34 2012 -0700 Committer: Alex Huang <[email protected]> Committed: Thu Nov 1 13:40:17 2012 -0700 ---------------------------------------------------------------------- .../src/org/apache/cloudstack/platform/Rules.java | 2 + .../platform/cloud/entity/api/BackupEntity.java | 4 +- .../platform/cloud/entity/api/NetworkEntity.java | 18 +++- .../platform/cloud/entity/api/NicEntity.java | 4 +- .../platform/cloud/entity/api/SnapshotEntity.java | 4 +- .../platform/cloud/entity/api/TemplateEntity.java | 4 +- .../cloud/entity/api/VirtualMachineEntity.java | 52 +++++++-- .../platform/cloud/entity/api/VolumeEntity.java | 4 +- .../platform/entity/api/CloudEntity.java | 90 --------------- .../platform/service/api/DirectoryService.java | 5 + .../platform/service/api/ManagementService.java | 64 ---------- .../platform/service/api/OperationsServices.java | 20 +++ .../platform/service/api/OrchestrationService.java | 32 ++---- 13 files changed, 101 insertions(+), 202 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/Rules.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/Rules.java b/platform/api/src/org/apache/cloudstack/platform/Rules.java index 8cb0ff1..61e0c3c 100755 --- a/platform/api/src/org/apache/cloudstack/platform/Rules.java +++ b/platform/api/src/org/apache/cloudstack/platform/Rules.java @@ -38,6 +38,7 @@ import com.cloud.utils.StringUtils; public class Rules { public static List<String> whenUsing() { List<String> rules = new ArrayList<String>(); + rules.add("Always be prepared to handle RuntimeExceptions."); return rules; } @@ -45,6 +46,7 @@ public class Rules { List<String> rules = new ArrayList<String>(); rules.add("You may think you're the greatest developer in the " + "world but every change to the API must be reviewed and approved. "); + rules.add("Every API must have unit tests written against it. And not it's unit tests"); rules.add(""); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java index 8a5edba..9bf39a8 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java @@ -18,12 +18,12 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; /** * @author ahuang * */ -public interface BackupEntity extends CloudEntity { +public interface BackupEntity extends CloudStackEntity { } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java index 6a91cc1..12d32a2 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java @@ -18,10 +18,22 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import java.util.List; + +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; import com.cloud.network.Network; -public interface NetworkEntity extends CloudEntity, Network { - void connectTo(NetworkEntity network); +public interface NetworkEntity extends CloudStackEntity, Network { + void routeTo(NetworkEntity network); + + List<EdgeService> listEdgeServicesTo(); + + List<String> listVirtualMachineUuids(); + + List<VirtualMachineEntity> listVirtualMachines(); + + List<NicEntity> listNics(); + + void addIpRange(); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java index b710db9..4da66cc 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java @@ -18,12 +18,12 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; /** * @author ahuang * */ -public interface NicEntity extends CloudEntity { +public interface NicEntity extends CloudStackEntity { } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java index bb80f91..efe9b1c 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java @@ -18,11 +18,11 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; import com.cloud.storage.Snapshot; -public interface SnapshotEntity extends CloudEntity, Snapshot { +public interface SnapshotEntity extends CloudStackEntity, Snapshot { /** * Make a reservation for backing up this snapshot * @param expiration time in seconds to expire the reservation http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java index 873f125..75623cc 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java @@ -18,10 +18,10 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; import com.cloud.template.VirtualMachineTemplate; -public interface TemplateEntity extends CloudEntity, VirtualMachineTemplate { +public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate { } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java index 7ed3db5..0e1d3d9 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java @@ -20,7 +20,7 @@ package org.apache.cloudstack.platform.cloud.entity.api; import java.util.List; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeploymentPlanner.ExcludeList; @@ -31,36 +31,64 @@ import com.cloud.vm.VirtualMachine; * Platform. * */ -public interface VirtualMachineEntity extends VirtualMachine, CloudEntity { +public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity { + /** + * @return List of uuids for volumes attached to this virtual machine. + */ + List<String> listVolumeUuids(); + + /** + * @return List of volumes attached to this virtual machine. + */ + List<VolumeEntity> listVolumes(); - List<VolumeEntity> getVolumes(); + /** + * @return List of uuids for nics attached to this virtual machine. + */ + List<String> listNicUuids(); - List<NicEntity> getNics(); + /** + * @return List of nics attached to this virtual machine. + */ + List<NicEntity> listNics(); + /** + * @return the template this virtual machine is based off. + */ TemplateEntity getTemplate(); /** * @return the list of tags associated with the virtual machine */ - List<String> getTags(); + List<String> listTags(); + + void addTag(); + + void delTag(); /** * Start the virtual machine with a given deploy destination + * @param plannerToUse the Deployment Planner that should be used * @param dest destination to which to deploy the machine * @param exclude list of areas to exclude - * @param plannerToUse the Deployment Planner that should be used + * @return a reservation id */ - void startIn(DeployDestination dest, ExcludeList exclude, String plannerToUse); + String reserve(String plannerToUse, DeployDestination dest, ExcludeList exclude); /** * Migrate this VM to a certain destination. * - * @param dest - * @param exclude - * @param plannerToUse + * @param reservationId reservation id from reserve call. + */ + void migrateTo(String reservationId); + + /** + * Deploy this virtual machine according to the reservation from before. + * @param reservationId reservation id from reserve call. + * */ - void migrateTo(DeployDestination dest, ExcludeList exclude); + void deploy(String reservationId); /** * Stop the virtual machine @@ -90,7 +118,7 @@ public interface VirtualMachineEntity extends VirtualMachine, CloudEntity { /** * Take a VM snapshot */ - void takeSnapshotOf(); + SnapshotEntity takeSnapshotOf(); /** * Attach volume to this VM http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java index 99e4c82..d7e5f38 100755 --- a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java +++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java @@ -18,11 +18,11 @@ */ package org.apache.cloudstack.platform.cloud.entity.api; -import org.apache.cloudstack.platform.entity.api.CloudEntity; +import org.apache.cloudstack.platform.entity.api.CloudStackEntity; import com.cloud.storage.Volume; -public interface VolumeEntity extends CloudEntity, Volume { +public interface VolumeEntity extends CloudStackEntity, Volume { /** * Take a snapshot of the volume http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudEntity.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudEntity.java b/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudEntity.java deleted file mode 100755 index 27ff543..0000000 --- a/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudEntity.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.platform.entity.api; - -import java.lang.reflect.Method; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * All entities returned by the Cloud Orchestration Platform must implement - * this interface. CloudValueEntity is an immutable representation of - * an entity exposed by Cloud Orchestration Platform. For each object, it - * defines two ids: uuid, generated by CloudStack Orchestration Platform, and - * an external id that is set by the caller when the entity is created. All - * ids must be unique for that entity. CloudValueEntity also can be converted - * to a CloudActionableEntity which contains actions the object can perform. - */ -public interface CloudEntity { - /** - * @return the uuid of the object. - */ - String getUuid(); - - /** - * @return the id which is often the database id. - */ - long getId(); - - /** - * @return external id set by the caller - */ - String getExternalId(); - - /** - * @return current state for the entity - */ - String getCurrentState(); - - /** - * @return desired state for the entity - */ - String getDesiredState(); - - /** - * Get the time the entity was created - */ - Date getCreatedTime(); - - /** - * Get the time the entity was last updated - */ - Date getLastUpdatedTime(); - - /** - * @return reference to the owner of this entity - */ - String getOwner(); - - /** - * @return details stored for this entity when created. - */ - Map<String, String> getDetails(String source); - - /** - * @return a list of sources that have added to the details. - */ - List<String> getDetailSources(); - - /** - * @return list of actions that can be performed on the object in its current state - */ - List<Method> getApplicableActions(); -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java index b724a86..e789613 100755 --- a/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java @@ -21,9 +21,14 @@ package org.apache.cloudstack.platform.service.api; import java.net.URI; import java.util.List; +import com.cloud.utils.component.PluggableService; + public interface DirectoryService { void registerService(String serviceName, URI endpoint); void unregisterService(String serviceName, URI endpoint); List<URI> getEndPoints(String serviceName); URI getLoadBalancedEndPoint(String serviceName); + + List<PluggableService> listServices(); + } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java deleted file mode 100755 index 128aed0..0000000 --- a/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.platform.service.api; - -import java.util.List; -import java.util.Map; - -import com.cloud.dc.DataCenter; -import com.cloud.dc.Pod; -import com.cloud.host.Host; -import com.cloud.host.Status; -import com.cloud.storage.StoragePool; - - -/** - * ManagementService specifies the management aspects of the - * Orchestration Platform. - */ -public interface ManagementService { - - /** - * Registers a storage to use - * @param uuid - * @return - */ - String registerStorage(String name, List<String> tags, Map<String, String> details); - String registerZone(String name, List<String> tags, Map<String, String> details); - String registerPod(String name, List<String> tags, Map<String, String> details); - String registerCluster(String name, List<String> tags, Map<String, String> details); - String registerHost(String name, List<String> tags, Map<String, String> details); - - void deregisterStorage(String uuid); - void deregisterZone(); - void deregisterPod(); - void deregisterCluster(); - void deregisterHost(); - - void changeState(String type, String entity, Status state); - - List<Host> listHosts(); - - List<Pod> listPods(); - - List<DataCenter> listZones(); - - List<StoragePool> listStorage(); - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java b/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java index 9c747f6..5cf7bc6 100755 --- a/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java @@ -18,8 +18,10 @@ */ package org.apache.cloudstack.platform.service.api; +import java.net.URL; import java.util.List; +import com.cloud.alert.Alert; import com.cloud.async.AsyncJob; public interface OperationsServices { @@ -34,4 +36,22 @@ public interface OperationsServices { List<AsyncJob> listJobsInWaiting(); void cancelJob(String job); + + List<Alert> listAlerts(); + + Alert getAlert(String uuid); + + void cancelAlert(String alert); + + void registerForAlerts(); + + String registerForEventNotifications(String type, String topic, URL url); + + boolean deregisterForEventNotifications(String notificationId); + + /** + * @return the list of event topics someone can register for + */ + List<String> listEventTopics(); + } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4b999040/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java ---------------------------------------------------------------------- diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java index aa0a9f7..87c2fe0 100755 --- a/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java @@ -22,10 +22,11 @@ import java.net.URL; import java.util.List; import java.util.Map; +import org.apache.cloudstack.platform.cloud.entity.api.NetworkEntity; +import org.apache.cloudstack.platform.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity; import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity; -import com.cloud.exception.InsufficientCapacityException; import com.cloud.hypervisor.Hypervisor; public interface OrchestrationService { @@ -44,7 +45,7 @@ public interface OrchestrationService { * @param details extra details to store for the VM * @return VirtualMachine */ - VirtualMachineEntity create(String name, + VirtualMachineEntity createVirtualMachine(String name, String template, String hostName, int cpu, @@ -56,7 +57,7 @@ public interface OrchestrationService { Map<String, String> details, String owner); - VirtualMachineEntity createFromScratch(String uuid, + VirtualMachineEntity createVirtualMachineFromScratch(String uuid, String iso, String os, String hypervisor, @@ -69,30 +70,15 @@ public interface OrchestrationService { Map<String, String> details, String owner); - /** - * Make reservations for a VM - * @param vm uuid of the VM - * @param planner DeploymentPlanner to use - * @param until time specified in seconds before reservation expires. null means to reserve forever. - * @return reservation id - */ - String reserve(String vm, String planner, Long until) throws InsufficientCapacityException; + NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway); - /** - * Deploy the reservation - * @param reservationId reservation id during the deployment - * @return job Id - * @throws CloudRuntimeException if error - */ - String deploy(String reservationId); + void destroyNetwork(String networkUuid); - void joinNetwork(String network1, String network2); + VolumeEntity createVolume(); - void createNetwork(); + void destroyVolume(String volumeEntity); - void destroyNetwork(); + TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor); - VolumeEntity createVolume(); - void registerTemplate(String name, URL path, String os, Hypervisor hypervisor); }
