mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cloudstack
This commit is contained in:
commit
77ae066c65
|
|
@ -78,7 +78,7 @@ domr.scripts.dir=scripts/network/domr/kvm
|
|||
# a sensible default will be selected based on the network.bridge.type but can
|
||||
# be overridden here.
|
||||
# native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
|
||||
# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver
|
||||
# openvswitch = com.cloud.hypervisor.kvm.resource.OvsVifDriver
|
||||
#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
|
||||
|
||||
# set the hypervisor type, values are: kvm, lxc
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ import java.util.List;
|
|||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
||||
|
|
@ -46,10 +51,6 @@ import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
|||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
|
|
@ -65,7 +66,7 @@ public interface ConfigurationService {
|
|||
* - the command wrapping name and value parameters
|
||||
* @return updated configuration object if successful
|
||||
*/
|
||||
Configuration updateConfiguration(UpdateCfgCmd cmd);
|
||||
Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException;
|
||||
|
||||
/**
|
||||
* Create a service offering through the API
|
||||
|
|
@ -250,7 +251,7 @@ public interface ConfigurationService {
|
|||
|
||||
NetworkOffering getNetworkOffering(long id);
|
||||
|
||||
Integer getNetworkOfferingNetworkRate(long networkOfferingId);
|
||||
Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId);
|
||||
|
||||
Account getVlanAccount(long vlanId);
|
||||
|
||||
|
|
@ -262,7 +263,7 @@ public interface ConfigurationService {
|
|||
|
||||
Long getDefaultPageSize();
|
||||
|
||||
Integer getServiceOfferingNetworkRate(long serviceOfferingId);
|
||||
Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId);
|
||||
|
||||
DiskOffering getDiskOffering(long diskOfferingId);
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public interface NetworkModel {
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
String getDefaultNetworkDomain();
|
||||
String getDefaultNetworkDomain(long zoneId);
|
||||
|
||||
/**
|
||||
* @param ntwkOffId
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public interface NetworkService {
|
|||
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
|
||||
|
||||
/* Requests an IP address for the guest nic */
|
||||
String allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
|
||||
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
|
||||
Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
|
||||
|
||||
boolean releaseSecondaryIpFromNic(long ipAddressId);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.text.DecimalFormat;
|
|||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
|
|
@ -389,8 +390,7 @@ public interface ResponseGenerator {
|
|||
TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
|
||||
VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
|
||||
|
||||
NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
|
||||
Long nicId, Long networkId);
|
||||
NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result);
|
||||
public NicResponse createNicResponse(Nic result);
|
||||
|
||||
AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ public class ListClustersCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
|
||||
private String managedState;
|
||||
|
||||
@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.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
|
||||
private Boolean showCapacities;
|
||||
|
||||
|
|
@ -114,7 +117,10 @@ public class ListClustersCmd extends BaseListCmd {
|
|||
this.managedState = managedstate;
|
||||
}
|
||||
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Boolean getShowCapacities() {
|
||||
return showCapacities;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,17 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name")
|
||||
private String configName;
|
||||
|
||||
@Parameter(name=ApiConstants.SCOPE, type = CommandType.STRING, description = "scope(zone/cluster/pool/account) of the parameter that needs to be updated")
|
||||
private String scope;
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
|
||||
private Long zone_id;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type = CommandType.UUID, entityType = {ZoneResponse.class, ClusterResponse.class, StoragePoolResponse.class, AccountResponse.class}, description = "corresponding ID of the scope")
|
||||
private Long id;
|
||||
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
|
||||
private Long cluster_id;
|
||||
|
||||
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
|
||||
private Long storagepool_id;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
|
||||
private Long account_id;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
@ -64,14 +70,21 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
return configName;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
public Long getZoneId() {
|
||||
return zone_id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
public Long getClusterId() {
|
||||
return cluster_id;
|
||||
}
|
||||
|
||||
public Long getStoragepoolId() {
|
||||
return storagepool_id;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return account_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getPageSizeVal() {
|
||||
|
|
@ -100,10 +113,17 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
for (Configuration cfg : result.first()) {
|
||||
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
|
||||
cfgResponse.setObjectName("configuration");
|
||||
if (scope != null) {
|
||||
cfgResponse.setScope(scope);
|
||||
} else {
|
||||
cfgResponse.setScope("global");
|
||||
if(getZoneId() != null) {
|
||||
cfgResponse.setScope("zone");
|
||||
}
|
||||
if(getClusterId() != null) {
|
||||
cfgResponse.setScope("cluster");
|
||||
}
|
||||
if(getStoragepoolId() != null) {
|
||||
cfgResponse.setScope("storagepool");
|
||||
}
|
||||
if(getAccountId() != null) {
|
||||
cfgResponse.setScope("account");
|
||||
}
|
||||
configResponses.add(cfgResponse);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,17 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="the value of the configuration", length=4095)
|
||||
private String value;
|
||||
|
||||
@Parameter(name=ApiConstants.SCOPE, type = CommandType.STRING, description = "scope(zone/cluster/pool/account) of the parameter that needs to be updated")
|
||||
private String scope;
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
|
||||
private Long zone_id;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type = CommandType.UUID, entityType = {ZoneResponse.class, ClusterResponse.class, StoragePoolResponse.class, AccountResponse.class}, description = "corresponding ID of the scope")
|
||||
private Long id;
|
||||
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
|
||||
private Long cluster_id;
|
||||
|
||||
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
|
||||
private Long storagepool_id;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
|
||||
private Long account_id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -61,12 +67,20 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
return value;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
public Long getZoneId() {
|
||||
return zone_id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
public Long getClusterId() {
|
||||
return cluster_id;
|
||||
}
|
||||
|
||||
public Long getStoragepoolId() {
|
||||
return storagepool_id;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return account_id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -89,12 +103,19 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
if (cfg != null) {
|
||||
ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
|
||||
response.setResponseName(getCommandName());
|
||||
if (scope != null) {
|
||||
response.setScope(scope);
|
||||
response.setValue(value);
|
||||
} else {
|
||||
response.setScope("global");
|
||||
if(getZoneId() != null) {
|
||||
response.setScope("zone");
|
||||
}
|
||||
if(getClusterId() != null) {
|
||||
response.setScope("cluster");
|
||||
}
|
||||
if(getStoragepoolId() != null) {
|
||||
response.setScope("storagepool");
|
||||
}
|
||||
if(getAccountId() != null) {
|
||||
response.setScope("account");
|
||||
}
|
||||
response.setValue(value);
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
description="the Zone ID for the host")
|
||||
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.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
|
||||
required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
|
||||
private Long virtualMachineId;
|
||||
|
|
@ -124,6 +127,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ public class ListPodsByCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
|
||||
private String allocationState;
|
||||
|
||||
@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.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
|
||||
private Boolean showCapacities;
|
||||
|
||||
|
|
@ -78,6 +81,10 @@ public class ListPodsByCmd extends BaseListCmd {
|
|||
return allocationState;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Boolean getShowCapacities() {
|
||||
return showCapacities;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ 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;
|
||||
|
|
@ -103,6 +106,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
description="the storage ID where vm's volumes belong to", since="3.0.1")
|
||||
private Long storageId;
|
||||
|
||||
@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 ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -110,6 +113,10 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
return storageId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
|||
description="the ID of the zone")
|
||||
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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -115,6 +118,10 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public boolean listInReadyState() {
|
||||
Account account = UserContext.current().getCaller();
|
||||
// It is account specific if account is admin type and domainId and accountName are not null
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
|
|||
description="the Zone ID of the network")
|
||||
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.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
|
||||
private String guestIpType;
|
||||
|
||||
|
|
@ -96,6 +99,10 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public String getGuestIpType() {
|
||||
return guestIpType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
|
|||
@Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
|
||||
description="the ID of the disk volume")
|
||||
private Long volumeId;
|
||||
|
||||
@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 ///////////////////////
|
||||
|
|
@ -83,6 +86,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
|
|||
return volumeId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
|||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
|
||||
description="list templates by zoneId")
|
||||
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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -92,6 +96,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public boolean listInReadyState() {
|
||||
|
||||
Account account = UserContext.current().getCaller();
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.vm;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -146,6 +147,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
|
|||
|
||||
UserContext.current().setEventDetails("Nic Id: " + getNicId() );
|
||||
String ip;
|
||||
NicSecondaryIp result;
|
||||
String secondaryIp = null;
|
||||
if ((ip = getIpaddress()) != null) {
|
||||
if (!NetUtils.isValidIp(ip)) {
|
||||
|
|
@ -154,12 +156,13 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
|
|||
}
|
||||
|
||||
try {
|
||||
secondaryIp = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
|
||||
result = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
|
||||
} catch (InsufficientAddressCapacityException e) {
|
||||
throw new InvalidParameterValueException("Allocating guest ip for nic failed");
|
||||
}
|
||||
|
||||
if (secondaryIp != null) {
|
||||
if (result != null) {
|
||||
secondaryIp = result.getIp4Address();
|
||||
if (getNetworkType() == NetworkType.Basic) {
|
||||
// add security group rules for the secondary ip addresses
|
||||
boolean success = false;
|
||||
|
|
@ -171,7 +174,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
|
|||
|
||||
s_logger.info("Associated ip address to NIC : " + secondaryIp);
|
||||
NicSecondaryIpResponse response = new NicSecondaryIpResponse();
|
||||
response = _responseGenerator.createSecondaryIPToNicResponse(secondaryIp, getNicId(), getNetworkId());
|
||||
response = _responseGenerator.createSecondaryIPToNicResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ 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.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
|
|
@ -56,6 +57,9 @@ 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.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
|
||||
private Boolean showCapacities;
|
||||
|
||||
|
|
@ -79,6 +83,10 @@ public class ListZonesByCmd extends BaseListCmd {
|
|||
return name;
|
||||
}
|
||||
|
||||
public String getZoneType() {
|
||||
return zoneType;
|
||||
}
|
||||
|
||||
public Boolean getShowCapacities() {
|
||||
return showCapacities;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ public class ConfigurationResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.SCOPE) @Param(description="scope(zone/cluster/pool/account) of the parameter that needs to be updated")
|
||||
private String scope;
|
||||
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the value of the configuration")
|
||||
private Long id;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the configuration")
|
||||
private String description;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.test;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
|
@ -64,15 +65,16 @@ public class AddIpToVmNicTest extends TestCase {
|
|||
|
||||
NetworkService networkService = Mockito.mock(NetworkService.class);
|
||||
AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
|
||||
NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
|
||||
|
||||
Mockito.when(
|
||||
networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn("10.1.1.2");
|
||||
networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(secIp);
|
||||
|
||||
ipTonicCmd._networkService = networkService;
|
||||
responseGenerator = Mockito.mock(ResponseGenerator.class);
|
||||
|
||||
NicSecondaryIpResponse ipres = Mockito.mock(NicSecondaryIpResponse.class);
|
||||
Mockito.when(responseGenerator.createSecondaryIPToNicResponse(Mockito.anyString(), Mockito.anyLong(), Mockito.anyLong())).thenReturn(ipres);
|
||||
Mockito.when(responseGenerator.createSecondaryIPToNicResponse(secIp)).thenReturn(ipres);
|
||||
|
||||
ipTonicCmd._responseGenerator = responseGenerator;
|
||||
ipTonicCmd.execute();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,16 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
label.add.affinity.group=Add new affinity group
|
||||
message.delete.affinity.group=Please confirm that you would like to remove this affinity group.
|
||||
label.delete.affinity.group=Delete Affinity Group
|
||||
label.edit.affinity.group=Edit Affinity Group
|
||||
label.affinity=Affinity
|
||||
label.anti.affinity=Anti-affinity
|
||||
label.affinity.groups=Affinity Groups
|
||||
label.anti.affinity.groups=Anti-affinity Groups
|
||||
label.affinity.group=Affinity Group
|
||||
label.anti.affinity.group=Anti-affinity Group
|
||||
changed.item.properties=Changed item properties
|
||||
confirm.enable.s3=Please fill in the following information to enable support for S3-backed Secondary Storage
|
||||
confirm.enable.swift=Please fill in the following information to enable support for Swift
|
||||
|
|
@ -624,11 +633,15 @@ label.key=Key
|
|||
label.kvm.traffic.label=KVM traffic label
|
||||
label.label=Label
|
||||
label.lang.brportugese=Brazilian Portugese
|
||||
label.lang.catalan=Catalan
|
||||
label.lang.chinese=Chinese (Simplified)
|
||||
label.lang.english=English
|
||||
label.lang.french=French
|
||||
label.lang.german=German
|
||||
label.lang.italian=Italian
|
||||
label.lang.japanese=Japanese
|
||||
label.lang.korean=Korean
|
||||
label.lang.norwegian=Norwegian
|
||||
label.lang.russian=Russian
|
||||
label.lang.spanish=Spanish
|
||||
label.lang.arabic=Arabic
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
confirm.enable.swift=Si us plau ompliu la seg\u00fcent informaci\u00f3 per habilitar el suport per a Swift
|
||||
error.installWizard.message=Quelcom ha fallat, vost\u00e8 pot tornar enrere i corregir els errors detalls suggerime
|
||||
error.password.not.match=Els camps de contrasenya no coincideixen
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
error.installWizard.message=Ein Fehler ist aufgetreten; Sie k\u00f6nnen zur\u00fcckgehen und den Fehler korregieren
|
||||
error.login=Ihr Benutzername / Passwort stimmt nicht mit uneren unseren Aufzeichnungen \u00fcberein.
|
||||
error.session.expired=Ihre Sitzung ist abgelaufen.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
error.installWizard.message=Algo salio mal, debes ir para atr\u00e1s y corregir los error.
|
||||
error.login=Su nombre de usuario / contrase\u00c3\u00b1a no coincide con nuestros registros.
|
||||
error.mgmt.server.inaccessible=El Servidor de Gesti\u00c3\u00b3n es inaccesible. Por favor, int\u00c3\u00a9ntelo de nuevo m\u00c3\u00a1s tarde.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=Elementi delle propriet\u00e0 modificati
|
||||
confirm.enable.s3=Si prega di inserire i valori richiesti per abilitare il supporto per il Secondary Storage di tipo S3
|
||||
confirm.enable.swift=Si prega di inserire i valori richiesti per abilitare il supporto per Swift
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=\ud56d\ubaa9 \uc18d\uc131 \ubcc0\uacbd
|
||||
confirm.enable.swift=Swift \uae30\uc220 \uc9c0\uc6d0\ub97c \uc0ac\uc6a9 \ud558\ub824\uba74 \ub2e4\uc74c \uc815\ubcf4\ub97c \uc785\ub825\ud574 \uc8fc\uc2ed\uc2dc\uc624.
|
||||
error.could.not.enable.zone=Zone\uc744 \uc0ac\uc6a9 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=Endrede egenskaper
|
||||
error.could.not.enable.zone=Kunne ikke aktivere sonen
|
||||
error.installWizard.message=Noe gikk galt. G\u00e5 tilbake og korriger feilene.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=Alteradas propriedades do item
|
||||
confirm.enable.s3=Por favor preencha as informa\u00e7\u00f5es abaixo para habilitar suporte a storage secund\u00e1ria fornecida por S3
|
||||
confirm.enable.swift=Por favor preencha as informa\u00e7\u00f5es abaixo para habilitar suporte ao Swift
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b
|
||||
confirm.enable.swift=\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438 Swift
|
||||
error.could.not.enable.zone=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u043e\u043d\u0443
|
||||
|
|
@ -1052,7 +1053,7 @@ message.acquire.public.ip=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442
|
|||
message.action.cancel.maintenance.mode=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f.
|
||||
message.action.cancel.maintenance=\u0423\u0437\u0435\u043b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u0448\u0435\u043b \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u042d\u0442\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0434\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442.
|
||||
message.action.change.service.warning.for.instance=\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430.
|
||||
message.action.change.service.warning.for.router=\n
|
||||
message.action.change.service.warning.for.router=\u0414\u043b\u044f \u0440\u043e\u0443\u0442\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430.
|
||||
message.action.delete.cluster=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440.
|
||||
message.action.delete.disk.offering=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.
|
||||
message.action.delete.domain=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u043e\u043c\u0435\u043d.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
changed.item.properties=\u66f4\u6539\u9879\u76ee\u5c5e\u6027
|
||||
confirm.enable.s3=\u8bf7\u586b\u5199\u4e0b\u5217\u4fe1\u606f\u4ee5\u542f\u7528\u652f\u6301S3\u7684\u4e8c\u7ea7\u5b58\u50a8
|
||||
confirm.enable.swift=\u8bf7\u586b\u5199\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u542f\u7528\u5bf9 SWIFT \u7684\u652f\u6301
|
||||
|
|
|
|||
|
|
@ -450,16 +450,15 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<target if="${nonoss}">
|
||||
<echo>test</echo>
|
||||
<replaceregexp
|
||||
file="${basedir}/target/generated-webapp/WEB-INF/web.xml"
|
||||
match="classpath:componentContext.xml"
|
||||
replace="classpath:nonossComponentContext.xml" byline="true" />
|
||||
<exec executable="cp">
|
||||
<arg value="-r" />
|
||||
<arg value="${basedir}/../plugins/network-elements/cisco-vnmc/scripts" />
|
||||
<arg value="${basedir}/target/generated-webapp/WEB-INF/classes/" />
|
||||
</exec>
|
||||
<copy overwrite="true" todir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts">
|
||||
<fileset dir="${basedir}/../plugins/network-elements/cisco-vnmc/scripts">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -532,10 +532,14 @@
|
|||
-->
|
||||
<bean id="UserDispersingPlanner" class="com.cloud.deploy.UserDispersingPlanner">
|
||||
<property name="name" value="UserDispersing"/>
|
||||
<property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
|
||||
<property name="HostAllocators" value="#{hostAllocators.Adapters}" />
|
||||
</bean>
|
||||
|
||||
<bean id="UserConcentratedPodPlanner" class="com.cloud.deploy.UserConcentratedPodPlanner">
|
||||
<property name="name" value="UserConcentratedPod"/>
|
||||
<property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
|
||||
<property name="HostAllocators" value="#{hostAllocators.Adapters}" />
|
||||
</bean>
|
||||
|
||||
<bean id="clusterBasedAgentLoadBalancerPlanner" class="com.cloud.cluster.agentlb.ClusterBasedAgentLoadBalancerPlanner">
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public class AsyncJobVO implements AsyncJob {
|
|||
this.callbackType = CALLBACK_POLLING;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.instanceId = instanceId;
|
||||
this.instanceType = instanceType;
|
||||
}
|
||||
|
||||
public AsyncJobVO(long userId, long accountId, String cmd, String cmdInfo,
|
||||
|
|
|
|||
|
|
@ -39,5 +39,29 @@
|
|||
<para>The response parameters are: id, ipaddress, secondaryips, gateway, netmask, macaddr,
|
||||
broadcasturi, isolationuri, isdefault,</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>deleteAlerts </para>
|
||||
<para>Deletes the specified alerts. The request parameters are: ids (allowed to pass one or
|
||||
more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
|
||||
<para>The response parameters are: true, false </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>archiveAlerts</para>
|
||||
<para>Archives the specified alerts. The request parameters are: ids (allowed to pass one or
|
||||
more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
|
||||
<para>The response parameters are: true, false </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>deleteEvents </para>
|
||||
<para>Deletes the specified events. The request parameters are: ids (allowed to pass one or
|
||||
more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
|
||||
<para>The response parameters are: true, false</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>archiveEvents</para>
|
||||
<para>Archives the specified events. The request parameters are: ids (allowed to pass one or
|
||||
more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
|
||||
<para>The response parameters are: true, false </para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,18 @@
|
|||
or by using the Details page. If you want to delete multiple alerts or events at the same time,
|
||||
you can use the respective context menu. You can delete alerts or events by category for a time
|
||||
period.</para>
|
||||
<para>In order to support the delete or archive alerts, the following global parameters have been
|
||||
added:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">alert.purge.delay</emphasis>: The alerts older than specified
|
||||
number of days are purged. Set the value to 0 to never purge alerts automatically.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">alert.purge.interval</emphasis>: The interval in seconds to wait
|
||||
before running the alert purge thread. The default is 86400 seconds (one day).</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<note>
|
||||
<para>Archived alerts or events cannot be viewed in the UI, or by using the API. They are
|
||||
maintained in the database for auditing or compliance purposes.</para>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
physical resources associated with a cloud environment. Events are used by monitoring systems,
|
||||
usage and billing systems, or any other event-driven workflow systems to discern a pattern and
|
||||
make the right business decision. In &PRODUCT; an event could be a state change of virtual or
|
||||
psychical resources, an action performed by an user (action events), or policy based events
|
||||
physical resources, an action performed by an user (action events), or policy based events
|
||||
(alerts).</para>
|
||||
<xi:include href="events-log.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="event-framework.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
|
|
@ -44,7 +44,7 @@ if echo $VERSION | grep SNAPSHOT ; then
|
|||
else
|
||||
DEFVER="-D_ver $REALVER"
|
||||
DEFPRE=
|
||||
DEFREL=
|
||||
DEFREL="-D_rel 1"
|
||||
fi
|
||||
|
||||
mkdir -p $RPMDIR/SPECS
|
||||
|
|
@ -78,7 +78,7 @@ else
|
|||
REALVER=`echo $VERSION`
|
||||
DEFVER="-D_ver $REALVER"
|
||||
DEFPRE=
|
||||
DEFREL=
|
||||
DEFREL="-D_rel 1"
|
||||
fi
|
||||
|
||||
mkdir -p $RPMDIR/SPECS
|
||||
|
|
|
|||
|
|
@ -520,6 +520,7 @@ setup_sshd(){
|
|||
local eth=$2
|
||||
[ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
|
||||
sed -i "/3922/s/eth./$eth/" /etc/iptables/rules.v4
|
||||
sed -i "/3922/s/eth./$eth/" /etc/iptables/rules
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -692,6 +693,8 @@ setup_router() {
|
|||
enable_fwding 1
|
||||
chkconfig nfs-common off
|
||||
cp /etc/iptables/iptables-router /etc/iptables/rules.v4
|
||||
#for old templates
|
||||
cp /etc/iptables/iptables-router /etc/iptables/rules
|
||||
setup_sshd $ETH1_IP "eth1"
|
||||
}
|
||||
|
||||
|
|
@ -764,6 +767,7 @@ EOF
|
|||
disable_rpfilter
|
||||
enable_fwding 1
|
||||
cp /etc/iptables/iptables-vpcrouter /etc/iptables/rules.v4
|
||||
cp /etc/iptables/iptables-vpcrouter /etc/iptables/rules
|
||||
setup_sshd $ETH0_IP "eth0"
|
||||
cp /etc/vpcdnsmasq.conf /etc/dnsmasq.conf
|
||||
cp /etc/cloud-nic.rules /etc/udev/rules.d/cloud-nic.rules
|
||||
|
|
@ -790,6 +794,7 @@ setup_dhcpsrvr() {
|
|||
enable_fwding 0
|
||||
chkconfig nfs-common off
|
||||
cp /etc/iptables/iptables-router /etc/iptables/rules.v4
|
||||
cp /etc/iptables/iptables-router /etc/iptables/rules
|
||||
if [ "$SSHONGUEST" == "true" ]
|
||||
then
|
||||
setup_sshd $ETH0_IP "eth0"
|
||||
|
|
@ -825,6 +830,7 @@ setup_secstorage() {
|
|||
echo "$public_ip $NAME" >> /etc/hosts
|
||||
|
||||
cp /etc/iptables/iptables-secstorage /etc/iptables/rules.v4
|
||||
cp /etc/iptables/iptables-secstorage /etc/iptables/rules
|
||||
if [ "$hyp" == "vmware" ]; then
|
||||
setup_sshd $ETH1_IP "eth1"
|
||||
else
|
||||
|
|
@ -849,6 +855,7 @@ setup_console_proxy() {
|
|||
sed -i /gateway/d /etc/hosts
|
||||
echo "$public_ip $NAME" >> /etc/hosts
|
||||
cp /etc/iptables/iptables-consoleproxy /etc/iptables/rules.v4
|
||||
cp /etc/iptables/iptables-consoleproxy /etc/iptables/rules
|
||||
if [ "$hyp" == "vmware" ]; then
|
||||
setup_sshd $ETH1_IP "eth1"
|
||||
else
|
||||
|
|
@ -874,6 +881,7 @@ setup_elbvm() {
|
|||
echo "$public_ip $NAME" >> /etc/hosts
|
||||
|
||||
cp /etc/iptables/iptables-elbvm /etc/iptables/rules.v4
|
||||
cp /etc/iptables/iptables-elbvm /etc/iptables/rules
|
||||
if [ "$SSHONGUEST" == "true" ]
|
||||
then
|
||||
setup_sshd $ETH0_IP "eth0"
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ import com.cloud.host.dao.HostDao;
|
|||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
|
|
@ -106,7 +107,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
|
|||
@Inject private PrimaryDataStoreDao _storagePoolDao;
|
||||
@Inject private ConfigurationDao _configDao;
|
||||
@Inject private ResourceManager _resourceMgr;
|
||||
@Inject private ConfigurationManager _configMgr;
|
||||
@Inject private ConfigurationManager _configMgr;
|
||||
@Inject ConfigurationServer _configServer;
|
||||
private Timer _timer = null;
|
||||
private float _cpuOverProvisioningFactor = 1;
|
||||
private long _capacityCheckPeriod = 60L * 60L * 1000L; // one hour by default
|
||||
|
|
@ -562,19 +564,30 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
|
|||
float overProvFactor = 1f;
|
||||
capacity = _capacityDao.findCapacityBy(capacityType.intValue(), cluster.getDataCenterId(), null, cluster.getId());
|
||||
|
||||
if (capacityType == Capacity.CAPACITY_TYPE_STORAGE){
|
||||
capacity.add(getUsedStats(capacityType, cluster.getDataCenterId(), cluster.getPodId(), cluster.getId()));
|
||||
// cpu and memory allocated capacity notification threshold can be defined at cluster level, so getting the value if they are defined at cluster level
|
||||
double capacityValue = 0;
|
||||
switch (capacityType) {
|
||||
case Capacity.CAPACITY_TYPE_STORAGE:
|
||||
capacity.add(getUsedStats(capacityType, cluster.getDataCenterId(), cluster.getPodId(), cluster.getId()));
|
||||
capacityValue = _capacityTypeThresholdMap.get(capacityType);
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_CPU:
|
||||
overProvFactor = ApiDBUtils.getCpuOverprovisioningFactor();
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.CPUCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
case Capacity.CAPACITY_TYPE_MEMORY:
|
||||
capacityValue = Double.parseDouble(_configServer.getConfigValue(Config.MemoryCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
|
||||
break;
|
||||
default:
|
||||
capacityValue = _capacityTypeThresholdMap.get(capacityType);
|
||||
}
|
||||
if (capacity == null || capacity.size() == 0){
|
||||
continue;
|
||||
}
|
||||
if (capacityType == Capacity.CAPACITY_TYPE_CPU){
|
||||
overProvFactor = ApiDBUtils.getCpuOverprovisioningFactor();
|
||||
}
|
||||
|
||||
double totalCapacity = capacity.get(0).getTotalCapacity() * overProvFactor;
|
||||
double usedCapacity = capacity.get(0).getUsedCapacity() + capacity.get(0).getReservedCapacity();
|
||||
if (totalCapacity != 0 && usedCapacity/totalCapacity > _capacityTypeThresholdMap.get(capacityType)){
|
||||
if (totalCapacity != 0 && usedCapacity/totalCapacity > capacityValue){
|
||||
generateEmailAlert(ApiDBUtils.findZoneById(cluster.getDataCenterId()), ApiDBUtils.findPodById(cluster.getPodId()), cluster,
|
||||
totalCapacity, usedCapacity, capacityType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ public class ApiDBUtils {
|
|||
}
|
||||
|
||||
public static Integer getNetworkRate(long networkOfferingId) {
|
||||
return _configMgr.getNetworkOfferingNetworkRate(networkOfferingId);
|
||||
return _configMgr.getNetworkOfferingNetworkRate(networkOfferingId, null);
|
||||
}
|
||||
|
||||
public static Account getVlanAccount(long vlanId) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import java.util.TimeZone;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.vm.*;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
|
|
@ -264,13 +265,6 @@ import com.cloud.uservm.UserVm;
|
|||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicVO;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
import com.cloud.vm.dao.NicSecondaryIpVO;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
|
|
@ -288,7 +282,6 @@ import org.apache.cloudstack.region.Region;
|
|||
import org.apache.cloudstack.usage.Usage;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
import org.apache.cloudstack.usage.UsageTypes;
|
||||
import com.cloud.vm.VmStats;
|
||||
import com.cloud.vm.dao.UserVmData;
|
||||
import com.cloud.vm.dao.UserVmData.NicData;
|
||||
import com.cloud.vm.dao.UserVmData.SecurityGroupData;
|
||||
|
|
@ -3646,11 +3639,12 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
return response;
|
||||
}
|
||||
|
||||
public NicSecondaryIpResponse createSecondaryIPToNicResponse(String ipAddr, Long nicId, Long networkId) {
|
||||
public NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result) {
|
||||
NicSecondaryIpResponse response = new NicSecondaryIpResponse();
|
||||
NicVO nic = _entityMgr.findById(NicVO.class, nicId);
|
||||
NetworkVO network = _entityMgr.findById(NetworkVO.class, networkId);
|
||||
response.setIpAddr(ipAddr);
|
||||
NicVO nic = _entityMgr.findById(NicVO.class, result.getNicId());
|
||||
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
|
||||
response.setId(result.getUuid());
|
||||
response.setIpAddr(result.getIp4Address());
|
||||
response.setNicId(nic.getUuid());
|
||||
response.setNwId(network.getUuid());
|
||||
response.setObjectName("nicsecondaryip");
|
||||
|
|
@ -3659,7 +3653,10 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
|
||||
public NicResponse createNicResponse(Nic result) {
|
||||
NicResponse response = new NicResponse();
|
||||
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
|
||||
|
||||
response.setId(result.getUuid());
|
||||
response.setNetworkid(network.getUuid());
|
||||
response.setIpaddress(result.getIp4Address());
|
||||
|
||||
if (result.getSecondaryIp()) {
|
||||
|
|
@ -3676,19 +3673,12 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
response.setGateway(result.getGateway());
|
||||
response.setId(result.getUuid());
|
||||
response.setGateway(result.getGateway());
|
||||
response.setNetmask(result.getNetmask());
|
||||
response.setMacAddress(result.getMacAddress());
|
||||
if (result.getBroadcastUri() != null) {
|
||||
response.setBroadcastUri(result.getBroadcastUri().toString());
|
||||
}
|
||||
if (result.getIsolationUri() != null) {
|
||||
response.setIsolationUri(result.getIsolationUri().toString());
|
||||
}
|
||||
|
||||
if (result.getIp6Address() != null) {
|
||||
response.setId(result.getIp6Address());
|
||||
response.setIp6Address(result.getIp6Address());
|
||||
}
|
||||
|
||||
response.setIsDefault(result.isDefaultNic());
|
||||
|
|
|
|||
|
|
@ -994,7 +994,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
Long id = cmd.getId();
|
||||
String name = cmd.getRouterName();
|
||||
String state = cmd.getState();
|
||||
Long zone = cmd.getZoneId();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
String zoneType = cmd.getZoneType();
|
||||
Long pod = cmd.getPodId();
|
||||
Long hostId = cmd.getHostId();
|
||||
String keyword = cmd.getKeyword();
|
||||
|
|
@ -1027,6 +1028,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.IN);
|
||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
|
||||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -1067,10 +1069,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
sc.setParameters("state", state);
|
||||
}
|
||||
|
||||
if (zone != null) {
|
||||
sc.setParameters("dataCenterId", zone);
|
||||
if (zoneId != null) {
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
}
|
||||
|
||||
if (zoneType != null) {
|
||||
sc.setParameters("dataCenterType", zoneType);
|
||||
}
|
||||
|
||||
if (pod != null) {
|
||||
sc.setParameters("podId", pod);
|
||||
}
|
||||
|
|
@ -1400,6 +1406,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
public Pair<List<HostJoinVO>, Integer> searchForServersInternal(ListHostsCmd cmd) {
|
||||
|
||||
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
|
||||
String zoneType = cmd.getZoneType();
|
||||
Object name = cmd.getHostName();
|
||||
Object type = cmd.getType();
|
||||
Object state = cmd.getState();
|
||||
|
|
@ -1421,6 +1428,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
sb.and("type", sb.entity().getType(), SearchCriteria.Op.LIKE);
|
||||
sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
|
||||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("resourceState", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -1465,6 +1473,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
if (zoneId != null) {
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
}
|
||||
if (zoneType != null) {
|
||||
sc.setParameters("dataCenterType", zoneType);
|
||||
}
|
||||
if (pod != null) {
|
||||
sc.setParameters("podId", pod);
|
||||
}
|
||||
|
|
@ -2208,10 +2219,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
Long id = cmd.getId();
|
||||
String keyword = cmd.getKeyword();
|
||||
String name = cmd.getName();
|
||||
String networkType = cmd.getZoneType();
|
||||
|
||||
Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchCriteria<DataCenterJoinVO> sc = _dcJoinDao.createSearchCriteria();
|
||||
|
||||
if(networkType != null)
|
||||
sc.addAnd("networkType", SearchCriteria.Op.EQ, networkType);
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
} else if (name != null) {
|
||||
|
|
|
|||
|
|
@ -203,8 +203,10 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
|
|||
accountResponse.setObjectName("account");
|
||||
|
||||
// set async job
|
||||
accountResponse.setJobId(account.getJobUuid());
|
||||
accountResponse.setJobStatus(account.getJobStatus());
|
||||
if (account.getJobId() != null) {
|
||||
accountResponse.setJobId(account.getJobUuid());
|
||||
accountResponse.setJobStatus(account.getJobStatus());
|
||||
}
|
||||
return accountResponse;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,8 +158,10 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO,
|
|||
routerResponse.setVpcId(router.getVpcUuid());
|
||||
|
||||
// set async job
|
||||
routerResponse.setJobId(router.getJobUuid());
|
||||
routerResponse.setJobStatus(router.getJobStatus());
|
||||
if (router.getJobId() != null) {
|
||||
routerResponse.setJobId(router.getJobUuid());
|
||||
routerResponse.setJobStatus(router.getJobStatus());
|
||||
}
|
||||
|
||||
routerResponse.setObjectName("router");
|
||||
|
||||
|
|
|
|||
|
|
@ -183,8 +183,10 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
|||
hostResponse.setResourceState(host.getResourceState().toString());
|
||||
|
||||
// set async job
|
||||
hostResponse.setJobId(host.getJobUuid());
|
||||
hostResponse.setJobStatus(host.getJobStatus());
|
||||
if (host.getJobId() != null) {
|
||||
hostResponse.setJobId(host.getJobUuid());
|
||||
hostResponse.setJobStatus(host.getJobStatus());
|
||||
}
|
||||
|
||||
hostResponse.setObjectName("host");
|
||||
|
||||
|
|
|
|||
|
|
@ -117,8 +117,10 @@ public class SecurityGroupJoinDaoImpl extends GenericDaoBase<SecurityGroupJoinVO
|
|||
}
|
||||
|
||||
// set async job
|
||||
sgResponse.setJobId(vsg.getJobUuid());
|
||||
sgResponse.setJobStatus(vsg.getJobStatus());
|
||||
if (vsg.getJobId() != null) {
|
||||
sgResponse.setJobId(vsg.getJobUuid());
|
||||
sgResponse.setJobStatus(vsg.getJobStatus());
|
||||
}
|
||||
|
||||
sgResponse.setObjectName("securitygroup");
|
||||
|
||||
|
|
|
|||
|
|
@ -103,8 +103,10 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
|
|||
poolResponse.setTags(pool.getTag());
|
||||
|
||||
// set async job
|
||||
poolResponse.setJobId(pool.getJobUuid());
|
||||
poolResponse.setJobStatus(pool.getJobStatus());
|
||||
if (pool.getJobId() != null) {
|
||||
poolResponse.setJobId(pool.getJobUuid());
|
||||
poolResponse.setJobStatus(pool.getJobStatus());
|
||||
}
|
||||
|
||||
poolResponse.setObjectName("storagepool");
|
||||
return poolResponse;
|
||||
|
|
|
|||
|
|
@ -83,8 +83,10 @@ public class UserAccountJoinDaoImpl extends GenericDaoBase<UserAccountJoinVO, Lo
|
|||
userResponse.setIsDefault(usr.isDefault());
|
||||
|
||||
// set async job
|
||||
userResponse.setJobId(usr.getJobUuid());
|
||||
userResponse.setJobStatus(usr.getJobStatus());
|
||||
if (usr.getJobId() != null) {
|
||||
userResponse.setJobId(usr.getJobUuid());
|
||||
userResponse.setJobStatus(usr.getJobStatus());
|
||||
}
|
||||
|
||||
userResponse.setObjectName("user");
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,10 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
|
|||
}
|
||||
}
|
||||
userVmResponse.setPassword(userVm.getPassword());
|
||||
userVmResponse.setJobId(userVm.getJobUuid());
|
||||
userVmResponse.setJobStatus(userVm.getJobStatus());
|
||||
if (userVm.getJobId() != null) {
|
||||
userVmResponse.setJobId(userVm.getJobUuid());
|
||||
userVmResponse.setJobStatus(userVm.getJobStatus());
|
||||
}
|
||||
//userVmResponse.setForVirtualNetwork(userVm.getForVirtualNetwork());
|
||||
|
||||
userVmResponse.setPublicIpId(userVm.getPublicIpUuid());
|
||||
|
|
|
|||
|
|
@ -197,8 +197,10 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
|
|||
volResponse.setExtractable(isExtractable);
|
||||
|
||||
// set async job
|
||||
volResponse.setJobId(volume.getJobUuid());
|
||||
volResponse.setJobStatus(volume.getJobStatus());
|
||||
if (volume.getJobId() != null) {
|
||||
volResponse.setJobId(volume.getJobUuid());
|
||||
volResponse.setJobStatus(volume.getJobStatus());
|
||||
}
|
||||
|
||||
volResponse.setObjectName("volume");
|
||||
return volResponse;
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||
private Long secondaryStorageTotal;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -645,12 +645,12 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||
}
|
||||
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
|||
private String projectName;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -781,14 +781,14 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
|||
}
|
||||
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity
|
|||
private long cpuReservedCapacity;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -427,11 +427,11 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity
|
|||
this.osCategoryName = osCategoryName;
|
||||
}
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
|
|||
private String projectName;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -269,11 +269,11 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
|
|||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -342,11 +342,11 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
this.reservedCapacity = reservedCapacity;
|
||||
}
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
private String domainPath = null;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -324,11 +324,11 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
this.loginAttempts = loginAttempts;
|
||||
}
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private String keypairName;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -1608,14 +1608,14 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
|
||||
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
private Storage.TemplateType templateType;
|
||||
|
||||
@Column(name="job_id")
|
||||
private long jobId;
|
||||
private Long jobId;
|
||||
|
||||
@Column(name="job_uuid")
|
||||
private String jobUuid;
|
||||
|
|
@ -817,13 +817,13 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity {
|
|||
|
||||
|
||||
|
||||
public long getJobId() {
|
||||
public Long getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setJobId(long jobId) {
|
||||
public void setJobId(Long jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,5 +41,5 @@ public interface CapacityDao extends GenericDao<CapacityVO, Long> {
|
|||
List<SummedCapacity> listCapacitiesGroupedByLevelAndType(Integer capacityType, Long zoneId, Long podId, Long clusterId, int level, Long limit);
|
||||
void updateCapacityState(Long dcId, Long podId, Long clusterId,
|
||||
Long hostId, String capacityState);
|
||||
List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, Float disableThreshold, long computeRequested);
|
||||
List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String ConfigName, long computeRequested);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -115,12 +116,20 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
|
|||
|
||||
private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit ";
|
||||
private static final String UPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE ";
|
||||
private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT cluster_id " +
|
||||
"FROM (SELECT cluster_id, ( (sum(capacity.used_capacity) + sum(capacity.reserved_capacity) + ?)/sum(total_capacity) ) ratio "+
|
||||
"FROM `cloud`.`op_host_capacity` capacity "+
|
||||
"WHERE capacity.data_center_id = ? AND capacity.capacity_type = ? AND capacity.total_capacity > 0 "+
|
||||
"GROUP BY cluster_id) tmp " +
|
||||
"WHERE tmp.ratio > ? ";
|
||||
|
||||
private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT clusterList.cluster_id " +
|
||||
"FROM ( SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value " +
|
||||
"FROM ( SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity total, " +
|
||||
"CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
|
||||
"WHEN 1 THEN ( SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
|
||||
"ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " +
|
||||
"END configValue " +
|
||||
"FROM `cloud`.`op_host_capacity` capacity " +
|
||||
"WHERE capacity.data_center_id = ? AND capacity.capacity_type = ? AND capacity.total_capacity > 0) cluster " +
|
||||
|
||||
"GROUP BY cluster.cluster_id) clusterList " +
|
||||
"WHERE clusterList.ratio > clusterList.value; ";
|
||||
|
||||
|
||||
|
||||
public CapacityDaoImpl() {
|
||||
|
|
@ -146,20 +155,22 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, Float disableThreshold, long compute_requested){
|
||||
public List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String configName, long compute_requested){
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
PreparedStatement pstmt = null;
|
||||
List<Long> result = new ArrayList<Long>();
|
||||
StringBuilder sql = new StringBuilder(LIST_CLUSTERS_CROSSING_THRESHOLD);
|
||||
|
||||
|
||||
// during listing the clusters that cross the threshold
|
||||
// we need to check with disabled thresholds of each cluster if not defined at cluster consider the global value
|
||||
try {
|
||||
pstmt = txn.prepareAutoCloseStatement(sql.toString());
|
||||
pstmt.setLong(1,compute_requested);
|
||||
pstmt.setShort(2,capacityType);
|
||||
pstmt.setFloat(3,disableThreshold);
|
||||
pstmt.setLong(4,zoneId);
|
||||
pstmt.setString(2, configName);
|
||||
pstmt.setString(3, configName);
|
||||
pstmt.setString(4, configName);
|
||||
pstmt.setLong(5,zoneId);
|
||||
pstmt.setShort(6,capacityType);
|
||||
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ public enum Config {
|
|||
CapacityCheckPeriod("Alert", ManagementServer.class, Integer.class, "capacity.check.period", "300000", "The interval in milliseconds between capacity checks", null),
|
||||
StorageAllocatedCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.storage.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of allocated storage utilization above which alerts will be sent about low storage available.", null),
|
||||
StorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.storage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available.", null),
|
||||
CPUCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available.", null),
|
||||
MemoryCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available.", null),
|
||||
CPUCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available.", null, ConfigurationParameterScope.cluster.toString()),
|
||||
MemoryCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available.", null, ConfigurationParameterScope.cluster.toString()),
|
||||
PublicIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.virtualnetwork.publicip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of public IP address space utilization above which alerts will be sent.", null),
|
||||
PrivateIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "pod.privateip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of private IP address space utilization above which alerts will be sent.", null),
|
||||
SecondaryStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.secstorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of secondary storage utilization above which alerts will be sent about low storage available.", null),
|
||||
|
|
@ -63,8 +63,8 @@ public enum Config {
|
|||
LocalStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.localStorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of local storage utilization above which alerts will be sent about low local storage available.", null),
|
||||
StorageAllocatedCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.", null),
|
||||
StorageCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.", null),
|
||||
CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null),
|
||||
MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null),
|
||||
CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigurationParameterScope.cluster.toString()),
|
||||
MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigurationParameterScope.cluster.toString()),
|
||||
|
||||
|
||||
// Storage
|
||||
|
|
@ -93,8 +93,8 @@ public enum Config {
|
|||
|
||||
GuestVlanBits("Network", ManagementServer.class, Integer.class, "guest.vlan.bits", "12", "The number of bits to reserve for the VLAN identifier in the guest subnet.", null),
|
||||
//MulticastThrottlingRate("Network", ManagementServer.class, Integer.class, "multicast.throttling.rate", "10", "Default multicast rate in megabits per second allowed.", null),
|
||||
NetworkThrottlingRate("Network", ManagementServer.class, Integer.class, "network.throttling.rate", "200", "Default data transfer rate in megabits per second allowed in network.", null),
|
||||
GuestDomainSuffix("Network", AgentManager.class, String.class, "guest.domain.suffix", "cloud.internal", "Default domain name for vms inside virtualized networks fronted by router", null),
|
||||
NetworkThrottlingRate("Network", ManagementServer.class, Integer.class, "network.throttling.rate", "200", "Default data transfer rate in megabits per second allowed in network.", null, ConfigurationParameterScope.zone.toString()),
|
||||
GuestDomainSuffix("Network", AgentManager.class, String.class, "guest.domain.suffix", "cloud.internal", "Default domain name for vms inside virtualized networks fronted by router", null, ConfigurationParameterScope.zone.toString()),
|
||||
DirectNetworkNoDefaultRoute("Network", ManagementServer.class, Boolean.class, "direct.network.no.default.route", "false", "Direct Network Dhcp Server should not send a default route", "true/false"),
|
||||
OvsTunnelNetwork("Network", ManagementServer.class, Boolean.class, "sdn.ovs.controller", "false", "Enable/Disable Open vSwitch SDN controller for L2-in-L3 overlay networks", null),
|
||||
OvsTunnelNetworkDefaultLabel("Network", ManagementServer.class, String.class, "sdn.ovs.controller.default.label", "cloud-public", "Default network label to be used when fetching interface for GRE endpoints", null),
|
||||
|
|
@ -112,7 +112,7 @@ public enum Config {
|
|||
|
||||
//VPN
|
||||
RemoteAccessVpnPskLength("Network", AgentManager.class, Integer.class, "remote.access.vpn.psk.length", "24", "The length of the ipsec preshared key (minimum 8, maximum 256)", null),
|
||||
RemoteAccessVpnClientIpRange("Network", AgentManager.class, String.class, "remote.access.vpn.client.iprange", "10.1.2.1-10.1.2.8", "The range of ips to be allocated to remote access vpn clients. The first ip in the range is used by the VPN server", null),
|
||||
RemoteAccessVpnClientIpRange("Network", AgentManager.class, String.class, "remote.access.vpn.client.iprange", "10.1.2.1-10.1.2.8", "The range of ips to be allocated to remote access vpn clients. The first ip in the range is used by the VPN server", null, ConfigurationParameterScope.account.toString()),
|
||||
RemoteAccessVpnUserLimit("Network", AgentManager.class, String.class, "remote.access.vpn.user.limit", "8", "The maximum number of VPN users that can be created per account", null),
|
||||
Site2SiteVpnConnectionPerVpnGatewayLimit("Network", ManagementServer.class, Integer.class, "site2site.vpn.vpngateway.connection.limit", "4", "The maximum number of VPN connection per VPN gateway", null),
|
||||
Site2SiteVpnSubnetsPerCustomerGatewayLimit("Network", ManagementServer.class, Integer.class, "site2site.vpn.customergateway.subnets.limit", "10", "The maximum number of subnets per customer gateway", null),
|
||||
|
|
@ -149,7 +149,7 @@ public enum Config {
|
|||
S3Enable("Advanced", ManagementServer.class, Boolean.class, "s3.enable", "false", "enable s3 ", null),
|
||||
EventPurgeInterval("Advanced", ManagementServer.class, Integer.class, "event.purge.interval", "86400", "The interval (in seconds) to wait before running the event purge thread", null),
|
||||
AccountCleanupInterval("Advanced", ManagementServer.class, Integer.class, "account.cleanup.interval", "86400", "The interval (in seconds) between cleanup for removed accounts", null),
|
||||
AllowPublicUserTemplates("Advanced", ManagementServer.class, Integer.class, "allow.public.user.templates", "true", "If false, users will not be able to create public templates.", null),
|
||||
AllowPublicUserTemplates("Advanced", ManagementServer.class, Integer.class, "allow.public.user.templates", "true", "If false, users will not be able to create public templates.", null, ConfigurationParameterScope.account.toString()),
|
||||
InstanceName("Advanced", AgentManager.class, String.class, "instance.name", "VM", "Name of the deployment instance.", "instanceName"),
|
||||
ExpungeDelay("Advanced", UserVmManager.class, Integer.class, "expunge.delay", "86400", "Determines how long (in seconds) to wait before actually expunging destroyed vm. The default value = the default value of expunge.interval", null),
|
||||
ExpungeInterval("Advanced", UserVmManager.class, Integer.class, "expunge.interval", "86400", "The interval (in seconds) to wait before running the expunge thread.", null),
|
||||
|
|
@ -419,7 +419,7 @@ public enum Config {
|
|||
global,
|
||||
zone,
|
||||
cluster,
|
||||
pool,
|
||||
storagepool,
|
||||
account
|
||||
}
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ public enum Config {
|
|||
static {
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.zone.toString(), new ArrayList<Config>());
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.cluster.toString(), new ArrayList<Config>());
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.pool.toString(), new ArrayList<Config>());
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.storagepool.toString(), new ArrayList<Config>());
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.account.toString(), new ArrayList<Config>());
|
||||
_scopeLevelConfigsMap.put(ConfigurationParameterScope.global.toString(), new ArrayList<Config>());
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
|||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
void updateConfiguration(long userId, String name, String category, String value, String scope, Long id);
|
||||
String updateConfiguration(long userId, String name, String category, String value, String scope, Long id);
|
||||
|
||||
/**
|
||||
* Creates a new service offering
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ import javax.naming.NamingException;
|
|||
import javax.naming.directory.DirContext;
|
||||
import javax.naming.directory.InitialDirContext;
|
||||
|
||||
import com.cloud.dc.*;
|
||||
import com.cloud.dc.dao.*;
|
||||
import com.cloud.user.*;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
|
|
@ -64,6 +66,10 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
|||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -72,20 +78,8 @@ import com.cloud.api.ApiDBUtils;
|
|||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.AccountVlanMapVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
import com.cloud.dc.DataCenterLinkLocalIpAddressVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DcDetailVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.PodVlanMapVO;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.deploy.DataCenterDeployment;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.DomainVO;
|
||||
|
|
@ -133,6 +127,7 @@ import com.cloud.org.Grouping;
|
|||
import com.cloud.org.Grouping.AllocationState;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectManager;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
|
|
@ -144,12 +139,6 @@ import com.cloud.storage.s3.S3Manager;
|
|||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.swift.SwiftManager;
|
||||
import com.cloud.test.IPRangeConfig;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
|
@ -182,8 +171,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Inject
|
||||
DataCenterDao _zoneDao;
|
||||
@Inject
|
||||
DcDetailsDao _zoneDetailsDao;
|
||||
@Inject
|
||||
DomainDao _domainDao;
|
||||
@Inject
|
||||
SwiftDao _swiftDao;
|
||||
|
|
@ -245,6 +232,18 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
FirewallRulesDao _firewallDao;
|
||||
@Inject
|
||||
VpcManager _vpcMgr;
|
||||
@Inject
|
||||
ConfigurationServer _configServer;
|
||||
@Inject
|
||||
DcDetailsDao _dcDetailsDao;
|
||||
@Inject
|
||||
ClusterDetailsDao _clusterDetailsDao;
|
||||
@Inject
|
||||
StoragePoolDetailsDao _storagePoolDetailsDao;
|
||||
@Inject
|
||||
AccountDetailsDao _accountDetailsDao;
|
||||
@Inject
|
||||
PrimaryDataStoreDao _storagePoolDao;
|
||||
|
||||
// FIXME - why don't we have interface for DataCenterLinkLocalIpAddressDao?
|
||||
@Inject protected DataCenterLinkLocalIpAddressDao _LinkLocalIpAllocDao;
|
||||
|
|
@ -323,9 +322,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
@Override
|
||||
@DB
|
||||
public void updateConfiguration(long userId, String name, String category, String value, String scope, Long resourceId) {
|
||||
public String updateConfiguration(long userId, String name, String category, String value, String scope, Long resourceId) {
|
||||
|
||||
String validationMsg = validateConfigurationValue(name, value, scope);
|
||||
String validationMsg = validateConfigurationValue(name, value);
|
||||
|
||||
if (validationMsg != null) {
|
||||
s_logger.error("Invalid configuration option, name: " + name + ", value:" + value);
|
||||
|
|
@ -335,23 +334,61 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// If scope of the parameter is given then it needs to be updated in the corresponding details table,
|
||||
// if scope is mentioned as global or not mentioned then it is normal global parameter updation
|
||||
if (scope != null && !scope.isEmpty() && !Config.ConfigurationParameterScope.global.toString().equalsIgnoreCase(scope)) {
|
||||
if (Config.ConfigurationParameterScope.zone.toString().equalsIgnoreCase(scope)) {
|
||||
DataCenterVO zone = _zoneDao.findById(resourceId);
|
||||
if (zone == null) {
|
||||
throw new InvalidParameterValueException("unable to find zone by id " + resourceId);
|
||||
}
|
||||
DcDetailVO dcDetailVO = _zoneDetailsDao.findDetail(resourceId, name.toLowerCase());
|
||||
if (dcDetailVO == null) {
|
||||
dcDetailVO = new DcDetailVO(zone.getId(), name, value);
|
||||
_zoneDetailsDao.persist(dcDetailVO);
|
||||
} else {
|
||||
dcDetailVO.setValue(value);
|
||||
_zoneDetailsDao.update(resourceId, dcDetailVO);
|
||||
}
|
||||
} else {
|
||||
s_logger.error("TO Do for the remaining levels (cluster/pool/account)");
|
||||
throw new InvalidParameterValueException("The scope "+ scope +" yet to be implemented");
|
||||
switch (Config.ConfigurationParameterScope.valueOf(scope)) {
|
||||
case zone: DataCenterVO zone = _zoneDao.findById(resourceId);
|
||||
if (zone == null) {
|
||||
throw new InvalidParameterValueException("unable to find zone by id " + resourceId);
|
||||
}
|
||||
DcDetailVO dcDetailVO = _dcDetailsDao.findDetail(resourceId, name.toLowerCase());
|
||||
if (dcDetailVO == null) {
|
||||
dcDetailVO = new DcDetailVO(resourceId, name, value);
|
||||
_dcDetailsDao.persist(dcDetailVO);
|
||||
} else {
|
||||
dcDetailVO.setValue(value);
|
||||
_dcDetailsDao.update(dcDetailVO.getId(), dcDetailVO);
|
||||
} break;
|
||||
case cluster: ClusterVO cluster = _clusterDao.findById(resourceId);
|
||||
if (cluster == null) {
|
||||
throw new InvalidParameterValueException("unable to find cluster by id " + resourceId);
|
||||
}
|
||||
ClusterDetailsVO clusterDetailsVO = _clusterDetailsDao.findDetail(resourceId, name);
|
||||
if (clusterDetailsVO == null) {
|
||||
clusterDetailsVO = new ClusterDetailsVO(resourceId, name, value);
|
||||
_clusterDetailsDao.persist(clusterDetailsVO);
|
||||
} else {
|
||||
clusterDetailsVO.setValue(value);
|
||||
_clusterDetailsDao.update(clusterDetailsVO.getId(), clusterDetailsVO);
|
||||
} break;
|
||||
|
||||
case storagepool: StoragePoolVO pool = _storagePoolDao.findById(resourceId);
|
||||
if (pool == null) {
|
||||
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
|
||||
}
|
||||
StoragePoolDetailVO storagePoolDetailVO = _storagePoolDetailsDao.findDetail(resourceId, name);
|
||||
if (storagePoolDetailVO == null) {
|
||||
storagePoolDetailVO = new StoragePoolDetailVO(resourceId, name, value);
|
||||
_storagePoolDetailsDao.persist(storagePoolDetailVO);
|
||||
|
||||
} else {
|
||||
storagePoolDetailVO.setValue(value);
|
||||
_storagePoolDetailsDao.update(storagePoolDetailVO.getId(), storagePoolDetailVO);
|
||||
} break;
|
||||
|
||||
case account: AccountVO account = _accountDao.findById(resourceId);
|
||||
if (account == null) {
|
||||
throw new InvalidParameterValueException("unable to find account by id " + resourceId);
|
||||
}
|
||||
AccountDetailVO accountDetailVO = _accountDetailsDao.findDetail(resourceId, name);
|
||||
if (accountDetailVO == null) {
|
||||
accountDetailVO = new AccountDetailVO(resourceId, name, value);
|
||||
_accountDetailsDao.persist(accountDetailVO);
|
||||
} else {
|
||||
accountDetailVO.setValue(value);
|
||||
_accountDetailsDao.update(accountDetailVO.getId(), accountDetailVO);
|
||||
} break;
|
||||
default: throw new InvalidParameterValueException("Scope provided is invalid");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Execute all updates in a single transaction
|
||||
|
|
@ -450,16 +487,19 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
txn.commit();
|
||||
return _configDao.getValue(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_CONFIGURATION_VALUE_EDIT, eventDescription = "updating configuration")
|
||||
public Configuration updateConfiguration(UpdateCfgCmd cmd) {
|
||||
public Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException {
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
String name = cmd.getCfgName();
|
||||
String value = cmd.getValue();
|
||||
String scope = cmd.getScope();
|
||||
Long id = cmd.getId();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
Long clusterId = cmd.getClusterId();
|
||||
Long storagepoolId = cmd.getStoragepoolId();
|
||||
Long accountId = cmd.getAccountId();
|
||||
UserContext.current().setEventDetails(" Name: " + name + " New Value: " + (((name.toLowerCase()).contains("password")) ? "*****" :
|
||||
(((value == null) ? "" : value))));
|
||||
// check if config value exists
|
||||
|
|
@ -476,17 +516,44 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
value = null;
|
||||
}
|
||||
|
||||
updateConfiguration(userId, name, config.getCategory(), value, scope, id);
|
||||
String updatedValue = _configDao.getValue(name);
|
||||
String scope = null;
|
||||
Long id = null;
|
||||
int paramCountCheck = 0;
|
||||
|
||||
if (zoneId != null) {
|
||||
scope = Config.ConfigurationParameterScope.zone.toString();
|
||||
id = zoneId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (clusterId != null) {
|
||||
scope = Config.ConfigurationParameterScope.cluster.toString();
|
||||
id = clusterId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (accountId != null) {
|
||||
scope = Config.ConfigurationParameterScope.account.toString();
|
||||
id = accountId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (storagepoolId != null) {
|
||||
scope = Config.ConfigurationParameterScope.storagepool.toString();
|
||||
id = storagepoolId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
|
||||
if (paramCountCheck > 1) {
|
||||
throw new InvalidParameterValueException("cannot handle multiple IDs, provide only one ID corresponding to the scope");
|
||||
}
|
||||
|
||||
String updatedValue = updateConfiguration(userId, name, config.getCategory(), value, scope, id);
|
||||
if ((value == null && updatedValue == null) || updatedValue.equalsIgnoreCase(value)) {
|
||||
return _configDao.findByName(name);
|
||||
|
||||
} else {
|
||||
throw new CloudRuntimeException("Unable to update configuration parameter " + name);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateConfigurationValue(String name, String value, String scope) {
|
||||
private String validateConfigurationValue(String name, String value) {
|
||||
|
||||
Config c = Config.getConfig(name);
|
||||
if (c == null) {
|
||||
|
|
@ -494,12 +561,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
return "Invalid configuration variable.";
|
||||
}
|
||||
String configScope = c.getScope();
|
||||
if (scope != null && !scope.isEmpty()) {
|
||||
if (!configScope.contains(scope)) {
|
||||
s_logger.error("Invalid scope " + scope + " for the parameter " + name);
|
||||
return "Invalid scope for the parameter.";
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> type = c.getType();
|
||||
|
||||
|
|
@ -4077,7 +4138,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
@Override
|
||||
public Integer getNetworkOfferingNetworkRate(long networkOfferingId) {
|
||||
public Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId) {
|
||||
|
||||
// validate network offering information
|
||||
NetworkOffering no = getNetworkOffering(networkOfferingId);
|
||||
|
|
@ -4089,7 +4150,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (no.getRateMbps() != null) {
|
||||
networkRate = no.getRateMbps();
|
||||
} else {
|
||||
networkRate = Integer.parseInt(_configDao.getValue(Config.NetworkThrottlingRate.key()));
|
||||
networkRate = Integer.parseInt(_configServer.getConfigValue(Config.NetworkThrottlingRate.key(), Config.ConfigurationParameterScope.zone.toString(), dataCenterId));
|
||||
}
|
||||
|
||||
// networkRate is unsigned int in netowrkOfferings table, and can't be
|
||||
|
|
@ -4225,7 +4286,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
@Override
|
||||
public Integer getServiceOfferingNetworkRate(long serviceOfferingId) {
|
||||
public Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId) {
|
||||
|
||||
// validate network offering information
|
||||
ServiceOffering offering = _serviceOfferingDao.findById(serviceOfferingId);
|
||||
|
|
@ -4239,7 +4300,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
} else {
|
||||
// for domain router service offering, get network rate from
|
||||
if (offering.getSystemVmType() != null && offering.getSystemVmType().equalsIgnoreCase(VirtualMachine.Type.DomainRouter.toString())) {
|
||||
networkRate = Integer.parseInt(_configDao.getValue(Config.NetworkThrottlingRate.key()));
|
||||
networkRate = Integer.parseInt(_configServer.getConfigValue(Config.NetworkThrottlingRate.key(), Config.ConfigurationParameterScope.zone.toString(), dataCenterId));
|
||||
} else {
|
||||
networkRate = Integer.parseInt(_configDao.getValue(Config.VmNetworkThrottlingRate.key()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -452,21 +452,6 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
|
|||
return disabledPods;
|
||||
}
|
||||
|
||||
private Map<Short,Float> getCapacityThresholdMap(){
|
||||
// Lets build this real time so that the admin wont have to restart MS if he changes these values
|
||||
Map<Short,Float> disableThresholdMap = new HashMap<Short, Float>();
|
||||
|
||||
String cpuDisableThresholdString = _configDao.getValue(Config.CPUCapacityDisableThreshold.key());
|
||||
float cpuDisableThreshold = NumbersUtil.parseFloat(cpuDisableThresholdString, 0.85F);
|
||||
disableThresholdMap.put(Capacity.CAPACITY_TYPE_CPU, cpuDisableThreshold);
|
||||
|
||||
String memoryDisableThresholdString = _configDao.getValue(Config.MemoryCapacityDisableThreshold.key());
|
||||
float memoryDisableThreshold = NumbersUtil.parseFloat(memoryDisableThresholdString, 0.85F);
|
||||
disableThresholdMap.put(Capacity.CAPACITY_TYPE_MEMORY, memoryDisableThreshold);
|
||||
|
||||
return disableThresholdMap;
|
||||
}
|
||||
|
||||
private List<Short> getCapacitiesForCheckingThreshold(){
|
||||
List<Short> capacityList = new ArrayList<Short>();
|
||||
capacityList.add(Capacity.CAPACITY_TYPE_CPU);
|
||||
|
|
@ -476,7 +461,6 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
|
|||
|
||||
private void removeClustersCrossingThreshold(List<Long> clusterListForVmAllocation, ExcludeList avoid, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
|
||||
|
||||
Map<Short,Float> capacityThresholdMap = getCapacityThresholdMap();
|
||||
List<Short> capacityList = getCapacitiesForCheckingThreshold();
|
||||
List<Long> clustersCrossingThreshold = new ArrayList<Long>();
|
||||
|
||||
|
|
@ -491,12 +475,11 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
|
|||
return;
|
||||
}
|
||||
if (capacity == Capacity.CAPACITY_TYPE_CPU) {
|
||||
clustersCrossingThreshold = _capacityDao.listClustersCrossingThreshold(capacity, plan.getDataCenterId(),
|
||||
capacityThresholdMap.get(capacity), cpu_requested);
|
||||
clustersCrossingThreshold = _capacityDao.listClustersCrossingThreshold(capacity, plan.getDataCenterId(), Config.CPUCapacityDisableThreshold.key(), cpu_requested);
|
||||
}
|
||||
else if (capacity == Capacity.CAPACITY_TYPE_MEMORY ) {
|
||||
clustersCrossingThreshold = _capacityDao.listClustersCrossingThreshold(capacity, plan.getDataCenterId(),
|
||||
capacityThresholdMap.get(capacity), ram_requested );
|
||||
Config.MemoryCapacityDisableThreshold.key(), ram_requested );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -506,8 +489,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
|
|||
// Remove clusters crossing disabled threshold
|
||||
clusterListForVmAllocation.removeAll(clustersCrossingThreshold);
|
||||
|
||||
s_logger.debug("Cannot allocate cluster list " + clustersCrossingThreshold.toString() + " for vm creation since their allocated percentage" +
|
||||
" crosses the disable capacity threshold: " + capacityThresholdMap.get(capacity) + " for capacity Type : " + capacity + ", skipping these clusters");
|
||||
s_logger.debug("Cannot allocate cluster list " + clustersCrossingThreshold.toString() + " for vm creation since their allocated percentage" +
|
||||
" crosses the disable capacity threshold defined at each cluster/ at global value for capacity Type : " + capacity + ", skipping these clusters");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import com.cloud.host.Host;
|
|||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.IpAddress.State;
|
||||
import com.cloud.network.Network.*;
|
||||
|
|
@ -153,6 +154,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
RemoteAccessVpnService _vpnMgr;
|
||||
@Inject
|
||||
PodVlanMapDao _podVlanMapDao;
|
||||
@Inject
|
||||
ConfigurationServer _configServer;
|
||||
|
||||
List<NetworkGuru> _networkGurus;
|
||||
public List<NetworkGuru> getNetworkGurus() {
|
||||
|
|
@ -245,7 +248,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
|
||||
int _networkGcWait;
|
||||
int _networkGcInterval;
|
||||
String _networkDomain;
|
||||
int _networkLockTimeout;
|
||||
|
||||
private Map<String, String> _configs;
|
||||
|
|
@ -866,7 +868,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
_networkGcInterval = NumbersUtil.parseInt(_configs.get(Config.NetworkGcInterval.key()), 600);
|
||||
|
||||
_configs = _configDao.getConfiguration("Network", params);
|
||||
_networkDomain = _configs.get(Config.GuestDomainSuffix.key());
|
||||
|
||||
_networkLockTimeout = NumbersUtil.parseInt(_configs.get(Config.NetworkLockTimeout.key()), 600);
|
||||
|
||||
|
|
@ -2023,7 +2024,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
|
||||
// 2) If null, generate networkDomain using domain suffix from the global config variables
|
||||
if (networkDomain == null) {
|
||||
networkDomain = "cs" + Long.toHexString(owner.getId()) + _networkDomain;
|
||||
networkDomain = "cs" + Long.toHexString(owner.getId()) + _configServer.getConfigValue(Config.GuestDomainSuffix.key(), Config.ConfigurationParameterScope.zone.toString(), zoneId);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.UnsupportedServiceException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.network.IpAddress.State;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.GuestType;
|
||||
|
|
@ -143,6 +144,8 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
|
||||
@Inject
|
||||
PodVlanMapDao _podVlanMapDao;
|
||||
@Inject
|
||||
ConfigurationServer _configServer;
|
||||
|
||||
List<NetworkElement> _networkElements;
|
||||
public List<NetworkElement> getNetworkElements() {
|
||||
|
|
@ -921,9 +924,9 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
}
|
||||
}
|
||||
if (isUserVmsDefaultNetwork || isDomRGuestOrPublicNetwork) {
|
||||
return _configMgr.getServiceOfferingNetworkRate(vm.getServiceOfferingId());
|
||||
return _configMgr.getServiceOfferingNetworkRate(vm.getServiceOfferingId(), vm.getDataCenterId());
|
||||
} else {
|
||||
return _configMgr.getNetworkOfferingNetworkRate(ntwkOff.getId());
|
||||
return _configMgr.getNetworkOfferingNetworkRate(ntwkOff.getId(), vm.getDataCenterId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1564,8 +1567,8 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultNetworkDomain() {
|
||||
return _networkDomain;
|
||||
public String getDefaultNetworkDomain(long zoneId) {
|
||||
return _configServer.getConfigValue(Config.GuestDomainSuffix.key(), Config.ConfigurationParameterScope.zone.toString(), zoneId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
}
|
||||
|
||||
|
||||
public String allocateSecondaryGuestIP (Account ipOwner, long zoneId, Long nicId, Long networkId, String requestedIp) throws InsufficientAddressCapacityException {
|
||||
public NicSecondaryIp allocateSecondaryGuestIP (Account ipOwner, long zoneId, Long nicId, Long networkId, String requestedIp) throws InsufficientAddressCapacityException {
|
||||
|
||||
Long accountId = null;
|
||||
Long domainId = null;
|
||||
|
|
@ -565,6 +565,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
return null;
|
||||
}
|
||||
|
||||
NicSecondaryIpVO secondaryIpVO;
|
||||
if (ipaddr != null) {
|
||||
// we got the ip addr so up the nics table and secodary ip
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
|
@ -580,11 +581,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
|
||||
s_logger.debug("Setting nic_secondary_ip table ...");
|
||||
vmId = nicVO.getInstanceId();
|
||||
NicSecondaryIpVO secondaryIpVO = new NicSecondaryIpVO(nicId, ipaddr, vmId, accountId, domainId, networkId);
|
||||
secondaryIpVO = new NicSecondaryIpVO(nicId, ipaddr, vmId, accountId, domainId, networkId);
|
||||
_nicSecondaryIpDao.persist(secondaryIpVO);
|
||||
txn.commit();
|
||||
return getNicSecondaryIp(secondaryIpVO.getId());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return ipaddr;
|
||||
}
|
||||
|
||||
@DB
|
||||
|
|
@ -676,6 +679,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
return true;
|
||||
}
|
||||
|
||||
NicSecondaryIp getNicSecondaryIp (long id) {
|
||||
NicSecondaryIp nicSecIp = _nicSecondaryIpDao.findById(id);
|
||||
if (nicSecIp == null) {
|
||||
return null;
|
||||
}
|
||||
return nicSecIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_NET_IP_RELEASE, eventDescription = "disassociating Ip", async = true)
|
||||
|
|
@ -1147,6 +1158,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
Long id = cmd.getId();
|
||||
String keyword = cmd.getKeyword();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
String zoneType = cmd.getZoneType();
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long domainId = cmd.getDomainId();
|
||||
String accountName = cmd.getAccountName();
|
||||
|
|
@ -1295,39 +1307,39 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
//get account level networks
|
||||
networksToReturn.addAll(listAccountSpecificNetworks(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
|
||||
permittedAccounts));
|
||||
//get domain level networks
|
||||
if (domainId != null) {
|
||||
networksToReturn
|
||||
.addAll(listDomainLevelNetworks(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
|
||||
physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
|
||||
physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
|
||||
domainId, false));
|
||||
}
|
||||
} else {
|
||||
//add account specific networks
|
||||
networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
|
||||
isRecursive));
|
||||
//add domain specific networks of domain + parent domains
|
||||
networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
|
||||
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
|
||||
isRecursive));
|
||||
//add networks of subdomains
|
||||
if (domainId == null) {
|
||||
networksToReturn
|
||||
.addAll(listDomainLevelNetworks(
|
||||
buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
|
||||
physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
|
||||
physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
|
||||
caller.getDomainId(), true));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId,
|
||||
guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags),
|
||||
guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType),
|
||||
searchFilter);
|
||||
}
|
||||
|
||||
|
|
@ -1372,7 +1384,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
|
||||
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id,
|
||||
Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
|
||||
String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags) {
|
||||
String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags, String zoneType) {
|
||||
|
||||
SearchCriteria<NetworkVO> sc = sb.create();
|
||||
|
||||
|
|
@ -1394,6 +1406,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
sc.setJoinParameters("zoneSearch", "networkType", zoneType);
|
||||
}
|
||||
|
||||
if (guestIpType != null) {
|
||||
sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.dao.*;
|
||||
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -56,10 +57,6 @@ import com.cloud.network.Networks.TrafficType;
|
|||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.NetworkRuleApplier;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
||||
import com.cloud.network.dao.FirewallRulesDao;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.IPAddressVO;
|
||||
import com.cloud.network.element.FirewallServiceProvider;
|
||||
import com.cloud.network.element.NetworkACLServiceProvider;
|
||||
import com.cloud.network.element.PortForwardingServiceProvider;
|
||||
|
|
@ -127,6 +124,8 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||
@Inject
|
||||
ResourceTagDao _resourceTagDao;
|
||||
@Inject
|
||||
NetworkDao _networkDao;
|
||||
@Inject
|
||||
VpcManager _vpcMgr;
|
||||
@Inject List<FirewallServiceProvider> _firewallElements;
|
||||
|
||||
|
|
@ -150,6 +149,11 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||
@Override
|
||||
public FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
|
||||
Network network = _networkDao.findById(rule.getNetworkId());
|
||||
if (network.getGuestType() == Network.GuestType.Shared) {
|
||||
throw new InvalidParameterValueException("Egress firewall rules are not supported for " + network.getGuestType() + " networks");
|
||||
}
|
||||
|
||||
return createFirewallRule(null, caller, rule.getXid(), rule.getSourcePortStart(),
|
||||
rule.getSourcePortEnd(), rule.getProtocol(), rule.getSourceCidrList(), rule.getIcmpCode(),
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
|
||||
// 2) If null, generate networkDomain using domain suffix from the global config variables
|
||||
if (networkDomain == null) {
|
||||
networkDomain = "cs" + Long.toHexString(owner.getId()) + _ntwkModel.getDefaultNetworkDomain();
|
||||
networkDomain = "cs" + Long.toHexString(owner.getId()) + _ntwkModel.getDefaultNetworkDomain(zoneId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ import com.cloud.network.rules.FirewallRule.Purpose;
|
|||
import com.cloud.network.rules.FirewallRuleVO;
|
||||
import com.cloud.network.rules.RulesManager;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.DomainManager;
|
||||
|
|
@ -100,6 +101,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
|
|||
@Inject UsageEventDao _usageEventDao;
|
||||
@Inject ConfigurationDao _configDao;
|
||||
@Inject List<RemoteAccessVPNServiceProvider> _vpnServiceProviders;
|
||||
@Inject ConfigurationServer _configServer;
|
||||
|
||||
|
||||
int _userLimit;
|
||||
|
|
@ -156,7 +158,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
|
|||
}
|
||||
|
||||
if (ipRange == null) {
|
||||
ipRange = _clientIpRange;
|
||||
ipRange = _configServer.getConfigValue(Config.RemoteAccessVpnClientIpRange.key(), Config.ConfigurationParameterScope.account.toString(), ipAddr.getAccountId());
|
||||
}
|
||||
String[] range = ipRange.split("-");
|
||||
if (range.length != 2) {
|
||||
|
|
@ -200,7 +202,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
|
|||
private void validateRemoteAccessVpnConfiguration() throws ConfigurationException {
|
||||
String ipRange = _clientIpRange;
|
||||
if (ipRange == null) {
|
||||
s_logger.warn("Remote Access VPN configuration missing client ip range -- ignoring");
|
||||
s_logger.warn("Remote Access VPN global configuration missing client ip range -- ignoring");
|
||||
return;
|
||||
}
|
||||
Integer pskLength = _pskLength;
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@ import com.cloud.dc.*;
|
|||
import com.cloud.dc.dao.DcDetailsDao;
|
||||
import com.cloud.user.*;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -59,6 +61,7 @@ import com.cloud.configuration.Resource.ResourceType;
|
|||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.configuration.dao.ResourceCountDao;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
|
|
@ -112,6 +115,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
|
||||
@Inject private ConfigurationDao _configDao;
|
||||
@Inject private DataCenterDao _zoneDao;
|
||||
@Inject private ClusterDao _clusterDao;
|
||||
@Inject private PrimaryDataStoreDao _storagePoolDao;
|
||||
@Inject private HostPodDao _podDao;
|
||||
@Inject private DiskOfferingDao _diskOfferingDao;
|
||||
@Inject private ServiceOfferingDao _serviceOfferingDao;
|
||||
|
|
@ -698,7 +703,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
return dcDetailVO.getValue();
|
||||
} break;
|
||||
|
||||
case cluster: ClusterDetailsVO cluster = _clusterDetailsDao.findById(resourceId);
|
||||
case cluster: ClusterVO cluster = _clusterDao.findById(resourceId);
|
||||
if (cluster == null) {
|
||||
throw new InvalidParameterValueException("unable to find cluster by id " + resourceId);
|
||||
}
|
||||
|
|
@ -707,7 +712,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
return clusterDetailsVO.getValue();
|
||||
} break;
|
||||
|
||||
case pool: StoragePoolDetailVO pool = _storagePoolDetailsDao.findById(resourceId);
|
||||
case storagepool: StoragePoolVO pool = _storagePoolDao.findById(resourceId);
|
||||
if (pool == null) {
|
||||
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
|
||||
}
|
||||
|
|
@ -716,7 +721,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
return storagePoolDetailVO.getValue();
|
||||
} break;
|
||||
|
||||
case account: AccountDetailVO account = _accountDetailsDao.findById(resourceId);
|
||||
case account: AccountVO account = _accountDao.findById(resourceId);
|
||||
if (account == null) {
|
||||
throw new InvalidParameterValueException("unable to find account by id " + resourceId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -616,48 +616,69 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
|
||||
@Override
|
||||
public Pair<List<? extends Cluster>, Integer> searchForClusters(ListClustersCmd cmd) {
|
||||
Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchCriteria<ClusterVO> sc = _clusterDao.createSearchCriteria();
|
||||
|
||||
Object id = cmd.getId();
|
||||
Object id = cmd.getId();
|
||||
Object name = cmd.getClusterName();
|
||||
Object podId = cmd.getPodId();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
Object hypervisorType = cmd.getHypervisorType();
|
||||
Object clusterType = cmd.getClusterType();
|
||||
Object allocationState = cmd.getAllocationState();
|
||||
String zoneType = cmd.getZoneType();
|
||||
String keyword = cmd.getKeyword();
|
||||
|
||||
zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
|
||||
|
||||
|
||||
|
||||
Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
|
||||
SearchBuilder<ClusterVO> sb = _clusterDao.createSearchBuilder();
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||
sb.and("clusterType", sb.entity().getClusterType(), SearchCriteria.Op.EQ);
|
||||
sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
|
||||
|
||||
if(zoneType != null) {
|
||||
SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
|
||||
zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
|
||||
sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
|
||||
SearchCriteria<ClusterVO> sc = sb.create();
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
sc.setParameters("id", id);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
|
||||
sc.setParameters("name", "%" + name + "%");
|
||||
}
|
||||
|
||||
if (podId != null) {
|
||||
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
|
||||
sc.setParameters("podId", podId);
|
||||
}
|
||||
|
||||
if (zoneId != null) {
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
}
|
||||
|
||||
if (hypervisorType != null) {
|
||||
sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType);
|
||||
sc.setParameters("hypervisorType", hypervisorType);
|
||||
}
|
||||
|
||||
if (clusterType != null) {
|
||||
sc.addAnd("clusterType", SearchCriteria.Op.EQ, clusterType);
|
||||
sc.setParameters("clusterType", clusterType);
|
||||
}
|
||||
|
||||
if (allocationState != null) {
|
||||
sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
|
||||
sc.setParameters("allocationState", allocationState);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
|
||||
}
|
||||
|
||||
if (keyword != null) {
|
||||
SearchCriteria<ClusterVO> ssc = _clusterDao.createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
|
@ -1068,17 +1089,29 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
|
||||
@Override
|
||||
public Pair<List<? extends Pod>, Integer> searchForPods(ListPodsByCmd cmd) {
|
||||
Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchCriteria<HostPodVO> sc = _hostPodDao.createSearchCriteria();
|
||||
|
||||
String podName = cmd.getPodName();
|
||||
Long id = cmd.getId();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
Object keyword = cmd.getKeyword();
|
||||
Object allocationState = cmd.getAllocationState();
|
||||
|
||||
String zoneType = cmd.getZoneType();
|
||||
zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
|
||||
|
||||
|
||||
Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
SearchBuilder<HostPodVO> sb = _hostPodDao.createSearchBuilder();
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
|
||||
|
||||
if(zoneType != null) {
|
||||
SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
|
||||
zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
|
||||
sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
SearchCriteria<HostPodVO> sc = sb.create();
|
||||
if (keyword != null) {
|
||||
SearchCriteria<HostPodVO> ssc = _hostPodDao.createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
|
|
@ -1088,21 +1121,25 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
}
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
sc.setParameters("id", id);
|
||||
}
|
||||
|
||||
|
||||
if (podName != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + podName + "%");
|
||||
sc.setParameters("name", "%" + podName + "%");
|
||||
}
|
||||
|
||||
|
||||
if (zoneId != null) {
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
}
|
||||
|
||||
|
||||
if (allocationState != null) {
|
||||
sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
|
||||
sc.setParameters("allocationState", allocationState);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
|
||||
}
|
||||
|
||||
|
||||
Pair<List<HostPodVO>, Integer> result = _hostPodDao.searchAndCount(sc, searchFilter);
|
||||
return new Pair<List<? extends Pod>, Integer>(result.first(), result.second());
|
||||
}
|
||||
|
|
@ -1237,16 +1274,41 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
Object name = cmd.getConfigName();
|
||||
Object category = cmd.getCategory();
|
||||
Object keyword = cmd.getKeyword();
|
||||
Long id = cmd.getId();
|
||||
String scope = cmd.getScope();
|
||||
Long zoneId = cmd.getZoneId();
|
||||
Long clusterId = cmd.getClusterId();
|
||||
Long storagepoolId = cmd.getStoragepoolId();
|
||||
Long accountId = cmd.getAccountId();
|
||||
String scope = null;
|
||||
Long id = null;
|
||||
int paramCountCheck = 0;
|
||||
|
||||
if (scope!= null && !scope.isEmpty()) {
|
||||
if (zoneId != null) {
|
||||
scope = Config.ConfigurationParameterScope.zone.toString();
|
||||
id = zoneId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (clusterId != null) {
|
||||
scope = Config.ConfigurationParameterScope.cluster.toString();
|
||||
id = clusterId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (accountId != null) {
|
||||
scope = Config.ConfigurationParameterScope.account.toString();
|
||||
id = accountId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
if (storagepoolId != null) {
|
||||
scope = Config.ConfigurationParameterScope.storagepool.toString();
|
||||
id = storagepoolId;
|
||||
paramCountCheck++;
|
||||
}
|
||||
|
||||
if (paramCountCheck > 1) {
|
||||
throw new InvalidParameterValueException("cannot handle multiple IDs, provide only one ID corresponding to the scope");
|
||||
}
|
||||
|
||||
if (scope != null && !scope.isEmpty()) {
|
||||
// getting the list of parameters at requested scope
|
||||
try {
|
||||
Config.ConfigurationParameterScope.valueOf(scope.toLowerCase());
|
||||
} catch (Exception e ) {
|
||||
throw new InvalidParameterValueException("Invalid scope " + scope + " while listing configuration parameters");
|
||||
}
|
||||
if (id == null) {
|
||||
throw new InvalidParameterValueException("Invalid id null, id is needed corresponding to the scope");
|
||||
}
|
||||
|
|
@ -1309,7 +1371,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
|
||||
return listTemplates(cmd.getId(), cmd.getIsoName(), cmd.getKeyword(), isoFilter, true, cmd.isBootable(), cmd.getPageSizeVal(),
|
||||
cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, true, cmd.listInReadyState(), permittedAccounts, caller,
|
||||
listProjectResourcesCriteria, tags);
|
||||
listProjectResourcesCriteria, tags, cmd.getZoneType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1342,12 +1404,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
|
||||
|
||||
return listTemplates(id, cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null, cmd.getPageSizeVal(), cmd.getStartIndex(),
|
||||
cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags);
|
||||
cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, cmd.getZoneType());
|
||||
}
|
||||
|
||||
private Set<Pair<Long, Long>> listTemplates(Long templateId, String name, String keyword, TemplateFilter templateFilter, boolean isIso,
|
||||
Boolean bootable, Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean showDomr, boolean onlyReady,
|
||||
List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
|
||||
List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
|
||||
|
||||
VMTemplateVO template = null;
|
||||
if (templateId != null) {
|
||||
|
|
@ -1388,7 +1450,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, tags);
|
||||
Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
|
||||
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
|
||||
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags);
|
||||
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
|
||||
|
||||
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
|
||||
if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
|
||||
|
|
@ -1412,7 +1474,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
|
||||
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers,
|
||||
bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
|
||||
permittedAccounts, caller, listProjectResourcesCriteria, tags);
|
||||
permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
|
||||
|
||||
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
|
||||
if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
|
||||
|
|
@ -1430,7 +1492,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
} else {
|
||||
if (template == null) {
|
||||
templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
|
||||
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags);
|
||||
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
|
||||
} else {
|
||||
// if template is not public, perform permission check here
|
||||
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
|
||||
|
|
@ -2640,6 +2702,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
public Pair<List<? extends VirtualMachine>, Integer> searchForSystemVm(ListSystemVMsCmd cmd) {
|
||||
String type = cmd.getSystemVmType();
|
||||
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
|
||||
String zoneType = cmd.getZoneType();
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getSystemVmName();
|
||||
String state = cmd.getState();
|
||||
|
|
@ -2666,6 +2729,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
sb.join("volumeSearch", volumeSearch, sb.entity().getId(), volumeSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
|
||||
zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
|
||||
sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
SearchCriteria<VMInstanceVO> sc = sb.create();
|
||||
|
||||
if (keyword != null) {
|
||||
|
|
@ -2706,6 +2775,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
sc.setJoinParameters("volumeSearch", "poolId", storageId);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
|
||||
}
|
||||
|
||||
Pair<List<VMInstanceVO>, Integer> result = _vmInstanceDao.searchAndCount(sc, searchFilter);
|
||||
return new Pair<List<? extends VirtualMachine>, Integer>(result.first(), result.second());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailV
|
|||
super();
|
||||
PoolSearch = createSearchBuilder();
|
||||
PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
|
||||
PoolSearch.and("name", PoolSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
PoolSearch.done();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>, StateDao<
|
|||
public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso,
|
||||
List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, Long zoneId,
|
||||
HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller,
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags);
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType);
|
||||
|
||||
public Set<Pair<Long, Long>> searchSwiftTemplates(String name, String keyword, TemplateFilter templateFilter,
|
||||
boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter,
|
||||
boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
|
||||
Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr,List<Account> permittedAccounts,
|
||||
Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
|
||||
Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (!permittedAccounts.isEmpty()) {
|
||||
for (Account permittedAccount : permittedAccounts) {
|
||||
|
|
@ -561,7 +561,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
sql = SELECT_TEMPLATE_HOST_REF;
|
||||
groupByClause = " GROUP BY t.id, h.data_center_id ";
|
||||
}
|
||||
if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) {
|
||||
if (((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) ||(zoneType != null && zoneId != null)) {
|
||||
dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +691,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
}
|
||||
|
||||
sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable, hyperType, zoneId,
|
||||
onlyReady, showDomr) + groupByClause + getOrderByLimit(pageSize, startIndex);
|
||||
onlyReady, showDomr, zoneType) + groupByClause + getOrderByLimit(pageSize, startIndex);
|
||||
|
||||
pstmt = txn.prepareStatement(sql);
|
||||
rs = pstmt.executeQuery();
|
||||
|
|
@ -752,7 +752,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
return templateZonePairList;
|
||||
}
|
||||
|
||||
private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady, boolean showDomr) {
|
||||
private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady, boolean showDomr, String zoneType) {
|
||||
String sql = "";
|
||||
if (keyword != null) {
|
||||
sql += " t.name LIKE \"%" + keyword + "%\" AND";
|
||||
|
|
@ -783,6 +783,9 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
}
|
||||
}else if (zoneId != null){
|
||||
sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;
|
||||
if (zoneType != null){
|
||||
sql += " AND dc.networktype = " + zoneType;
|
||||
}
|
||||
}else{
|
||||
sql += " AND tzr.removed is null ";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ import com.cloud.configuration.Resource.ResourceType;
|
|||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
|
|
@ -571,6 +572,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
|
|||
String keyword = cmd.getKeyword();
|
||||
String snapshotTypeStr = cmd.getSnapshotType();
|
||||
String intervalTypeStr = cmd.getIntervalType();
|
||||
String zoneType = cmd.getZoneType();
|
||||
Map<String, String> tags = cmd.getTags();
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
|
|
@ -602,17 +604,23 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
|
|||
sb.and("snapshotTypeNEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.NEQ);
|
||||
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
|
||||
for (int count=0; count < tags.size(); count++) {
|
||||
tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
|
||||
tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
|
||||
tagSearch.cp();
|
||||
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
|
||||
for (int count=0; count < tags.size(); count++) {
|
||||
tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
|
||||
tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
|
||||
tagSearch.cp();
|
||||
}
|
||||
tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
|
||||
sb.groupBy(sb.entity().getId());
|
||||
sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
|
||||
sb.groupBy(sb.entity().getId());
|
||||
sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
|
||||
zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
|
||||
sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
SearchCriteria<SnapshotVO> sc = sb.create();
|
||||
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
|
||||
|
|
@ -630,6 +638,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
|
|||
}
|
||||
}
|
||||
|
||||
if(zoneType != null) {
|
||||
sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
sc.setParameters("name", "%" + name + "%");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
|
|
@ -44,6 +45,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.storage.GuestOS;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
|
|
@ -82,6 +84,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
|
|||
protected @Inject ResourceLimitService _resourceLimitMgr;
|
||||
protected @Inject DataStoreManager storeMgr;
|
||||
@Inject TemplateManager templateMgr;
|
||||
@Inject ConfigurationServer _configServer;
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
|
|
@ -167,8 +170,8 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
|
|||
if (url.toLowerCase().contains("file://")) {
|
||||
throw new InvalidParameterValueException("File:// type urls are currently unsupported");
|
||||
}
|
||||
|
||||
boolean allowPublicUserTemplates = Boolean.parseBoolean(_configDao.getValue("allow.public.user.templates"));
|
||||
// check whether owner can create public templates
|
||||
boolean allowPublicUserTemplates = Boolean.parseBoolean(_configServer.getConfigValue(Config.AllowPublicUserTemplates.key(), Config.ConfigurationParameterScope.account.toString(), templateOwner.getId()));
|
||||
if (!isAdmin && !allowPublicUserTemplates && isPublic) {
|
||||
throw new InvalidParameterValueException("Only private templates/ISO can be created.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ import com.cloud.projects.Project;
|
|||
import com.cloud.projects.ProjectManager;
|
||||
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.LaunchPermissionVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
|
@ -253,6 +254,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
protected ResourceManager _resourceMgr;
|
||||
@Inject VolumeManager volumeMgr;
|
||||
@Inject VMTemplateHostDao templateHostDao;
|
||||
@Inject
|
||||
ConfigurationServer _configServer;
|
||||
|
||||
|
||||
int _primaryStorageDownloadWait;
|
||||
|
|
@ -1609,7 +1612,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
}
|
||||
|
||||
boolean isAdmin = _accountMgr.isAdmin(caller.getType());
|
||||
boolean allowPublicUserTemplates = Boolean.valueOf(_configDao.getValue("allow.public.user.templates"));
|
||||
// check configuration parameter(allow.public.user.templates) value for the template owner
|
||||
boolean allowPublicUserTemplates = Boolean.valueOf(_configServer.getConfigValue(Config.AllowPublicUserTemplates.key(), Config.ConfigurationParameterScope.account.toString(), template.getAccountId()));
|
||||
if (!isAdmin && !allowPublicUserTemplates && isPublic != null && isPublic) {
|
||||
throw new InvalidParameterValueException("Only private " + mediaType + "s can be created.");
|
||||
}
|
||||
|
|
@ -1842,8 +1846,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
if (isPublic == null) {
|
||||
isPublic = Boolean.FALSE;
|
||||
}
|
||||
boolean allowPublicUserTemplates = Boolean.parseBoolean(_configDao
|
||||
.getValue("allow.public.user.templates"));
|
||||
// check whether template owner can create public templates
|
||||
boolean allowPublicUserTemplates = Boolean.parseBoolean(_configServer.getConfigValue(Config.AllowPublicUserTemplates.key(), Config.ConfigurationParameterScope.account.toString(), templateOwner.getId()));
|
||||
if (!isAdmin && !allowPublicUserTemplates && isPublic) {
|
||||
throw new PermissionDeniedException("Failed to create template "
|
||||
+ name + ", only private templates can be created.");
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import com.cloud.upgrade.dao.Upgrade229to2210;
|
|||
import com.cloud.upgrade.dao.Upgrade301to302;
|
||||
import com.cloud.upgrade.dao.Upgrade302to40;
|
||||
import com.cloud.upgrade.dao.Upgrade30to301;
|
||||
import com.cloud.upgrade.dao.Upgrade40to41;
|
||||
import com.cloud.upgrade.dao.UpgradeSnapshot217to224;
|
||||
import com.cloud.upgrade.dao.UpgradeSnapshot223to224;
|
||||
import com.cloud.upgrade.dao.VersionDaoImpl;
|
||||
|
|
@ -53,87 +54,95 @@ public class PremiumDatabaseUpgradeChecker extends DatabaseUpgradeChecker {
|
|||
new Upgrade221to222Premium(), new UpgradeSnapshot217to224(), new Upgrade222to224Premium(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.1.8", new DbUpgrade[] { new Upgrade218to22Premium(), new Upgrade221to222Premium(),
|
||||
new UpgradeSnapshot217to224(), new Upgrade222to224Premium(), new Upgrade218to224DomainVlans(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213()
|
||||
, new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40() });
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.1.9", new DbUpgrade[] { new Upgrade218to22Premium(), new Upgrade221to222Premium(),
|
||||
new UpgradeSnapshot217to224(), new Upgrade222to224Premium(), new Upgrade218to224DomainVlans(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40() });
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.1", new DbUpgrade[] { new Upgrade221to222Premium(), new Upgrade222to224Premium(),
|
||||
new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(),
|
||||
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.2", new DbUpgrade[] { new Upgrade222to224Premium(), new UpgradeSnapshot223to224(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40() });
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.3", new DbUpgrade[] { new Upgrade222to224Premium(), new UpgradeSnapshot223to224(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.4", new DbUpgrade[] { new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(),
|
||||
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.5", new DbUpgrade[] { new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.6", new DbUpgrade[] { new Upgrade227to228Premium(), new Upgrade228to229(), new Upgrade229to2210(),
|
||||
new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.7", new DbUpgrade[] { new Upgrade227to228Premium(), new Upgrade228to229(), new Upgrade229to2210(),
|
||||
new Upgrade2210to2211(), new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.8", new DbUpgrade[] { new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
|
||||
new Upgrade2211to2212Premium(), new Upgrade2212to2213(), new Upgrade2213to2214(),
|
||||
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.9", new DbUpgrade[] { new Upgrade229to2210(), new Upgrade2210to2211(),
|
||||
new Upgrade2211to2212Premium(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
|
||||
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.10", new DbUpgrade[] { new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
|
||||
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.11", new DbUpgrade[] { new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
|
||||
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40() });
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.12", new DbUpgrade[] { new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
|
||||
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.13", new DbUpgrade[] { new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40() });
|
||||
_upgradeMap.put("2.2.13", new DbUpgrade[] { new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
|
||||
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("2.2.14", new DbUpgrade[] { new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
|
||||
new Upgrade302to40() });
|
||||
new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("3.0.0", new DbUpgrade[] { new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
|
||||
|
||||
_upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40() });
|
||||
|
||||
_upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40() });
|
||||
}
|
||||
_upgradeMap.put("3.0.0", new DbUpgrade[] { new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40(), new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("4.0.0", new DbUpgrade[] { new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("4.0.1", new DbUpgrade[] { new Upgrade40to41() });
|
||||
|
||||
_upgradeMap.put("4.0.2", new DbUpgrade[] { new Upgrade40to41() }); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2902,10 +2902,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
}
|
||||
|
||||
UserVO user = _userDao.findById(userId);
|
||||
|
||||
boolean status = false;
|
||||
try {
|
||||
VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
|
||||
vmEntity.stop(new Long(userId).toString());
|
||||
status = vmEntity.stop(new Long(userId).toString());
|
||||
if (status) {
|
||||
return _vmDao.findById(vmId);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ResourceUnavailableException e) {
|
||||
throw new CloudRuntimeException(
|
||||
"Unable to contact the agent to stop the virtual machine "
|
||||
|
|
@ -2915,8 +2920,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
"Unable to contact the agent to stop the virtual machine "
|
||||
+ vm, e);
|
||||
}
|
||||
|
||||
return _vmDao.findById(vmId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
vmGuru.finalizeStop(profile, answer);
|
||||
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString());
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.warn("Unable to stop vm, operation timed out: " + e.toString());
|
||||
} finally {
|
||||
if (!stopped) {
|
||||
if (!forced) {
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
}
|
||||
|
||||
@Override
|
||||
public String allocateSecondaryGuestIP(Account account, long zoneId,
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId,
|
||||
Long nicId, Long networkId, String ipaddress) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
* @see com.cloud.network.NetworkModel#getDefaultNetworkDomain()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultNetworkDomain() {
|
||||
public String getDefaultNetworkDomain(long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
* @see com.cloud.configuration.ConfigurationService#getNetworkOfferingNetworkRate(long)
|
||||
*/
|
||||
@Override
|
||||
public Integer getNetworkOfferingNetworkRate(long networkOfferingId) {
|
||||
public Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
* @see com.cloud.configuration.ConfigurationService#getServiceOfferingNetworkRate(long)
|
||||
*/
|
||||
@Override
|
||||
public Integer getServiceOfferingNetworkRate(long serviceOfferingId) {
|
||||
public Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -426,9 +426,9 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
* @see com.cloud.configuration.ConfigurationManager#updateConfiguration(long, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void updateConfiguration(long userId, String name, String category, String value, String scope, Long resourceId) {
|
||||
public String updateConfiguration(long userId, String name, String category, String value, String scope, Long resourceId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
|||
|
|
@ -1316,7 +1316,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
}
|
||||
|
||||
@Override
|
||||
public String allocateSecondaryGuestIP(Account account, long zoneId,
|
||||
public NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId,
|
||||
Long nicId, Long networkId, String ipaddress) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
* @see com.cloud.network.NetworkModel#getDefaultNetworkDomain()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultNetworkDomain() {
|
||||
public String getDefaultNetworkDomain(long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,17 @@ package org.apache.cloudstack.affinity;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.user.AccountDetailsDao;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.UserContextInitializer;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
|
@ -38,6 +45,8 @@ import com.cloud.api.query.dao.UserAccountJoinDaoImpl;
|
|||
import com.cloud.capacity.dao.CapacityDaoImpl;
|
||||
import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.dao.DcDetailsDao;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
|
|
@ -100,10 +109,6 @@ import com.cloud.storage.s3.S3Manager;
|
|||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.swift.SwiftManager;
|
||||
import com.cloud.tags.dao.ResourceTagsDaoImpl;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.UserContextInitializer;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.AccountDaoImpl;
|
||||
import com.cloud.user.dao.UserDaoImpl;
|
||||
|
|
@ -330,6 +335,22 @@ public class AffinityApiTestConfiguration {
|
|||
public DataCenterLinkLocalIpAddressDao datacenterLinkLocalIpAddressDao() {
|
||||
return Mockito.mock(DataCenterLinkLocalIpAddressDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationServer configurationServer() {
|
||||
return Mockito.mock(ConfigurationServer.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClusterDetailsDao clusterDetailsDao() {
|
||||
return Mockito.mock(ClusterDetailsDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AccountDetailsDao accountDetailsDao() {
|
||||
return Mockito.mock(AccountDetailsDao.class);
|
||||
}
|
||||
|
||||
|
||||
public static class Library implements TypeFilter {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,14 @@ package org.apache.cloudstack.networkoffering;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.dao.*;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.user.*;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
|
@ -37,18 +43,6 @@ import com.cloud.api.query.dao.UserAccountJoinDaoImpl;
|
|||
import com.cloud.capacity.dao.CapacityDaoImpl;
|
||||
import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterIpAddressDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDao;
|
||||
import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterVnetDaoImpl;
|
||||
import com.cloud.dc.dao.DcDetailsDaoImpl;
|
||||
import com.cloud.dc.dao.HostPodDaoImpl;
|
||||
import com.cloud.dc.dao.PodVlanDaoImpl;
|
||||
import com.cloud.dc.dao.PodVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.VlanDaoImpl;
|
||||
import com.cloud.domain.dao.DomainDaoImpl;
|
||||
import com.cloud.event.dao.UsageEventDaoImpl;
|
||||
import com.cloud.host.dao.HostDaoImpl;
|
||||
|
|
@ -97,10 +91,6 @@ import com.cloud.storage.s3.S3Manager;
|
|||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.swift.SwiftManager;
|
||||
import com.cloud.tags.dao.ResourceTagsDaoImpl;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.ResourceLimitService;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.user.UserContextInitializer;
|
||||
import com.cloud.user.dao.AccountDaoImpl;
|
||||
import com.cloud.user.dao.UserDaoImpl;
|
||||
import com.cloud.utils.component.SpringComponentScanUtils;
|
||||
|
|
@ -323,6 +313,22 @@ public class ChildTestConfiguration {
|
|||
public DataCenterLinkLocalIpAddressDao datacenterLinkLocalIpAddressDao() {
|
||||
return Mockito.mock(DataCenterLinkLocalIpAddressDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationServer configurationServer() {
|
||||
return Mockito.mock(ConfigurationServer.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClusterDetailsDao clusterDetailsDao() {
|
||||
return Mockito.mock(ClusterDetailsDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AccountDetailsDao accountDetailsDao() {
|
||||
return Mockito.mock(AccountDetailsDao.class);
|
||||
}
|
||||
|
||||
|
||||
public static class Library implements TypeFilter {
|
||||
|
||||
|
|
|
|||
|
|
@ -1110,3 +1110,7 @@ CREATE VIEW `cloud`.`account_view` AS
|
|||
and async_job.job_status = 0;
|
||||
|
||||
alter table `cloud_usage`.`usage_network_offering` add column nic_id bigint(20) unsigned NOT NULL;
|
||||
ALTER TABLE `cloud`.`data_center_details` MODIFY value varchar(1024);
|
||||
ALTER TABLE `cloud`.`cluster_details` MODIFY value varchar(255);
|
||||
ALTER TABLE `cloud`.`storage_pool_details` MODIFY value varchar(255);
|
||||
ALTER TABLE `cloud`.`account_details` MODIFY value varchar(255);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,238 @@
|
|||
# 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.
|
||||
""" Tests for Multiple IP Ranges feature
|
||||
"""
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.integration.lib.utils import *
|
||||
from marvin.integration.lib.base import *
|
||||
from marvin.integration.lib.common import *
|
||||
from netaddr import *
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
class Services:
|
||||
"""Test Multiple IP Ranges
|
||||
"""
|
||||
def __init__(self):
|
||||
self.services = {
|
||||
"account": {
|
||||
"email": "test@test.com",
|
||||
"firstname": "Test",
|
||||
"lastname": "User",
|
||||
"username": "test",
|
||||
# Random characters are appended for unique
|
||||
# username
|
||||
"password": "password",
|
||||
},
|
||||
"service_offering": {
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 200, # in MHz
|
||||
"memory": 256, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small Disk",
|
||||
"name": "Small Disk",
|
||||
"disksize": 1
|
||||
},
|
||||
"templates": {
|
||||
"displaytext": 'Template',
|
||||
"name": 'Template',
|
||||
"ostype": "CentOS 5.3 (64-bit)",
|
||||
"templatefilter": 'self',
|
||||
},
|
||||
"vlan_ip_range": {
|
||||
"startip": "",
|
||||
"endip": "",
|
||||
"netmask": "",
|
||||
"gateway": "",
|
||||
"forvirtualnetwork": "false",
|
||||
"vlan": "untagged",
|
||||
}
|
||||
}
|
||||
|
||||
class TestMultipleIpRanges(cloudstackTestCase):
|
||||
"""Test Multiple IP Ranges for guest network
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(TestMultipleIpRanges, cls).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
|
||||
cls.services['mode'] = cls.zone.networktype
|
||||
cls.services["domainid"] = cls.domain.id
|
||||
cls.services["zoneid"] = cls.zone.id
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
cls.services["account"] = cls.account.account.name
|
||||
cls._cleanup = [
|
||||
cls.account,
|
||||
]
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
#Cleanup resources used
|
||||
cleanup_resources(cls.api_client, cls._cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def setUp(self):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.cleanup = [ ]
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
#Clean up, terminate the resources created
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def increment_cidr(self):
|
||||
"""Takes CIDR as input and will increment by one and returns the new CIDR
|
||||
"""
|
||||
publicIpRange = PublicIpRange.list(self.apiclient)
|
||||
self.startIp = publicIpRange[0].startip
|
||||
self.endIp = publicIpRange[0].endip
|
||||
self.gateway = publicIpRange[0].gateway
|
||||
self.netmask = publicIpRange[0].netmask
|
||||
#Pass ip address and mask length to IPNetwork to findout the CIDR
|
||||
ip = IPNetwork(self.startIp+"/"+self.netmask)
|
||||
new_cidr = ip.__iadd__(1)
|
||||
ip2 = IPNetwork(new_cidr)
|
||||
return ip2
|
||||
|
||||
def verify_vlan_range(self,vlan,services):
|
||||
#compare vlan_list response with configured values
|
||||
self.assertEqual(
|
||||
isinstance(vlan, list),
|
||||
True,
|
||||
"Check list response returned a valid list"
|
||||
)
|
||||
self.assertNotEqual(
|
||||
len(vlan),
|
||||
0,
|
||||
"check list vlan response"
|
||||
)
|
||||
self.assertEqual(
|
||||
vlan[0].startip,
|
||||
services["startip"],
|
||||
"Start IP in vlan ip range is not matched with the configured start ip"
|
||||
)
|
||||
self.assertEqual(
|
||||
vlan[0].endip,
|
||||
services["endip"],
|
||||
"End IP in vlan ip range is not matched with the configured end ip"
|
||||
)
|
||||
self.assertEqual(
|
||||
vlan[0].gateway,
|
||||
services["gateway"],
|
||||
"gateway in vlan ip range is not matched with the configured gateway"
|
||||
)
|
||||
self.assertEqual(
|
||||
vlan[0].netmask,
|
||||
services["netmask"],
|
||||
"netmask in vlan ip range is not matched with the configured netmask"
|
||||
)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced_sg", "sg"])
|
||||
def test_01_add_ip_same_cidr(self):
|
||||
"""Test add guest ip range in the existing cidr
|
||||
"""
|
||||
#call increment_cidr function to get exiting cidr from the setup and increment it
|
||||
ip2 = self.increment_cidr()
|
||||
test_nw = ip2.network
|
||||
#Add IP range(5 IPs) in the new CIDR
|
||||
test_gateway = test_nw+1
|
||||
test_startIp = test_nw+2
|
||||
test_endIp = test_startIp+5
|
||||
test_startIp2= test_endIp+5
|
||||
test_endIp2 = test_startIp2+5
|
||||
#Populating services with new IP range
|
||||
self.services["vlan_ip_range"]["startip"] = test_startIp
|
||||
self.services["vlan_ip_range"]["endip"] = test_endIp
|
||||
self.services["vlan_ip_range"]["gateway"] = test_gateway
|
||||
self.services["vlan_ip_range"]["netmask"] = self.netmask
|
||||
self.services["vlan_ip_range"]["zoneid"] = self.zone.id
|
||||
self.services["vlan_ip_range"]["podid"] = self.pod.id
|
||||
#create new vlan ip range
|
||||
new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
|
||||
self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
|
||||
self.cleanup.append(new_vlan)
|
||||
new_vlan_res = new_vlan.list(self.apiclient,new_vlan.id)
|
||||
#Compare list output with configured values
|
||||
self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
|
||||
#Add few more ips in the same CIDR
|
||||
self.services["vlan_ip_range"]["startip"] = test_startIp2
|
||||
self.services["vlan_ip_range"]["endip"] = test_endIp2
|
||||
new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
|
||||
self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2))
|
||||
self.cleanup.append(new_vlan2)
|
||||
#list new vlan ip range
|
||||
new_vlan2_res = new_vlan2.list(self.apiclient,new_vlan2.id)
|
||||
#Compare list output with configured values
|
||||
self.verify_vlan_range(new_vlan2_res,self.services["vlan_ip_range"])
|
||||
return
|
||||
|
||||
@attr(tags=["advanced_sg", "sg"])
|
||||
def test_02_add_ip_diff_cidr(self):
|
||||
"""Test add ip range in a new cidr
|
||||
|
||||
Steps:
|
||||
1.Get public vlan range (guest cidr) from the setup
|
||||
2.Add IP range to a new cidr
|
||||
"""
|
||||
#call increment_cidr function to get exiting cidr from the setup and increment it
|
||||
ip2 = self.increment_cidr()
|
||||
test_nw = ip2.network
|
||||
#Add IP range(5 IPs) in the new CIDR
|
||||
test_gateway = test_nw+1
|
||||
test_startIp = test_nw+2
|
||||
test_endIp = test_startIp+5
|
||||
#Populating services with new IP range
|
||||
self.services["vlan_ip_range"]["startip"] = test_startIp
|
||||
self.services["vlan_ip_range"]["endip"] = test_endIp
|
||||
self.services["vlan_ip_range"]["gateway"] = test_gateway
|
||||
self.services["vlan_ip_range"]["netmask"] = self.netmask
|
||||
self.services["vlan_ip_range"]["zoneid"] = self.zone.id
|
||||
self.services["vlan_ip_range"]["podid"] = self.pod.id
|
||||
#create new vlan ip range
|
||||
new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
|
||||
self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
|
||||
self.cleanup.append(new_vlan)
|
||||
new_vlan_res = new_vlan.list(self.apiclient,new_vlan.id)
|
||||
#Compare list output with configured values
|
||||
self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
|
||||
return
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,447 @@
|
|||
# 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.
|
||||
|
||||
""" P1 tests for VPN users
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.integration.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
PublicIPAddress,
|
||||
Vpn,
|
||||
VpnUser,
|
||||
Configurations,
|
||||
NATRule
|
||||
)
|
||||
from marvin.integration.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
cleanup_resources,
|
||||
)
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test VPN users Services
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.services = {
|
||||
"account": {
|
||||
"email": "test@test.com",
|
||||
"firstname": "Test",
|
||||
"lastname": "User",
|
||||
"username": "test",
|
||||
# Random characters are appended for unique
|
||||
# username
|
||||
"password": "password",
|
||||
},
|
||||
"service_offering": {
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 128, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small Disk Offering",
|
||||
"name": "Small Disk Offering",
|
||||
"disksize": 1
|
||||
},
|
||||
"virtual_machine": {
|
||||
"displayname": "TestVM",
|
||||
"username": "root",
|
||||
"password": "password",
|
||||
"ssh_port": 22,
|
||||
"hypervisor": 'KVM',
|
||||
"privateport": 22,
|
||||
"publicport": 22,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"vpn_user": {
|
||||
"username": "test",
|
||||
"password": "test",
|
||||
},
|
||||
"natrule": {
|
||||
"privateport": 1701,
|
||||
"publicport": 1701,
|
||||
"protocol": "UDP"
|
||||
},
|
||||
"ostype": 'CentOS 5.5 (64-bit)',
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
# Networking mode: Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
class TestVPNUsers(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(TestVPNUsers,
|
||||
cls).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services["mode"] = cls.zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
|
||||
cls._cleanup = [cls.service_offering, ]
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
# Cleanup resources used
|
||||
cleanup_resources(cls.api_client, cls._cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def setUp(self):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.account = Account.create(
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
domainid=self.domain.id
|
||||
)
|
||||
self.virtual_machine = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
self.services["virtual_machine"],
|
||||
templateid=self.template.id,
|
||||
accountid=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
serviceofferingid=self.service_offering.id
|
||||
)
|
||||
self.public_ip = PublicIPAddress.create(
|
||||
self.apiclient,
|
||||
self.virtual_machine.account,
|
||||
self.virtual_machine.zoneid,
|
||||
self.virtual_machine.domainid,
|
||||
self.services["virtual_machine"]
|
||||
)
|
||||
self.cleanup = [
|
||||
self.account,
|
||||
]
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
# Clean up, terminate the created instance, volumes and snapshots
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def create_VPN(self, public_ip):
|
||||
"""Creates VPN for the network"""
|
||||
|
||||
self.debug("Creating VPN with public IP: %s" % public_ip.ipaddress.id)
|
||||
try:
|
||||
# Assign VPN to Public IP
|
||||
vpn = Vpn.create(self.apiclient,
|
||||
self.public_ip.ipaddress.id,
|
||||
account=self.account.account.name,
|
||||
domainid=self.account.account.domainid)
|
||||
|
||||
self.debug("Verifying the remote VPN access")
|
||||
vpns = Vpn.list(self.apiclient,
|
||||
publicipid=public_ip.ipaddress.id,
|
||||
listall=True)
|
||||
self.assertEqual(
|
||||
isinstance(vpns, list),
|
||||
True,
|
||||
"List VPNs shall return a valid response"
|
||||
)
|
||||
return vpn
|
||||
except Exception as e:
|
||||
self.fail("Failed to create remote VPN access: %s" % e)
|
||||
|
||||
def create_VPN_Users(self, rand_name=True, api_client=None):
|
||||
"""Creates VPN users for the network"""
|
||||
|
||||
self.debug("Creating VPN users for account: %s" %
|
||||
self.account.account.name)
|
||||
if api_client is None:
|
||||
api_client = self.apiclient
|
||||
try:
|
||||
vpnuser = VpnUser.create(
|
||||
api_client,
|
||||
self.services["vpn_user"]["username"],
|
||||
self.services["vpn_user"]["password"],
|
||||
account=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
rand_name=rand_name
|
||||
)
|
||||
|
||||
self.debug("Verifying the remote VPN access")
|
||||
vpn_users = VpnUser.list(self.apiclient,
|
||||
id=vpnuser.id,
|
||||
listall=True)
|
||||
self.assertEqual(
|
||||
isinstance(vpn_users, list),
|
||||
True,
|
||||
"List VPNs shall return a valid response"
|
||||
)
|
||||
return vpnuser
|
||||
except Exception as e:
|
||||
self.fail("Failed to create remote VPN users: %s" % e)
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
@attr(configuration='remote.access.vpn.user.limit')
|
||||
def test_01_VPN_user_limit(self):
|
||||
"""VPN remote access user limit tests"""
|
||||
|
||||
# Validate the following
|
||||
# prerequisite: change management configuration setting of
|
||||
# remote.access.vpn.user.limit
|
||||
# 1. provision more users than is set in the limit
|
||||
# Provisioning of users after the limit should failProvisioning of
|
||||
# users after the limit should fail
|
||||
|
||||
self.debug("Fetching the limit for remote access VPN users")
|
||||
configs = Configurations.list(
|
||||
self.apiclient,
|
||||
name='remote.access.vpn.user.limit',
|
||||
listall=True)
|
||||
self.assertEqual(isinstance(configs, list),
|
||||
True,
|
||||
"List configs should return a valid response")
|
||||
|
||||
limit = int(configs[0].value)
|
||||
|
||||
self.debug("Enabling the VPN access for IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
|
||||
self.create_VPN(self.public_ip)
|
||||
self.debug("Creating %s VPN users" % limit)
|
||||
for x in range(limit):
|
||||
self.create_VPN_Users()
|
||||
|
||||
self.debug("Adding another user exceeding limit for remote VPN users")
|
||||
with self.assertRaises(Exception):
|
||||
self.create_VPN_Users()
|
||||
self.debug("Limit exceeded exception raised!")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_02_use_vpn_port(self):
|
||||
"""Test create VPN when L2TP port in use"""
|
||||
|
||||
# Validate the following
|
||||
# 1. set a port forward for UDP: 1701 and enable VPN
|
||||
# 2. set port forward rule for the udp port 1701 over which L2TP works
|
||||
# 3. port forward should prevent VPN from being enabled
|
||||
|
||||
self.debug("Creating a port forwarding rule on port 1701")
|
||||
# Create NAT rule
|
||||
nat_rule = NATRule.create(
|
||||
self.apiclient,
|
||||
self.virtual_machine,
|
||||
self.services["natrule"],
|
||||
self.public_ip.ipaddress.id)
|
||||
|
||||
self.debug("Verifying the NAT rule created")
|
||||
nat_rules = NATRule.list(self.apiclient, id=nat_rule.id, listall=True)
|
||||
|
||||
self.assertEqual(isinstance(nat_rules, list),
|
||||
True,
|
||||
"List NAT rules should return a valid response")
|
||||
|
||||
self.debug("Enabling the VPN connection for IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
with self.assertRaises(Exception):
|
||||
self.create_VPN(self.public_ip)
|
||||
self.debug("Create VPN connection failed! Test successful!")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_03_enable_vpn_use_port(self):
|
||||
"""Test create NAT rule when VPN when L2TP enabled"""
|
||||
|
||||
# Validate the following
|
||||
# 1. Enable a VPN connection on source NAT
|
||||
# 2. Add a VPN user
|
||||
# 3. add a port forward rule for UDP port 1701. Should result in error
|
||||
# saying that VPN is enabled over port 1701
|
||||
|
||||
self.debug("Enabling the VPN connection for IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
self.create_VPN(self.public_ip)
|
||||
|
||||
self.debug("Creating a port forwarding rule on port 1701")
|
||||
# Create NAT rule
|
||||
with self.assertRaises(Exception):
|
||||
NATRule.create(
|
||||
self.apiclient,
|
||||
self.virtual_machine,
|
||||
self.services["natrule"],
|
||||
self.public_ip.ipaddress.id)
|
||||
|
||||
self.debug("Create NAT rule failed! Test successful!")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_04_add_new_users(self):
|
||||
"""Test add new users to existing VPN"""
|
||||
|
||||
# Validate the following
|
||||
# 1. Enable a VPN connection on source NAT
|
||||
# 2. Add new user to VPN when there are already existing users.
|
||||
# 3. We should be able to successfully establish a VPN connection using
|
||||
# the newly added user credential.
|
||||
|
||||
self.debug("Enabling the VPN connection for IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
self.create_VPN(self.public_ip)
|
||||
|
||||
try:
|
||||
self.debug("Adding new VPN user to account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN_Users()
|
||||
|
||||
# TODO: Verify the VPN connection
|
||||
self.debug("Adding another user to account")
|
||||
self.create_VPN_Users()
|
||||
|
||||
# TODO: Verify the VPN connection with new user
|
||||
except Exception as e:
|
||||
self.fail("Failed to create new VPN user: %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_05_add_duplicate_user(self):
|
||||
"""Test add duplicate user to existing VPN"""
|
||||
|
||||
# Validate the following
|
||||
# 1. Enable a VPN connection on source NAT
|
||||
# 2. Add a VPN user say "abc" that already an added user to the VPN.
|
||||
# 3. Adding this VPN user should fail.
|
||||
|
||||
self.debug("Enabling the VPN connection for IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
self.create_VPN(self.public_ip)
|
||||
|
||||
self.debug("Adding new VPN user to account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN_Users(rand_name=False)
|
||||
|
||||
# TODO: Verify the VPN connection
|
||||
self.debug("Adding another user to account with same username")
|
||||
with self.assertRaises(Exception):
|
||||
self.create_VPN_Users(rand_name=False)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_06_add_VPN_user_global_admin(self):
|
||||
"""Test as global admin, add a new VPN user to an existing VPN entry
|
||||
that was created by another account."""
|
||||
|
||||
# Steps for verification
|
||||
# 1. Create a new user and deploy few Vms.
|
||||
# 2. Enable VPN access. Add few VPN users.
|
||||
# 3. Make sure that VPN access works as expected.
|
||||
# 4. As global Admin , add VPN user to this user's existing VPN entry.
|
||||
# Validate the following
|
||||
# 1. The newly added VPN user should get configured to the router of
|
||||
# user account.
|
||||
# 2. We should be able to use this newly created user credential to
|
||||
# establish VPN connection that will give access all VMs of this user
|
||||
|
||||
self.debug("Enabling VPN connection to account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN(self.public_ip)
|
||||
self.debug("Creating VPN user for the account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN_Users()
|
||||
|
||||
self.debug("Creating a global admin account")
|
||||
admin = Account.create(self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True,
|
||||
domainid=self.account.account.domainid)
|
||||
self.cleanup.append(admin)
|
||||
self.debug("Creating API client for newly created user")
|
||||
api_client = self.testClient.createUserApiClient(
|
||||
UserName=self.account.account.name,
|
||||
DomainName=self.account.account.domain)
|
||||
|
||||
self.debug("Adding new user to VPN as a global admin: %s" %
|
||||
admin.account.name)
|
||||
try:
|
||||
self.create_VPN_Users(api_client=api_client)
|
||||
except Exception as e:
|
||||
self.fail("Global admin should be allowed to create VPN user: %s" %
|
||||
e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns"])
|
||||
def test_07_add_VPN_user_domain_admin(self):
|
||||
"""Test as domain admin, add a new VPN user to an existing VPN entry
|
||||
that was created by another account."""
|
||||
|
||||
# Steps for verification
|
||||
# 1. Create a new user and deploy few Vms.
|
||||
# 2. Enable VPN access. Add few VPN users.
|
||||
# 3. Make sure that VPN access works as expected.
|
||||
# 4. As domain Admin , add VPN user to this user's existing VPN entry.
|
||||
# Validate the following
|
||||
# 1. The newly added VPN user should get configured to the router of
|
||||
# user account.
|
||||
# 2. We should be able to use this newly created user credential to
|
||||
# establish VPN connection that will give access all VMs of this user
|
||||
|
||||
self.debug("Enabling VPN connection to account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN(self.public_ip)
|
||||
self.debug("Creating VPN user for the account: %s" %
|
||||
self.account.account.name)
|
||||
self.create_VPN_Users()
|
||||
|
||||
self.debug("Creating a domain admin account")
|
||||
admin = Account.create(self.apiclient,
|
||||
self.services["account"],
|
||||
domainid=self.account.account.domainid)
|
||||
self.cleanup.append(admin)
|
||||
self.debug("Creating API client for newly created user")
|
||||
api_client = self.testClient.createUserApiClient(
|
||||
UserName=self.account.account.name,
|
||||
DomainName=self.account.account.domain)
|
||||
|
||||
self.debug("Adding new user to VPN as a domain admin: %s" %
|
||||
admin.account.name)
|
||||
try:
|
||||
self.create_VPN_Users(api_client=api_client)
|
||||
except Exception as e:
|
||||
self.fail("Domain admin should be allowed to create VPN user: %s" %
|
||||
e)
|
||||
return
|
||||
|
|
@ -39,22 +39,22 @@ class TestUpdateConfigWithScope(cloudstackTestCase):
|
|||
updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
|
||||
updateConfigurationCmd.name = "use.external.dns"
|
||||
updateConfigurationCmd.value = "true"
|
||||
updateConfigurationCmd.scope = "zone"
|
||||
updateConfigurationCmd.id = 1
|
||||
updateConfigurationCmd.scopename = "zone"
|
||||
updateConfigurationCmd.scopeid = 1
|
||||
|
||||
updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
|
||||
self.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name, updateConfigurationResponse.value))
|
||||
|
||||
listConfigurationsCmd = listConfigurations.listConfigurationsCmd()
|
||||
listConfigurationsCmd.cfgName = updateConfigurationResponse.name
|
||||
listConfigurationsCmd.scope = "zone"
|
||||
listConfigurationsCmd.id = 1
|
||||
listConfigurationsCmd.scopename = "zone"
|
||||
listConfigurationsCmd.scopeid = 1
|
||||
listConfigurationsResponse = self.apiClient.listConfigurations(listConfigurationsCmd)
|
||||
|
||||
self.assertNotEqual(len(listConfigurationsResponse), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
configParam = listConfigurationsResponse[0]
|
||||
configParam = listConfigurationsResponse[2]
|
||||
self.assertEqual(configParam.value, updateConfigurationResponse.value, "Check if the update API returned \
|
||||
is the same as the one we got in the list API")
|
||||
|
||||
|
|
@ -67,6 +67,6 @@ class TestUpdateConfigWithScope(cloudstackTestCase):
|
|||
updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
|
||||
updateConfigurationCmd.name = "use.external.dns"
|
||||
updateConfigurationCmd.value = "false"
|
||||
updateConfigurationCmd.scope = "zone"
|
||||
updateConfigurationCmd.id = 1
|
||||
updateConfigurationCmd.scopename = "zone"
|
||||
updateConfigurationCmd.scopeid = 1
|
||||
self.apiClient.updateConfiguration(updateConfigurationCmd)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class job(object):
|
|||
def __init__(self):
|
||||
self.id = None
|
||||
self.cmd = None
|
||||
|
||||
|
||||
class jobStatus(object):
|
||||
def __init__(self):
|
||||
self.result = None
|
||||
|
|
@ -37,8 +39,11 @@ class jobStatus(object):
|
|||
self.duration = None
|
||||
self.jobId = None
|
||||
self.responsecls = None
|
||||
|
||||
def __str__(self):
|
||||
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v) in self.__dict__.iteritems()))
|
||||
|
||||
|
||||
class workThread(threading.Thread):
|
||||
def __init__(self, in_queue, outqueue, apiClient, db=None, lock=None):
|
||||
threading.Thread.__init__(self)
|
||||
|
|
@ -47,11 +52,11 @@ class workThread(threading.Thread):
|
|||
self.connection = apiClient.connection.__copy__()
|
||||
self.db = None
|
||||
self.lock = lock
|
||||
|
||||
|
||||
def queryAsynJob(self, job):
|
||||
if job.jobId is None:
|
||||
return job
|
||||
|
||||
|
||||
try:
|
||||
self.lock.acquire()
|
||||
result = self.connection.poll(job.jobId, job.responsecls).jobresult
|
||||
|
|
@ -59,10 +64,10 @@ class workThread(threading.Thread):
|
|||
result = str(e)
|
||||
finally:
|
||||
self.lock.release()
|
||||
|
||||
|
||||
job.result = result
|
||||
return job
|
||||
|
||||
|
||||
def executeCmd(self, job):
|
||||
cmd = job.cmd
|
||||
|
||||
|
|
@ -70,14 +75,15 @@ class workThread(threading.Thread):
|
|||
jobId = None
|
||||
try:
|
||||
self.lock.acquire()
|
||||
|
||||
|
||||
if cmd.isAsync == "false":
|
||||
jobstatus.startTime = datetime.datetime.now()
|
||||
|
||||
|
||||
result = self.connection.make_request(cmd)
|
||||
jobstatus.result = result
|
||||
jobstatus.endTime = datetime.datetime.now()
|
||||
jobstatus.duration = time.mktime(jobstatus.endTime.timetuple()) - time.mktime(jobstatus.startTime.timetuple())
|
||||
jobstatus.duration = time.mktime(jobstatus.endTime.timetuple()) - time.mktime(
|
||||
jobstatus.startTime.timetuple())
|
||||
else:
|
||||
result = self.connection.make_request(cmd, None, True)
|
||||
if result is None:
|
||||
|
|
@ -99,9 +105,9 @@ class workThread(threading.Thread):
|
|||
jobstatus.result = sys.exc_info()
|
||||
finally:
|
||||
self.lock.release()
|
||||
|
||||
|
||||
return jobstatus
|
||||
|
||||
|
||||
def run(self):
|
||||
while self.inqueue.qsize() > 0:
|
||||
job = self.inqueue.get()
|
||||
|
|
@ -109,18 +115,20 @@ class workThread(threading.Thread):
|
|||
jobstatus = self.queryAsynJob(job)
|
||||
else:
|
||||
jobstatus = self.executeCmd(job)
|
||||
|
||||
|
||||
self.output.put(jobstatus)
|
||||
self.inqueue.task_done()
|
||||
|
||||
|
||||
'''release the resource'''
|
||||
self.connection.close()
|
||||
|
||||
|
||||
class jobThread(threading.Thread):
|
||||
def __init__(self, inqueue, interval):
|
||||
threading.Thread.__init__(self)
|
||||
self.inqueue = inqueue
|
||||
self.interval = interval
|
||||
|
||||
def run(self):
|
||||
while self.inqueue.qsize() > 0:
|
||||
job = self.inqueue.get()
|
||||
|
|
@ -130,23 +138,25 @@ class jobThread(threading.Thread):
|
|||
job.apiClient.connection.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
self.inqueue.task_done()
|
||||
time.sleep(self.interval)
|
||||
|
||||
|
||||
|
||||
class outputDict(object):
|
||||
def __init__(self):
|
||||
self.lock = threading.Condition()
|
||||
self.dict = {}
|
||||
self.dict = {}
|
||||
|
||||
|
||||
class asyncJobMgr(object):
|
||||
def __init__(self, apiClient, db):
|
||||
self.inqueue = Queue.Queue()
|
||||
self.output = outputDict()
|
||||
self.output = outputDict()
|
||||
self.outqueue = Queue.Queue()
|
||||
self.apiClient = apiClient
|
||||
self.db = db
|
||||
|
||||
|
||||
def submitCmds(self, cmds):
|
||||
if not self.inqueue.empty():
|
||||
return False
|
||||
|
|
@ -160,11 +170,12 @@ class asyncJobMgr(object):
|
|||
id += 1
|
||||
ids.append(id)
|
||||
return ids
|
||||
|
||||
|
||||
def updateTimeStamp(self, jobstatus):
|
||||
jobId = jobstatus.jobId
|
||||
if jobId is not None and self.db is not None:
|
||||
result = self.db.execute("select job_status, created, last_updated from async_job where id=%s"%jobId)
|
||||
result = self.db.execute(
|
||||
"select job_status, created, last_updated from async_job where id='%s'" % str(jobId))
|
||||
if result is not None and len(result) > 0:
|
||||
if result[0][0] == 1:
|
||||
jobstatus.status = True
|
||||
|
|
@ -174,7 +185,7 @@ class asyncJobMgr(object):
|
|||
jobstatus.endTime = result[0][2]
|
||||
delta = jobstatus.endTime - jobstatus.startTime
|
||||
jobstatus.duration = delta.total_seconds()
|
||||
|
||||
|
||||
def waitForComplete(self, workers=10):
|
||||
self.inqueue.join()
|
||||
lock = threading.Lock()
|
||||
|
|
@ -183,28 +194,30 @@ class asyncJobMgr(object):
|
|||
for i in range(workers):
|
||||
worker = workThread(self.outqueue, resultQueue, self.apiClient, self.db, lock)
|
||||
worker.start()
|
||||
|
||||
|
||||
self.outqueue.join()
|
||||
|
||||
|
||||
asyncJobResult = []
|
||||
while resultQueue.qsize() > 0:
|
||||
jobstatus = resultQueue.get()
|
||||
self.updateTimeStamp(jobstatus)
|
||||
asyncJobResult.append(jobstatus)
|
||||
|
||||
|
||||
return asyncJobResult
|
||||
|
||||
|
||||
'''put commands into a queue at first, then start workers numbers threads to execute this commands'''
|
||||
|
||||
def submitCmdsAndWait(self, cmds, workers=10):
|
||||
self.submitCmds(cmds)
|
||||
lock = threading.Lock()
|
||||
for i in range(workers):
|
||||
worker = workThread(self.inqueue, self.outqueue, self.apiClient, self.db, lock)
|
||||
worker.start()
|
||||
|
||||
|
||||
return self.waitForComplete(workers)
|
||||
|
||||
'''submit one job and execute the same job ntimes, with nums_threads of threads'''
|
||||
|
||||
def submitJobExecuteNtimes(self, job, ntimes=1, nums_threads=1, interval=1):
|
||||
inqueue1 = Queue.Queue()
|
||||
lock = threading.Condition()
|
||||
|
|
@ -213,22 +226,23 @@ class asyncJobMgr(object):
|
|||
setattr(newjob, "apiClient", copy.copy(self.apiClient))
|
||||
setattr(newjob, "lock", lock)
|
||||
inqueue1.put(newjob)
|
||||
|
||||
|
||||
for i in range(nums_threads):
|
||||
work = jobThread(inqueue1, interval)
|
||||
work.start()
|
||||
inqueue1.join()
|
||||
|
||||
|
||||
'''submit n jobs, execute them with nums_threads of threads'''
|
||||
|
||||
def submitJobs(self, jobs, nums_threads=1, interval=1):
|
||||
inqueue1 = Queue.Queue()
|
||||
lock = threading.Condition()
|
||||
|
||||
|
||||
for job in jobs:
|
||||
setattr(job, "apiClient", copy.copy(self.apiClient))
|
||||
setattr(job, "lock", lock)
|
||||
inqueue1.put(job)
|
||||
|
||||
|
||||
for i in range(nums_threads):
|
||||
work = jobThread(inqueue1, interval)
|
||||
work.start()
|
||||
|
|
|
|||
|
|
@ -33,13 +33,18 @@ from requests import RequestException
|
|||
class cloudConnection(object):
|
||||
""" Connections to make API calls to the cloudstack management server
|
||||
"""
|
||||
def __init__(self, mgtSvr, port=8096, apiKey=None, securityKey=None,
|
||||
def __init__(self, mgtSvr, port=8096, user=None, passwd=None,
|
||||
apiKey=None, securityKey=None,
|
||||
asyncTimeout=3600, logging=None, scheme='http',
|
||||
path='client/api'):
|
||||
self.apiKey = apiKey
|
||||
self.securityKey = securityKey
|
||||
self.mgtSvr = mgtSvr
|
||||
self.port = port
|
||||
if user:
|
||||
self.user = user
|
||||
if passwd:
|
||||
self.passwd = passwd
|
||||
self.logging = logging
|
||||
self.path = path
|
||||
self.retries = 5
|
||||
|
|
@ -55,9 +60,10 @@ class cloudConnection(object):
|
|||
% (self.protocol, self.mgtSvr, self.port, self.path)
|
||||
|
||||
def __copy__(self):
|
||||
return cloudConnection(self.mgtSvr, self.port, self.apiKey,
|
||||
self.securityKey, self.asyncTimeout,
|
||||
self.logging, self.protocol, self.path)
|
||||
return cloudConnection(self.mgtSvr, self.port, self.user, self.passwd,
|
||||
self.apiKey, self.securityKey,
|
||||
self.asyncTimeout, self.logging, self.protocol,
|
||||
self.path)
|
||||
|
||||
def poll(self, jobid, response):
|
||||
"""
|
||||
|
|
@ -200,7 +206,8 @@ class cloudConnection(object):
|
|||
@return:
|
||||
"""
|
||||
cmdname, isAsync, payload = self.sanitize_command(cmd)
|
||||
self.logging.debug("sending %s request: %s %s" % (method, cmdname, str(payload)))
|
||||
self.logging.debug("sending %s request: %s %s" % (method, cmdname,
|
||||
str(payload)))
|
||||
response = self.request(
|
||||
cmdname, self.auth, payload=payload, method=method)
|
||||
self.logging.debug("Request: %s Response: %s" %
|
||||
|
|
|
|||
|
|
@ -18,24 +18,29 @@
|
|||
import cloudstackConnection
|
||||
import asyncJobMgr
|
||||
import dbConnection
|
||||
from cloudstackAPI import *
|
||||
from cloudstackAPI import *
|
||||
import random
|
||||
import string
|
||||
import hashlib
|
||||
|
||||
class cloudstackTestClient(object):
|
||||
def __init__(self, mgtSvr=None, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600,
|
||||
def __init__(self, mgtSvr=None, port=8096, user=None, passwd=None,
|
||||
apiKey=None, securityKey=None, asyncTimeout=3600,
|
||||
defaultWorkerThreads=10, logging=None):
|
||||
self.connection = cloudstackConnection.cloudConnection(mgtSvr, port, apiKey, securityKey, asyncTimeout, logging)
|
||||
self.connection = \
|
||||
cloudstackConnection.cloudConnection(
|
||||
mgtSvr, port, user,
|
||||
passwd, apiKey, securityKey,
|
||||
asyncTimeout, logging)
|
||||
self.apiClient = cloudstackAPIClient.CloudStackAPIClient(self.connection)
|
||||
self.dbConnection = None
|
||||
self.asyncJobMgr = None
|
||||
self.ssh = None
|
||||
self.defaultWorkerThreads = defaultWorkerThreads
|
||||
|
||||
|
||||
def dbConfigure(self, host="localhost", port=3306, user='cloud', passwd='cloud', db='cloud'):
|
||||
self.dbConnection = dbConnection.dbConnection(host, port, user, passwd, db)
|
||||
|
||||
|
||||
def isAdminContext(self):
|
||||
"""
|
||||
A user is a regular user if he fails to listDomains;
|
||||
|
|
@ -53,7 +58,7 @@ class cloudstackTestClient(object):
|
|||
return 2 #domain-admin
|
||||
except:
|
||||
return 0 #user
|
||||
|
||||
|
||||
def random_gen(self, size=6, chars=string.ascii_uppercase + string.digits):
|
||||
"""Generate Random Strings of variable length"""
|
||||
return ''.join(random.choice(chars) for x in range(size))
|
||||
|
|
@ -61,7 +66,7 @@ class cloudstackTestClient(object):
|
|||
def createUserApiClient(self, UserName, DomainName, acctType=0):
|
||||
if not self.isAdminContext():
|
||||
return self.apiClient
|
||||
|
||||
|
||||
listDomain = listDomains.listDomainsCmd()
|
||||
listDomain.listall = True
|
||||
listDomain.name = DomainName
|
||||
|
|
@ -73,11 +78,11 @@ class cloudstackTestClient(object):
|
|||
cdomain.name = DomainName
|
||||
domain = self.apiClient.createDomain(cdomain)
|
||||
domId = domain.id
|
||||
|
||||
|
||||
mdf = hashlib.md5()
|
||||
mdf.update("password")
|
||||
mdf_pass = mdf.hexdigest()
|
||||
|
||||
|
||||
cmd = listAccounts.listAccountsCmd()
|
||||
cmd.name = UserName
|
||||
cmd.domainid = domId
|
||||
|
|
@ -95,46 +100,47 @@ class cloudstackTestClient(object):
|
|||
createAcctCmd.username = UserName
|
||||
acct = self.apiClient.createAccount(createAcctCmd)
|
||||
acctId = acct.id
|
||||
|
||||
listuser = listUsers.listUsersCmd()
|
||||
|
||||
listuser = listUsers.listUsersCmd()
|
||||
listuser.username = UserName
|
||||
|
||||
|
||||
listuserRes = self.apiClient.listUsers(listuser)
|
||||
userId = listuserRes[0].id
|
||||
apiKey = listuserRes[0].apikey
|
||||
securityKey = listuserRes[0].secretkey
|
||||
|
||||
|
||||
if apiKey is None:
|
||||
registerUser = registerUserKeys.registerUserKeysCmd()
|
||||
registerUser.id = userId
|
||||
registerUserRes = self.apiClient.registerUserKeys(registerUser)
|
||||
apiKey = registerUserRes.apikey
|
||||
securityKey = registerUserRes.secretkey
|
||||
|
||||
|
||||
newUserConnection = cloudstackConnection.cloudConnection(self.connection.mgtSvr, self.connection.port,
|
||||
self.connection.user, self.connection.passwd,
|
||||
apiKey, securityKey, self.connection.asyncTimeout, self.connection.logging)
|
||||
self.userApiClient = cloudstackAPIClient.CloudStackAPIClient(newUserConnection)
|
||||
self.userApiClient.connection = newUserConnection
|
||||
return self.userApiClient
|
||||
|
||||
|
||||
def close(self):
|
||||
if self.connection is not None:
|
||||
self.connection.close()
|
||||
|
||||
|
||||
def getDbConnection(self):
|
||||
return self.dbConnection
|
||||
|
||||
def executeSql(self, sql=None):
|
||||
if sql is None or self.dbConnection is None:
|
||||
return None
|
||||
|
||||
|
||||
return self.dbConnection.execute()
|
||||
|
||||
|
||||
def executeSqlFromFile(self, sqlFile=None):
|
||||
if sqlFile is None or self.dbConnection is None:
|
||||
return None
|
||||
return self.dbConnection.executeSqlFromFile(sqlFile)
|
||||
|
||||
|
||||
def getApiClient(self):
|
||||
return self.apiClient
|
||||
|
||||
|
|
@ -151,18 +157,21 @@ class cloudstackTestClient(object):
|
|||
|
||||
|
||||
'''FixME, httplib has issue if more than one thread submitted'''
|
||||
|
||||
def submitCmdsAndWait(self, cmds, workers=1):
|
||||
if self.asyncJobMgr is None:
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
return self.asyncJobMgr.submitCmdsAndWait(cmds, workers)
|
||||
|
||||
|
||||
'''submit one job and execute the same job ntimes, with nums_threads of threads'''
|
||||
|
||||
def submitJob(self, job, ntimes=1, nums_threads=10, interval=1):
|
||||
if self.asyncJobMgr is None:
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
self.asyncJobMgr.submitJobExecuteNtimes(job, ntimes, nums_threads, interval)
|
||||
|
||||
'''submit n jobs, execute them with nums_threads of threads'''
|
||||
|
||||
'''submit n jobs, execute them with nums_threads of threads'''
|
||||
|
||||
def submitJobs(self, jobs, nums_threads=10, interval=1):
|
||||
if self.asyncJobMgr is None:
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,11 @@ class dbConnection(object):
|
|||
return None
|
||||
|
||||
resultRow = []
|
||||
with contextlib.closing(mysql.connector.connect(host=self.host, port=self.port, user=self.user, password=self.passwd, db=self.database)) as conn:
|
||||
with contextlib.closing(mysql.connector.connect(host=str(self.host),
|
||||
port=int(self.port),
|
||||
user=str(self.user),
|
||||
password=str(self.passwd),
|
||||
db=str(self.database))) as conn:
|
||||
conn.autocommit = True
|
||||
with contextlib.closing(conn.cursor(buffered=True)) as cursor:
|
||||
cursor.execute(sql, params)
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ class deployDataCenters():
|
|||
|
||||
self.testClient = \
|
||||
cloudstackTestClient.cloudstackTestClient(mgt.mgtSvrIp, mgt.port, \
|
||||
mgt.user, mgt.passwd, \
|
||||
mgt.apiKey, \
|
||||
mgt.securityKey, \
|
||||
logging=self.testClientLogger)
|
||||
|
|
@ -409,6 +410,7 @@ class deployDataCenters():
|
|||
apiKey, securityKey = self.registerApiKey()
|
||||
self.testClient = \
|
||||
cloudstackTestClient.cloudstackTestClient(mgt.mgtSvrIp, 8080, \
|
||||
mgt.user, mgt.passwd, \
|
||||
apiKey, securityKey, \
|
||||
logging=self.testClientLogger)
|
||||
|
||||
|
|
@ -419,6 +421,11 @@ class deployDataCenters():
|
|||
dbSvr.passwd, dbSvr.db)
|
||||
|
||||
self.apiClient = self.testClient.getApiClient()
|
||||
"""set hypervisor"""
|
||||
if mgt.hypervisor:
|
||||
self.apiClient.hypervisor = mgt.hypervisor
|
||||
else:
|
||||
self.apiClient.hypervisor = "XenServer" #Defaults to Xenserver
|
||||
|
||||
def updateConfiguration(self, globalCfg):
|
||||
if globalCfg is None:
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue