mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Moved from platform to engine
This commit is contained in:
parent
cf6b336739
commit
37197d6360
85
engine/api/src/org/apache/cloudstack/engine/Rules.java
Executable file
85
engine/api/src/org/apache/cloudstack/engine/Rules.java
Executable file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.engine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* Rules specifies all rules about developing and using CloudStack Orchestration
|
||||
* Platforms APIs. This class is not actually used in CloudStack Orchestration
|
||||
* Platform but must be read by all who wants to use and develop against
|
||||
* CloudStack Orchestration Platform.
|
||||
*
|
||||
* Make sure to make changes here when there are changes to how the APIs should
|
||||
* be used and developed.
|
||||
*
|
||||
* Changes to this class must be approved by the maintainer of this project.
|
||||
*
|
||||
*/
|
||||
public class Rules {
|
||||
public static List<String> whenUsing() {
|
||||
List<String> rules = new ArrayList<String>();
|
||||
rules.add("Always be prepared to handle RuntimeExceptions.");
|
||||
return rules;
|
||||
}
|
||||
|
||||
public static List<String> whenWritingNewApis() {
|
||||
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("");
|
||||
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
private static void printRule(String rule) {
|
||||
System.out.print("API Rule: ");
|
||||
String skip = "";
|
||||
int brk = 0;
|
||||
while (true) {
|
||||
int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' ');
|
||||
if (stop < 0) {
|
||||
break;
|
||||
}
|
||||
System.out.print(skip);
|
||||
skip = " ";
|
||||
System.out.println(rule.substring(brk, stop).trim());
|
||||
brk = stop;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:");
|
||||
for (String rule : whenUsing()) {
|
||||
printRule(rule);
|
||||
}
|
||||
System.out.println("");
|
||||
System.out.println("When writing APIs, you must follow these rules:");
|
||||
for (String rule : whenWritingNewApis()) {
|
||||
printRule(rule);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
/**
|
||||
* @author ahuang
|
||||
*
|
||||
*/
|
||||
public interface BackupEntity extends CloudStackEntity {
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
public interface EdgeService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.network.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();
|
||||
}
|
||||
29
engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NicEntity.java
Executable file
29
engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NicEntity.java
Executable file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
/**
|
||||
* @author ahuang
|
||||
*
|
||||
*/
|
||||
public interface NicEntity extends CloudStackEntity {
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
||||
public interface SnapshotEntity extends CloudStackEntity, Snapshot {
|
||||
/**
|
||||
* Make a reservation for backing up this snapshot
|
||||
* @param expiration time in seconds to expire the reservation
|
||||
* @return reservation token
|
||||
*/
|
||||
String reserveForBackup(int expiration);
|
||||
|
||||
/**
|
||||
* Perform the backup according to the reservation token
|
||||
* @param reservationToken token returned by reserveForBackup
|
||||
*/
|
||||
void backup(String reservationToken);
|
||||
|
||||
/**
|
||||
* restore this snapshot to this vm.
|
||||
* @param vm
|
||||
*/
|
||||
void restore(String vm);
|
||||
|
||||
/**
|
||||
* Destroy this snapshot.
|
||||
*/
|
||||
void destroy();
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate {
|
||||
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
* VirtualMachineEntity represents a Virtual Machine in Cloud Orchestration
|
||||
* Platform.
|
||||
*
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* @return List of uuids for nics attached to this virtual machine.
|
||||
*/
|
||||
List<String> listNicUuids();
|
||||
|
||||
/**
|
||||
* @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> 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
|
||||
* @return a reservation id
|
||||
*/
|
||||
String reserve(String plannerToUse, DeployDestination dest, ExcludeList exclude);
|
||||
|
||||
/**
|
||||
* Migrate this VM to a certain destination.
|
||||
*
|
||||
* @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 deploy(String reservationId);
|
||||
|
||||
/**
|
||||
* Stop the virtual machine
|
||||
*
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Cleans up after any botched starts. CloudStack Orchestration Platform
|
||||
* will attempt a best effort to actually shutdown any resource but
|
||||
* even if it cannot, it releases the resource from its database.
|
||||
*/
|
||||
void cleanup();
|
||||
|
||||
/**
|
||||
* Destroys the VM.
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* Duplicate this VM in the database so that it will start new
|
||||
* @param externalId
|
||||
* @return a new VirtualMachineEntity
|
||||
*/
|
||||
VirtualMachineEntity duplicate(String externalId);
|
||||
|
||||
/**
|
||||
* Take a VM snapshot
|
||||
*/
|
||||
SnapshotEntity takeSnapshotOf();
|
||||
|
||||
/**
|
||||
* Attach volume to this VM
|
||||
* @param volume volume to attach
|
||||
* @param deviceId deviceId to use
|
||||
*/
|
||||
void attach(VolumeEntity volume, short deviceId);
|
||||
|
||||
/**
|
||||
* Detach the volume from this VM
|
||||
* @param volume volume to detach
|
||||
*/
|
||||
void detach(VolumeEntity volume);
|
||||
|
||||
/**
|
||||
* Connect the VM to a network
|
||||
* @param network network to attach
|
||||
* @param deviceId device id to use when a nic is created
|
||||
*/
|
||||
void connectTo(NetworkEntity network, short nicId);
|
||||
|
||||
/**
|
||||
* Disconnect the VM from this network
|
||||
* @param netowrk network to disconnect from
|
||||
*/
|
||||
void disconnectFrom(NetworkEntity netowrk, short nicId);
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.engine.cloud.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
public interface VolumeEntity extends CloudStackEntity, Volume {
|
||||
|
||||
/**
|
||||
* Take a snapshot of the volume
|
||||
*/
|
||||
SnapshotEntity takeSnapshotOf(boolean full);
|
||||
|
||||
/**
|
||||
* Make a reservation to do storage migration
|
||||
*
|
||||
* @param expirationTime time in seconds the reservation is cancelled
|
||||
* @return reservation token
|
||||
*/
|
||||
String reserveForMigration(long expirationTime);
|
||||
|
||||
/**
|
||||
* Migrate using a reservation.
|
||||
* @param reservationToken reservation token
|
||||
*/
|
||||
void migrate(String reservationToken);
|
||||
|
||||
/**
|
||||
* Setup for a copy of this volume.
|
||||
* @return destination to copy to
|
||||
*/
|
||||
VolumeEntity setupForCopy();
|
||||
|
||||
/**
|
||||
* Perform the copy
|
||||
* @param dest copy to this volume
|
||||
*/
|
||||
void copy(VolumeEntity dest);
|
||||
|
||||
/**
|
||||
* Attach to the vm
|
||||
* @param vm vm to attach to
|
||||
* @param deviceId device id to use
|
||||
*/
|
||||
void attachTo(String vm, long deviceId);
|
||||
|
||||
/**
|
||||
* Detach from the vm
|
||||
*/
|
||||
void detachFrom();
|
||||
|
||||
/**
|
||||
* Destroy the volume
|
||||
*/
|
||||
void destroy();
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
import com.cloud.org.Cluster;
|
||||
|
||||
public interface ClusterEntity extends DataCenterResourceEntity, Cluster, OrganizationScope {
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.fsm.StateObject;
|
||||
|
||||
/**
|
||||
* This interface specifies the states and operations all physical
|
||||
* and virtual resources in the data center must implement.
|
||||
*/
|
||||
public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
|
||||
|
||||
/**
|
||||
* This is the state machine for how CloudStack should interact with
|
||||
*
|
||||
*/
|
||||
public enum State {
|
||||
Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."),
|
||||
Enabled("The resource is now enabled for CloudStack to use."),
|
||||
Deactivated("The resource is disactivated so CloudStack should not use it for new resource needs.");
|
||||
|
||||
String _description;
|
||||
|
||||
private State(String description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
public enum Event {
|
||||
EnableRequest,
|
||||
DisableRequest,
|
||||
DeactivateRequest,
|
||||
ActivatedRequest
|
||||
}
|
||||
|
||||
protected static final StateMachine2<State, Event, DataCenterResourceEntity> s_fsm = new StateMachine2<State, Event, DataCenterResourceEntity>();
|
||||
static {
|
||||
s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled);
|
||||
s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled);
|
||||
s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated);
|
||||
s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Prepare the resource to take new on new demands.
|
||||
*/
|
||||
boolean enable();
|
||||
|
||||
/**
|
||||
* Disables the resource. Cleanup. Prepare for the resource to be removed.
|
||||
*/
|
||||
boolean disable();
|
||||
|
||||
/**
|
||||
* Do not use the resource for new demands.
|
||||
*/
|
||||
boolean deactivate();
|
||||
|
||||
/**
|
||||
* Reactivates a deactivated resource.
|
||||
*/
|
||||
boolean reactivate();
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
public interface OrganizationScope {
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.org.Cluster;
|
||||
|
||||
public interface PodEntity extends DataCenterResourceEntity, Pod {
|
||||
|
||||
List<Cluster> listClusters();
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
public interface StorageEntity extends DataCenterResourceEntity, StoragePool {
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.engine.datacenter.entity.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
|
||||
/**
|
||||
* Describes a zone and operations that can be done in a zone.
|
||||
*/
|
||||
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
|
||||
List<PodEntity> listPods();
|
||||
}
|
||||
96
engine/api/src/org/apache/cloudstack/engine/entity/api/CloudStackEntity.java
Executable file
96
engine/api/src/org/apache/cloudstack/engine/entity/api/CloudStackEntity.java
Executable file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.engine.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 CloudStackEntity {
|
||||
/**
|
||||
* @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();
|
||||
|
||||
void addDetail(String source, String name, String value);
|
||||
|
||||
void delDetail(String source, String name, String value);
|
||||
|
||||
void updateDetail(String source, String name, String value);
|
||||
|
||||
/**
|
||||
* @return list of actions that can be performed on the object in its current state
|
||||
*/
|
||||
List<Method> getApplicableActions();
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.engine.exception;
|
||||
|
||||
public class InsufficientCapacityException {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.engine.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();
|
||||
|
||||
}
|
||||
45
engine/api/src/org/apache/cloudstack/engine/service/api/EntityService.java
Executable file
45
engine/api/src/org/apache/cloudstack/engine/service/api/EntityService.java
Executable file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.engine.service.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
/**
|
||||
* Service to retrieve CloudStack entities
|
||||
* very likely to change
|
||||
*/
|
||||
public interface EntityService {
|
||||
List<String> listVirtualMachines();
|
||||
List<String> listVolumes();
|
||||
List<String> listNetworks();
|
||||
List<String> listNics();
|
||||
List<String> listSnapshots();
|
||||
List<String> listTemplates();
|
||||
List<String> listStoragePools();
|
||||
List<String> listHosts();
|
||||
|
||||
VirtualMachine getVirtualMachine(String vm);
|
||||
Volume getVolume(String volume);
|
||||
Network getNetwork(String network);
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.engine.service.api;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.alert.Alert;
|
||||
import com.cloud.async.AsyncJob;
|
||||
|
||||
public interface OperationsServices {
|
||||
List<AsyncJob> listJobs();
|
||||
|
||||
List<AsyncJob> listJobsInProgress();
|
||||
|
||||
List<AsyncJob> listJobsCompleted();
|
||||
|
||||
List<AsyncJob> listJobsCompleted(Long from);
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.engine.service.api;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
|
||||
public interface OrchestrationService {
|
||||
/**
|
||||
* creates a new virtual machine
|
||||
*
|
||||
* @param uuid externally unique name to reference the virtual machine
|
||||
* @param template reference to the template
|
||||
* @param hostName name of the host
|
||||
* @param cpu # of cpu cores
|
||||
* @param speed speed of the cpu core
|
||||
* @param memory memory to allocate in bytes
|
||||
* @param networks networks that this VM belongs in
|
||||
* @param rootDiskTags tags for the root disk
|
||||
* @param computeTags tags for the compute
|
||||
* @param details extra details to store for the VM
|
||||
* @return VirtualMachine
|
||||
*/
|
||||
VirtualMachineEntity createVirtualMachine(String name,
|
||||
String template,
|
||||
String hostName,
|
||||
int cpu,
|
||||
int speed,
|
||||
long memory,
|
||||
List<String> networks,
|
||||
List<String> rootDiskTags,
|
||||
List<String> computeTags,
|
||||
Map<String, String> details,
|
||||
String owner);
|
||||
|
||||
VirtualMachineEntity createVirtualMachineFromScratch(String uuid,
|
||||
String iso,
|
||||
String os,
|
||||
String hypervisor,
|
||||
String hostName,
|
||||
int cpu,
|
||||
int speed,
|
||||
long memory,
|
||||
List<String> networks,
|
||||
List<String> computeTags,
|
||||
Map<String, String> details,
|
||||
String owner);
|
||||
|
||||
NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway);
|
||||
|
||||
void destroyNetwork(String networkUuid);
|
||||
|
||||
VolumeEntity createVolume();
|
||||
|
||||
void destroyVolume(String volumeEntity);
|
||||
|
||||
TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.engine.service.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* ProvisioningService registers and deregisters physical and virtual
|
||||
* resources that the management server can use.
|
||||
*/
|
||||
public interface ProvisioningService {
|
||||
|
||||
String registerStorage(String name, List<String> tags, Map<String, String> details);
|
||||
ZoneEntity 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();
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.hypervisor;
|
||||
|
||||
|
||||
public interface ComputeSubsystem {
|
||||
|
||||
void start(String vm, String reservationId);
|
||||
|
||||
void cancel(String reservationId);
|
||||
|
||||
void stop(String vm, String reservationId);
|
||||
|
||||
void migrate(String vm, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.network;
|
||||
|
||||
public interface NetworkServiceProvider {
|
||||
/**
|
||||
* Plug your network elements into this network
|
||||
* @param network
|
||||
* @param reservationId
|
||||
*/
|
||||
void plugInto(String network, String reservationId);
|
||||
|
||||
/**
|
||||
* Unplug your network elements from this network
|
||||
* @param network
|
||||
* @param reservationId
|
||||
*/
|
||||
void unplugFrom(String network, String reservationId);
|
||||
|
||||
/**
|
||||
* Cancel a previous work
|
||||
* @param reservationId
|
||||
*/
|
||||
void cancel(String reservationId);
|
||||
|
||||
void provideServiceTo(String vm, String network, String reservationId);
|
||||
|
||||
void removeServiceFrom(String vm, String network, String reservationId);
|
||||
|
||||
void cleanUp(String network, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.network;
|
||||
|
||||
public interface NetworkSubsystem {
|
||||
String create();
|
||||
|
||||
String start(String network, String reservationId);
|
||||
|
||||
void shutdown(String nework, String reservationId);
|
||||
|
||||
void prepare(String vm, String network, String reservationId);
|
||||
|
||||
void release(String vm, String network, String reservationId);
|
||||
|
||||
void cancel(String reservationId);
|
||||
|
||||
void destroy(String network, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface BackupStrategy {
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
|
||||
public interface DataMigrationSubSystem {
|
||||
|
||||
Class<? extends Grouping> getScopeCoverage();
|
||||
void migrate(URI source, URI dest, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore.DataStoreRef;
|
||||
|
||||
/*
|
||||
* Logic entity
|
||||
*/
|
||||
public interface DataObject {
|
||||
String getURI();
|
||||
String getUUID();
|
||||
DataStoreRef getStoreRef();
|
||||
long getSize();
|
||||
//volume/snapshot/template
|
||||
String getType();
|
||||
//db id
|
||||
Long getId();
|
||||
DataObject getParent();
|
||||
void setParent(DataObject obj);
|
||||
List<DataObject> getChidren();
|
||||
boolean lock();
|
||||
boolean unlock();
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
import com.cloud.utils.fsm.StateMachine;
|
||||
|
||||
public enum DataObjectBackupStorageOperationState {
|
||||
Copying,
|
||||
Deleting,
|
||||
Ready,
|
||||
NonOperational;
|
||||
|
||||
public enum Event {
|
||||
Initial("Init state machine"),
|
||||
CopyingRequested("Copy operation is requested"),
|
||||
DeleteRequested("Delete operation is requested"),
|
||||
OperationSuccess("Operation successed"),
|
||||
OperationFailed("Operation failed");
|
||||
|
||||
private final String _msg;
|
||||
|
||||
private Event(String msg) {
|
||||
_msg = msg;
|
||||
}
|
||||
}
|
||||
|
||||
public DataObjectBackupStorageOperationState getNextState(Event a) {
|
||||
return s_fsm.getNextState(this, a);
|
||||
}
|
||||
|
||||
protected static final StateMachine<DataObjectBackupStorageOperationState, Event> s_fsm = new StateMachine<DataObjectBackupStorageOperationState, Event>();
|
||||
static {
|
||||
s_fsm.addTransition(null, Event.Initial, DataObjectBackupStorageOperationState.Ready);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationSuccess, DataObjectBackupStorageOperationState.Ready);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.DeleteRequested, DataObjectBackupStorageOperationState.Deleting);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
|
||||
s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationSuccess, DataObjectBackupStorageOperationState.NonOperational);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
public interface DataStore {
|
||||
public class DataStoreRef {
|
||||
|
||||
}
|
||||
|
||||
public class DataStoreDriverRef {
|
||||
|
||||
}
|
||||
|
||||
public enum StoreType {
|
||||
Primary,
|
||||
Image,
|
||||
Backup;
|
||||
}
|
||||
public class StoreScope {
|
||||
public long zoneId;
|
||||
private long clusterId;
|
||||
private long hostId;
|
||||
}
|
||||
|
||||
String getURI();
|
||||
String getUUID();
|
||||
long getCluterId();
|
||||
long getPodId();
|
||||
long getZoneId();
|
||||
String getPath();
|
||||
StoreType getType();
|
||||
StoragePoolType getPoolType();
|
||||
StoreScope getScope();
|
||||
boolean isSharedStorage();
|
||||
Long getId();
|
||||
DataStoreDriver getDataStoreDriver();
|
||||
StorageProvider getProvider();
|
||||
DataStoreEndPointSelector getEndPointSelector();
|
||||
FileSystem getFileSystem();
|
||||
VolumeStrategy getVolumeStrategy();
|
||||
SnapshotStrategy getSnapshotStrategy();
|
||||
BackupStrategy getBackupStrategy();
|
||||
TemplateStrategy getTemplateStrategy();
|
||||
DataStoreLifeCycle getLifeCycle();
|
||||
|
||||
VolumeProfile prepareVolume(Volume volume, DataStore destStore);
|
||||
SnapshotProfile prepareSnapshot(Snapshot snapshot, DataStore destStore);
|
||||
TemplateProfile prepareTemplate(long templateId, DataStore destStore);
|
||||
boolean contains(Volume volume);
|
||||
boolean contains(Snapshot snapshot);
|
||||
boolean contains(TemplateProfile template);
|
||||
TemplateProfile get(TemplateProfile template);
|
||||
StorageFilerTO getTO();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
public interface DataStoreConfigurator {
|
||||
String getProtocol();
|
||||
StoragePool getStoragePool(Map<String, String> configs);
|
||||
List<String> getConfigNames();
|
||||
Map<String, String> getConfigs(URI uri, Map<String, String> extras);
|
||||
boolean validate(Map<String, String> configs);
|
||||
DataStore getDataStore(StoragePool pool);
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public interface DataStoreDriver {
|
||||
String getDriverType();
|
||||
TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep);
|
||||
TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep);
|
||||
DataObject create(DataObject obj);
|
||||
DataObject copy(DataObject src, DataStore dest);
|
||||
DataObject copy(DataObject src, DataObject dest);
|
||||
DataObject move(DataObject src, DataObject dest);
|
||||
VolumeProfile createVolumeFromTemplate(VolumeProfile vol, TemplateProfile tp, DataStoreEndPoint dp);
|
||||
Answer sendMessage(DataStoreEndPoint dsep, Command cmd);
|
||||
boolean delete(DataObject obj);
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
public class DataStoreEndPoint {
|
||||
protected long hostId;
|
||||
protected String privIp;
|
||||
|
||||
public DataStoreEndPoint(long host, String ip) {
|
||||
hostId = host;
|
||||
privIp = ip;
|
||||
}
|
||||
|
||||
public long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public String getPrivateIp() {
|
||||
return privIp;
|
||||
}
|
||||
|
||||
public Answer sendCommand(Command cmd) {
|
||||
return new Answer(cmd);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DataStoreEndPointSelector {
|
||||
List<DataStoreEndPoint> getEndPoints(StorageEvent event);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface DataStoreExtendedAttribute {
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface DataStoreLifeCycle {
|
||||
public enum DataStoreEvent {
|
||||
HOSTUP,
|
||||
HOSTDOWN,
|
||||
}
|
||||
void add();
|
||||
void delete();
|
||||
void enable();
|
||||
void disable();
|
||||
void processEvent(DataStoreEvent event, Object... objs);
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
public interface FileSystem {
|
||||
DataObject create(DataObject obj);
|
||||
DataObject copy(DataObject Obj, DataStore destStore);
|
||||
DataObject copy(DataObject obj, DataObject destObj);
|
||||
DataObject move(DataObject srcObj, DataObject destObj);
|
||||
boolean delete(DataObject obj);
|
||||
long getStats(DataObject obj);
|
||||
String getFileType();
|
||||
boolean isWritable(DataObject obj);
|
||||
boolean contains(DataObject obj);
|
||||
DataObject ioctl(DataObject obj, Object... objects);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
public interface Snapshot extends DataObject {
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
public class SnapshotProfile {
|
||||
private String _uri;
|
||||
public String getURI() {
|
||||
return _uri;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface SnapshotStrategy {
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
public enum StorageEvent {
|
||||
DownloadTemplateToPrimary,
|
||||
RegisterTemplate,
|
||||
CreateVolumeFromTemplate;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore.StoreType;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
public interface StorageProvider extends Adapter {
|
||||
List<HypervisorType> supportedHypervisors();
|
||||
String getProviderName();
|
||||
List<StoreType> supportedStoreTypes();
|
||||
void configure(Map<String, String> storeProviderInfo);
|
||||
DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params);
|
||||
DataStore getDataStore(StoragePool pool);
|
||||
Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs();
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
|
||||
public interface StorageSubSystem {
|
||||
String getType();
|
||||
Class<? extends Grouping> getScope();
|
||||
|
||||
URI grantAccess(String vol, String reservationId);
|
||||
URI RemoveAccess(String vol, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,287 @@
|
||||
// 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.engine.subsystem.api.storage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
public class TemplateProfile {
|
||||
Long userId;
|
||||
String name;
|
||||
String displayText;
|
||||
Integer bits;
|
||||
Boolean passwordEnabled;
|
||||
Boolean sshKeyEnbaled;
|
||||
Boolean requiresHvm;
|
||||
String url;
|
||||
Boolean isPublic;
|
||||
Boolean featured;
|
||||
Boolean isExtractable;
|
||||
ImageFormat format;
|
||||
Long guestOsId;
|
||||
Long zoneId;
|
||||
HypervisorType hypervisorType;
|
||||
String accountName;
|
||||
Long domainId;
|
||||
Long accountId;
|
||||
String chksum;
|
||||
Boolean bootable;
|
||||
Long templateId;
|
||||
VirtualMachineTemplate template;
|
||||
String templateTag;
|
||||
Map details;
|
||||
|
||||
public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm,
|
||||
String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId,
|
||||
HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, Map details, Boolean sshKeyEnabled) {
|
||||
this.templateId = templateId;
|
||||
this.userId = userId;
|
||||
this.name = name;
|
||||
this.displayText = displayText;
|
||||
this.bits = bits;
|
||||
this.passwordEnabled = passwordEnabled;
|
||||
this.requiresHvm = requiresHvm;
|
||||
this.url = url;
|
||||
this.isPublic = isPublic;
|
||||
this.featured = featured;
|
||||
this.isExtractable = isExtractable;
|
||||
this.format = format;
|
||||
this.guestOsId = guestOsId;
|
||||
this.zoneId = zoneId;
|
||||
this.hypervisorType = hypervisorType;
|
||||
this.accountName = accountName;
|
||||
this.domainId = domainId;
|
||||
this.accountId = accountId;
|
||||
this.chksum = chksum;
|
||||
this.bootable = bootable;
|
||||
this.details = details;
|
||||
this.sshKeyEnbaled = sshKeyEnabled;
|
||||
}
|
||||
|
||||
public TemplateProfile(Long userId, VirtualMachineTemplate template, Long zoneId) {
|
||||
this.userId = userId;
|
||||
this.template = template;
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm,
|
||||
String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId,
|
||||
HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, String templateTag, Map details, Boolean sshKeyEnabled) {
|
||||
this(templateId, userId, name, displayText, bits, passwordEnabled, requiresHvm, url, isPublic, featured, isExtractable, format, guestOsId, zoneId,
|
||||
hypervisorType, accountName, domainId, accountId, chksum, bootable, details, sshKeyEnabled);
|
||||
this.templateTag = templateTag;
|
||||
}
|
||||
|
||||
public Long getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
public void setTemplateId(Long id) {
|
||||
this.templateId = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
public void setDisplayText(String text) {
|
||||
this.displayText = text;
|
||||
}
|
||||
|
||||
public Integer getBits() {
|
||||
return bits;
|
||||
}
|
||||
public void setBits(Integer bits) {
|
||||
this.bits = bits;
|
||||
}
|
||||
|
||||
public Boolean getPasswordEnabled() {
|
||||
return passwordEnabled;
|
||||
}
|
||||
public void setPasswordEnabled(Boolean enabled) {
|
||||
this.passwordEnabled = enabled;
|
||||
}
|
||||
|
||||
public Boolean getRequiresHVM() {
|
||||
return requiresHvm;
|
||||
}
|
||||
public void setRequiresHVM(Boolean hvm) {
|
||||
this.requiresHvm = hvm;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
public void setIsPublic(Boolean is) {
|
||||
this.isPublic = is;
|
||||
}
|
||||
|
||||
public Boolean getFeatured() {
|
||||
return featured;
|
||||
}
|
||||
public void setFeatured(Boolean featured) {
|
||||
this.featured = featured;
|
||||
}
|
||||
|
||||
public Boolean getIsExtractable() {
|
||||
return isExtractable;
|
||||
}
|
||||
public void setIsExtractable(Boolean is) {
|
||||
this.isExtractable = is;
|
||||
}
|
||||
|
||||
public ImageFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
public void setFormat(ImageFormat format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public Long getGuestOsId() {
|
||||
return guestOsId;
|
||||
}
|
||||
public void setGuestOsId(Long id) {
|
||||
this.guestOsId = id;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
public void setZoneId(Long id) {
|
||||
this.zoneId = id;
|
||||
}
|
||||
|
||||
public HypervisorType getHypervisorType() {
|
||||
return hypervisorType;
|
||||
}
|
||||
public void setHypervisorType(HypervisorType type) {
|
||||
this.hypervisorType = type;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
public void setDomainId(Long id) {
|
||||
this.domainId = id;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
public void setAccountId(Long id) {
|
||||
this.accountId = id;
|
||||
}
|
||||
|
||||
public String getCheckSum() {
|
||||
return chksum;
|
||||
}
|
||||
public void setCheckSum(String chksum) {
|
||||
this.chksum = chksum;
|
||||
}
|
||||
|
||||
public Boolean getBootable() {
|
||||
return this.bootable;
|
||||
}
|
||||
public void setBootable(Boolean bootable) {
|
||||
this.bootable = bootable;
|
||||
}
|
||||
|
||||
public VirtualMachineTemplate getTemplate() {
|
||||
return template;
|
||||
}
|
||||
public void setTemplate(VirtualMachineTemplate template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public String getTemplateTag() {
|
||||
return templateTag;
|
||||
}
|
||||
|
||||
public void setTemplateTag(String templateTag) {
|
||||
this.templateTag = templateTag;
|
||||
}
|
||||
|
||||
public Map getDetails() {
|
||||
return this.details;
|
||||
}
|
||||
|
||||
public void setDetails(Map details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void setSshKeyEnabled(Boolean enabled) {
|
||||
this.sshKeyEnbaled = enabled;
|
||||
}
|
||||
|
||||
public Boolean getSshKeyEnabled() {
|
||||
return this.sshKeyEnbaled;
|
||||
}
|
||||
|
||||
public String getImageStorageUri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLocalPath(String path) {
|
||||
|
||||
}
|
||||
|
||||
public String getLocalPath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getJobId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setTemplatePoolRefId(long id) {
|
||||
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getTemplatePoolRefId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import com.cloud.agent.api.storage.DownloadCommand.Proxy;
|
||||
|
||||
public interface TemplateStrategy {
|
||||
TemplateProfile install(TemplateProfile tp);
|
||||
TemplateProfile get(long templateId);
|
||||
TemplateProfile register(TemplateProfile tp);
|
||||
boolean canRegister(long templateId);
|
||||
int getDownloadWait();
|
||||
long getMaxTemplateSizeInBytes();
|
||||
Proxy getHttpProxy();
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.engine.subsystem.api.storage;
|
||||
|
||||
public class VolumeProfile {
|
||||
private String _uri;
|
||||
public String getURI() {
|
||||
return _uri;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
public interface VolumeStrategy {
|
||||
Volume createVolume(Volume vol);
|
||||
Volume createDataVolume(Volume vol);
|
||||
Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol);
|
||||
Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol);
|
||||
Volume createVolumeFromTemplate(TemplateProfile template, Volume vol);
|
||||
Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore);
|
||||
Volume createVolumeFromBaseTemplate(Volume destVol, TemplateProfile tp);
|
||||
boolean deleteVolume(Volume vol);
|
||||
VolumeProfile get(long volumeId);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user