mirror of https://github.com/apache/cloudstack.git
merge is complete
This commit is contained in:
commit
7b7db0560c
|
|
@ -82,6 +82,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
private int _pingRetries;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
|
||||
|
||||
public AgentShell() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public class Answer extends Command {
|
|||
protected String details;
|
||||
|
||||
protected Answer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public Answer(Command command) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
package com.cloud.agent.api.storage;
|
||||
// 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
|
||||
31
core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java → api/src/com/cloud/agent/api/storage/PasswordAuth.java
Executable file → Normal file
31
core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java → api/src/com/cloud/agent/api/storage/PasswordAuth.java
Executable file → Normal file
|
|
@ -16,23 +16,24 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
|
||||
public class DeleteVolumeCommand extends ssCommand {
|
||||
private String volumePath;
|
||||
/**
|
||||
* Password authentication
|
||||
*/
|
||||
public class PasswordAuth {
|
||||
|
||||
public DeleteVolumeCommand() {
|
||||
}
|
||||
String userName;
|
||||
String password;
|
||||
public PasswordAuth() {
|
||||
|
||||
public DeleteVolumeCommand(String secUrl, String volumePath) {
|
||||
this.setSecUrl(secUrl);
|
||||
this.volumePath = volumePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
public PasswordAuth(String user, String password) {
|
||||
this.userName = user;
|
||||
this.password = password;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getVolumePath() {
|
||||
return volumePath;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
// 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 com.cloud.agent.api.storage;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* Download Proxy
|
||||
*/
|
||||
public class Proxy {
|
||||
private String _host;
|
||||
private int _port;
|
||||
private String _userName;
|
||||
private String _password;
|
||||
|
||||
public Proxy() {
|
||||
|
||||
}
|
||||
|
||||
public Proxy(String host, int port, String userName, String password) {
|
||||
this._host = host;
|
||||
this._port = port;
|
||||
this._userName = userName;
|
||||
this._password = password;
|
||||
}
|
||||
|
||||
public Proxy(URI uri) {
|
||||
this._host = uri.getHost();
|
||||
this._port = uri.getPort() == -1 ? 3128 : uri.getPort();
|
||||
String userInfo = uri.getUserInfo();
|
||||
if (userInfo != null) {
|
||||
String[] tokens = userInfo.split(":");
|
||||
if (tokens.length == 1) {
|
||||
this._userName = userInfo;
|
||||
this._password = "";
|
||||
} else if (tokens.length == 2) {
|
||||
this._userName = tokens[0];
|
||||
this._password = tokens[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return _host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return _port;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return _userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return _password;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
public enum DataObjectType {
|
||||
VOLUME,
|
||||
|
|
@ -16,9 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
|
||||
|
||||
public interface ImageDataStoreProvider extends DataStoreProvider {
|
||||
|
||||
public interface DataStoreTO {
|
||||
public DataStoreRole getRole();
|
||||
}
|
||||
|
|
@ -16,9 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.image.motion;
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import org.apache.cloudstack.storage.motion.DataMotionStrategy;
|
||||
public interface DataTO {
|
||||
public DataObjectType getObjectType();
|
||||
public DataStoreTO getDataStore();
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getPath();
|
||||
|
||||
public interface ImageMotionStrategy extends DataMotionStrategy {
|
||||
long getId();
|
||||
}
|
||||
|
|
@ -16,23 +16,45 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.cloud.storage.Volume;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchCriteria2;
|
||||
import com.cloud.utils.db.SearchCriteriaService;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
|
||||
@Component
|
||||
class DataStoreProviderDaoImpl extends GenericDaoBase<DataStoreProviderVO, Long> implements DataStoreProviderDao {
|
||||
|
||||
@Override
|
||||
public DataStoreProviderVO findByName(String name) {
|
||||
SearchCriteriaService<DataStoreProviderVO, DataStoreProviderVO> sc = SearchCriteria2.create(DataStoreProviderVO.class);
|
||||
sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
|
||||
return sc.find();
|
||||
public class DiskTO {
|
||||
private DataTO data;
|
||||
private Long diskSeq;
|
||||
private Volume.Type type;
|
||||
public DiskTO() {
|
||||
|
||||
}
|
||||
|
||||
public DiskTO(DataTO data, Long diskSeq, Volume.Type type) {
|
||||
this.data = data;
|
||||
this.diskSeq = diskSeq;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
public DataTO getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataTO data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Long getDiskSeq() {
|
||||
return diskSeq;
|
||||
}
|
||||
|
||||
public void setDiskSeq(Long diskSeq) {
|
||||
this.diskSeq = diskSeq;
|
||||
}
|
||||
|
||||
public Volume.Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Volume.Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,6 +52,9 @@ public class FirewallRuleTO implements InternalIdentity {
|
|||
private Integer icmpType;
|
||||
private Integer icmpCode;
|
||||
private FirewallRule.TrafficType trafficType;
|
||||
private String guestCidr;
|
||||
private boolean defaultEgressPolicy;
|
||||
private FirewallRule.FirewallRuleType type;
|
||||
|
||||
protected FirewallRuleTO() {
|
||||
}
|
||||
|
|
@ -109,9 +112,12 @@ public class FirewallRuleTO implements InternalIdentity {
|
|||
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
|
||||
}
|
||||
|
||||
public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType) {
|
||||
public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType, String guestCidr, boolean defaultEgressPolicy, FirewallRule.FirewallRuleType type) {
|
||||
this(rule.getId(), guestVlanTag, null, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), rule.getSourceCidrList(), rule.getIcmpType(), rule.getIcmpCode());
|
||||
this.trafficType = trafficType;
|
||||
this.defaultEgressPolicy = defaultEgressPolicy;
|
||||
this.guestCidr = guestCidr;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public FirewallRule.TrafficType getTrafficType(){
|
||||
|
|
@ -169,4 +175,15 @@ public class FirewallRuleTO implements InternalIdentity {
|
|||
return purpose;
|
||||
}
|
||||
|
||||
public boolean isDefaultEgressPolicy() {
|
||||
return defaultEgressPolicy;
|
||||
}
|
||||
|
||||
public String getGuestCidr() {
|
||||
return guestCidr;
|
||||
}
|
||||
|
||||
public FirewallRule.FirewallRuleType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,31 +14,47 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.storage.to;
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
|
||||
public final class NfsTO implements DataStoreTO {
|
||||
|
||||
private String _url;
|
||||
private DataStoreRole _role;
|
||||
|
||||
public NfsTO() {
|
||||
|
||||
super();
|
||||
|
||||
public class NfsPrimaryDataStoreTO extends PrimaryDataStoreTO {
|
||||
private String server;
|
||||
private String path;
|
||||
|
||||
public NfsPrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) {
|
||||
super(dataStore);
|
||||
}
|
||||
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
|
||||
public NfsTO(String url, DataStoreRole role) {
|
||||
|
||||
super();
|
||||
|
||||
this._url = url;
|
||||
this._role = role;
|
||||
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return this.server;
|
||||
|
||||
public String getUrl() {
|
||||
return _url;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
|
||||
public void setUrl(String _url) {
|
||||
this._url = _url;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
|
||||
@Override
|
||||
public DataStoreRole getRole() {
|
||||
return _role;
|
||||
}
|
||||
|
||||
public void setRole(DataStoreRole _role) {
|
||||
this._role = _role;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -18,9 +18,10 @@ package com.cloud.agent.api.to;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.utils.S3Utils;
|
||||
|
||||
public final class S3TO implements S3Utils.ClientOptions {
|
||||
public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
|
||||
|
||||
private Long id;
|
||||
private String uuid;
|
||||
|
|
@ -33,6 +34,7 @@ public final class S3TO implements S3Utils.ClientOptions {
|
|||
private Integer maxErrorRetry;
|
||||
private Integer socketTimeout;
|
||||
private Date created;
|
||||
private boolean enableRRS;
|
||||
|
||||
public S3TO() {
|
||||
|
||||
|
|
@ -44,7 +46,7 @@ public final class S3TO implements S3Utils.ClientOptions {
|
|||
final String secretKey, final String endPoint,
|
||||
final String bucketName, final Boolean httpsFlag,
|
||||
final Integer connectionTimeout, final Integer maxErrorRetry,
|
||||
final Integer socketTimeout, final Date created) {
|
||||
final Integer socketTimeout, final Date created, final boolean enableRRS) {
|
||||
|
||||
super();
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ public final class S3TO implements S3Utils.ClientOptions {
|
|||
this.maxErrorRetry = maxErrorRetry;
|
||||
this.socketTimeout = socketTimeout;
|
||||
this.created = created;
|
||||
this.enableRRS = enableRRS;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +131,10 @@ public final class S3TO implements S3Utils.ClientOptions {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (enableRRS != thatS3TO.enableRRS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
@ -249,4 +256,20 @@ public final class S3TO implements S3Utils.ClientOptions {
|
|||
this.created = created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStoreRole getRole() {
|
||||
return DataStoreRole.Image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean getEnableRRS() {
|
||||
return enableRRS;
|
||||
}
|
||||
|
||||
public void setEnableRRS(boolean enableRRS) {
|
||||
this.enableRRS = enableRRS;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
public class SwiftTO {
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
|
||||
public class SwiftTO implements DataStoreTO {
|
||||
Long id;
|
||||
String url;
|
||||
String account;
|
||||
|
|
@ -54,5 +56,11 @@ public class SwiftTO {
|
|||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStoreRole getRole() {
|
||||
return DataStoreRole.Image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class VirtualMachineTO {
|
|||
Map<String, String> params;
|
||||
String uuid;
|
||||
|
||||
VolumeTO[] disks;
|
||||
DiskTO[] disks;
|
||||
NicTO[] nics;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
|
|
@ -215,11 +215,11 @@ public class VirtualMachineTO {
|
|||
this.bootupScripts = bootupScripts;
|
||||
}
|
||||
|
||||
public VolumeTO[] getDisks() {
|
||||
public DiskTO[] getDisks() {
|
||||
return disks;
|
||||
}
|
||||
|
||||
public void setDisks(VolumeTO[] disks) {
|
||||
public void setDisks(DiskTO[] disks) {
|
||||
this.disks = disks;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ public class VolumeTO implements InternalIdentity {
|
|||
private long deviceId;
|
||||
private String chainInfo;
|
||||
private String guestOsType;
|
||||
private Long bytesReadRate;
|
||||
private Long bytesWriteRate;
|
||||
private Long iopsReadRate;
|
||||
private Long iopsWriteRate;
|
||||
|
||||
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) {
|
||||
this.id = id;
|
||||
|
|
@ -133,4 +137,37 @@ public class VolumeTO implements InternalIdentity {
|
|||
public String toString() {
|
||||
return new StringBuilder("Vol[").append(id).append("|").append(type).append("|").append(path).append("|").append(size).append("]").toString();
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,4 +274,6 @@ public interface NetworkModel {
|
|||
Networks.IsolationType[] listNetworkIsolationMethods();
|
||||
|
||||
Nic getNicInNetworkIncludingRemoved(long vmId, long networkId);
|
||||
|
||||
boolean getExecuteInSeqNtwkElmtCmd();
|
||||
}
|
||||
|
|
@ -52,4 +52,20 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
|
|||
boolean isCustomized();
|
||||
|
||||
void setDiskSize(long diskSize);
|
||||
|
||||
void setBytesReadRate(Long bytesReadRate);
|
||||
|
||||
Long getBytesReadRate();
|
||||
|
||||
void setBytesWriteRate(Long bytesWriteRate);
|
||||
|
||||
Long getBytesWriteRate();
|
||||
|
||||
void setIopsReadRate(Long iopsReadRate);
|
||||
|
||||
Long getIopsReadRate();
|
||||
|
||||
void setIopsWriteRate(Long iopsWriteRate);
|
||||
|
||||
Long getIopsWriteRate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,5 +127,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
boolean getInternalLb();
|
||||
|
||||
boolean getPublicLb();
|
||||
boolean getEgressDefaultPolicy();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,15 +124,6 @@ public interface ManagementService {
|
|||
*/
|
||||
Pair<List<? extends Host>, Integer> searchForServers(ListHostsCmd cmd);
|
||||
|
||||
/**
|
||||
* Creates a new template
|
||||
*
|
||||
* @param cmd
|
||||
* @return updated template
|
||||
*/
|
||||
VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd);
|
||||
|
||||
VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd);
|
||||
|
||||
|
||||
|
||||
|
|
@ -223,28 +214,6 @@ public interface ManagementService {
|
|||
*/
|
||||
List<? extends Capacity> listCapacities(ListCapacityCmd cmd);
|
||||
|
||||
/**
|
||||
* List ISOs that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
Set<Pair<Long, Long>> listIsos(ListIsosCmd cmd);
|
||||
|
||||
/**
|
||||
* List templates that match the specified criteria.
|
||||
*
|
||||
* @param cmd
|
||||
* The command that wraps the (optional) templateId, name, keyword, templateFilter, bootable, account,
|
||||
* and zoneId
|
||||
* parameters.
|
||||
* @return list of ISOs
|
||||
*/
|
||||
Set<Pair<Long, Long>> listTemplates(ListTemplatesCmd cmd);
|
||||
|
||||
|
||||
/**
|
||||
* List system VMs by the given search criteria
|
||||
|
|
@ -271,20 +240,6 @@ public interface ManagementService {
|
|||
|
||||
Map<String, Object> listCapabilities(ListCapabilitiesCmd cmd);
|
||||
|
||||
/**
|
||||
* Extracts the volume to a particular location.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume
|
||||
* exists),
|
||||
* id (the id of the volume)
|
||||
* @throws URISyntaxException
|
||||
* @throws InternalErrorException
|
||||
* @throws PermissionDeniedException
|
||||
*
|
||||
*/
|
||||
Long extractVolume(ExtractVolumeCmd cmd) throws URISyntaxException;
|
||||
|
||||
/**
|
||||
* return an array of available hypervisors
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
package com.cloud.storage;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
|
|
@ -14,3 +14,15 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface GuestOSHypervisor extends InternalIdentity {
|
||||
|
||||
String getHypervisorType();
|
||||
|
||||
String getGuestOsName();
|
||||
|
||||
long getGuestOsId();
|
||||
}
|
||||
|
|
@ -14,27 +14,34 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.api.storage;
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface ImageStore extends Identity, InternalIdentity {
|
||||
|
||||
|
||||
public class DeleteTemplateCommand extends ssCommand {
|
||||
private String templatePath;
|
||||
/**
|
||||
* @return name of the object store.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return availability zone.
|
||||
*/
|
||||
Long getDataCenterId();
|
||||
|
||||
|
||||
public DeleteTemplateCommand() {
|
||||
}
|
||||
/**
|
||||
* @return object store provider name
|
||||
*/
|
||||
String getProviderName();
|
||||
|
||||
public DeleteTemplateCommand(String secUrl, String templatePath) {
|
||||
this.setSecUrl(secUrl);
|
||||
this.templatePath = templatePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getTemplatePath() {
|
||||
return templatePath;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return data store protocol
|
||||
*/
|
||||
String getProtocol();
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
package com.cloud.storage;
|
||||
|
||||
public enum ScopeType {
|
||||
HOST,
|
||||
|
|
@ -60,6 +60,9 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
|
|||
CreatedOnPrimary,
|
||||
BackingUp,
|
||||
BackedUp,
|
||||
Copying,
|
||||
Destroying,
|
||||
Destroyed,//it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage
|
||||
Error;
|
||||
|
||||
public String toString() {
|
||||
|
|
@ -76,6 +79,8 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
|
|||
OperationNotPerformed,
|
||||
BackupToSecondary,
|
||||
BackedupToSecondary,
|
||||
DestroyRequested,
|
||||
CopyingRequested,
|
||||
OperationSucceeded,
|
||||
OperationFailed
|
||||
}
|
||||
|
|
@ -86,8 +91,6 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
|
|||
|
||||
long getVolumeId();
|
||||
|
||||
String getPath();
|
||||
|
||||
String getName();
|
||||
|
||||
Date getCreated();
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ import java.util.List;
|
|||
|
||||
public class Storage {
|
||||
public static enum ImageFormat {
|
||||
QCOW2(true, true, false),
|
||||
RAW(false, false, false),
|
||||
VHD(true, true, true),
|
||||
ISO(false, false, false),
|
||||
QCOW2(true, true, false, "qcow2"),
|
||||
RAW(false, false, false, "raw"),
|
||||
VHD(true, true, true, "vhd"),
|
||||
ISO(false, false, false, "iso"),
|
||||
OVA(true, true, true, "ova"),
|
||||
BAREMETAL(false, false, false),
|
||||
TAR(false, false, false);
|
||||
BAREMETAL(false, false, false, "BAREMETAL"),
|
||||
TAR(false, false, false, "tar");
|
||||
|
||||
private final boolean thinProvisioned;
|
||||
private final boolean supportSparse;
|
||||
|
|
@ -66,6 +66,7 @@ public class Storage {
|
|||
|
||||
return fileExtension;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static enum FileSystem {
|
||||
|
|
@ -97,8 +98,8 @@ public class Storage {
|
|||
Iscsi(true), // for e.g., ZFS Comstar
|
||||
ISO(false), // for iso image
|
||||
LVM(false), // XenServer local LVM SR
|
||||
CLVM(true),
|
||||
RBD(true),
|
||||
CLVM(true),
|
||||
RBD(true), // http://libvirt.org/storage.html#StorageBackendRBD
|
||||
SharedMountPoint(true),
|
||||
VMFS(true), // VMware VMFS storage
|
||||
PreSetup(true), // for XenServer, Storage Pool is set up by customers.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public interface StoragePool extends Identity, InternalIdentity {
|
|||
/**
|
||||
* @return available storage in bytes
|
||||
*/
|
||||
long getAvailableBytes();
|
||||
long getUsedBytes();
|
||||
|
||||
Long getClusterId();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,17 @@ package com.cloud.storage;
|
|||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateCacheStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
||||
|
|
@ -43,6 +48,8 @@ public interface StorageService{
|
|||
*/
|
||||
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
|
||||
UnknownHostException, ResourceUnavailableException;
|
||||
|
||||
ImageStore createCacheStore(CreateCacheStoreCmd cmd);
|
||||
|
||||
/**
|
||||
* Delete the storage pool
|
||||
|
|
@ -82,4 +89,9 @@ public interface StorageService{
|
|||
public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
|
||||
|
||||
public StoragePool getStoragePool(long id);
|
||||
|
||||
boolean deleteImageStore(DeleteImageStoreCmd cmd);
|
||||
|
||||
ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public interface Upload extends InternalIdentity, Identity {
|
|||
FTP_UPLOAD, HTTP_DOWNLOAD
|
||||
}
|
||||
|
||||
long getHostId();
|
||||
long getDataStoreId();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
Destroying("The volume is destroying, and can't be recovered."),
|
||||
UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage"),
|
||||
Uploading("volume is uploading"),
|
||||
Copying("volume is copying from image store to primary, in case it's an uploaded volume"),
|
||||
Uploaded("volume is uploaded");
|
||||
|
||||
String _description;
|
||||
|
|
@ -73,9 +74,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);
|
||||
s_fsm.addTransition(Resizing, Event.OperationFailed, Ready);
|
||||
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
|
||||
s_fsm.addTransition(Uploaded, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
|
||||
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
|
||||
s_fsm.addTransition(Creating, Event.CopyFailed, Uploaded);// Copying volume from sec to primary failed.
|
||||
s_fsm.addTransition(Uploaded, Event.CopyRequested, Copying);
|
||||
s_fsm.addTransition(Copying, Event.OperationSucceeded, Ready);
|
||||
s_fsm.addTransition(Copying, Event.OperationFailed, Uploaded);
|
||||
s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
|
||||
s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
|
||||
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);
|
||||
|
|
@ -152,7 +153,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
|
||||
Date getCreated();
|
||||
|
||||
long getDiskOfferingId();
|
||||
Long getDiskOfferingId();
|
||||
|
||||
String getChainInfo();
|
||||
|
||||
|
|
@ -173,4 +174,5 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
* @param reserv
|
||||
*/
|
||||
void setReservationId(String reserv);
|
||||
Storage.ImageFormat getFormat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,12 @@
|
|||
*/
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.*;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.user.Account;
|
||||
|
|
@ -36,7 +39,7 @@ public interface VolumeApiService {
|
|||
* @throws PermissionDeniedException
|
||||
*/
|
||||
Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
|
||||
/**
|
||||
* Creates the volume based on the given criteria
|
||||
*
|
||||
|
|
@ -50,7 +53,7 @@ public interface VolumeApiService {
|
|||
|
||||
/**
|
||||
* Resizes the volume based on the given criteria
|
||||
*
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria
|
||||
* @return the volume object
|
||||
|
|
@ -58,7 +61,7 @@ public interface VolumeApiService {
|
|||
*/
|
||||
Volume resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
Volume migrateVolume(MigrateVolumeCmd cmd) throws ConcurrentOperationException;
|
||||
Volume migrateVolume(MigrateVolumeCmd cmd);
|
||||
|
||||
/**
|
||||
* Uploads the volume to secondary storage
|
||||
|
|
@ -75,5 +78,24 @@ public interface VolumeApiService {
|
|||
|
||||
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
|
||||
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId)
|
||||
throws ResourceAllocationException;
|
||||
Volume updateVolume(UpdateVolumeCmd updateVolumeCmd);
|
||||
|
||||
/**
|
||||
* Extracts the volume to a particular location.
|
||||
*
|
||||
* @param cmd
|
||||
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume
|
||||
* exists),
|
||||
* id (the id of the volume)
|
||||
* @throws URISyntaxException
|
||||
* @throws InternalErrorException
|
||||
* @throws PermissionDeniedException
|
||||
*
|
||||
*/
|
||||
String extractVolume(ExtractVolumeCmd cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import com.cloud.storage.Volume;
|
|||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface SnapshotService {
|
||||
public interface SnapshotApiService {
|
||||
|
||||
/**
|
||||
* List all snapshots of a disk volume. Optionally lists snapshots created by specified interval
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.storage.template;
|
||||
|
||||
public class TemplateInfo {
|
||||
public class TemplateProp {
|
||||
String templateName;
|
||||
String installPath;
|
||||
long size;
|
||||
|
|
@ -25,11 +25,11 @@ public class TemplateInfo {
|
|||
boolean isPublic;
|
||||
boolean isCorrupted;
|
||||
|
||||
protected TemplateInfo() {
|
||||
protected TemplateProp() {
|
||||
|
||||
}
|
||||
|
||||
public TemplateInfo(String templateName, String installPath, long size, long physicalSize, boolean isPublic, boolean isCorrupted) {
|
||||
public TemplateProp(String templateName, String installPath, long size, long physicalSize, boolean isPublic, boolean isCorrupted) {
|
||||
this.templateName = templateName;
|
||||
this.installPath = installPath;
|
||||
this.size = size;
|
||||
|
|
@ -38,7 +38,7 @@ public class TemplateInfo {
|
|||
this.isCorrupted = isCorrupted;
|
||||
}
|
||||
|
||||
public TemplateInfo(String templateName, String installPath, boolean isPublic, boolean isCorrupted) {
|
||||
public TemplateProp(String templateName, String installPath, boolean isPublic, boolean isCorrupted) {
|
||||
this(templateName, installPath, 0, 0, isPublic, isCorrupted);
|
||||
}
|
||||
|
||||
|
|
@ -24,19 +24,22 @@ import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd;
|
|||
import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
|
||||
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public interface TemplateService {
|
||||
public interface TemplateApiService {
|
||||
|
||||
VirtualMachineTemplate registerTemplate(RegisterTemplateCmd cmd) throws URISyntaxException, ResourceAllocationException;
|
||||
|
||||
|
|
@ -72,29 +75,32 @@ public interface TemplateService {
|
|||
*
|
||||
* @param cmd
|
||||
* - the command specifying the mode and id of the ISO
|
||||
* @return extractId.
|
||||
* @return extractUrl extract url.
|
||||
*/
|
||||
Long extract(ExtractIsoCmd cmd) throws InternalErrorException;
|
||||
String extract(ExtractIsoCmd cmd) throws InternalErrorException;
|
||||
|
||||
/**
|
||||
* Extracts a Template
|
||||
*
|
||||
* @param cmd
|
||||
* - the command specifying the mode and id of the template
|
||||
* @return extractId
|
||||
* @return extractUrl extract url
|
||||
*/
|
||||
Long extract(ExtractTemplateCmd cmd) throws InternalErrorException;
|
||||
String extract(ExtractTemplateCmd cmd) throws InternalErrorException;
|
||||
|
||||
VirtualMachineTemplate getTemplate(long templateId);
|
||||
|
||||
List<String> listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd);
|
||||
|
||||
boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd);
|
||||
|
||||
|
||||
VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd,
|
||||
Account templateOwner) throws ResourceAllocationException;
|
||||
|
||||
VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command)
|
||||
throws CloudRuntimeException;
|
||||
|
||||
VirtualMachineTemplate updateTemplate(UpdateIsoCmd cmd);
|
||||
|
||||
VirtualMachineTemplate updateTemplate(UpdateTemplateCmd cmd);
|
||||
}
|
||||
|
|
@ -92,4 +92,6 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
|||
|
||||
String getTemplateTag();
|
||||
Map getDetails();
|
||||
|
||||
Boolean isDynamicallyScalable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ public class DiskProfile {
|
|||
private Long templateId;
|
||||
private long volumeId;
|
||||
private String path;
|
||||
private Long bytesReadRate;
|
||||
private Long bytesWriteRate;
|
||||
private Long iopsReadRate;
|
||||
private Long iopsWriteRate;
|
||||
|
||||
private HypervisorType hyperType;
|
||||
|
||||
|
|
@ -154,4 +158,36 @@ public class DiskProfile {
|
|||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
}
|
||||
}
|
||||
|
||||
public static final String IsDynamicScalingEnabled = "enable.dynamic.scaling";
|
||||
|
||||
public enum Event {
|
||||
StartRequested,
|
||||
StopRequested,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package com.cloud.vm;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.to.DataTO;
|
||||
import com.cloud.agent.api.to.DiskTO;
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
|
|
@ -133,11 +135,11 @@ public interface VirtualMachineProfile {
|
|||
|
||||
List<NicProfile> getNics();
|
||||
|
||||
List<VolumeTO> getDisks();
|
||||
List<DiskTO> getDisks();
|
||||
|
||||
void addNic(int index, NicProfile nic);
|
||||
|
||||
void addDisk(int index, VolumeTO disk);
|
||||
void addDisk(int index, DiskTO disk);
|
||||
|
||||
StringBuilder getBootArgsBuilder();
|
||||
|
||||
|
|
@ -147,7 +149,7 @@ public interface VirtualMachineProfile {
|
|||
|
||||
void addNic(NicProfile nic);
|
||||
|
||||
void addDisk(VolumeTO disk);
|
||||
void addDisk(DiskTO disk);
|
||||
|
||||
VirtualMachine.Type getType();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public class ApiConstants {
|
|||
public static final String BOOTABLE = "bootable";
|
||||
public static final String BIND_DN = "binddn";
|
||||
public static final String BIND_PASSWORD = "bindpass";
|
||||
public static final String BYTES_READ_RATE = "bytesreadrate";
|
||||
public static final String BYTES_WRITE_RATE = "byteswriterate";
|
||||
public static final String CATEGORY = "category";
|
||||
public static final String CERTIFICATE = "certificate";
|
||||
public static final String PRIVATE_KEY = "privatekey";
|
||||
|
|
@ -104,6 +106,8 @@ public class ApiConstants {
|
|||
public static final String INTERNAL_DNS1 = "internaldns1";
|
||||
public static final String INTERNAL_DNS2 = "internaldns2";
|
||||
public static final String INTERVAL_TYPE = "intervaltype";
|
||||
public static final String IOPS_READ_RATE = "iopsreadrate";
|
||||
public static final String IOPS_WRITE_RATE = "iopswriterate";
|
||||
public static final String IP_ADDRESS = "ipaddress";
|
||||
public static final String IP6_ADDRESS = "ip6address";
|
||||
public static final String IP_ADDRESS_ID = "ipaddressid";
|
||||
|
|
@ -117,6 +121,7 @@ public class ApiConstants {
|
|||
public static final String IS_PORTABLE = "isportable";
|
||||
public static final String IS_PUBLIC = "ispublic";
|
||||
public static final String IS_PERSISTENT = "ispersistent";
|
||||
public static final String EGRESS_DEFAULT_POLICY = "egressdefaultpolicy";
|
||||
public static final String IS_READY = "isready";
|
||||
public static final String IS_RECURSIVE = "isrecursive";
|
||||
public static final String ISO_FILTER = "isofilter";
|
||||
|
|
@ -241,8 +246,7 @@ public class ApiConstants {
|
|||
public static final String IS_VOLATILE = "isvolatile";
|
||||
public static final String VOLUME_ID = "volumeid";
|
||||
public static final String ZONE_ID = "zoneid";
|
||||
public static final String ZONE_NAME = "zonename";
|
||||
public static final String ZONE_TYPE = "zonetype";
|
||||
public static final String ZONE_NAME = "zonename";
|
||||
public static final String NETWORK_TYPE = "networktype";
|
||||
public static final String PAGE = "page";
|
||||
public static final String PAGE_SIZE = "pagesize";
|
||||
|
|
@ -506,6 +510,7 @@ public class ApiConstants {
|
|||
public static final String DEPLOYMENT_PLANNER = "deploymentplanner";
|
||||
public static final String ACL_ID = "aclid";
|
||||
public static final String NUMBER = "number";
|
||||
public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ import com.cloud.server.TaggedResourceService;
|
|||
import com.cloud.storage.DataStoreProviderApiService;
|
||||
import com.cloud.storage.StorageService;
|
||||
import com.cloud.storage.VolumeApiService;
|
||||
import com.cloud.storage.snapshot.SnapshotService;
|
||||
import com.cloud.template.TemplateService;
|
||||
import com.cloud.storage.snapshot.SnapshotApiService;
|
||||
import com.cloud.template.TemplateApiService;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.DomainService;
|
||||
|
|
@ -115,9 +115,9 @@ public abstract class BaseCmd {
|
|||
@Inject public VolumeApiService _volumeService;
|
||||
@Inject public ResourceService _resourceService;
|
||||
@Inject public NetworkService _networkService;
|
||||
@Inject public TemplateService _templateService;
|
||||
@Inject public TemplateApiService _templateService;
|
||||
@Inject public SecurityGroupService _securityGroupService;
|
||||
@Inject public SnapshotService _snapshotService;
|
||||
@Inject public SnapshotApiService _snapshotService;
|
||||
@Inject public VpcVirtualNetworkApplianceService _routerService;
|
||||
@Inject public ResponseGenerator _responseGenerator;
|
||||
@Inject public EntityManager _entityMgr;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the template, integer")
|
||||
private Integer sortKey;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
private Boolean isDynamicallyScalable;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -90,4 +93,8 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
public Integer getSortKey() {
|
||||
return sortKey;
|
||||
}
|
||||
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return isDynamicallyScalable;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import org.apache.cloudstack.api.response.HostForMigrationResponse;
|
|||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
|
||||
import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.InstanceGroupResponse;
|
||||
import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
|
||||
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
|
||||
|
|
@ -172,6 +173,7 @@ import com.cloud.projects.ProjectInvitation;
|
|||
import com.cloud.region.ha.GlobalLoadBalancerRule;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.S3;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
|
@ -277,7 +279,7 @@ public interface ResponseGenerator {
|
|||
|
||||
Host findHostById(Long hostId);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, long zoneId, boolean readyOnly);
|
||||
//List<TemplateResponse> createTemplateResponses(long templateId, long zoneId, boolean readyOnly);
|
||||
|
||||
VpnUsersResponse createVpnUserResponse(VpnUser user);
|
||||
|
||||
|
|
@ -293,13 +295,17 @@ public interface ResponseGenerator {
|
|||
|
||||
SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group);
|
||||
|
||||
ExtractResponse createExtractResponse(Long uploadId, Long id, Long zoneId, Long accountId, String mode);
|
||||
ExtractResponse createExtractResponse(Long uploadId, Long id, Long zoneId, Long accountId, String mode, String url);
|
||||
|
||||
ExtractResponse createExtractResponse(Long id, Long zoneId, Long accountId, String mode, String url);
|
||||
|
||||
EventResponse createEventResponse(Event event);
|
||||
|
||||
//List<EventResponse> createEventResponse(EventJoinVO... events);
|
||||
|
||||
TemplateResponse createIsoResponse(VirtualMachineTemplate result);
|
||||
TemplateResponse createTemplateUpdateResponse(VirtualMachineTemplate result);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly);
|
||||
|
||||
List<CapacityResponse> createCapacityResponse(List<? extends Capacity> result, DecimalFormat format);
|
||||
|
||||
|
|
@ -319,13 +325,13 @@ public interface ResponseGenerator {
|
|||
|
||||
Long getSecurityGroupId(String groupName, long accountId);
|
||||
|
||||
List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
|
||||
List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
|
||||
|
||||
// List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
|
||||
//List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
|
||||
|
||||
ProjectResponse createProjectResponse(Project project);
|
||||
|
||||
|
||||
List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
|
||||
|
||||
List<TemplateResponse> createTemplateResponses(long templateId, Long vmId);
|
||||
|
||||
FirewallResponse createFirewallResponse(FirewallRule fwRule);
|
||||
|
|
@ -358,6 +364,8 @@ public interface ResponseGenerator {
|
|||
|
||||
RegionResponse createRegionResponse(Region region);
|
||||
|
||||
ImageStoreResponse createImageStoreResponse(ImageStore os);
|
||||
|
||||
/**
|
||||
* @param resourceTag
|
||||
* @param keyValueOnly TODO
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -26,14 +24,15 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "addSecondaryStorage", description="Adds secondary storage.", responseObject=HostResponse.class)
|
||||
@APICommand(name = "addSecondaryStorage", description="Adds secondary storage.", responseObject=ImageStoreResponse.class)
|
||||
public class AddSecondaryStorageCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
|
||||
private static final String s_name = "addsecondarystorageresponse";
|
||||
|
|
@ -49,6 +48,8 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
description="the Zone ID for the secondary storage")
|
||||
private Long zoneId;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -61,6 +62,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -77,17 +79,19 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
List<? extends Host> result = _resourceService.discoverHosts(this);
|
||||
HostResponse hostResponse = null;
|
||||
if (result != null && result.size() > 0) {
|
||||
for (Host host : result) {
|
||||
// There should only be one secondary storage host per add
|
||||
hostResponse = _responseGenerator.createHostResponse(host);
|
||||
hostResponse.setResponseName(getCommandName());
|
||||
hostResponse.setObjectName("secondarystorage");
|
||||
this.setResponseObject(hostResponse);
|
||||
}
|
||||
AddImageStoreCmd cmd = new AddImageStoreCmd();
|
||||
cmd.setUrl(getUrl());
|
||||
cmd.setZoneId(getZoneId());
|
||||
cmd.setProviderName("NFS");
|
||||
|
||||
try{
|
||||
ImageStore result = _storageService.discoverImageStore(cmd);
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("secondarystorage");
|
||||
setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,12 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
|
|||
public void execute() {
|
||||
ListResponse<HostForMigrationResponse> response = null;
|
||||
Pair<List<? extends Host>,Integer> result;
|
||||
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
|
||||
Map<Host, Boolean> hostsRequiringStorageMotion;
|
||||
|
||||
Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
|
||||
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
|
||||
result = hostsForMigration.first();
|
||||
hostsWithCapacity = hostsForMigration.second();
|
||||
List<? extends Host> hostsWithCapacity = hostsForMigration.second();
|
||||
hostsRequiringStorageMotion = hostsForMigration.third();
|
||||
|
||||
response = new ListResponse<HostForMigrationResponse>();
|
||||
|
|
|
|||
|
|
@ -172,11 +172,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
response = _queryService.searchForServers(this);
|
||||
} else {
|
||||
Pair<List<? extends Host>,Integer> result;
|
||||
List<? extends Host> hostsWithCapacity = new ArrayList<Host>();
|
||||
Ternary<Pair<List<? extends Host>,Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
|
||||
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
|
||||
result = hostsForMigration.first();
|
||||
hostsWithCapacity = hostsForMigration.second();
|
||||
List<? extends Host> hostsWithCapacity = hostsForMigration.second();
|
||||
|
||||
response = new ListResponse<HostResponse>();
|
||||
List<HostResponse> hostResponses = new ArrayList<HostResponse>();
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd
|
|||
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC Internal LB VMs")
|
||||
private Boolean forVpc;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
private String zoneType;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -125,9 +122,6 @@ public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd
|
|||
return Role.INTERNAL_LB_VM.toString();
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
package org.apache.cloudstack.api.command.admin.ldap;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -27,6 +30,7 @@ import org.apache.cloudstack.api.BaseCmd;
|
|||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.LDAPConfigResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
@ -91,7 +95,7 @@ public class LDAPConfigCmd extends BaseCmd {
|
|||
}
|
||||
|
||||
public void setBindDN(String bdn) {
|
||||
this.bindDN=bdn;
|
||||
bindDN=bdn;
|
||||
}
|
||||
|
||||
public String getQueryFilter() {
|
||||
|
|
@ -159,9 +163,16 @@ public class LDAPConfigCmd extends BaseCmd {
|
|||
if (getListAll()){
|
||||
// return the existing conf
|
||||
LDAPConfigCmd cmd = _configService.listLDAPConfig(this);
|
||||
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
|
||||
lr.setResponseName(getCommandName());
|
||||
this.setResponseObject(lr);
|
||||
ListResponse<LDAPConfigResponse> response = new ListResponse<LDAPConfigResponse>();
|
||||
List<LDAPConfigResponse> responses = new ArrayList<LDAPConfigResponse>();
|
||||
|
||||
if(!cmd.getHostname().equals("")) {
|
||||
responses.add(_responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN()));
|
||||
}
|
||||
|
||||
response.setResponses(responses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) {
|
||||
throw new InvalidParameterValueException("You need to provide hostname, searchbase and queryfilter to configure your LDAP server");
|
||||
|
|
@ -171,7 +182,7 @@ public class LDAPConfigCmd extends BaseCmd {
|
|||
if (result){
|
||||
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
|
||||
lr.setResponseName(getCommandName());
|
||||
this.setResponseObject(lr);
|
||||
setResponseObject(lr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
" Supported keys are internallbprovider/publiclbprovider with service provider as a value")
|
||||
protected Map details;
|
||||
|
||||
@Parameter(name=ApiConstants.EGRESS_DEFAULT_POLICY, type=CommandType.BOOLEAN, description="true if default guest network egress policy is allow; false if default egress policy is deny")
|
||||
private Boolean egressDefaultPolicy;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -163,6 +166,13 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
return isPersistent == null ? false : isPersistent;
|
||||
}
|
||||
|
||||
public Boolean getEgressDefaultPolicy() {
|
||||
if (egressDefaultPolicy == null) {
|
||||
return true;
|
||||
}
|
||||
return egressDefaultPolicy;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getServiceProviders() {
|
||||
Map<String, List<String>> serviceProviderMap = null;
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,18 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the disk offering. Values are local and shared.")
|
||||
private String storageType = ServiceOffering.StorageType.shared.toString();
|
||||
|
||||
@Parameter(name=ApiConstants.BYTES_READ_RATE, type=CommandType.LONG, required=false, description="bytes read rate of the disk offering")
|
||||
private Long bytesReadRate;
|
||||
|
||||
@Parameter(name=ApiConstants.BYTES_WRITE_RATE, type=CommandType.LONG, required=false, description="bytes write rate of the disk offering")
|
||||
private Long bytesWriteRate;
|
||||
|
||||
@Parameter(name=ApiConstants.IOPS_READ_RATE, type=CommandType.LONG, required=false, description="io requests read rate of the disk offering")
|
||||
private Long iopsReadRate;
|
||||
|
||||
@Parameter(name=ApiConstants.IOPS_WRITE_RATE, type=CommandType.LONG, required=false, description="io requests write rate of the disk offering")
|
||||
private Long iopsWriteRate;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_OFFERING, type=CommandType.BOOLEAN, description="an optional field, whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
|
|
@ -94,6 +106,22 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
return domainId;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
|
||||
public String getStorageType() {
|
||||
return storageType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,18 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters")
|
||||
private Map<String, String> details;
|
||||
|
||||
@Parameter(name=ApiConstants.BYTES_READ_RATE, type=CommandType.LONG, required=false, description="bytes read rate of the disk offering")
|
||||
private Long bytesReadRate;
|
||||
|
||||
@Parameter(name=ApiConstants.BYTES_WRITE_RATE, type=CommandType.LONG, required=false, description="bytes write rate of the disk offering")
|
||||
private Long bytesWriteRate;
|
||||
|
||||
@Parameter(name=ApiConstants.IOPS_READ_RATE, type=CommandType.LONG, required=false, description="io requests read rate of the disk offering")
|
||||
private Long iopsReadRate;
|
||||
|
||||
@Parameter(name=ApiConstants.IOPS_WRITE_RATE, type=CommandType.LONG, required=false, description="io requests write rate of the disk offering")
|
||||
private Long iopsWriteRate;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -172,6 +184,22 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return params;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -81,9 +81,8 @@ public class ListPortableIpRangesCmd extends BaseListCmd {
|
|||
public void execute(){
|
||||
ListResponse<PortableIpRangeResponse> response = new ListResponse<PortableIpRangeResponse>();
|
||||
List<PortableIpRangeResponse> responses = new ArrayList<PortableIpRangeResponse>();
|
||||
List<? extends PortableIpRange> portableIpRanges = new ArrayList<PortableIpRange>();
|
||||
|
||||
portableIpRanges = _configService.listPortableIpRanges(this);
|
||||
List<? extends PortableIpRange> portableIpRanges = _configService.listPortableIpRanges(this);
|
||||
if (portableIpRanges != null && !portableIpRanges.isEmpty()) {
|
||||
for (PortableIpRange range : portableIpRanges) {
|
||||
PortableIpRangeResponse rangeResponse = _responseGenerator.createPortableIPRangeResponse(range);
|
||||
|
|
|
|||
|
|
@ -66,9 +66,6 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
description="the Zone ID of the router")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
private String zoneType;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
|
||||
description="list by network id")
|
||||
private Long networkId;
|
||||
|
|
@ -108,10 +105,6 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,154 @@
|
|||
// 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.api.command.admin.storage;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "addImageStore", description="Adds backup image store.", responseObject=ImageStoreResponse.class, since = "4.2.0")
|
||||
public class AddImageStoreCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
|
||||
private static final String s_name = "addimagestoreresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name for the image store")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the URL for the image store")
|
||||
private String url;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
description="the Zone ID for the image store")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
|
||||
required=true, description="the image store provider name")
|
||||
private String providerName;
|
||||
|
||||
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
|
||||
private Map<String, String> details;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
Map<String, String> detailsMap = null;
|
||||
if (details != null && !details.isEmpty()) {
|
||||
detailsMap = new HashMap<String, String>();
|
||||
Collection<?> props = details.values();
|
||||
Iterator<?> iter = props.iterator();
|
||||
while (iter.hasNext()) {
|
||||
HashMap<String, String> detail = (HashMap<String, String>) iter.next();
|
||||
String key = detail.get("key");
|
||||
String value = detail.get("value");
|
||||
detailsMap.put(key, value);
|
||||
}
|
||||
}
|
||||
return detailsMap;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return this.providerName;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public void setDetails(Map<String, String> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
ImageStore result = _storageService.discoverImageStore(this);
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("secondarystorage");
|
||||
this.setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
} catch (DiscoveryException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,12 +31,17 @@ import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
|
|||
import static org.apache.cloudstack.api.BaseCmd.CommandType.INTEGER;
|
||||
import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.S3Response;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
|
|
@ -44,10 +49,11 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.storage.S3;
|
||||
import com.cloud.storage.ImageStore;
|
||||
|
||||
@APICommand(name = "addS3", description = "Adds S3", responseObject = S3Response.class, since = "4.0.0")
|
||||
@APICommand(name = "addS3", description = "Adds S3", responseObject = ImageStoreResponse.class, since = "4.0.0")
|
||||
public final class AddS3Cmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddS3Cmd.class.getName());
|
||||
|
||||
private static String COMMAND_NAME = "adds3response";
|
||||
|
||||
|
|
@ -88,26 +94,33 @@ public final class AddS3Cmd extends BaseCmd {
|
|||
ServerApiException, ConcurrentOperationException, ResourceAllocationException,
|
||||
NetworkRuleConflictException {
|
||||
|
||||
final S3 result;
|
||||
AddImageStoreCmd cmd = new AddImageStoreCmd();
|
||||
cmd.setProviderName("S3");
|
||||
Map<String, String> details = new HashMap<String, String>();
|
||||
details.put(ApiConstants.S3_ACCESS_KEY, this.getAccessKey());
|
||||
details.put(ApiConstants.S3_SECRET_KEY, this.getSecretKey());
|
||||
details.put(ApiConstants.S3_END_POINT, this.getEndPoint());
|
||||
details.put(ApiConstants.S3_BUCKET_NAME, this.getBucketName());
|
||||
details.put(ApiConstants.S3_HTTPS_FLAG, this.getHttpsFlag().toString());
|
||||
details.put(ApiConstants.S3_CONNECTION_TIMEOUT, this.getConnectionTimeout().toString());
|
||||
details.put(ApiConstants.S3_MAX_ERROR_RETRY, this.getMaxErrorRetry().toString());
|
||||
details.put(ApiConstants.S3_SOCKET_TIMEOUT, this.getSocketTimeout().toString());
|
||||
|
||||
try {
|
||||
|
||||
result = _resourceService.discoverS3(this);
|
||||
|
||||
if (result == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3.");
|
||||
try{
|
||||
ImageStore result = _storageService.discoverImageStore(cmd);
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("secondarystorage");
|
||||
this.setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
|
||||
} catch (DiscoveryException e) {
|
||||
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
|
||||
|
||||
} catch (DiscoveryException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
|
||||
final S3Response response = _responseGenerator.createS3Response(result);
|
||||
response.setResponseName(this.getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* 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.api.command.admin.storage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "createCacheStore", description="create cache store.", responseObject=ImageStoreResponse.class)
|
||||
public class CreateCacheStoreCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
|
||||
private static final String s_name = "createcachestoreresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the cache store")
|
||||
private String url;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
description="the Zone ID for the image store")
|
||||
private Long zoneId;
|
||||
|
||||
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store")
|
||||
private Map<String, String> details;
|
||||
|
||||
@Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING,
|
||||
required=false, description="the scope of the image store: zone only for now")
|
||||
private String scope;
|
||||
|
||||
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
|
||||
required=false, description="the cache store provider name")
|
||||
private String providerName;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return this.providerName;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
ImageStore result = _storageService.createCacheStore(this);
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("secondarystorage");
|
||||
this.setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
// 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.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "deleteImageStore", description = "Deletes an image store .", responseObject = SuccessResponse.class, since = "4.2.0")
|
||||
public class DeleteImageStoreCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteImageStoreCmd.class.getName());
|
||||
|
||||
private static final String s_name = "deleteimagestoreresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class,
|
||||
required = true, description = "the image store ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
boolean result = _storageService.deleteImageStore(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete image store");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// 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.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listCacheStores", description="Lists cache stores.", responseObject=ImageStoreResponse.class, since = "4.2.0")
|
||||
public class ListCacheStoresCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListCacheStoresCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listcachestoreresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the cache store")
|
||||
private String storeName;
|
||||
|
||||
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="the cache store protocol")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="the cache store provider")
|
||||
private String provider;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
|
||||
description="the Zone ID for the cache store")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = ImageStoreResponse.class,
|
||||
description="the ID of the cache store")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
ListResponse<ImageStoreResponse> response = _queryService.searchForCacheStores(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// 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.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listImageStores", description="Lists image stores.", responseObject=ImageStoreResponse.class, since = "4.2.0")
|
||||
public class ListImageStoresCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListImageStoresCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listimagestoreresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the image store")
|
||||
private String storeName;
|
||||
|
||||
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="the image store protocol")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="the image store provider")
|
||||
private String provider;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
|
||||
description="the Zone ID for the image store")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = ImageStoreResponse.class,
|
||||
description="the ID of the storage pool")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
ListResponse<ImageStoreResponse> response = _queryService.searchForImageStores(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,23 +18,18 @@
|
|||
*/
|
||||
package org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.S3Response;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.storage.S3;
|
||||
|
||||
@APICommand(name = "listS3s", description = "Lists S3s", responseObject = S3Response.class, since = "4.0.0")
|
||||
@APICommand(name = "listS3s", description = "Lists S3s", responseObject = ImageStoreResponse.class, since = "4.0.0")
|
||||
public class ListS3sCmd extends BaseListCmd {
|
||||
|
||||
private static final String COMMAND_NAME = "lists3sresponse";
|
||||
|
|
@ -44,28 +39,11 @@ public class ListS3sCmd extends BaseListCmd {
|
|||
ServerApiException, ConcurrentOperationException, ResourceAllocationException,
|
||||
NetworkRuleConflictException {
|
||||
|
||||
final List<? extends S3> result = _resourceService.listS3s(this);
|
||||
final ListResponse<S3Response> response = new ListResponse<S3Response>();
|
||||
final List<S3Response> s3Responses = new ArrayList<S3Response>();
|
||||
|
||||
if (result != null) {
|
||||
|
||||
for (S3 s3 : result) {
|
||||
|
||||
S3Response s3Response = _responseGenerator.createS3Response(s3);
|
||||
s3Response.setResponseName(this.getCommandName());
|
||||
s3Response.setObjectName("s3");
|
||||
s3Responses.add(s3Response);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
response.setResponses(s3Responses);
|
||||
response.setResponseName(this.getCommandName());
|
||||
|
||||
ListImageStoresCmd cmd = new ListImageStoresCmd();
|
||||
cmd.setProvider("S3");
|
||||
ListResponse<ImageStoreResponse> response = _queryService.searchForImageStores(cmd);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ public class ListStoragePoolsCmd extends BaseListCmd {
|
|||
description="the ID of the storage pool")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING, entityType = StoragePoolResponse.class,
|
||||
description="the ID of the storage pool")
|
||||
private String scope;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -116,4 +120,8 @@ public class ListStoragePoolsCmd extends BaseListCmd {
|
|||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.swift;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -24,14 +27,14 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.SwiftResponse;
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.storage.Swift;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = HostResponse.class, since="3.0.0")
|
||||
@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since="3.0.0")
|
||||
public class AddSwiftCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName());
|
||||
private static final String s_name = "addswiftresponse";
|
||||
|
|
@ -88,21 +91,29 @@ public class AddSwiftCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
Swift result = _resourceService.discoverSwift(this);
|
||||
SwiftResponse swiftResponse = null;
|
||||
if (result != null) {
|
||||
swiftResponse = _responseGenerator.createSwiftResponse(result);
|
||||
swiftResponse.setResponseName(getCommandName());
|
||||
swiftResponse.setObjectName("swift");
|
||||
this.setResponseObject(swiftResponse);
|
||||
AddImageStoreCmd cmd = new AddImageStoreCmd();
|
||||
cmd.setProviderName("Swift");
|
||||
cmd.setUrl(getUrl());
|
||||
Map<String, String> details = new HashMap<String, String>();
|
||||
details.put(ApiConstants.ACCOUNT, getAccount());
|
||||
details.put(ApiConstants.USERNAME, getUsername());
|
||||
details.put(ApiConstants.KEY, getKey());
|
||||
|
||||
|
||||
try{
|
||||
ImageStore result = _storageService.discoverImageStore(cmd);
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("secondarystorage");
|
||||
setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift");
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
} catch (DiscoveryException ex) {
|
||||
String errMsg = "Failed to add Swift due to " + ex.toString();
|
||||
s_logger.warn(errMsg, ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errMsg);
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,24 +16,19 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.swift;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.SwiftResponse;
|
||||
|
||||
import com.cloud.storage.Swift;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "listSwifts", description = "List Swift.", responseObject = HostResponse.class, since="3.0.0")
|
||||
@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since="3.0.0")
|
||||
public class ListSwiftsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
|
||||
private static final String s_name = "listswiftsresponse";
|
||||
|
|
@ -66,20 +61,11 @@ public class ListSwiftsCmd extends BaseListCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
Pair<List<? extends Swift>, Integer> result = _resourceService.listSwifts(this);
|
||||
ListResponse<SwiftResponse> response = new ListResponse<SwiftResponse>();
|
||||
List<SwiftResponse> swiftResponses = new ArrayList<SwiftResponse>();
|
||||
|
||||
if (result != null) {
|
||||
for (Swift swift : result.first()) {
|
||||
SwiftResponse swiftResponse = _responseGenerator.createSwiftResponse(swift);
|
||||
swiftResponse.setResponseName(getCommandName());
|
||||
swiftResponse.setObjectName("swift");
|
||||
swiftResponses.add(swiftResponse);
|
||||
}
|
||||
}
|
||||
response.setResponses(swiftResponses, result.second());
|
||||
ListImageStoresCmd cmd = new ListImageStoresCmd();
|
||||
cmd.setProvider("Swift");
|
||||
ListResponse<ImageStoreResponse> response = _queryService.searchForImageStores(cmd);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class PrepareTemplateCmd extends BaseCmd {
|
|||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
|
||||
VirtualMachineTemplate vmTemplate = _templateService.prepareTemplate(templateId, zoneId);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate.getId(), zoneId, true);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(vmTemplate, zoneId, true);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -112,10 +112,12 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Iso;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
|
@ -124,12 +126,12 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
|
|||
public void execute(){
|
||||
try {
|
||||
CallContext.current().setEventDetails(getEventDescription());
|
||||
Long uploadId = _templateService.extract(this);
|
||||
if (uploadId != null){
|
||||
ExtractResponse response = _responseGenerator.createExtractResponse(uploadId, id, zoneId, getEntityOwnerId(), mode);
|
||||
String uploadUrl = _templateService.extract(this);
|
||||
if (uploadUrl != null) {
|
||||
ExtractResponse response = _responseGenerator.createExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
|
||||
response.setResponseName(getCommandName());
|
||||
response.setObjectName("iso");
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract iso");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,16 +149,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
Set<Pair<Long, Long>> isoZonePairSet = _mgr.listIsos(this);
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = new ArrayList<TemplateResponse>();
|
||||
|
||||
for (Pair<Long, Long> iso : isoZonePairSet) {
|
||||
List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
|
||||
responses = _responseGenerator.createIsoResponses(iso.first(), iso.second(), listInReadyState());
|
||||
templateResponses.addAll(responses);
|
||||
}
|
||||
response.setResponses(templateResponses);
|
||||
ListResponse<TemplateResponse> response = _queryService.listIsos(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,9 @@ public class RegisterIsoCmd extends BaseCmd {
|
|||
description="Image store uuid")
|
||||
private String imageStoreUuid;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if iso contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
protected Boolean isDynamicallyScalable;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -150,6 +153,10 @@ public class RegisterIsoCmd extends BaseCmd {
|
|||
return this.imageStoreUuid;
|
||||
}
|
||||
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return isDynamicallyScalable == null ? false : isDynamicallyScalable;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -174,7 +181,7 @@ public class RegisterIsoCmd extends BaseCmd {
|
|||
VirtualMachineTemplate template = _templateService.registerIso(this);
|
||||
if (template != null) {
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(template.getId(), zoneId, false);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _mgr.updateTemplate(this);
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createIsoResponse(result);
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import com.cloud.user.Account;
|
|||
public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName());
|
||||
|
||||
private static final String s_name = "revokesecuritygroupegress";
|
||||
private static final String s_name = "revokesecuritygroupegressresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import com.cloud.user.Account;
|
|||
public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupIngressCmd.class.getName());
|
||||
|
||||
private static final String s_name = "revokesecuritygroupingress";
|
||||
private static final String s_name = "revokesecuritygroupingressresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
|
||||
private Long policyId;
|
||||
|
||||
private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
|
||||
private final String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
|
|
@ -153,10 +153,10 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
Snapshot snapshot = _snapshotService.allocSnapshot(getVolumeId(), getPolicyId());
|
||||
Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId());
|
||||
if (snapshot != null) {
|
||||
this.setEntityId(snapshot.getId());
|
||||
this.setEntityUuid(snapshot.getUuid());
|
||||
setEntityId(snapshot.getId());
|
||||
setEntityUuid(snapshot.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot");
|
||||
}
|
||||
|
|
@ -166,15 +166,19 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
public void execute() {
|
||||
s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
|
||||
CallContext.current().setEventDetails("Volume Id: "+getVolumeId());
|
||||
Snapshot snapshot = _snapshotService.createSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()));
|
||||
if (snapshot != null) {
|
||||
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
Snapshot snapshot;
|
||||
try {
|
||||
snapshot = _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()));
|
||||
if (snapshot != null) {
|
||||
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
|
||||
}
|
||||
s_logger.info("VOLSS: backupSnapshotCmd finishes:" + System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
|||
VirtualMachineTemplate template = _templateService.copyTemplate(this);
|
||||
|
||||
if (template != null){
|
||||
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(template.getId(), getDestinationZoneId(), false);
|
||||
List<TemplateResponse> listResponse = _responseGenerator.createTemplateResponses(template, getDestinationZoneId(), false);
|
||||
TemplateResponse response = new TemplateResponse();
|
||||
if (listResponse != null && !listResponse.isEmpty()) {
|
||||
response = listResponse.get(0);
|
||||
|
|
|
|||
|
|
@ -113,10 +113,12 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
|
|||
return "extracting template: " + getId() + " from zone: " + getZoneId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
|
@ -125,11 +127,11 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
|
|||
public void execute(){
|
||||
try {
|
||||
CallContext.current().setEventDetails(getEventDescription());
|
||||
Long uploadId = _templateService.extract(this);
|
||||
if (uploadId != null){
|
||||
ExtractResponse response = _responseGenerator.createExtractResponse(uploadId, id, zoneId, getEntityOwnerId(), mode);
|
||||
String uploadUrl = _templateService.extract(this);
|
||||
if (uploadUrl != null) {
|
||||
ExtractResponse response = _responseGenerator.createExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
|||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
|
|
@ -120,18 +121,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
Set<Pair<Long, Long>> templateZonePairSet = _mgr.listTemplates(this);
|
||||
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = new ArrayList<TemplateResponse>();
|
||||
|
||||
for (Pair<Long, Long> template : templateZonePairSet) {
|
||||
List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
|
||||
responses = _responseGenerator.createTemplateResponses(template.first().longValue(), template.second(), listInReadyState());
|
||||
templateResponses.addAll(responses);
|
||||
}
|
||||
|
||||
response.setResponses(templateResponses);
|
||||
ListResponse<TemplateResponse> response = _queryService.listTemplates(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,13 +112,12 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||
description="Register template for the project")
|
||||
private Long projectId;
|
||||
|
||||
@Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING,
|
||||
description="Image store uuid")
|
||||
private String imageStoreUuid;
|
||||
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
|
||||
protected Map details;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
protected Boolean isDynamicallyScalable;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -195,9 +194,6 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||
return templateTag;
|
||||
}
|
||||
|
||||
public String getImageStoreUuid() {
|
||||
return this.imageStoreUuid;
|
||||
}
|
||||
|
||||
public Map getDetails() {
|
||||
if (details == null || details.isEmpty()) {
|
||||
|
|
@ -209,6 +205,10 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||
return params;
|
||||
}
|
||||
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return isDynamicallyScalable == null ? false : isDynamicallyScalable;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -238,7 +238,7 @@ public class RegisterTemplateCmd extends BaseCmd {
|
|||
VirtualMachineTemplate template = _templateService.registerTemplate(this);
|
||||
if (template != null){
|
||||
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(template.getId(), zoneId, false);
|
||||
List<TemplateResponse> templateResponses = _responseGenerator.createTemplateResponses(template, zoneId, false);
|
||||
response.setResponses(templateResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
VirtualMachineTemplate result = _mgr.updateTemplate(this);
|
||||
VirtualMachineTemplate result = _templateService.updateTemplate(this);
|
||||
if (result != null) {
|
||||
TemplateResponse response = _responseGenerator.createIsoResponse(result);
|
||||
TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(result);
|
||||
response.setObjectName("template");
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ public class UpdateVMCmd extends BaseCmd{
|
|||
@Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, description="an optional field, whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
protected Boolean isDynamicallyScalable;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -96,6 +99,10 @@ public class UpdateVMCmd extends BaseCmd{
|
|||
return displayVm;
|
||||
}
|
||||
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return isDynamicallyScalable;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
public Boolean getDisplayVolume() {
|
||||
return displayVolume;
|
||||
return displayVolume != null ? displayVolume : Boolean.TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.volume;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -96,10 +94,12 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
|||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.Volume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
|
@ -127,11 +127,9 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
try {
|
||||
CallContext.current().setEventDetails("Volume Id: "+getId());
|
||||
Long uploadId = _mgr.extractVolume(this);
|
||||
if (uploadId != null){
|
||||
Upload uploadInfo = _entityMgr.findById(Upload.class, uploadId);
|
||||
CallContext.current().setEventDetails("Volume Id: " + getId());
|
||||
String uploadUrl = _volumeService.extractVolume(this);
|
||||
if (uploadUrl != null) {
|
||||
ExtractResponse response = new ExtractResponse();
|
||||
response.setResponseName(getCommandName());
|
||||
response.setObjectName("volume");
|
||||
|
|
@ -142,18 +140,13 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
|||
response.setZoneId(zone.getUuid());
|
||||
response.setZoneName(zone.getName());
|
||||
response.setMode(mode);
|
||||
response.setUploadId(uploadInfo.getUuid());
|
||||
response.setState(uploadInfo.getUploadState().toString());
|
||||
response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
|
||||
Account account = _entityMgr.findById(Account.class, getEntityOwnerId());
|
||||
response.setAccountId(account.getUuid());
|
||||
response.setUrl(uploadInfo.getUploadUrl());
|
||||
this.setResponseObject(response);
|
||||
response.setUrl(uploadUrl);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume");
|
||||
}
|
||||
} catch (URISyntaxException ex) {
|
||||
s_logger.info(ex);
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,18 +98,15 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
Volume result;
|
||||
try {
|
||||
result = _volumeService.migrateVolume(this);
|
||||
if (result != null) {
|
||||
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
} catch (ConcurrentOperationException e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume: ");
|
||||
}
|
||||
|
||||
Volume result;
|
||||
result = _volumeService.migrateVolume(this);
|
||||
if (result != null) {
|
||||
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ public class ListZonesByCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
private String zoneType;
|
||||
@Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||
private String networkType;
|
||||
|
||||
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
|
||||
private Boolean showCapacities;
|
||||
|
|
@ -77,8 +77,8 @@ public class ListZonesByCmd extends BaseListCmd {
|
|||
return name;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
public String getNetworkType() {
|
||||
return networkType;
|
||||
}
|
||||
|
||||
public Boolean getShowCapacities() {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ public class ClusterResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the cluster")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("hypervisortype") @Param(description="the hypervisor type of the cluster")
|
||||
private String hypervisorType;
|
||||
|
||||
|
|
@ -120,10 +117,6 @@ public class ClusterResponse extends BaseResponse {
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getClusterType() {
|
||||
return clusterType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,18 @@ public class DiskOfferingResponse extends BaseResponse {
|
|||
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
|
||||
private String storageType;
|
||||
|
||||
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the disk offering")
|
||||
private Long bytesReadRate;
|
||||
|
||||
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the disk offering")
|
||||
private Long bytesWriteRate;
|
||||
|
||||
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the disk offering")
|
||||
private Long iopsReadRate;
|
||||
|
||||
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk offering")
|
||||
private Long iopsWriteRate;
|
||||
|
||||
@SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
|
||||
private Boolean displayOffering;
|
||||
|
||||
|
|
@ -150,4 +162,20 @@ public class DiskOfferingResponse extends BaseResponse {
|
|||
public void setStorageType(String storageType) {
|
||||
this.storageType = storageType;
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,6 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name for the router")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.DNS1) @Param(description="the first DNS for the router")
|
||||
private String dns1;
|
||||
|
||||
|
|
@ -188,14 +185,6 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setDns1(String dns1) {
|
||||
this.dns1 = dns1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,6 @@ public class HostResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the host")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the host")
|
||||
private String podId;
|
||||
|
||||
|
|
@ -213,10 +210,6 @@ public class HostResponse extends BaseResponse {
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
// 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.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class ImageStoreDetailResponse extends BaseResponse {
|
||||
@SerializedName("name") @Param(description="detail property name of the image store")
|
||||
private String name;
|
||||
|
||||
@SerializedName("value") @Param(description="detail property value of the image store")
|
||||
private String value;
|
||||
|
||||
public ImageStoreDetailResponse(){
|
||||
super();
|
||||
}
|
||||
|
||||
public ImageStoreDetailResponse(String name, String val){
|
||||
super();
|
||||
this.name = name;
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
String oid = this.getName();
|
||||
result = prime * result + ((oid== null) ? 0 : oid.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ImageStoreDetailResponse other = (ImageStoreDetailResponse) obj;
|
||||
String oid = this.getName();
|
||||
if (oid == null) {
|
||||
if (other.getName() != null)
|
||||
return false;
|
||||
} else if (!oid.equals(other.getName()))
|
||||
return false;
|
||||
else if ( this.getValue().equals(other.getValue()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
// 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.api.response;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value=ImageStore.class)
|
||||
public class ImageStoreResponse extends BaseResponse {
|
||||
@SerializedName("id") @Param(description="the ID of the image store")
|
||||
private String id;
|
||||
|
||||
@SerializedName("zoneid") @Param(description="the Zone ID of the image store")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the image store")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName("name") @Param(description="the name of the image store")
|
||||
private String name;
|
||||
|
||||
@SerializedName("url") @Param(description="the url of the image store")
|
||||
private String url;
|
||||
|
||||
@SerializedName("protocol") @Param(description="the protocol of the image store")
|
||||
private String protocol;
|
||||
|
||||
@SerializedName("providername") @Param(description="the provider name of the image store")
|
||||
private String providerName;
|
||||
|
||||
@SerializedName("scope") @Param(description="the scope of the image store")
|
||||
private ScopeType scope;
|
||||
|
||||
@SerializedName("details") @Param(description="the details of the image store")
|
||||
private Set<ImageStoreDetailResponse> details;
|
||||
|
||||
|
||||
public ImageStoreResponse(){
|
||||
this.details = new LinkedHashSet<ImageStoreDetailResponse>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getZoneName() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public ScopeType getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(ScopeType type) {
|
||||
this.scope = type;
|
||||
}
|
||||
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public Set<ImageStoreDetailResponse> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(Set<ImageStoreDetailResponse> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void addDetail(ImageStoreDetailResponse detail){
|
||||
this.details.add(detail);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -89,6 +89,9 @@ public class NetworkOfferingResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.DETAILS) @Param(description="additional key/value details tied with network offering", since="4.2.0")
|
||||
private Map details;
|
||||
|
||||
@SerializedName(ApiConstants.EGRESS_DEFAULT_POLICY) @Param(description="true if network offering supports persistent networks, false otherwise")
|
||||
private Boolean egressDefaultPolicy;
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
|
|
@ -167,4 +170,8 @@ public class NetworkOfferingResponse extends BaseResponse {
|
|||
this.details = details;
|
||||
}
|
||||
|
||||
public void setEgressDefaultPolicy(Boolean egressDefaultPolicy) {
|
||||
this.egressDefaultPolicy = egressDefaultPolicy;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone the network belongs to")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the networktype of the zone the network belongs to")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("networkofferingid") @Param(description="network offering id the network is created from")
|
||||
private String networkOfferingId;
|
||||
|
||||
|
|
@ -310,10 +307,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setCidr(String cidr) {
|
||||
this.cidr = cidr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ public class PodResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the Pod")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("gateway") @Param(description="the gateway of the Pod")
|
||||
private String gateway;
|
||||
|
||||
|
|
@ -90,10 +87,6 @@ public class PodResponse extends BaseResponse {
|
|||
return zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,18 @@ public class ServiceOfferingResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.")
|
||||
private Integer networkRate;
|
||||
|
||||
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the service offering")
|
||||
private Long bytesReadRate;
|
||||
|
||||
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the service offering")
|
||||
private Long bytesWriteRate;
|
||||
|
||||
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the service offering")
|
||||
private Long iopsReadRate;
|
||||
|
||||
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the service offering")
|
||||
private Long iopsWriteRate;
|
||||
|
||||
@SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy used to deploy VM.")
|
||||
private String deploymentPlanner;
|
||||
|
||||
|
|
@ -247,4 +259,20 @@ public class ServiceOfferingResponse extends BaseResponse {
|
|||
public void setVolatileVm(boolean isVolatile) {
|
||||
this.isVolatile = isVolatile;
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,14 +89,6 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
|
|||
@Param(description = "id of the availability zone")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME)
|
||||
@Param(description = "name of the availability zone")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE)
|
||||
@Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with snapshot", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
|
|
@ -180,13 +172,6 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
|
|||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ public class StoragePoolResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the storage pool")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("podid") @Param(description="the Pod ID of the storage pool")
|
||||
private String podId;
|
||||
|
|
@ -145,14 +143,6 @@ public class StoragePoolResponse extends BaseResponse {
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ public class SystemVmResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name for the system VM")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName("dns1") @Param(description="the first DNS for the system VM")
|
||||
private String dns1;
|
||||
|
||||
|
|
@ -149,14 +146,6 @@ public class SystemVmResponse extends BaseResponse {
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public String getDns1() {
|
||||
return dns1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@
|
|||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
|
@ -32,7 +34,7 @@ import com.cloud.template.VirtualMachineTemplate;
|
|||
|
||||
@EntityReference(value=VirtualMachineTemplate.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class TemplateResponse extends BaseResponse implements ControlledEntityResponse {
|
||||
public class TemplateResponse extends BaseResponse implements ControlledViewEntityResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the template ID")
|
||||
private String id;
|
||||
|
||||
|
|
@ -83,15 +85,14 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
|
|||
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the account name to which the template belongs")
|
||||
private String account;
|
||||
|
||||
//TODO: since a template can be associated to more than one zones, this model is not accurate. For backward-compatibility, keep these fields
|
||||
// here, but add a zones field to capture multiple zones.
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone for this template")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone for this template")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the networktype of the zone for this template")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.STATUS) @Param(description="the status of the template")
|
||||
private String status;
|
||||
|
||||
|
|
@ -137,12 +138,24 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
|
|||
@SerializedName(ApiConstants.DETAILS) @Param(description="additional key/value details tied with template")
|
||||
private Map details;
|
||||
|
||||
@SerializedName("zones") @Param(description="list of zones associated with tempate", responseObject = TemplateZoneResponse.class)
|
||||
private Set<TemplateZoneResponse> zones;
|
||||
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with tempate", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
private Set<ResourceTagResponse> tags;
|
||||
|
||||
@SerializedName(ApiConstants.SSHKEY_ENABLED) @Param(description="true if template is sshkey enabled, false otherwise")
|
||||
private Boolean sshKeyEnabled;
|
||||
|
||||
@SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) @Param(description="true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
private Boolean isDynamicallyScalable;
|
||||
|
||||
public TemplateResponse(){
|
||||
zones = new LinkedHashSet<TemplateZoneResponse>();
|
||||
tags = new LinkedHashSet<ResourceTagResponse>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
|
|
@ -160,10 +173,6 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setAccountId(String accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
|
@ -296,12 +305,31 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
|
|||
this.details = details;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
public void setTags(Set<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void addTag(ResourceTagResponse tag){
|
||||
this.tags.add(tag);
|
||||
}
|
||||
|
||||
public void setZones(Set<TemplateZoneResponse> zones){
|
||||
this.zones = zones;
|
||||
}
|
||||
|
||||
public void addZone(TemplateZoneResponse zone){
|
||||
this.zones.add(zone);
|
||||
}
|
||||
|
||||
public void setSshKeyEnabled(boolean sshKeyEnabled) {
|
||||
this.sshKeyEnabled = sshKeyEnabled;
|
||||
}
|
||||
|
||||
public void setDynamicallyScalable(boolean isDynamicallyScalable) {
|
||||
this.isDynamicallyScalable = isDynamicallyScalable;
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
// 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.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class TemplateZoneResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone for the template")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone for the template")
|
||||
private String zoneName;
|
||||
|
||||
|
||||
public TemplateZoneResponse(){
|
||||
super();
|
||||
}
|
||||
|
||||
public TemplateZoneResponse(String zoneId, String zoneName){
|
||||
super();
|
||||
this.zoneId = zoneId;
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getZoneName() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
String oid = this.getZoneId();
|
||||
result = prime * result + ((oid== null) ? 0 : oid.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TemplateZoneResponse other = (TemplateZoneResponse) obj;
|
||||
String oid = this.getZoneId();
|
||||
if (oid == null) {
|
||||
if (other.getZoneId() != null)
|
||||
return false;
|
||||
} else if (!oid.equals(other.getZoneId()))
|
||||
return false;
|
||||
else if ( this.getZoneName().equals(other.getZoneName()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -80,9 +80,6 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the availability zone for the virtual machine")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the network type of the availability zone for the virtual machine")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the host for the virtual machine")
|
||||
private String hostId;
|
||||
|
||||
|
|
@ -192,6 +189,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
@SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
@SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) @Param(description="true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
|
||||
private Boolean isDynamicallyScalable;
|
||||
|
||||
public UserVmResponse(){
|
||||
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
|
||||
nics = new LinkedHashSet<NicResponse>();
|
||||
|
|
@ -273,10 +273,6 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setHostId(String hostId) {
|
||||
this.hostId = hostId;
|
||||
}
|
||||
|
|
@ -439,4 +435,8 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
this.affinityGroupList.add(affinityGroup);
|
||||
}
|
||||
|
||||
public void setDynamicallyScalable(boolean isDynamicallyScalable) {
|
||||
this.isDynamicallyScalable = isDynamicallyScalable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
@Param(description = "name of the availability zone")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_TYPE)
|
||||
@Param(description = "network type of the availability zone")
|
||||
private String zoneType;
|
||||
|
||||
@SerializedName(ApiConstants.TYPE)
|
||||
@Param(description = "type of the disk volume (ROOT or DATADISK)")
|
||||
private String volumeType;
|
||||
|
|
@ -110,6 +106,18 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
@Param(description = "shared or local storage")
|
||||
private String storageType;
|
||||
|
||||
@SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the disk volume")
|
||||
private Long bytesReadRate;
|
||||
|
||||
@SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the disk volume")
|
||||
private Long bytesWriteRate;
|
||||
|
||||
@SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the disk volume")
|
||||
private Long iopsReadRate;
|
||||
|
||||
@SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk volume")
|
||||
private Long iopsWriteRate;
|
||||
|
||||
@SerializedName(ApiConstants.HYPERVISOR)
|
||||
@Param(description = "Hypervisor the volume belongs to")
|
||||
private String hypervisor;
|
||||
|
|
@ -205,10 +213,6 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public void setZoneType(String zoneType) {
|
||||
this.zoneType = zoneType;
|
||||
}
|
||||
|
||||
public void setVolumeType(String volumeType) {
|
||||
this.volumeType = volumeType;
|
||||
}
|
||||
|
|
@ -258,6 +262,38 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
|
|||
this.storageType = storageType;
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
|
||||
public void setHypervisor(String hypervisor) {
|
||||
this.hypervisor = hypervisor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
|||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListCacheStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||
|
|
@ -32,6 +35,7 @@ import org.apache.cloudstack.api.command.user.project.ListProjectInvitationsCmd;
|
|||
import org.apache.cloudstack.api.command.user.project.ListProjectsCmd;
|
||||
import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
|
||||
|
|
@ -75,6 +79,10 @@ public interface QueryService {
|
|||
|
||||
public ListResponse<StoragePoolResponse> searchForStoragePools(ListStoragePoolsCmd cmd);
|
||||
|
||||
public ListResponse<ImageStoreResponse> searchForImageStores(ListImageStoresCmd cmd);
|
||||
|
||||
public ListResponse<ImageStoreResponse> searchForCacheStores(ListCacheStoresCmd cmd);
|
||||
|
||||
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd);
|
||||
|
||||
public ListResponse<AsyncJobResponse> searchForAsyncJobs(ListAsyncJobsCmd cmd);
|
||||
|
|
@ -85,6 +93,9 @@ public interface QueryService {
|
|||
|
||||
public ListResponse<ZoneResponse> listDataCenters(ListZonesByCmd cmd);
|
||||
|
||||
public ListResponse<TemplateResponse> listTemplates(ListTemplatesCmd cmd);
|
||||
|
||||
public ListResponse<TemplateResponse> listIsos(ListIsosCmd cmd);
|
||||
public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
|
||||
String affinityGroupType, Long vmId, String accountName, Long domainId, boolean isRecursive,
|
||||
boolean listAll, Long startIndex, Long pageSize);
|
||||
|
|
|
|||
|
|
@ -21,29 +21,29 @@ import junit.framework.TestCase;
|
|||
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.resource.ResourceService;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.StorageService;
|
||||
|
||||
public class AddSecondaryStorageCmdTest extends TestCase {
|
||||
|
||||
private AddSecondaryStorageCmd addSecondaryStorageCmd;
|
||||
private AddImageStoreCmd addImageStoreCmd;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() {
|
||||
addSecondaryStorageCmd = new AddSecondaryStorageCmd() {
|
||||
addImageStoreCmd = new AddImageStoreCmd() {
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -51,69 +51,48 @@ public class AddSecondaryStorageCmdTest extends TestCase {
|
|||
@Test
|
||||
public void testExecuteForResult() throws Exception {
|
||||
|
||||
ResourceService resourceService = Mockito.mock(ResourceService.class);
|
||||
addSecondaryStorageCmd._resourceService = resourceService;
|
||||
StorageService resourceService = Mockito.mock(StorageService.class);
|
||||
addImageStoreCmd._storageService = resourceService;
|
||||
|
||||
Host host = Mockito.mock(Host.class);
|
||||
Host[] mockHosts = new Host[] { host };
|
||||
ImageStore store = Mockito.mock(ImageStore.class);
|
||||
|
||||
Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
|
||||
.thenReturn(Arrays.asList(mockHosts));
|
||||
Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
|
||||
.thenReturn(store);
|
||||
|
||||
ResponseGenerator responseGenerator = Mockito
|
||||
.mock(ResponseGenerator.class);
|
||||
addSecondaryStorageCmd._responseGenerator = responseGenerator;
|
||||
addImageStoreCmd._responseGenerator = responseGenerator;
|
||||
|
||||
HostResponse responseHost = new HostResponse();
|
||||
ImageStoreResponse responseHost = new ImageStoreResponse();
|
||||
responseHost.setName("Test");
|
||||
|
||||
Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(
|
||||
Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(
|
||||
responseHost);
|
||||
|
||||
addSecondaryStorageCmd.execute();
|
||||
addImageStoreCmd.execute();
|
||||
|
||||
Mockito.verify(responseGenerator).createHostResponse(host);
|
||||
Mockito.verify(responseGenerator).createImageStoreResponse(store);
|
||||
|
||||
HostResponse actualResponse = (HostResponse) addSecondaryStorageCmd
|
||||
ImageStoreResponse actualResponse = (ImageStoreResponse) addImageStoreCmd
|
||||
.getResponseObject();
|
||||
|
||||
Assert.assertEquals(responseHost, actualResponse);
|
||||
Assert.assertEquals("addsecondarystorageresponse",
|
||||
Assert.assertEquals("addimagestoreresponse",
|
||||
actualResponse.getResponseName());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteForEmptyResult() throws Exception {
|
||||
|
||||
ResourceService resourceService = Mockito.mock(ResourceService.class);
|
||||
addSecondaryStorageCmd._resourceService = resourceService;
|
||||
|
||||
Host[] mockHosts = new Host[] {};
|
||||
|
||||
Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
|
||||
.thenReturn(Arrays.asList(mockHosts));
|
||||
|
||||
try {
|
||||
addSecondaryStorageCmd.execute();
|
||||
} catch (ServerApiException exception) {
|
||||
Assert.assertEquals("Failed to add secondary storage",
|
||||
exception.getDescription());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteForNullResult() throws Exception {
|
||||
|
||||
ResourceService resourceService = Mockito.mock(ResourceService.class);
|
||||
addSecondaryStorageCmd._resourceService = resourceService;
|
||||
StorageService resourceService = Mockito.mock(StorageService.class);
|
||||
addImageStoreCmd._storageService = resourceService;
|
||||
|
||||
Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
|
||||
Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
|
||||
.thenReturn(null);
|
||||
|
||||
try {
|
||||
addSecondaryStorageCmd.execute();
|
||||
addImageStoreCmd.execute();
|
||||
} catch (ServerApiException exception) {
|
||||
Assert.assertEquals("Failed to add secondary storage",
|
||||
exception.getDescription());
|
||||
|
|
|
|||
|
|
@ -1,97 +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.api.command.test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||
import org.apache.cloudstack.api.response.SwiftResponse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.resource.ResourceService;
|
||||
import com.cloud.storage.Swift;
|
||||
|
||||
public class AddSwiftCmdTest extends TestCase {
|
||||
|
||||
private AddSwiftCmd addSwiftCmd;
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
addSwiftCmd = new AddSwiftCmd();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteSuccess() {
|
||||
|
||||
ResourceService resourceService = Mockito.mock(ResourceService.class);
|
||||
addSwiftCmd._resourceService = resourceService;
|
||||
|
||||
Swift swift = Mockito.mock(Swift.class);
|
||||
|
||||
try {
|
||||
Mockito.when(resourceService.discoverSwift(addSwiftCmd))
|
||||
.thenReturn(swift);
|
||||
} catch (DiscoveryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ResponseGenerator responseGenerator = Mockito
|
||||
.mock(ResponseGenerator.class);
|
||||
addSwiftCmd._responseGenerator = responseGenerator;
|
||||
|
||||
SwiftResponse swiftResponse = Mockito.mock(SwiftResponse.class);
|
||||
|
||||
Mockito.when(responseGenerator.createSwiftResponse(swift)).thenReturn(
|
||||
swiftResponse);
|
||||
|
||||
addSwiftCmd.execute();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteFailure() {
|
||||
|
||||
ResourceService resourceService = Mockito.mock(ResourceService.class);
|
||||
addSwiftCmd._resourceService = resourceService;
|
||||
try {
|
||||
Mockito.when(resourceService.discoverSwift(addSwiftCmd))
|
||||
.thenReturn(null);
|
||||
} catch (DiscoveryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
addSwiftCmd.execute();
|
||||
} catch (ServerApiException exception) {
|
||||
Assert.assertEquals("Failed to add Swift",
|
||||
exception.getDescription());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,10 @@ public class CloudStackServiceOfferingVO {
|
|||
@Id
|
||||
@Column(name="id")
|
||||
private String id;
|
||||
|
||||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
|
|
@ -61,7 +64,9 @@ public class CloudStackServiceOfferingVO {
|
|||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue