mirror of https://github.com/apache/cloudstack.git
Merged from master
This commit is contained in:
commit
aaa16af211
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<components-simulator.xml>
|
||||
<management-server class="com.cloud.server.ManagementServerSimulatorImpl" library="com.cloud.configuration.SimulatorComponentLibrary" extends="components.xml:management-server">
|
||||
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
|
||||
<param name="premium">true</param>
|
||||
</dao>
|
||||
<adapters key="com.cloud.ha.Investigator">
|
||||
<adapter name="SimpleInvestigator" class="com.cloud.ha.CheckOnAgentInvestigator"/>
|
||||
<adapter name="PingInvestigator" class="com.cloud.ha.UserVmDomRInvestigator"/>
|
||||
<adapter name="ManagementIPSysVMInvestigator" class="com.cloud.ha.ManagementIPSystemVMInvestigator"/>
|
||||
</adapters>
|
||||
<adapters key="com.cloud.resource.Discoverer">
|
||||
<adapter name="Simulator Agent" class="com.cloud.resource.SimulatorDiscoverer"/>
|
||||
<adapter name="XCP Agent" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer"/>
|
||||
<adapter name="SecondaryStorage" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer"/>
|
||||
<adapter name="KVM Agent" class="com.cloud.hypervisor.kvm.discoverer.KvmServerDiscoverer"/>
|
||||
<adapter name="SecondaryStorage" class="com.cloud.resource.SimulatorSecondaryDiscoverer"/>
|
||||
</adapters>
|
||||
|
||||
<adapters key="com.cloud.hypervisor.HypervisorGuru">
|
||||
<adapter name="SimulatorGuru" class="com.cloud.simulator.SimulatorGuru"/>
|
||||
<adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
|
||||
<adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
|
||||
</adapters>
|
||||
<adapters key="com.cloud.agent.StartupCommandProcessor">
|
||||
<adapter name="BasicAgentAuthorizer" class="com.cloud.agent.manager.authn.impl.BasicAgentAuthManager"/>
|
||||
</adapters>
|
||||
</management-server>
|
||||
|
||||
<configuration-server class="com.cloud.server.ConfigurationServerImpl" extends="components.xml:configuration-server">
|
||||
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
|
||||
<param name="premium">true</param>
|
||||
</dao>
|
||||
</configuration-server>
|
||||
|
||||
</components-simulator.xml>
|
||||
|
|
@ -20,11 +20,14 @@ public class DnsmasqTO {
|
|||
String routerIp;
|
||||
String gateway;
|
||||
String netmask;
|
||||
String startIpOfSubnet;
|
||||
|
||||
public DnsmasqTO(String routerIp, String gateway, String netmask) {
|
||||
public DnsmasqTO(String routerIp, String gateway, String netmask, String StartIpOfSubnet) {
|
||||
this.routerIp = routerIp;
|
||||
this.startIpOfSubnet = StartIpOfSubnet;
|
||||
this.gateway = gateway;
|
||||
this.netmask =netmask;
|
||||
|
||||
}
|
||||
|
||||
public void setRouterIp(String routerIp){
|
||||
|
|
@ -39,6 +42,10 @@ public class DnsmasqTO {
|
|||
this.netmask = netmask ;
|
||||
}
|
||||
|
||||
public void setStartIpOfSubnet( String ipOfSubNet) {
|
||||
startIpOfSubnet = ipOfSubNet;
|
||||
}
|
||||
|
||||
public String getRouterIp() {
|
||||
return routerIp;
|
||||
}
|
||||
|
|
@ -50,4 +57,8 @@ public class DnsmasqTO {
|
|||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
public String getStartIpOfSubnet() {
|
||||
return startIpOfSubnet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.dc;
|
||||
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity{
|
||||
long getId();
|
||||
Long getDataCenterId();
|
||||
Long getPodId();
|
||||
Long getClusterId();
|
||||
Long getHostId();
|
||||
Long getDomainId();
|
||||
Long getAccountId();
|
||||
String getUuid();
|
||||
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
|||
List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
|
||||
throws InsufficientServerCapacityException;
|
||||
|
||||
PlannerResourceUsage getResourceUsage();
|
||||
PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -438,6 +438,10 @@ public class EventTypes {
|
|||
public static final String EVENT_PORTABLE_IP_RANGE_DELETE = "PORTABLE.IP.RANGE.DELETE";
|
||||
public static final String EVENT_PORTABLE_IP_TRANSFER = "PORTABLE.IP.TRANSFER";
|
||||
|
||||
// Dedicated Resources
|
||||
public static final String EVENT_DEDICATE_RESOURCE = "DEDICATE.RESOURCE";
|
||||
public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE";
|
||||
|
||||
static {
|
||||
|
||||
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ public interface GlobalLoadBalancingRulesService {
|
|||
|
||||
GlobalLoadBalancerRule updateGlobalLoadBalancerRule(UpdateGlobalLoadBalancerRuleCmd updateGslbCmd);
|
||||
|
||||
boolean revokeAllGslbRulesForAccount(com.cloud.user.Account caller, long accountId)
|
||||
throws com.cloud.exception.ResourceUnavailableException;
|
||||
|
||||
/*
|
||||
* methods for managing sites participating in global load balancing
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
|
|
@ -26,7 +25,6 @@ import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
|||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface AccountService {
|
||||
|
||||
|
|
@ -78,13 +76,11 @@ public interface AccountService {
|
|||
|
||||
Account finalizeOwner(Account caller, String accountName, Long domainId, Long projectId);
|
||||
|
||||
Pair<List<Long>, Long> finalizeAccountDomainForList(Account caller, String accountName, Long domainId, Long projectId);
|
||||
|
||||
Account getActiveAccountByName(String accountName, Long domainId);
|
||||
|
||||
Account getActiveAccountById(Long accountId);
|
||||
Account getActiveAccountById(long accountId);
|
||||
|
||||
Account getAccount(Long accountId);
|
||||
Account getAccount(long accountId);
|
||||
|
||||
User getActiveUser(long userId);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
public interface VmDiskStats {
|
||||
// vm related disk stats
|
||||
|
||||
public Long getIORead();
|
||||
|
||||
public Long getIOWrite();
|
||||
|
||||
public Long getBytesRead();
|
||||
|
||||
public Long getBytesWrite();
|
||||
|
||||
}
|
||||
|
|
@ -23,5 +23,13 @@ public interface VmStats {
|
|||
public double getNetworkReadKBs();
|
||||
|
||||
public double getNetworkWriteKBs();
|
||||
|
||||
public double getDiskReadIOs();
|
||||
|
||||
public double getDiskWriteIOs();
|
||||
|
||||
public double getDiskReadKBs();
|
||||
|
||||
public double getDiskWriteKBs();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package org.apache.cloudstack.affinity;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
|
@ -45,10 +44,8 @@ public interface AffinityGroupService {
|
|||
* @param account
|
||||
* @param domainId
|
||||
* @param affinityGroupName
|
||||
* @throws ResourceInUseException
|
||||
*/
|
||||
boolean deleteAffinityGroup(Long affinityGroupId, String account, Long domainId, String affinityGroupName)
|
||||
throws ResourceInUseException;
|
||||
boolean deleteAffinityGroup(Long affinityGroupId, String account, Long domainId, String affinityGroupName);
|
||||
|
||||
/** Lists Affinity Groups in your account
|
||||
* @param account
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ public class ApiConstants {
|
|||
public static final String STATE = "state";
|
||||
public static final String STATUS = "status";
|
||||
public static final String STORAGE_TYPE = "storagetype";
|
||||
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
|
||||
public static final String SYSTEM_VM_TYPE = "systemvmtype";
|
||||
public static final String TAGS = "tags";
|
||||
public static final String TARGET_IQN = "targetiqn";
|
||||
|
|
@ -304,6 +305,8 @@ public class ApiConstants {
|
|||
public static final String TEMPLATE_TAG = "templatetag";
|
||||
public static final String HYPERVISOR_VERSION = "hypervisorversion";
|
||||
public static final String MAX_GUESTS_LIMIT = "maxguestslimit";
|
||||
public static final String MAX_DATA_VOLUMES_LIMIT = "maxdatavolumeslimit";
|
||||
public static final String MAX_HOSTS_PER_CLUSTER = "maxhostspercluster";
|
||||
public static final String PROJECT_ID = "projectid";
|
||||
public static final String PROJECT_IDS = "projectids";
|
||||
public static final String PROJECT = "project";
|
||||
|
|
@ -402,6 +405,7 @@ public class ApiConstants {
|
|||
public static final String VSM_CONFIG_MODE = "vsmconfigmode";
|
||||
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
|
||||
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
|
||||
public static final String VCENTER = "vcenter";
|
||||
public static final String ADD_VSM_FLAG = "addvsmflag";
|
||||
public static final String END_POINT = "endpoint";
|
||||
public static final String REGION_ID = "regionid";
|
||||
|
|
|
|||
|
|
@ -21,15 +21,8 @@ import java.util.EnumSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||
|
|
@ -66,6 +59,7 @@ import org.apache.cloudstack.api.response.LBHealthCheckResponse;
|
|||
import org.apache.cloudstack.api.response.LBStickinessResponse;
|
||||
import org.apache.cloudstack.api.response.LDAPConfigResponse;
|
||||
import org.apache.cloudstack.api.response.LoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
|
|
@ -73,6 +67,8 @@ import org.apache.cloudstack.api.response.NicResponse;
|
|||
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
import org.apache.cloudstack.api.response.PortableIpRangeResponse;
|
||||
import org.apache.cloudstack.api.response.PortableIpResponse;
|
||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectAccountResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
|
||||
|
|
@ -95,7 +91,6 @@ import org.apache.cloudstack.api.response.SnapshotResponse;
|
|||
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
|
||||
import org.apache.cloudstack.api.response.StaticRouteResponse;
|
||||
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.SwiftResponse;
|
||||
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
|
||||
|
|
@ -115,11 +110,10 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
|
|||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.api.response.VpnUsersResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.response.*;
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
|
||||
import org.apache.cloudstack.region.Region;
|
||||
import org.apache.cloudstack.region.PortableIp;
|
||||
import org.apache.cloudstack.region.PortableIpRange;
|
||||
import org.apache.cloudstack.region.Region;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
|
||||
import com.cloud.capacity.Capacity;
|
||||
|
|
@ -162,6 +156,12 @@ import com.cloud.network.rules.StaticNatRule;
|
|||
import com.cloud.network.rules.StickinessPolicy;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityRule;
|
||||
import com.cloud.network.vpc.NetworkACL;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
|
|
@ -257,7 +257,7 @@ public interface ResponseGenerator {
|
|||
|
||||
StoragePoolResponse createStoragePoolResponse(StoragePool pool);
|
||||
|
||||
StoragePoolForMigrationResponse createStoragePoolForMigrationResponse(StoragePool pool);
|
||||
StoragePoolResponse createStoragePoolForMigrationResponse(StoragePool pool);
|
||||
|
||||
ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,15 +99,12 @@ public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
|
||||
s_logger.debug("hello alena");
|
||||
CallContext.current().setEventDetails("Internal load balancer element: " + id);
|
||||
s_logger.debug("hello alena");
|
||||
VirtualRouterProvider result = _service.get(0).configureInternalLoadBalancerElement(getId(), getEnabled());
|
||||
s_logger.debug("hello alena");
|
||||
if (result != null){
|
||||
InternalLoadBalancerElementResponse routerResponse = _responseGenerator.createInternalLbElementResponse(result);
|
||||
routerResponse.setResponseName(getCommandName());
|
||||
this.setResponseObject(routerResponse);
|
||||
setResponseObject(routerResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the internal load balancer element");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||
required=false, description="the scope of the storage: cluster or zone")
|
||||
private String scope;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=false,
|
||||
description="hypervisor type of the hosts in zone that will be attached to this storage pool. KVM, VMware supported as of now.")
|
||||
private String hypervisor;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -121,9 +125,9 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||
return this.scope;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ import org.apache.cloudstack.api.ApiConstants;
|
|||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "findStoragePoolsForMigration", description="Lists storage pools available for migration of a volume.",
|
||||
responseObject=StoragePoolForMigrationResponse.class)
|
||||
responseObject=StoragePoolResponse.class)
|
||||
public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName());
|
||||
|
||||
|
|
@ -74,13 +74,13 @@ public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
|
|||
public void execute() {
|
||||
Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools =
|
||||
_mgr.listStoragePoolsForMigrationOfVolume(getId());
|
||||
ListResponse<StoragePoolForMigrationResponse> response = new ListResponse<StoragePoolForMigrationResponse>();
|
||||
List<StoragePoolForMigrationResponse> poolResponses = new ArrayList<StoragePoolForMigrationResponse>();
|
||||
ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
|
||||
List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
|
||||
|
||||
List<? extends StoragePool> allPools = pools.first();
|
||||
List<? extends StoragePool> suitablePoolList = pools.second();
|
||||
for (StoragePool pool : allPools) {
|
||||
StoragePoolForMigrationResponse poolResponse = _responseGenerator.createStoragePoolForMigrationResponse(pool);
|
||||
StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolForMigrationResponse(pool);
|
||||
Boolean suitableForMigration = false;
|
||||
for (StoragePool suitablePool : suitablePoolList) {
|
||||
if (suitablePool.getId() == pool.getId()) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VpcOfferingResponse.class,
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VpcOfferingResponse.class, required=true,
|
||||
description="the id of the VPC offering")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import org.apache.cloudstack.context.CallContext;
|
|||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class)
|
||||
|
|
@ -124,7 +123,6 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
boolean result = _affinityGroupService.deleteAffinityGroup(id, accountName, domainId, name);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
|
|
@ -132,10 +130,6 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
|
|||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete affinity group");
|
||||
}
|
||||
} catch (ResourceInUseException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
|||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
|
||||
@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class)
|
||||
public class ListAffinityGroupsCmd extends BaseListCmd {
|
||||
public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListAffinityGroupsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listaffinitygroupsresponse";
|
||||
|
|
@ -77,7 +77,8 @@ public class ListAffinityGroupsCmd extends BaseListCmd {
|
|||
public void execute(){
|
||||
|
||||
ListResponse<AffinityGroupResponse> response = _queryService.listAffinityGroups(id, affinityGroupName,
|
||||
affinityGroupType, virtualMachineId, getStartIndex(), getPageSizeVal());
|
||||
affinityGroupType, virtualMachineId, getAccountName(), getDomainId(), isRecursive(),
|
||||
listAll(), getStartIndex(), getPageSizeVal());
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@ import org.apache.log4j.Logger;
|
|||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
|
@ -92,13 +94,19 @@ public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
_gslbService.deleteGlobalLoadBalancerRule(this);
|
||||
CallContext.current().setEventDetails("Deleting global Load balancer Id: " + getGlobalLoadBalancerId());
|
||||
boolean result = _gslbService.deleteGlobalLoadBalancerRule(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Global Load Balancer rule.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
return BaseAsyncCmd.gslbSyncObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class RestartVPCCmd extends BaseAsyncCmd{
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class,
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class, required=true,
|
||||
description="the id of the VPC")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ public class UpdateVPCCmd extends BaseAsyncCmd{
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class,
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpcResponse.class, required=true,
|
||||
description="the id of the VPC")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC")
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the VPC", required=true)
|
||||
private String vpcName;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the VPC")
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is supported")
|
||||
private boolean isSecurityGroupEnabled;
|
||||
|
||||
@SerializedName(ApiConstants.MAX_DATA_VOLUMES_LIMIT) @Param(description="the maximum number of Data Volumes that can be attached for this hypervisor")
|
||||
private Integer maxDataVolumesLimit;
|
||||
|
||||
@SerializedName(ApiConstants.MAX_HOSTS_PER_CLUSTER) @Param(description="the maximum number of Hosts per cluster for this hypervisor")
|
||||
private Integer maxHostsPerCluster;
|
||||
|
||||
@SerializedName(ApiConstants.STORAGE_MOTION_ENABLED) @Param(description="true if storage motion is supported")
|
||||
private boolean isStorageMotionSupported;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
|
@ -84,4 +92,28 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
|
|||
public void setIsSecurityGroupEnabled(Boolean sgEnabled) {
|
||||
this.isSecurityGroupEnabled = sgEnabled;
|
||||
}
|
||||
|
||||
public Boolean getIsStorageMotionSupported() {
|
||||
return this.isStorageMotionSupported;
|
||||
}
|
||||
|
||||
public void setIsStorageMotionSupported(Boolean smSupported) {
|
||||
this.isStorageMotionSupported = smSupported;
|
||||
}
|
||||
|
||||
public Integer getMaxDataVolumesLimit() {
|
||||
return maxDataVolumesLimit;
|
||||
}
|
||||
|
||||
public void setMaxDataVolumesLimit(Integer maxDataVolumesLimit) {
|
||||
this.maxDataVolumesLimit = maxDataVolumesLimit;
|
||||
}
|
||||
|
||||
public Integer getMaxHostsPerCluster() {
|
||||
return maxHostsPerCluster;
|
||||
}
|
||||
|
||||
public void setMaxHostsPerCluster(Integer maxHostsPerCluster) {
|
||||
this.maxHostsPerCluster = maxHostsPerCluster;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
@SerializedName(ApiConstants.DISPLAY_NETWORK) @Param(description="an optional field, whether to the display the network to the end user or not.")
|
||||
private Boolean displayNetwork;
|
||||
|
||||
@SerializedName(ApiConstants.ACL_ID) @Param(description="ACL Id associated with the VPC network")
|
||||
private String aclId;
|
||||
|
||||
|
||||
public Boolean getDisplayNetwork() {
|
||||
return displayNetwork;
|
||||
}
|
||||
|
|
@ -353,4 +357,12 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
|
|||
public void setIp6Cidr(String ip6Cidr) {
|
||||
this.ip6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
public String getAclId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
public void setAclId(String aclId) {
|
||||
this.aclId = aclId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,249 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
|
||||
@EntityReference(value=StoragePool.class)
|
||||
public class StoragePoolForMigrationResponse extends BaseResponse {
|
||||
@SerializedName("id") @Param(description="the ID of the storage pool")
|
||||
private String id;
|
||||
|
||||
@SerializedName("zoneid") @Param(description="the Zone ID of the storage pool")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the storage pool")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName("podid") @Param(description="the Pod ID of the storage pool")
|
||||
private String podId;
|
||||
|
||||
@SerializedName("podname") @Param(description="the Pod name of the storage pool")
|
||||
private String podName;
|
||||
|
||||
@SerializedName("name") @Param(description="the name of the storage pool")
|
||||
private String name;
|
||||
|
||||
@SerializedName("ipaddress") @Param(description="the IP address of the storage pool")
|
||||
private String ipAddress;
|
||||
|
||||
@SerializedName("path") @Param(description="the storage pool path")
|
||||
private String path;
|
||||
|
||||
@SerializedName("created") @Param(description="the date and time the storage pool was created")
|
||||
private Date created;
|
||||
|
||||
@SerializedName("type") @Param(description="the storage pool type")
|
||||
private String type;
|
||||
|
||||
@SerializedName("clusterid") @Param(description="the ID of the cluster for the storage pool")
|
||||
private String clusterId;
|
||||
|
||||
@SerializedName("clustername") @Param(description="the name of the cluster for the storage pool")
|
||||
private String clusterName;
|
||||
|
||||
@SerializedName("disksizetotal") @Param(description="the total disk size of the storage pool")
|
||||
private Long diskSizeTotal;
|
||||
|
||||
@SerializedName("disksizeallocated") @Param(description="the host's currently allocated disk size")
|
||||
private Long diskSizeAllocated;
|
||||
|
||||
@SerializedName("disksizeused") @Param(description="the host's currently used disk size")
|
||||
private Long diskSizeUsed;
|
||||
|
||||
@SerializedName("tags") @Param(description="the tags for the storage pool")
|
||||
private String tags;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="the state of the storage pool")
|
||||
private StoragePoolStatus state;
|
||||
|
||||
@SerializedName(ApiConstants.SCOPE) @Param(description="the scope of the storage pool")
|
||||
private String scope;
|
||||
|
||||
@SerializedName("suitableformigration") @Param(description="true if this pool is suitable to migrate a volume," +
|
||||
" false otherwise")
|
||||
private Boolean suitableForMigration;
|
||||
|
||||
/**
|
||||
* @return the scope
|
||||
*/
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scope the scope to set
|
||||
*/
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getZoneName() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public String getPodName() {
|
||||
return podName;
|
||||
}
|
||||
|
||||
public void setPodName(String podName) {
|
||||
this.podName = podName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getClusterId() {
|
||||
return clusterId;
|
||||
}
|
||||
|
||||
public void setClusterId(String clusterId) {
|
||||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public Long getDiskSizeTotal() {
|
||||
return diskSizeTotal;
|
||||
}
|
||||
|
||||
public void setDiskSizeTotal(Long diskSizeTotal) {
|
||||
this.diskSizeTotal = diskSizeTotal;
|
||||
}
|
||||
|
||||
public Long getDiskSizeAllocated() {
|
||||
return diskSizeAllocated;
|
||||
}
|
||||
|
||||
public void setDiskSizeAllocated(Long diskSizeAllocated) {
|
||||
this.diskSizeAllocated = diskSizeAllocated;
|
||||
}
|
||||
|
||||
public Long getDiskSizeUsed() {
|
||||
return diskSizeUsed;
|
||||
}
|
||||
|
||||
public void setDiskSizeUsed(Long diskSizeUsed) {
|
||||
this.diskSizeUsed = diskSizeUsed;
|
||||
}
|
||||
|
||||
public String getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public StoragePoolStatus getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(StoragePoolStatus state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setSuitableForMigration(Boolean suitableForMigration) {
|
||||
this.suitableForMigration = suitableForMigration;
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,13 @@ public class StoragePoolResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.SCOPE) @Param(description="the scope of the storage pool")
|
||||
private String scope;
|
||||
|
||||
@SerializedName(ApiConstants.HYPERVISOR) @Param(description="the hypervisor type of the storage pool")
|
||||
private String hypervisor;
|
||||
|
||||
@SerializedName("suitableformigration") @Param(description="true if this pool is suitable to migrate a volume," +
|
||||
" false otherwise")
|
||||
private Boolean suitableForMigration;
|
||||
|
||||
/**
|
||||
* @return the scope
|
||||
*/
|
||||
|
|
@ -101,9 +108,17 @@ public class StoragePoolResponse extends BaseResponse {
|
|||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
|
||||
public void setHypervisor(String hypervisor) {
|
||||
this.hypervisor = hypervisor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
return getId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
|
@ -249,4 +264,8 @@ public class StoragePoolResponse extends BaseResponse {
|
|||
public void setState(StoragePoolStatus state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setSuitableForMigration(Boolean suitableForMigration) {
|
||||
this.suitableForMigration = suitableForMigration;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,18 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
@SerializedName("networkkbswrite") @Param(description="the outgoing network traffic on the host")
|
||||
private Long networkKbsWrite;
|
||||
|
||||
@SerializedName("diskkbsread") @Param(description="the read (bytes) of disk on the vm")
|
||||
private Long diskKbsRead;
|
||||
|
||||
@SerializedName("diskkbswrite") @Param(description="the write (bytes) of disk on the vm")
|
||||
private Long diskKbsWrite;
|
||||
|
||||
@SerializedName("diskioread") @Param(description="the read (io) of disk on the vm")
|
||||
private Long diskIORead;
|
||||
|
||||
@SerializedName("diskiowrite") @Param(description="the write (io) of disk on the vm")
|
||||
private Long diskIOWrite;
|
||||
|
||||
@SerializedName("guestosid") @Param(description="Os type ID of the virtual machine")
|
||||
private String guestOsId;
|
||||
|
||||
|
|
@ -301,6 +313,22 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
|
|||
this.isoDisplayText = isoDisplayText;
|
||||
}
|
||||
|
||||
public void setDiskKbsRead(Long diskKbsRead) {
|
||||
this.diskKbsRead = diskKbsRead;
|
||||
}
|
||||
|
||||
public void setDiskKbsWrite(Long diskKbsWrite) {
|
||||
this.diskKbsWrite = diskKbsWrite;
|
||||
}
|
||||
|
||||
public void setDiskIORead(Long diskIORead) {
|
||||
this.diskIORead = diskIORead;
|
||||
}
|
||||
|
||||
public void setDiskIOWrite(Long diskIOWrite) {
|
||||
this.diskIOWrite = diskIOWrite;
|
||||
}
|
||||
|
||||
public void setServiceOfferingId(String serviceOfferingId) {
|
||||
this.serviceOfferingId = serviceOfferingId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ public interface QueryService {
|
|||
public ListResponse<ZoneResponse> listDataCenters(ListZonesByCmd cmd);
|
||||
|
||||
public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
|
||||
String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
|
||||
String affinityGroupType, Long vmId, String accountName, Long domainId, boolean isRecursive,
|
||||
boolean listAll, Long startIndex, Long pageSize);
|
||||
|
||||
public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ public class UsageTypes {
|
|||
public static final int PORT_FORWARDING_RULE = 12;
|
||||
public static final int NETWORK_OFFERING = 13;
|
||||
public static final int VPN_USERS = 14;
|
||||
public static final int VM_DISK_IO_READ = 21;
|
||||
public static final int VM_DISK_IO_WRITE = 22;
|
||||
public static final int VM_DISK_BYTES_READ = 23;
|
||||
public static final int VM_DISK_BYTES_WRITE = 24;
|
||||
|
||||
public static List<UsageTypeResponse> listUsageTypes(){
|
||||
List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
|
||||
|
|
@ -53,6 +57,10 @@ public class UsageTypes {
|
|||
responseList.add(new UsageTypeResponse(PORT_FORWARDING_RULE, "Port Forwarding Usage"));
|
||||
responseList.add(new UsageTypeResponse(NETWORK_OFFERING, "Network Offering Usage"));
|
||||
responseList.add(new UsageTypeResponse(VPN_USERS, "VPN users usage"));
|
||||
responseList.add(new UsageTypeResponse(VM_DISK_IO_READ, "VM Disk usage(I/O Read)"));
|
||||
responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM Disk usage(I/O Write)"));
|
||||
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM Disk usage(Bytes Read)"));
|
||||
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM Disk usage(Bytes Write)"));
|
||||
return responseList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
label.view.secondary.ips=View secondary IPs
|
||||
message.acquire.ip.nic=Please confirm that you would like to acquire a new secondary IP for this NIC.<br/>NOTE: You need to manually configure the newly-acquired secondary IP inside the virtual machine.
|
||||
message.select.affinity.groups=Please select any affinity groups you want this VM to belong to:
|
||||
message.no.affinity.groups=You do not have any affinity groups. Please continue to the next step.
|
||||
label.action.delete.nic=Remove NIC
|
||||
|
|
@ -53,6 +55,7 @@ label.account.specific=Account-Specific
|
|||
label.account=Account
|
||||
label.accounts=Accounts
|
||||
label.acquire.new.ip=Acquire New IP
|
||||
label.acquire.new.secondary.ip=Acquire new secondary IP
|
||||
label.action.attach.disk.processing=Attaching Disk....
|
||||
label.action.attach.disk=Attach Disk
|
||||
label.action.attach.iso.processing=Attaching ISO....
|
||||
|
|
@ -464,10 +467,14 @@ label.disabled=Disabled
|
|||
label.disabling.vpn.access=Disabling VPN Access
|
||||
label.disk.allocated=Disk Allocated
|
||||
label.disk.offering=Disk Offering
|
||||
label.disk.read.bytes=Disk Read (Bytes)
|
||||
label.disk.read.io=Disk Read (IO)
|
||||
label.disk.size.gb=Disk Size (in GB)
|
||||
label.disk.size=Disk Size
|
||||
label.disk.total=Disk Total
|
||||
label.disk.volume=Disk Volume
|
||||
label.disk.write.bytes=Disk Write (Bytes)
|
||||
label.disk.write.io=Disk Write (IO)
|
||||
label.display.name=Display name
|
||||
label.display.text=Display Text
|
||||
label.dns.1=DNS 1
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@
|
|||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-acl-static-role-based</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-dedicated-resources</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
|
|
@ -136,6 +141,11 @@
|
|||
<artifactId>cloud-plugin-planner-implicit-dedication</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-explicit-dedication</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-host-allocator-random</artifactId>
|
||||
|
|
|
|||
|
|
@ -158,6 +158,14 @@
|
|||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="dedicatedResourceDaoImpl" class="com.cloud.dc.dao.DedicatedResourceDaoImpl">
|
||||
<property name="configParams">
|
||||
<map>
|
||||
<entry key="cache.size" value="30" />
|
||||
<entry key="cache.time.to.live" value="3600" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
DAOs with default configuration
|
||||
|
|
@ -329,11 +337,13 @@
|
|||
<bean id="usageVMInstanceDaoImpl" class="com.cloud.usage.dao.UsageVMInstanceDaoImpl" />
|
||||
<bean id="usageVPNUserDaoImpl" class="com.cloud.usage.dao.UsageVPNUserDaoImpl" />
|
||||
<bean id="usageVolumeDaoImpl" class="com.cloud.usage.dao.UsageVolumeDaoImpl" />
|
||||
<bean id="usageVmDiskDaoImpl" class="com.cloud.usage.dao.UsageVmDiskDaoImpl" />
|
||||
<bean id="userAccountDaoImpl" class="com.cloud.user.dao.UserAccountDaoImpl" />
|
||||
<bean id="userAccountJoinDaoImpl" class="com.cloud.api.query.dao.UserAccountJoinDaoImpl" />
|
||||
<bean id="userIpv6AddressDaoImpl" class="com.cloud.network.dao.UserIpv6AddressDaoImpl" />
|
||||
<bean id="userStatisticsDaoImpl" class="com.cloud.user.dao.UserStatisticsDaoImpl" />
|
||||
<bean id="userStatsLogDaoImpl" class="com.cloud.user.dao.UserStatsLogDaoImpl" />
|
||||
<bean id="userVmDiskStatsDaoImpl" class="com.cloud.user.dao.VmDiskStatisticsDaoImpl" />
|
||||
<bean id="userVmCloneSettingDaoImpl" class="com.cloud.vm.dao.UserVmCloneSettingDaoImpl" />
|
||||
<bean id="userVmDaoImpl" class="com.cloud.vm.dao.UserVmDaoImpl" />
|
||||
<bean id="userVmDetailsDaoImpl" class="com.cloud.vm.dao.UserVmDetailsDaoImpl" />
|
||||
|
|
@ -667,7 +677,6 @@
|
|||
<bean id="ipv6AddressManagerImpl" class="com.cloud.network.Ipv6AddressManagerImpl" />
|
||||
|
||||
<bean id="apiRateLimitServiceImpl" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl"/>
|
||||
|
||||
<bean id="alertManagerImpl" class="com.cloud.alert.AlertManagerImpl" />
|
||||
<bean id="autoScaleManagerImpl" class="com.cloud.network.as.AutoScaleManagerImpl" />
|
||||
<bean id="capacityManagerImpl" class="com.cloud.capacity.CapacityManagerImpl" />
|
||||
|
|
@ -786,6 +795,7 @@
|
|||
<bean id="mockAgentManagerImpl" class="com.cloud.agent.manager.MockAgentManagerImpl" />
|
||||
<bean id="mockStorageManagerImpl" class="com.cloud.agent.manager.MockStorageManagerImpl" />
|
||||
<bean id="mockVmManagerImpl" class="com.cloud.agent.manager.MockVmManagerImpl" />
|
||||
<bean id="mockNetworkManagerImpl" class="com.cloud.agent.manager.MockNetworkManagerImpl" />
|
||||
<bean id="simulatorManagerImpl" class="com.cloud.agent.manager.SimulatorManagerImpl" />
|
||||
<bean id="vMSnapshotManagerImpl" class="com.cloud.vm.snapshot.VMSnapshotManagerImpl" />
|
||||
<bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
|
||||
|
|
|
|||
|
|
@ -265,6 +265,10 @@ addSecondaryStorage=1
|
|||
updateHostPassword=1
|
||||
releaseHostReservation=1
|
||||
|
||||
#### VmWare DC
|
||||
addVmwareDc=1
|
||||
removeVmwareDc=1
|
||||
|
||||
#### volume commands
|
||||
attachVolume=15
|
||||
uploadVolume=15
|
||||
|
|
@ -276,10 +280,6 @@ extractVolume=15
|
|||
migrateVolume=15
|
||||
resizeVolume=15
|
||||
updateVolume=1
|
||||
addVolumeDetail=1
|
||||
updateVolumeDetail=1
|
||||
removeVolumeDetail=1
|
||||
listVolumeDetails=1
|
||||
|
||||
#### registration command: FIXME -- this really should be something in management server that
|
||||
#### generates a new key for the user and they just have to
|
||||
|
|
@ -350,10 +350,6 @@ updateNetwork=15
|
|||
addNicToVirtualMachine=15
|
||||
removeNicFromVirtualMachine=15
|
||||
updateDefaultNicForVirtualMachine=15
|
||||
addNicDetail=1
|
||||
updateNicDetail=1
|
||||
removeNicDetail=1
|
||||
listNicDetails=1
|
||||
|
||||
####
|
||||
addIpToNic=15
|
||||
|
|
@ -641,3 +637,16 @@ listInternalLoadBalancerVMs=1
|
|||
### Network Isolation methods listing
|
||||
listNetworkIsolationMethods=1
|
||||
|
||||
#### Dedicated Resource commands
|
||||
dedicateZone=1
|
||||
dedicatePod=1
|
||||
dedicateCluster=1
|
||||
dedicateHost=1
|
||||
releaseDedicatedZone=1
|
||||
releaseDedicatedPod=1
|
||||
releaseDedicatedCluster=1
|
||||
releaseDedicatedHost=1
|
||||
listDedicatedZones=1
|
||||
listDedicatedPods=1
|
||||
listDedicatedClusters=1
|
||||
listDedicatedHosts=1
|
||||
|
|
|
|||
|
|
@ -24,28 +24,27 @@
|
|||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
|
||||
OSS deployment configuration
|
||||
|
||||
|
||||
OSS/non-OSS counter-exclusive components and related configurations should be put here
|
||||
for example, configurationDaoImpl component, it has exclusive configuration settings in OSS and non-OSS deployment,
|
||||
its component declaration should be put in both componentContext.xml.in and nonossComponentContext.xml.in, each with
|
||||
independent configuration
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<bean id="databaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker" />
|
||||
<bean id="configurationDaoImpl" class="com.cloud.configuration.dao.ConfigurationDaoImpl" />
|
||||
|
||||
<bean id="GlobalLoadBalancingRulesServiceImpl" class ="org.apache.cloudstack.region.gslb.GlobalLoadBalancingRulesServiceImpl" />
|
||||
|
||||
<!--
|
||||
|
|
@ -70,13 +69,13 @@
|
|||
<bean id="MidoNetElement" class="com.cloud.network.element.MidoNetElement">
|
||||
<property name="name" value="MidoNetElement"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Deployment configurations of various adapters
|
||||
|
||||
|
||||
It determines whether or not a adapter is activated or how it is loaded in order in its managing provider,
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<!-- Security adapters -->
|
||||
|
|
@ -171,7 +170,7 @@
|
|||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="hostAllocators" class="com.cloud.utils.component.AdapterList">
|
||||
<property name="Adapters">
|
||||
<list>
|
||||
|
|
@ -260,13 +259,22 @@
|
|||
<property name="name" value="HostAntiAffinityProcessor"/>
|
||||
<property name="type" value="host anti-affinity"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="affinityProcessors" class="com.cloud.utils.component.AdapterList">
|
||||
<property name="Adapters">
|
||||
<list>
|
||||
<ref bean="HostAntiAffinityProcessor" />
|
||||
<ref bean="ExplicitDedicationProcessor"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
<!--
|
||||
Dedicated Resources components
|
||||
-->
|
||||
<bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl"/>
|
||||
<bean id="ExplicitDedicationProcessor" class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
|
||||
<property name="name" value="ExplicitDedicationProcessor"/>
|
||||
<property name="type" value="ExplicitDedication"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@
|
|||
</bean>
|
||||
<bean id="VmwareManager" class="com.cloud.hypervisor.vmware.manager.VmwareManagerImpl"/>
|
||||
<bean id="vmwareContextFactory" class="com.cloud.hypervisor.vmware.resource.VmwareContextFactory" />
|
||||
<bean id="VmwareDatacenterDaoImpl" class="com.cloud.hypervisor.vmware.dao.VmwareDatacenterDaoImpl" />
|
||||
<bean id="VmwareDatacenterZoneMapDaoImpl" class="com.cloud.hypervisor.vmware.dao.VmwareDatacenterZoneMapDaoImpl" />
|
||||
<bean id="LegacyZoneDaoImpl" class="com.cloud.hypervisor.vmware.dao.LegacyZoneDaoImpl" />
|
||||
<bean id="vmwareStorageMotionStrategy" class="org.apache.cloudstack.storage.motion.VmwareStorageMotionStrategy"/>
|
||||
|
||||
<!--
|
||||
Nicira support components
|
||||
|
|
@ -370,4 +374,14 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
Dedicated Resources components
|
||||
-->
|
||||
|
||||
<bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl"/>
|
||||
<bean id="ExplicitDedicationProcessor" class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
|
||||
<property name="name" value="ExplicitDedicationProcessor"/>
|
||||
<property name="type" value="ExplicitDedication"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -234,4 +234,10 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl"/>
|
||||
<bean id="ExplicitDedicationProcessor" class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
|
||||
<property name="name" value="ExplicitDedicationProcessor"/>
|
||||
<property name="type" value="ExplicitDedication"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
|
||||
@LogLevel(Log4jLevel.Trace)
|
||||
public class GetVmDiskStatsAnswer extends Answer {
|
||||
|
||||
String hostName;
|
||||
HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsMap;
|
||||
|
||||
public GetVmDiskStatsAnswer(GetVmDiskStatsCommand cmd, String details, String hostName, HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsMap) {
|
||||
super(cmd, true, details);
|
||||
this.hostName = hostName;
|
||||
this.vmDiskStatsMap = vmDiskStatsMap;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public HashMap<String, List<VmDiskStatsEntry>> getVmDiskStatsMap() {
|
||||
return vmDiskStatsMap;
|
||||
}
|
||||
|
||||
protected GetVmDiskStatsAnswer() {
|
||||
//no-args constructor for json serialization-deserialization
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
|
||||
@LogLevel(Log4jLevel.Trace)
|
||||
public class GetVmDiskStatsCommand extends Command {
|
||||
List<String> vmNames;
|
||||
String hostGuid;
|
||||
String hostName;
|
||||
|
||||
protected GetVmDiskStatsCommand() {
|
||||
}
|
||||
|
||||
public GetVmDiskStatsCommand(List<String> vmNames, String hostGuid, String hostName) {
|
||||
this.vmNames = vmNames;
|
||||
this.hostGuid = hostGuid;
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
public List<String> getVmNames() {
|
||||
return vmNames;
|
||||
}
|
||||
|
||||
public String getHostGuid(){
|
||||
return this.hostGuid;
|
||||
}
|
||||
|
||||
public String getHostName(){
|
||||
return this.hostName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,10 +24,18 @@ import com.cloud.agent.api.to.StorageFilerTO;
|
|||
public class MigrateWithStorageCommand extends Command {
|
||||
VirtualMachineTO vm;
|
||||
Map<VolumeTO, StorageFilerTO> volumeToFiler;
|
||||
String tgtHost;
|
||||
|
||||
public MigrateWithStorageCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
|
||||
this.vm = vm;
|
||||
this.volumeToFiler = volumeToFiler;
|
||||
this.tgtHost = null;
|
||||
}
|
||||
|
||||
public MigrateWithStorageCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler, String tgtHost) {
|
||||
this.vm = vm;
|
||||
this.volumeToFiler = volumeToFiler;
|
||||
this.tgtHost = tgtHost;
|
||||
}
|
||||
|
||||
public VirtualMachineTO getVirtualMachine() {
|
||||
|
|
@ -38,6 +46,10 @@ public class MigrateWithStorageCommand extends Command {
|
|||
return volumeToFiler;
|
||||
}
|
||||
|
||||
public String getTargetHost() {
|
||||
return tgtHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class UnPlugNicCommand extends Command{
|
|||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
public String getVmName() {
|
||||
return instanceName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import com.cloud.vm.VmDiskStats;
|
||||
|
||||
public class VmDiskStatsEntry implements VmDiskStats {
|
||||
|
||||
String vmName;
|
||||
String path;
|
||||
Long ioRead = 0L;
|
||||
Long ioWrite = 0L;
|
||||
Long bytesWrite = 0L;
|
||||
Long bytesRead = 0L;
|
||||
|
||||
public VmDiskStatsEntry() {
|
||||
}
|
||||
|
||||
public VmDiskStatsEntry(String vmName, String path, Long ioWrite, Long ioRead, Long bytesWrite, Long bytesRead) {
|
||||
this.ioRead = ioRead;
|
||||
this.ioWrite = ioWrite;
|
||||
this.bytesRead = bytesRead;
|
||||
this.bytesWrite = bytesWrite;
|
||||
this.vmName = vmName;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public void setVmName(String vmName) {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setBytesRead(Long bytesRead) {
|
||||
this.bytesRead = bytesRead;
|
||||
}
|
||||
|
||||
public Long getBytesRead() {
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
public void setBytesWrite(Long bytesWrite) {
|
||||
this.bytesWrite = bytesWrite;
|
||||
}
|
||||
|
||||
public Long getBytesWrite() {
|
||||
return bytesWrite;
|
||||
}
|
||||
|
||||
public void setIORead(Long ioRead) {
|
||||
this.ioRead = ioRead;
|
||||
}
|
||||
|
||||
public Long getIORead() {
|
||||
return ioRead;
|
||||
}
|
||||
|
||||
public void setIOWrite(Long ioWrite) {
|
||||
this.ioWrite = ioWrite;
|
||||
}
|
||||
|
||||
public Long getIOWrite() {
|
||||
return ioWrite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,6 +23,10 @@ public class VmStatsEntry implements VmStats {
|
|||
double cpuUtilization;
|
||||
double networkReadKBs;
|
||||
double networkWriteKBs;
|
||||
double diskReadIOs;
|
||||
double diskWriteIOs;
|
||||
double diskReadKBs;
|
||||
double diskWriteKBs;
|
||||
int numCPUs;
|
||||
String entityType;
|
||||
|
||||
|
|
@ -37,6 +41,18 @@ public class VmStatsEntry implements VmStats {
|
|||
this.numCPUs = numCPUs;
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public VmStatsEntry(double cpuUtilization, double networkReadKBs, double networkWriteKBs,
|
||||
double diskReadKBs, double diskWriteKBs, int numCPUs, String entityType)
|
||||
{
|
||||
this.cpuUtilization = cpuUtilization;
|
||||
this.networkReadKBs = networkReadKBs;
|
||||
this.networkWriteKBs = networkWriteKBs;
|
||||
this.diskReadKBs = diskReadKBs;
|
||||
this.diskWriteKBs = diskWriteKBs;
|
||||
this.numCPUs = numCPUs;
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public double getCPUUtilization() {
|
||||
return cpuUtilization;
|
||||
|
|
@ -62,6 +78,38 @@ public class VmStatsEntry implements VmStats {
|
|||
this.networkWriteKBs = networkWriteKBs;
|
||||
}
|
||||
|
||||
public double getDiskReadIOs() {
|
||||
return diskReadIOs;
|
||||
}
|
||||
|
||||
public void setDiskReadIOs(double diskReadIOs) {
|
||||
this.diskReadIOs = diskReadIOs;
|
||||
}
|
||||
|
||||
public double getDiskWriteIOs() {
|
||||
return diskWriteIOs;
|
||||
}
|
||||
|
||||
public void setDiskWriteIOs(double diskWriteIOs) {
|
||||
this.diskWriteIOs = diskWriteIOs;
|
||||
}
|
||||
|
||||
public double getDiskReadKBs() {
|
||||
return diskReadKBs;
|
||||
}
|
||||
|
||||
public void setDiskReadKBs(double diskReadKBs) {
|
||||
this.diskReadKBs = diskReadKBs;
|
||||
}
|
||||
|
||||
public double getDiskWriteKBs() {
|
||||
return diskWriteKBs;
|
||||
}
|
||||
|
||||
public void setDiskWriteKBs(double diskWriteKBs) {
|
||||
this.diskWriteKBs = diskWriteKBs;
|
||||
}
|
||||
|
||||
public int getNumCPUs() {
|
||||
return numCPUs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ public class VirtualRoutingResource implements Manager {
|
|||
for (IpAliasTO ipAliasTO : revokedIpAliasTOs) {
|
||||
args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
|
||||
}
|
||||
args = args + " " ;
|
||||
args = args + "- " ;
|
||||
List<IpAliasTO> activeIpAliasTOs = cmd.getCreateIpAliasTos();
|
||||
for (IpAliasTO ipAliasTO : activeIpAliasTOs) {
|
||||
args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ import java.util.List;
|
|||
"conf-dir=/etc/dnsmasq.d\n",
|
||||
"dhcp-option=tag:net1,3,ipaddress\n",
|
||||
"dhcp-option=tag:net1,1,netmask\n",
|
||||
"dhcp-option=6,10.147.28.149,8.8.8.8\n",
|
||||
"dhcp-option=6,router_ip,external_dns\n",
|
||||
"dhcp-optsfile=/etc/dhcpopts.txt\n",
|
||||
|
||||
|
||||
|
|
@ -85,11 +85,21 @@ import java.util.List;
|
|||
String netmask="";
|
||||
String domain= dnsMasqconfigcmd.getDomain();
|
||||
String dnsServers="";
|
||||
String dns_external="";
|
||||
if (dnsMasqconfigcmd.getDns1()!= null) {
|
||||
dns_external = dnsMasqconfigcmd.getDns1()+",";
|
||||
}
|
||||
if (dnsMasqconfigcmd.getDns2() != null) {
|
||||
dns_external = dns_external+dnsMasqconfigcmd.getDns2()+",";
|
||||
}
|
||||
dns_external = dns_external + "*";
|
||||
dns_external = dns_external.replace(",*","");
|
||||
int i=0;
|
||||
for (; i< dnsmasqTOs.size(); i++) {
|
||||
range=range + "dhcp-range=set:range"+i+","+dnsmasqTOs.get(i).getRouterIp()+",static\n";
|
||||
range=range + "dhcp-range=set:range"+i+","+dnsmasqTOs.get(i).getStartIpOfSubnet()+",static\n";
|
||||
gateway=gateway +"dhcp-option=tag:range"+i+",3,"+dnsmasqTOs.get(i).getGateway()+"\n";
|
||||
netmask=netmask +"dhcp-option=tag:range"+i+",1,"+dnsmasqTOs.get(i).getNetmask()+"\n";
|
||||
dnsServers=dnsServers+"dhcp-option=tag:range"+i+",6,"+dnsmasqTOs.get(i).getRouterIp()+","+dns_external+"\n";
|
||||
}
|
||||
dnsMasqconf.set(12, "domain="+domain+"\n");
|
||||
dnsMasqconf.set(14, "domain="+domain+"\n");
|
||||
|
|
@ -97,21 +107,7 @@ import java.util.List;
|
|||
dnsMasqconf.set(18, range);
|
||||
dnsMasqconf.set(22, gateway);
|
||||
dnsMasqconf.set(23, netmask);
|
||||
if (dnsMasqconfigcmd.getInternal_dns1() != null) {
|
||||
dnsServers = dnsServers+dnsMasqconfigcmd.getInternal_dns1()+",";
|
||||
}
|
||||
if (dnsMasqconfigcmd.getInternal_dns2() != null) {
|
||||
dnsServers = dnsServers+dnsMasqconfigcmd.getInternal_dns2()+",";
|
||||
}
|
||||
if (dnsMasqconfigcmd.getDns1() != null) {
|
||||
dnsServers = dnsServers+dnsMasqconfigcmd.getDns1()+",";
|
||||
}
|
||||
if (dnsMasqconfigcmd.getDns2() != null) {
|
||||
dnsServers = dnsServers+dnsMasqconfigcmd.getDns2()+",";
|
||||
}
|
||||
dnsServers = dnsServers +"*";
|
||||
dnsServers = dnsServers.replace(",*", "");
|
||||
dnsMasqconf.set(24,"dhcp-option=6,"+dnsServers);
|
||||
dnsMasqconf.set(24,dnsServers);
|
||||
return dnsMasqconf.toArray( new String[dnsMasqconf.size()]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cloud-developer</artifactId>
|
||||
<name>Apache CloudStack Developer Tools</name>
|
||||
<name>Apache CloudStack Developer Mode</name>
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- 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.
|
||||
-->
|
||||
|
||||
<!ENTITY PRODUCT "CloudStack">
|
||||
<!ENTITY BOOKID "Technical Documentation">
|
||||
<!ENTITY YEAR "2013">
|
||||
<!ENTITY HOLDER "Apache Software Foundation">
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "CloudStack_GSoC_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
|
||||
%xinclude;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<book>
|
||||
<bookinfo id="cloudstack_gsoc_2013">
|
||||
<title>&PRODUCT; Guide for the 2013 Google Summer of Code</title>
|
||||
<productname>Apache CloudStack</productname>
|
||||
<productnumber>4.3.0</productnumber>
|
||||
<edition>1</edition>
|
||||
<pubsnumber></pubsnumber>
|
||||
<abstract>
|
||||
<para>
|
||||
Guide for 2013 Google Summer of Code Projects.
|
||||
</para>
|
||||
</abstract>
|
||||
<corpauthor>
|
||||
<inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
|
||||
</imageobject>
|
||||
</inlinemediaobject>
|
||||
</corpauthor>
|
||||
<xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</bookinfo>
|
||||
<xi:include href="gsoc-tuna.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="gsoc-imduffy15.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="gsoc-dharmesh.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
</book>
|
||||
|
||||
|
|
@ -39,28 +39,43 @@
|
|||
<para>Click the Configure button of the VPC to which you want to deploy the VMs.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
<para>The Public IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Acquire New IP, and click Yes in the confirmation dialog.</para>
|
||||
|
|
@ -70,4 +85,4 @@
|
|||
rules.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
<section id="add-gateway-vpc">
|
||||
<title>Adding a Private Gateway to a VPC</title>
|
||||
<para>A private gateway can be added by the root admin only. The VPC private network has 1:1
|
||||
relationship with the NIC of the physical network. No gateways with duplicated VLAN and IP are
|
||||
allowed in the same data center.</para>
|
||||
relationship with the NIC of the physical network. You can configure multiple private gateways
|
||||
to a single VPC. No gateways with duplicated VLAN and IP are allowed in the same data center.</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as an administrator or end user.</para>
|
||||
|
|
@ -45,16 +45,34 @@
|
|||
<para>The following options are displayed.</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
|
|
@ -96,9 +114,38 @@
|
|||
<para><emphasis role="bold">VLAN</emphasis>: The VLAN associated with the VPC
|
||||
gateway.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Source NAT</emphasis>: Select this option to enable the source
|
||||
NAT service on the VPC private gateway.</para>
|
||||
<para>See <xref linkend="sourcenat-private-gateway"/>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">ACL</emphasis>: Controls both ingress and egress traffic on a
|
||||
VPC private gateway. By default, all the traffic is blocked.</para>
|
||||
<para>See <xref linkend="acl-private-gateway"/>.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The new gateway appears in the list. You can repeat these steps to add more gateway for
|
||||
this VPC.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<section id="sourcenat-private-gateway">
|
||||
<title>Source NAT on Private Gateway</title>
|
||||
<para>You might want to deploy multiple VPCs with the same super CIDR and guest tier CIDR.
|
||||
Therefore, multiple guest VMs from different VPCs can have the same IPs to reach a enterprise
|
||||
data center through the private gateway. In such cases, a NAT service need to be configured on
|
||||
the private gateway. If Source NAT is enabled, the guest VMs in VPC reaches the enterprise
|
||||
network via private gateway IP address by using the NAT service. </para>
|
||||
<para>The Source NAT service on a private gateway can be enabled while adding the private
|
||||
gateway. On deletion of a private gateway, source NAT rules specific to the private gateway
|
||||
are deleted.</para>
|
||||
</section>
|
||||
<section id="acl-private-gateway">
|
||||
<title>ACL on Private Gateway</title>
|
||||
<para>The traffic on the VPC private gateway is controlled by creating both ingress and egress
|
||||
network ACL rules. The ACLs contains both allow and deny rules. As per the rule, all the
|
||||
ingress traffic to the private gateway interface and all the egress traffic out from the
|
||||
private gateway interface are blocked. You can change this default behaviour while creating a
|
||||
private gateway.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -21,103 +21,310 @@
|
|||
-->
|
||||
<section id="add-loadbalancer-rule-vpc">
|
||||
<title>Adding Load Balancing Rules on a VPC</title>
|
||||
<para>A &PRODUCT; user or administrator may create load balancing rules that balance traffic
|
||||
received at a public IP to one or more VMs that belong to a network tier that provides load
|
||||
balancing service in a VPC. A user creates a rule, specifies an algorithm, and assigns the rule
|
||||
to a set of VMs within a VPC.</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as an administrator or end user.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the left navigation, choose Network.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Select view, select VPC.</para>
|
||||
<para>All the VPCs that you have created for the account is listed in the page.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Configure button of the VPC to which you want to configure load balancing
|
||||
rules.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<itemizedlist>
|
||||
<para>In a VPC, you can configure two types of load balancing—external LB and internal LB.
|
||||
External LB is nothing but a LB rule created to redirect the traffic received at a public IP of
|
||||
the VPC virtual router. The traffic is load balanced within a tier based on your configuration.
|
||||
Citrix NetScaler and VPC virtual router are supported for external LB. When you use internal LB
|
||||
service, traffic received at a tier is load balanced across different tiers within the VPC. For
|
||||
example, traffic reached at Web tier is redirected to Application tier. External load balancing
|
||||
devices are not supported for internal LB. The service is provided by a internal LB VM
|
||||
configured on the target tier.</para>
|
||||
<section id="curent-lb-vpc">
|
||||
<title>Load Balancing Within a Tier (External LB)</title>
|
||||
<para>A &PRODUCT; user or administrator may create load balancing rules that balance traffic
|
||||
received at a public IP to one or more VMs that belong to a network tier that provides load
|
||||
balancing service in a VPC. A user creates a rule, specifies an algorithm, and assigns the
|
||||
rule to a set of VMs within a VPC.</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as an administrator or end user.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the left navigation, choose Network.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Select view, select VPC.</para>
|
||||
<para>All the VPCs that you have created for the account is listed in the page.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Configure button of the VPC, for which you want to configure load balancing
|
||||
rules.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created listed in a diagram.</para>
|
||||
<para>For each tier, the following options are displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Router node, select Public IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the IP address for which you want to create the rule, then click the
|
||||
Configuration tab.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Load Balancing node of the diagram, click View All.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select the tier to which you want to apply the rule.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Name</emphasis>: A name for the load balancer rule.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Public Port</emphasis>: The port that receives the incoming
|
||||
traffic to be balanced.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Private Port</emphasis>: The port that the VMs will use to
|
||||
receive the traffic.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Algorithm</emphasis>. Choose the load balancing algorithm
|
||||
you want &PRODUCT; to use. &PRODUCT; supports the following well-known
|
||||
algorithms:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Round-robin</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Least connections</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Source</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Stickiness</emphasis>. (Optional) Click Configure and choose
|
||||
the algorithm for the stickiness policy. See Sticky Session Policies for Load Balancer
|
||||
Rules.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Add VMs</emphasis>: Click Add VMs, then select two or more
|
||||
VMs that will divide the load of incoming traffic, and click Apply.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>The new load balancing rule appears in the list. You can repeat these steps to add more
|
||||
load balancing rules for this IP address.</para>
|
||||
</section>
|
||||
<section id="acros-tiers-lb">
|
||||
<title>Load Balancing Across Tiers</title>
|
||||
<para>&PRODUCT; supports sharing workload across different tiers within your VPC. Assume that
|
||||
multiple tiers are set up in your environment, such as Web tier and Application tier. Traffic
|
||||
to each tier is balanced on the VPC virtual router on the public side, as explained in <xref
|
||||
linkend="add-loadbalancer-rule-vpc"/>. If you want the traffic coming from the Web tier to
|
||||
the Application tier to be balanced, use the internal load balancing feature offered by
|
||||
&PRODUCT;.</para>
|
||||
<section id="vpc-pic">
|
||||
<title>How Does Internal LB Work in VPC?</title>
|
||||
<para>In this figure, a public LB rule is created for the public IP 72.52.125.10 with public
|
||||
port 80 and private port 81. The LB rule, created on the VPC virtual router, is applied on
|
||||
the traffic coming from the Internet to the VMs on the Web tier. On the Application tier two
|
||||
internal load balancing rules are created. An internal LB rule for the guest IP 10.10.10.4
|
||||
with load balancer port 23 and instance port 25 is configured on the VM, InternalLBVM1.
|
||||
Another internal LB rule for the guest IP 10.10.10.4 with load balancer port 45 and instance
|
||||
port 46 is configured on the VM, InternalLBVM1. Another internal LB rule for the guest IP
|
||||
10.10.10.6, with load balancer port 23 and instance port 25 is configured on the VM,
|
||||
InternalLBVM2.</para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/vpc-lb.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>vpc-lb.png: Configuring internal LB for VPC</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
</section>
|
||||
<section id="enable-vpc-lb">
|
||||
<title>Enabling Internal LB on a VPC Tier</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Create a network offering, as given in <xref linkend="int-lb-vpc"/>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Create an internal load balancing rule and apply, as given in <xref
|
||||
linkend="int-lb-vpc"/>.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="int-lb-offering">
|
||||
<title>Creating a Network Offering for Internal LB</title>
|
||||
<para>To have internal LB support on VPC, create a network offering as follows: </para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as a user or admin.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>From the Select Offering drop-down, choose Network Offering.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the IP address for which you want to create the rule, then click the Configuration
|
||||
tab.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Load Balancing node of the diagram, click View All.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select the tier to which you want to apply the rule.</para>
|
||||
<note>
|
||||
<para>In a VPC, the load balancing service is supported only on a single tier.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Name</emphasis>: A name for the load balancer rule.</para>
|
||||
<para>Click Add Network Offering.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Public Port</emphasis>: The port that receives the incoming
|
||||
traffic to be balanced.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Private Port</emphasis>: The port that the VMs will use to
|
||||
receive the traffic.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Algorithm</emphasis>. Choose the load balancing algorithm you
|
||||
want &PRODUCT; to use. &PRODUCT; supports the following well-known algorithms:</para>
|
||||
<para>In the dialog, make the following choices:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Round-robin</para>
|
||||
<para><emphasis role="bold">Name</emphasis>: Any desired name for the network
|
||||
offering.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Least connections</para>
|
||||
<para><emphasis role="bold">Description</emphasis>: A short description of the
|
||||
offering that can be displayed to users.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Source</para>
|
||||
<para><emphasis role="bold">Network Rate</emphasis>: Allowed data transfer rate in MB
|
||||
per second.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Traffic Type</emphasis>: The type of network traffic that
|
||||
will be carried on the network.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Guest Type</emphasis>: Choose whether the guest network is
|
||||
isolated or shared.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Persistent</emphasis>: Indicate whether the guest network
|
||||
is persistent or not. The network that you can provision without having to deploy a
|
||||
VM on it is termed persistent network. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">VPC</emphasis>: This option indicate whether the guest
|
||||
network is Virtual Private Cloud-enabled. A Virtual Private Cloud (VPC) is a
|
||||
private, isolated part of &PRODUCT;. A VPC can have its own virtual network topology
|
||||
that resembles a traditional physical network. For more information on VPCs, see
|
||||
<xref linkend="vpc"/>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Specify VLAN</emphasis>: (Isolated guest networks only)
|
||||
Indicate whether a VLAN should be specified when this offering is used.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Supported Services</emphasis>: Select Load Balancer.
|
||||
Select <code>InternalLbVM</code> from the provider list.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Load Balancer Type</emphasis>: Select Internal LB from the
|
||||
drop-down.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">System Offering</emphasis>: Choose the system service
|
||||
offering that you want virtual routers to use in this network.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Conserve mode</emphasis>: Indicate whether to use conserve
|
||||
mode. In this mode, network resources are allocated only when the first virtual
|
||||
machine starts in the network.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Stickiness</emphasis>. (Optional) Click Configure and choose
|
||||
the algorithm for the stickiness policy. See Sticky Session Policies for Load Balancer
|
||||
Rules.</para>
|
||||
<para>Click OK and the network offering is created.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="int-lb-vpc">
|
||||
<title>Creating an Internal LB Rule</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as an administrator or end user.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Add VMs</emphasis>: Click Add VMs, then select two or more VMs
|
||||
that will divide the load of incoming traffic, and click Apply.</para>
|
||||
<para>In the left navigation, choose Network.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>The new load balancing rule appears in the list. You can repeat these steps to add more load
|
||||
balancing rules for this IP address.</para>
|
||||
</section>
|
||||
<listitem>
|
||||
<para>In the Select view, select VPC.</para>
|
||||
<para>All the VPCs that you have created for the account is listed in the page.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Locate the VPC for which you want to configure internal LB, then click
|
||||
Configure.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Locate the Tier for which you want to configure an internal LB rule, click Internal
|
||||
LB.</para>
|
||||
<para>In the Internal LB page, click Add Internal LB.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the dialog, specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Name</emphasis>: A name for the load balancer rule.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Description</emphasis>: A short description of the rule
|
||||
that can be displayed to users.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Source IP Address</emphasis>: The source IP from which
|
||||
traffic originates. Typically, this is the IP of an instance on another tier within
|
||||
your VPC.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Source Port</emphasis>: The port associated with the
|
||||
source IP. Traffic on this port is load balanced. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Instance Port</emphasis>: The port of the internal LB
|
||||
VM.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Algorithm</emphasis>. Choose the load balancing algorithm
|
||||
you want &PRODUCT; to use. &PRODUCT; supports the following well-known
|
||||
algorithms:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Round-robin</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Least connections</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Source</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -35,28 +35,42 @@
|
|||
<para>Click the Configure button of the VPC to which you want to deploy the VMs.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<para>For each tier, the following options are displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Choose an existing IP address or acquire a new IP address. Click the name of the IP
|
||||
address in the list.</para>
|
||||
<para>In the Router node, select Public IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
@ -95,7 +109,7 @@
|
|||
<listitem>
|
||||
<para><emphasis role="bold">Add VM</emphasis>: Click Add VM. Select the name of the
|
||||
instance to which this rule applies, and click Apply.</para>
|
||||
<para>You can test the rule by opening an ssh session to the instance.</para>
|
||||
<para>You can test the rule by opening an SSH session to the instance.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Configure button of the VPC for which you want to set up tiers.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Create network.</para>
|
||||
<para>The Add new tier dialog is displayed, as follows:</para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
|
|
@ -62,7 +65,7 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Network Offering</emphasis>: The following default network
|
||||
offerings are listed: DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
|
||||
offerings are listed: Internal LB, DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
|
||||
DefaultIsolatedNetworkOfferingForVpcNetworks</para>
|
||||
<para>In a VPC, only one tier can be created by using LB-enabled network offering.</para>
|
||||
</listitem>
|
||||
|
|
|
|||
|
|
@ -33,13 +33,21 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Configure button of the VPC to which you want to deploy the VMs.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed.</para>
|
||||
<para>The VPC page is displayed where all the tiers you have created are listed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Add VM button of the tier for which you want to add a VM.</para>
|
||||
<para>Click Virtual Machines tab of the tier to which you want to add a VM.</para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/add-vm-vpc.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>add-vm-vpc.png: adding a VM to a vpc.</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
<para>The Add Instance page is displayed.</para>
|
||||
<para>Follow the on-screen instruction to add an instance. For information on adding an
|
||||
instance, see Adding Instances section in the Installation Guide.</para>
|
||||
instance, see the Installation Guide.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ under the License.
|
|||
<section id="generating-rpms">
|
||||
<title>Generating RPMS</title>
|
||||
<para>Now that we have the prerequisites and source, you will cd to the <filename>packaging/centos63/</filename> directory.</para>
|
||||
<programlisting><prompt>$</prompt> cd packaging/centos63</programlisting>
|
||||
<para>Generating RPMs is done using the <filename>package.sh</filename> script:
|
||||
<programlisting><prompt>$</prompt>./package.sh</programlisting>
|
||||
</para>
|
||||
|
|
|
|||
|
|
@ -37,31 +37,66 @@
|
|||
<para>All the VPCs that you have created for the account is listed in the page.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<para>Click the Configure button of the VPC, for which you want to configure load balancing
|
||||
rules.</para>
|
||||
<para>For each tier, the following options are displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select Network ACLs.</para>
|
||||
<para>The Network ACLs page is displayed.</para>
|
||||
<para>Select Network ACL Lists.</para>
|
||||
<para>The following default rules are displayed in the Network ACLs page: default_allow,
|
||||
default_deny.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Add Network ACLs.</para>
|
||||
<para>Click Add ACL Lists, and specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">ACL List Name</emphasis>: A name for the ACL list.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Description</emphasis>: A short description of the ACL list
|
||||
that can be displayed to users.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select the ACL list.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select the ACL List Rules tab.</para>
|
||||
<para>To add an ACL rule, fill in the following fields to specify what kind of network traffic
|
||||
is allowed in this tier. </para>
|
||||
is allowed in the VPC. </para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">CIDR</emphasis>: The CIDR acts as the Source CIDR for the
|
||||
|
|
@ -74,7 +109,8 @@
|
|||
<para><emphasis role="bold">Protocol</emphasis>: The networking protocol that sources use
|
||||
to send traffic to the tier. The TCP and UDP protocols are typically used for data
|
||||
exchange and end-user communications. The ICMP protocol is typically used to send error
|
||||
messages or network monitoring data.</para>
|
||||
messages or network monitoring data. All supports all the traffic. Other option is
|
||||
Protocol Number.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Start Port</emphasis>, <emphasis role="bold">End
|
||||
|
|
@ -83,8 +119,10 @@
|
|||
fields.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Select Tier</emphasis>: Select the tier for which you want to
|
||||
add this ACL rule.</para>
|
||||
<para><emphasis role="bold">Protocol Number</emphasis>: The protocol number associated
|
||||
with IPv4 or IPv6. For more information, see <ulink
|
||||
url="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml">Protocol
|
||||
Numbers</ulink>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">ICMP Type</emphasis>, <emphasis role="bold">ICMP
|
||||
|
|
@ -92,48 +130,14 @@
|
|||
sent.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Traffic Type</emphasis>: Select the traffic type you want to
|
||||
apply. </para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Egress</emphasis>: To add an egress rule, select Egress
|
||||
from the Traffic type drop-down box and click Add. This specifies what type of
|
||||
traffic is allowed to be sent out of VM instances in this tier. If no egress rules
|
||||
are specified, all traffic from the tier is allowed out at the VPC virtual router.
|
||||
Once egress rules are specified, only the traffic specified in egress rules and the
|
||||
responses to any traffic that has been allowed in through an ingress rule are
|
||||
allowed out. No egress rule is required for the VMs in a tier to communicate with
|
||||
each other.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Ingress</emphasis>: To add an ingress rule, select Ingress
|
||||
from the Traffic type drop-down box and click Add. This specifies what network
|
||||
traffic is allowed into the VM instances in this tier. If no ingress rules are
|
||||
specified, then no traffic will be allowed in, except for responses to any traffic
|
||||
that has been allowed out through an egress rule.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<note>
|
||||
<para>By default, all incoming and outgoing traffic to the guest networks is blocked. To
|
||||
open the ports, create a new network ACL.</para>
|
||||
</note>
|
||||
<para><emphasis role="bold">Action</emphasis>: What action to be taken. </para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Add. The ACL rule is added.</para>
|
||||
<para>To view the list of ACL rules you have added, click the desired tier from the Network
|
||||
ACLs page, then select the Network ACL tab.</para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/network-acl.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>network-acl.png: adding, editing, deleting an ACL rule.</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
<para>You can edit the tags assigned to the ACL rules and delete the ACL rules you have
|
||||
created. Click the appropriate button in the Actions column.</para>
|
||||
created. Click the appropriate button in the Details tab.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -42,27 +42,42 @@
|
|||
<para>Click the Configure button of the VPC to which you want to deploy the VMs.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<para>For each tier, the following options are displayed.</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select IP Addresses.</para>
|
||||
<para>In the Router node, select Public IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
@ -74,7 +89,7 @@
|
|||
<imagedata fileref="./images/enable-disable.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>enable-disable.png: button to enable Statid NAT.</phrase>
|
||||
<phrase>enable-disable.png: button to enable Static NAT.</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject>The button toggles between Enable and Disable, depending on whether
|
||||
static NAT is currently enabled for the IP address.</para>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "CloudStack_GSoC_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<chapter id="gsoc-dharmesh">
|
||||
<title>Dharmesh's 2013 GSoC Proposal</title>
|
||||
<para>This chapter describes Dharmrsh's 2013 Google Summer of Code project within the &PRODUCT; ASF project. It is a copy paste of the submitted proposal.</para>
|
||||
<section id="abstract-dharmesh">
|
||||
<title>Abstract</title>
|
||||
<para>
|
||||
The project aims to bring <ulink url="http://aws.amazon.com/cloudformation/"><citetitle>cloudformation</citetitle></ulink> like service to cloudstack. One of the prime use-case is cluster computing frameworks on cloudstack. A cloudformation service will give users and administrators of cloudstack ability to manage and control a set of resources easily. The cloudformation will allow booting and configuring a set of VMs and form a cluster. Simple example would be LAMP stack. More complex clusters such as mesos or hadoop cluster requires a little more advanced configuration. There is already some work done by Chiradeep Vittal at this front [5]. In this project, I will implement server side cloudformation service for cloudstack and demonstrate how to run mesos cluster using it.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mesos">
|
||||
<title>Mesos</title>
|
||||
<para>
|
||||
<ulink url="http://incubator.apache.org/mesos/"><citetitle>Mesos</citetitle></ulink> is a resource management platform for clusters. It aims to increase resource utilization of clusters by sharing cluster resources among multiple processing frameworks(like MapReduce, MPI, Graph Processing) or multiple instances of same framework. It provides efficient resource isolation through use of containers. Uses zookeeper for state maintenance and fault tolerance.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mesos-use">
|
||||
<title>What can run on mesos ?</title>
|
||||
|
||||
<para><emphasis role="bold">Spark:</emphasis> A cluster computing framework based on the Resilient Distributed Datasets (RDDs) abstraction. RDD is more generalized than MapReduce and can support iterative and interactive computation while retaining fault tolerance, scalability, data locality etc.</para>
|
||||
|
||||
<para><emphasis role="bold">Hadoop:</emphasis>: Hadoop is fault tolerant and scalable distributed computing framework based on MapReduce abstraction.</para>
|
||||
|
||||
<para><emphasis role="bold">Begel:</emphasis>: A graph processing framework based on pregel.</para>
|
||||
|
||||
<para>and other frameworks like MPI, Hypertable.</para>
|
||||
</section>
|
||||
|
||||
<section id="mesos-deploy">
|
||||
<title>How to deploy mesos ?</title>
|
||||
|
||||
<para>Mesos provides cluster installation <ulink url="https://github.com/apache/mesos/blob/trunk/docs/Deploy-Scripts.textile"><citetitle>scripts</citetitle></ulink> for cluster deployment. There are also scripts available to deploy a cluster on <ulink url="https://github.com/apache/mesos/blob/trunk/docs/EC2-Scripts.textile"><citetitle>Amazon EC2</citetitle></ulink>. It would be interesting to see if this scripts can be leveraged in anyway.</para>
|
||||
</section>
|
||||
|
||||
<section id="deliverables-dharmesh">
|
||||
<title>Deliverables</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Deploy CloudStack and understand instance configuration/contextualization</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Test and deploy Mesos on a set of CloudStack based VM, manually. Design/propose an automation framework</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Test stackmate and engage chiradeep (report bugs, make suggestion, make pull request)</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Create cloudformation template to provision a Mesos Cluster</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Compare with Apache Whirr or other cluster provisioning tools for server side implementation of cloudformation service.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
||||
<section id="arch-and-tools">
|
||||
<title>Architecture and Tools</title>
|
||||
|
||||
<para>The high level architecture is as follows:</para>
|
||||
|
||||
<para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="images/mesos-integration-arch.jpg"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</para>
|
||||
|
||||
|
||||
<para>It includes following components:</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>CloudFormation Query API server:</para>
|
||||
<para>This acts as a point of contact to and exposes CloudFormation functionality as Query API. This can be accessed directly or through existing tools from Amazon AWS for their cloudformation service. It will be easy to start as a module which resides outside cloudstack at first and I plan to use dropwizard [3] to start with. Later may be the API server can be merged with cloudstack core. I plan to use mysql for storing details of clusters.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Provisioning:</para>
|
||||
|
||||
<para>Provisioning module is responsible for handling the booting process of the VMs through cloudstack. This uses the cloudstack APIs for launching VMs. I plan to use preconfigured templates/images with required dependencies installed, which will make cluster creation process much faster even for large clusters. Error handling is very important part of this module. For example, what you do if few VMs fail to boot in cluster ?</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Configuration:</para>
|
||||
|
||||
<para>This module deals with configuring the VMs to form a cluster. This can be done via manual scripts/code or via configuration management tools like chef/ironfan/knife. Potentially workflow automation tools like rundeck [4] also can be used. Also Apache whirr and Provisionr are options. I plan to explore this tools and select suitable ones.</para>
|
||||
</listitem>
|
||||
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
||||
<section id="api">
|
||||
<title>API</title>
|
||||
|
||||
<para>Query <ulink url="http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Operations.html"><citetitle>API</citetitle></ulink> will be based on Amazon AWS cloudformation service. This will allow leveraging existing <ulink url="http://aws.amazon.com/developertools/AWS-CloudFormation"><citetitle>tools</citetitle></ulink> for AWS.</para>
|
||||
</section>
|
||||
|
||||
<section id="timeline">
|
||||
<title>Timeline</title>
|
||||
<para>1-1.5 week : project design. Architecture, tools selection, API design</para>
|
||||
<para>1-1.5 week : getting familiar with cloudstack and stackmate codebase and architecture details</para>
|
||||
<para>1-1.5 week : getting familiar with mesos internals</para>
|
||||
<para>1-1.5 week : setting up the dev environment and create mesos templates</para>
|
||||
<para>2-3 week : build provisioning and configuration module</para>
|
||||
<para>Midterm evaluation: provisioning module, configuration module</para>
|
||||
<para>2-3 week : develope cloudformation server side implementation</para>
|
||||
<para>2-3 week : test and integrate</para>
|
||||
</section>
|
||||
|
||||
<section id="future-work">
|
||||
<title>Future Work</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Auto Scaling:</emphasis></para>
|
||||
<para>Automatically adding or removing VMs from mesos cluster based on various conditions like utilization going above/below a static threshold. There can be more sophisticated strategies based on prediction or fine grained metric collection with tight integration with mesos framework.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Cluster Simulator:</emphasis></para>
|
||||
<para>Integrating with existing simulator to simulate mesos clusters. This can be useful in various scenarios, for example while developing a new scheduling algorithm, testing autoscaling etc.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
@ -0,0 +1,395 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "CloudStack_GSoC_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<chapter id="gsoc-imduffy15">
|
||||
<title>Ians's 2013 GSoC Proposal</title>
|
||||
<para>This chapter describes Ians 2013 Google Summer of Code project within the &PRODUCT; ASF project. It is a copy paste of the submitted proposal.</para>
|
||||
<section id="ldap-user-provisioning">
|
||||
<title>LDAP user provisioning</title>
|
||||
<para>
|
||||
"Need to automate the way the LDAP users are provisioned into cloud stack. This will mean better
|
||||
integration with a LDAP server, ability to import users and a way to define how the LDAP user
|
||||
maps to the cloudstack users."
|
||||
</para>
|
||||
</section>
|
||||
<section id="abstract">
|
||||
<title>Abstract</title>
|
||||
<para>
|
||||
The aim of this project is to provide an more effective mechanism to provision users from LDAP
|
||||
into cloudstack. Currently cloudstack enables LDAP authentication. In this authentication users
|
||||
must be first setup in cloudstack. Once the user is setup in cloudstack they can authenticate
|
||||
using their LDAP username and password. This project will improve Cloudstack LDAP integration
|
||||
by enabling users be setup automatically using their LDAP credential
|
||||
</para>
|
||||
</section>
|
||||
<section id="deliverables">
|
||||
<title>Deliverables</title>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Service that retrieves a list of LDAP users from a configured group</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Extension of the cloudstack UI "Add User" screen to offer user list from LDAP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Add service for saving new user it details from LDAP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>BDD unit and acceptance automated testing</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Document change details</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="quantifiable-results">
|
||||
<title>Quantifiable Results</title>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add new user to cloudstack and LDAP is setup in cloudstack</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>A table of users appears for the current list of users (not already created on cloudstack) from the LDAP group displaying their usernames, given name and email address. The timezone dropdown will still be available beside each user</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add new user to cloudstack and LDAP is not setup in cloudstack</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>The current add user screen and functionality is provided</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add new user to cloudstack and LDAP is setup in cloudstack</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen and mandatory information is missing</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>These fields will be editable to enable you to populate the name or email address</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add new user to cloudstack, LDAP is setup and the user being created is in the LDAP query group</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>There is a list of LDAP users displayed but the user is present in the list</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add a new user to cloudstack, LDAP is setup and the user is not in the query group</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>There is a list of LDAP users displayed but the user is not in the list</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator wants to add a group of new users to cloudstack</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The administrator opens the "Add User" screen, selects the users and hits save</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>The list of new users are saved to the database</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>An administrator has created a new LDAP user on cloudstack</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>The user authenticates against cloudstack with the right credentials</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>They are authorised in cloudstack</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Given</entry>
|
||||
<entry>A user wants to edit an LDAP user</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>When</entry>
|
||||
<entry>They open the "Edit User" screen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Then</entry>
|
||||
<entry>The password fields are disabled and cannot be changed</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para/>
|
||||
</section>
|
||||
<section id="the-design-document">
|
||||
<title>The Design Document</title>
|
||||
<para>
|
||||
<emphasis role="bold">
|
||||
LDAP user list service
|
||||
</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">name:</emphasis> ldapUserList
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">responseObject:</emphasis> LDAPUserResponse {username,email,name}
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">parameter:</emphasis> listType:enum {NEW, EXISTING,ALL} (Default to ALL if no option provided)
|
||||
</para>
|
||||
<para>
|
||||
Create a new API service call for retreiving the list of users from LDAP. This will call a new
|
||||
ConfigurationService which will retrieve the list of users using the configured search base and the query
|
||||
filter. The list may be filtered in the ConfigurationService based on listType parameter
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">
|
||||
LDAP Available Service
|
||||
</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">name:</emphasis> ldapAvailable
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">responseObject</emphasis> LDAPAvailableResponse {available:boolean}
|
||||
</para>
|
||||
<para>
|
||||
Create a new API service call veriying LDAP is setup correctly verifying the following configuration elements are all set:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>ldap.hostname</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.port</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.usessl</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.queryfilter</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.searchbase</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.dn</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>ldap.password</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">
|
||||
LDAP Save Users Service
|
||||
</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">name:</emphasis> ldapSaveUsers
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">responseObject:</emphasis> LDAPSaveUsersRssponse {list<![CDATA[<UserResponse>]]>}
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">parameter:</emphasis> list of users
|
||||
</para>
|
||||
<para>
|
||||
Saves the list of objects instead. Following the functionality in CreateUserCmd it will
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Create the user via the account service</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Handle the response</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
It will be decided whether a transation should remain over whole save or only over individual users. A list of UserResponse will be returned.
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">
|
||||
Extension of cloudstack UI "Add User" screen
|
||||
</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
Extend account.js enable the adding of a list of users with editable fields where required. The new "add user" screen for LDAP setup will:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Make an ajax call to the ldapAvailable, ldapuserList and ldapSaveUsers services</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Validate on username, email, firstname and lastname</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">
|
||||
Extension of cloudstack UI "Edit User" screen
|
||||
</emphasis>
|
||||
</para>
|
||||
<para>
|
||||
Extend account.js to disable the password fields on the edit user screen if LDAP available, specifically:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Make an ajax call to the ldapAvailable, ldapuserList and ldapSaveUsers services</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Validate on username, email, firstname and lastname. Additional server validation will nsure the password has not changed</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
<section id="approach">
|
||||
<title>Approach</title>
|
||||
<para>
|
||||
To get started a development cloudstack environment will be created with DevCloud used to verify changes. Once the schedule is agreed with the mentor the deliverables will be broken into small user stories with expected delivery dates set. The development cycle will focus on BDD, enforcing all unit and acceptance tests are written first.
|
||||
</para>
|
||||
<para>
|
||||
A build pipe line for continious delivery environment around cloudstack will be implemented, the following stages will be adopted:
|
||||
</para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Stage</entry>
|
||||
<entry>Action</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Commit</entry>
|
||||
<entry>Run unit tests</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Sonar</entry>
|
||||
<entry>Runs code quality metrics</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Acceptance</entry>
|
||||
<entry>Deploys the devcloud and runs all acceptance tests</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Deployment</entry>
|
||||
<entry>Deploy a new management server using Chef</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</section>
|
||||
<section id="about-me">
|
||||
<title>About me</title>
|
||||
<para>
|
||||
I am a Computer Science Student at Dublin City University in Ireland. I have interests in virtualization,
|
||||
automation, information systems, networking and web development
|
||||
</para>
|
||||
<para>
|
||||
I was involved with a project in a K-12(educational) environment of moving their server systems over
|
||||
to a virtualized environment on ESXi. I have good knowledge of programming in Java, PHP and
|
||||
Scripting langages. During the configuration of an automation system for OS deployment I experienced
|
||||
some exposure to scripting in powershell, batch, vbs and bash and configuration of PXE images based
|
||||
of WinPE and Debian.
|
||||
Additionally I am also a mentor in an opensource teaching movement called CoderDojo, we teach kids
|
||||
from the age of 8 everything from web page, HTML 5 game and raspberry pi development. It's really
|
||||
cool.
|
||||
</para>
|
||||
<para>
|
||||
I’m excited at the opportunity and learning experience that cloudstack are offering with this project.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "CloudStack_GSoC_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<chapter id="gsoc-tuna">
|
||||
<title>Nguyen's 2013 GSoC Proposal</title>
|
||||
<para>This chapter describes Nguyen 2013 Google Summer of Code project within the &PRODUCT; ASF project. It is a copy paste of the submitted proposal.</para>
|
||||
<section id="add-xen-xcp-support-for-gre-sdn-controller">
|
||||
<title>Add Xen/XCP support for GRE SDN controller</title>
|
||||
<para>
|
||||
"This project aims to enhance the current native SDN controller in supporting Xen/XCP and integrate successfully the open source SDN controller (FloodLight) driving Open vSwitch through its interfaces."
|
||||
</para>
|
||||
</section>
|
||||
<section id="Abstract">
|
||||
<title>Abstract</title>
|
||||
<para>
|
||||
SDN, standing for Software-Defined Networking, is an approach to building data network equipments and softwares. It were invented by ONRC, Stanford University. SDN basically decouples the control from physical networking boxes and given to a software application called a controller. SDN has three parts: controller, protocols and switch; In which, OpenFlow is an open standard to deploy innovative protocols. Nowaday, more and more datacenters use SDN instead of traditional physical networking boxes. For example, Google announced that they completely built its own switches and SDN confrollers for use in its internal backbone network.
|
||||
</para>
|
||||
<para>
|
||||
OpenvSwitch, an open source software switch, is widely used as a virtual switch in virtualized server environments. It can currently run on any Linux-based virtualization platform, such as: KVM, Xen (XenServer, XCP, Xen hypervisor), VirtualBox... It also has been ported to a number of different operating systems and hardware platforms: Linux, FreeBSD, Windows and even non-POSIX embedded systems. In cloud computing IaaS, using OpenvSwitch instead of Linux bridge on compute nodes becomes an inevitable trend because of its powerful features and the ability of OpenFlow integration as well.
|
||||
</para>
|
||||
<para>
|
||||
In CloudStack, we already have a native SDN controller. With KVM hypervisor, developers can easily install OpenvSwitch module; whereas, Xen even has a build-in one. The combination of SDN controller and OpenvSwitch gives us many advanced things. For example, creating GRE tunnels as an isolation method instead of VLAN is a good try. In this project, we are planning to support GRE tunnels in Xen/XCP hypervisor with the native SDN controller. When it's done, substituting open-sources SDN controllers (floodlight, beacon, pox, nox) for the current one is an amazing next step.
|
||||
</para>
|
||||
</section>
|
||||
<section id="design-desription">
|
||||
<title>Design description</title>
|
||||
<para>
|
||||
CloudStack currently has a native SDN Controller that is used to build meshes of GRE tunnels between Xen hosts. There consists of 4 parts: OVS tunnel manager, OVS Dao/VO, Command/Answer and Ovs tunnel plugin. The details are as follow:
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">OVS tunnel manager:</emphasis> Consist of OvsElement and OvsTunnelManager.
|
||||
</para>
|
||||
<para>
|
||||
OvsElement is used for controlling Ovs tunnel lifecycle (prepare, release)
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>prepare(network, nic, vm, dest): create tunnel for vm on network to dest</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>release(network, nic, vm): destroy tunnel for vm on network</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
OvsTunnelManager drives bridge configuration and tunnel creation via calling respective commands to Agent.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>destroyTunnel(vm, network): call OvsDestroyTunnelCommand to destroy tunnel for vm on network</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>createTunnel(vm, network, dest): call OvsCreateTunnelCommand to create tunnel for vm on network to dest</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
<emphasis role="bold">OVS tunnel plugin:</emphasis> These are ovstunnel and ovs-vif-flows.py script, writen as XAPI plugin. The OVS tunnel manager will call them via XML-RPC.
|
||||
</para>
|
||||
<para>
|
||||
Ovstunnel plugin calls corresponding vsctl commands for setting up the OVS bridge, creating GRE tunnels or destroying them.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>setup_ovs_bridge()</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>destroy_ovs_bridge()</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>create_tunnel()</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>destroy_tunnel()</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Ovs-vif-flow.py clears or applies rule for VIFs every time it is plugged or unplugged from a OVS bridge.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>clear_flow()</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>apply_flow()</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
<emphasis role="bold">OVS command/answer:</emphasis> It is designed under the format of requests and answers between Manager and Plugin. These commands will correspondence exactly the mentioned manipulations.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>OvsSetupBridgeCommand</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsSetupBridgeAnswer</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsDestroyBridgeCommand</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsDestroyBridgeAnswer</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsCreateTunnelCommand</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsCreateTunnelAnswer</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsDestroyTunnelCommand</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsDestroyTunnelAnswer</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsFetchInterfaceCommand</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsFetchInterfaceAnswer</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
<emphasis role="bold">OVS Dao/VO</emphasis>
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>OvsTunnelInterfaceDao</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsTunnelInterfaceVO</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsTunnelNetworkDao</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OvsTunnelNetworkVO</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="integrate-floodLight-as-sdn-controller">
|
||||
<title>Integrate FloodLight as SDN controller</title>
|
||||
<para>
|
||||
I think that we maybe deploy FloodLight Server as a new SystemVM. This VM acts like current SystemVMs. One Floodlight SystemVM per Zone, so it can manage for virtual switches under this zone.
|
||||
</para>
|
||||
</section>
|
||||
<section id="Deliverables">
|
||||
<title>Deliverables</title>
|
||||
<para>
|
||||
GRE has been used as isolation method in CloudStack when deploy with Xen/XCP hosts.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>User set sdn.ovs.controller parameter in Global Setting to true. He deploys Advance Networking and chooses GRE as isolation method</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Make use of Floodlight instead of native SDN controller.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="About-me">
|
||||
<title>About me</title>
|
||||
<para>
|
||||
My name is Nguyen Anh Tu, a young and enthusiastic researcher in Cloud Computing Center - Viettel Research and Development Institute, Vietnam. Since last year, we has built Cloud Platform based on CloudStack, starting with version 3.0.2. As the results, some advanced modules were successfully developed, consists of:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Encrypt Data Volume for VMs.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Dynamic Allocate Memory for VMs by changing policy on Squeeze Daemon.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>AutoScale without using NetScale.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Deploy a new SystemVM type for Intrustion Detection System.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Given the working experience and recent researches, I have obtained remarkably the understanding of specific knowledges to carry on this project, details as follow:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Java source code on CloudStack: Design Pattern, Spring framework.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Bash, Python programming.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>XAPI plugin.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>XML-RPC.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>OpenVSwitch on Xen.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Other knowledges:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>XAPI RRD, XenStore.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Ocaml Programming (XAPI functions).</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
@ -28,5 +28,5 @@
|
|||
their guest network and their clients.</para>
|
||||
<para>In shared networks in Basic zone and Security Group-enabled Advanced networks, you will have
|
||||
the flexibility to add multiple guest IP ranges from different subnets. You can add or remove
|
||||
one IP range at a time.</para>
|
||||
one IP range at a time. For more information, see <xref linkend="multiple-ip-range"/>.</para>
|
||||
</section>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 815 B |
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
|
|
@ -0,0 +1,205 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="ip-vlan-tenant">
|
||||
<title>Dedicated Resources: Public IP Addresses and VLANs Per Account</title>
|
||||
<para>&PRODUCT; provides you the ability to reserve a set of public IP addresses and VLANs
|
||||
exclusively for an account. During zone creation, you can continue to define a set of VLANs and
|
||||
multiple public IP ranges. This feature extends the functionality to enable you to dedicate a
|
||||
fixed set of VLANs and guest IP addresses for a tenant.</para>
|
||||
<para>This feature provides you the following capabilities:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Reserve a VLAN range and public IP address range from an Advanced zone and assign it to
|
||||
a domain or account</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Disassociate a VLAN and public IP address range from an domain or account</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>View the number of public IP addresses allocated to an account</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Check whether the required range is available and is conforms to account limits.</para>
|
||||
<para>The maximum IPs per account limit cannot be superseded.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<section id="howto-dedicate-ip">
|
||||
<title>Dedicating IP Address Ranges to an Account</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Log in to the &PRODUCT; UI as administrator.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the left navigation bar, click Infrastructure.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In Zones, click View All.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Choose the zone you want to work with.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Physical Network tab.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Public node of the diagram, click Configure.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the IP Ranges tab.</para>
|
||||
<para>You can either assign an existing IP range to an account, or create a new IP range and
|
||||
assign to an account.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>To assign an existing IP range to an account, perform the following:</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>Locate the IP range you want to work with.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Add Account <inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/addAccount-icon.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>addAccount-icon.png: button to assign an IP range to an account.</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject>button.</para>
|
||||
<para>The Add Account dialog is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Account</emphasis>: The account to which you want to
|
||||
assign the IP address range.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Domain</emphasis>: The domain associated with the
|
||||
account.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>To create a new IP range and assign an account, perform the following:</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Gateway</emphasis></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Netmask</emphasis></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">VLAN</emphasis></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Start IP</emphasis></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">End IP</emphasis></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold">Account</emphasis>: Perform the following:</para>
|
||||
<orderedlist numeration="lowerroman">
|
||||
<listitem>
|
||||
<para>Click Account.</para>
|
||||
<para>The Add Account page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold"><emphasis role="bold"
|
||||
>Account</emphasis></emphasis>: The account to which you want to
|
||||
assign an IP address range.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold"><emphasis role="bold"
|
||||
>Domain</emphasis></emphasis>: The domain associated with the
|
||||
account.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click OK.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Add.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="howto-dedicate-vlan">
|
||||
<title>Dedicating VLAN Ranges to an Account</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>After the &PRODUCT; Management Server is installed, log in to the &PRODUCT; UI as
|
||||
administrator.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the left navigation bar, click Infrastructure.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In Zones, click View All.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Choose the zone you want to work with.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Physical Network tab.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Guest node of the diagram, click Configure.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select the Dedicated VLAN Ranges tab.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click Dedicate VLAN Range.</para>
|
||||
<para>The Dedicate VLAN Range dialog is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Specify the following:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><emphasis role="bold"><emphasis role="bold">VLAN Range</emphasis></emphasis>: The
|
||||
VLAN range that you want to assign to an account.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold"><emphasis role="bold">Account</emphasis></emphasis>: The
|
||||
account to which you want to assign the selected VLAN range.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><emphasis role="bold"><emphasis role="bold">Domain</emphasis></emphasis>: The
|
||||
domain associated with the account.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="multiple-ip-range">
|
||||
<title>About Multiple IP Ranges</title>
|
||||
<note>
|
||||
<para>The feature can only be implemented on IPv4 addresses.</para>
|
||||
</note>
|
||||
<para>&PRODUCT; provides you with the flexibility to add guest IP ranges from different subnets in
|
||||
Basic zones and security groups-enabled Advanced zones. For security groups-enabled Advanced
|
||||
zones, it implies multiple subnets can be added to the same VLAN. With the addition of this
|
||||
feature, you will be able to add IP address ranges from the same subnet or from a different one
|
||||
when IP address are exhausted. This would in turn allows you to employ higher number of subnets
|
||||
and thus reduce the address management overhead. To support this feature, the capability of
|
||||
<code>createVlanIpRange</code> API is extended to add IP ranges also from a different
|
||||
subnet.</para>
|
||||
<para>Ensure that you manually configure the gateway of the new subnet before adding the IP range.
|
||||
Note that &PRODUCT; supports only one gateway for a subnet; overlapping subnets are not
|
||||
currently supported.</para>
|
||||
<para>Use the <code>deleteVlanRange</code> API to delete IP ranges. This operation fails if an IP
|
||||
from the remove range is in use. If the remove range contains the IP address on which the DHCP
|
||||
server is running, &PRODUCT; acquires a new IP from the same subnet. If no IP is available in
|
||||
the subnet, the remove operation fails.</para>
|
||||
<para>This feature is supported on KVM, xenServer, and VMware hypervisors.</para>
|
||||
</section>
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
<xi:include href="using-multiple-guest-networks.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="reserved-ip-addresses-non-csvms.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="multiple-ip-nic.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="multiple-ip-range.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="security-groups.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="external-firewalls-and-load-balancers.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
<section id="pvlan">
|
||||
<title>Isolation in Advanced Zone Using Private VLAN</title>
|
||||
<para/>
|
||||
<section id="about-pvlan">
|
||||
<title>About Private VLAN</title>
|
||||
<para>In an Ethernet switch, a VLAN is a broadcast domain in which hosts can establish direct
|
||||
communication with each another at Layer 2. Private VLAN is designed as an extension of VLAN
|
||||
standard to add further segmentation of the logical broadcast domain. A regular VLAN is a
|
||||
single broadcast domain, whereas a private VLAN partitions a larger VLAN broadcast domain into
|
||||
smaller sub-domains. A sub-domain is represented by a pair of VLANs: a Primary VLAN and a
|
||||
Secondary VLAN. The original VLAN that is being divided into smaller groups is called
|
||||
Primary, That implies all VLAN pairs in a private VLAN share the same Primary VLAN. All the
|
||||
secondary VLANs exist only inside the Primary. Each Secondary VLAN has a specific VLAN ID
|
||||
associated to it, which differentiates one sub-domain from another.</para>
|
||||
<para>For further reading:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><ulink
|
||||
url="http://www.cisco.com/en/US/docs/switches/lan/catalyst3750/software/release/12.2_25_see/configuration/guide/swpvlan.html#wp1038379"
|
||||
>Understanding Private VLANs</ulink></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><ulink url="http://tools.ietf.org/html/rfc5517">Cisco Systems' Private VLANs: Scalable
|
||||
Security in a Multi-Client Environment</ulink></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><ulink url="http://kb.vmware.com">Private VLAN (PVLAN) on vNetwork Distributed Switch
|
||||
- Concept Overview (1010691)</ulink></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="prereq-pvlan">
|
||||
<title>Prerequisites</title>
|
||||
<para>Ensure that you configure private VLAN on your physical switches out-of-band.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -40,27 +40,42 @@
|
|||
<para>Click the Configure button of the VPC whose IP you want to release.</para>
|
||||
<para>The VPC page is displayed where all the tiers you created are listed in a
|
||||
diagram.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Settings icon.</para>
|
||||
<para>The following options are displayed.</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>IP Addresses</para>
|
||||
<para>Internal LB</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Gateways</para>
|
||||
<para>Public LB IP</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPN</para>
|
||||
<para>Static NAT</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACLs</para>
|
||||
<para>Virtual Machines</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>CIDR</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>The following router information is displayed:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Private Gateways</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Public IP Addresses</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Site-to-Site VPNs</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Network ACL Lists</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Select IP Addresses.</para>
|
||||
<para>Select Public IP Addresses.</para>
|
||||
<para>The IP Addresses page is displayed.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
|||
|
|
@ -40,16 +40,18 @@
|
|||
<para>The Configure VPC page is displayed. Locate the tier you want to work with.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Click the Remove VPC button:</para>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/remove-tier.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>remove-tier.png: removing a tier from a vpc.</phrase>
|
||||
</textobject>
|
||||
</mediaobject>
|
||||
<para>Wait for some time for the tier to be removed.</para>
|
||||
<para>Select the tier you want to remove.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>In the Network Details tab, click the Delete Network button.
|
||||
<inlinemediaobject><imageobject>
|
||||
<imagedata fileref="./images/del-tier.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>del-tier.png: button to remove a tier</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject></para>
|
||||
<para>Click Yes to confirm. Wait for some time for the tier to be removed.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -38,14 +38,15 @@
|
|||
<para>Select the VPC you want to work with.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>To remove, click the Remove VPC button<inlinemediaobject>
|
||||
<para>In the Details tab, click the Remove VPC button<inlinemediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="./images/remove-vpc.png"/>
|
||||
</imageobject>
|
||||
<textobject>
|
||||
<phrase>remove-vpc.png: button to remove a VPC</phrase>
|
||||
</textobject>
|
||||
</inlinemediaobject></para>
|
||||
</inlinemediaobject></para>
|
||||
<para>You can remove the VPC by also using the remove button in the Quick View.</para>
|
||||
<para>You can edit the name and description of a VPC. To do that, select the VPC, then click
|
||||
the Edit button. <inlinemediaobject>
|
||||
<imageobject>
|
||||
|
|
|
|||
|
|
@ -151,8 +151,8 @@
|
|||
cannot be used for StaticNAT or port forwarding.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>The instances only have a private IP address that you provision. To communicate with the
|
||||
Internet, enable NAT to an instance that you launch in your VPC.</para>
|
||||
<para>The instances can only have a private IP address that you provision. To communicate with
|
||||
the Internet, enable NAT to an instance that you launch in your VPC.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Only new networks can be added to a VPC. The maximum number of networks per VPC is
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# Publican configuration file for CloudStack Complete Documentation Set
|
||||
# Contains all technical docs except release notes
|
||||
# Config::Simple 4.58
|
||||
# Tue May 29 00:57:27 2012
|
||||
#
|
||||
# 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.
|
||||
|
||||
xml_lang: en-US
|
||||
type: Book
|
||||
docname: CloudStack_GSoC_Guide
|
||||
brand: cloudstack
|
||||
chunk_first: 1
|
||||
chunk_section_depth: 1
|
||||
|
|
@ -21,6 +21,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage;
|
|||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.StoragePoolInfo;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
|
||||
public interface DataStoreLifeCycle {
|
||||
|
|
@ -28,8 +29,8 @@ public interface DataStoreLifeCycle {
|
|||
|
||||
public boolean attachCluster(DataStore store, ClusterScope scope);
|
||||
public boolean attachHost(DataStore store, HostScope scope, StoragePoolInfo existingInfo);
|
||||
boolean attachZone(DataStore dataStore, ZoneScope scope);
|
||||
|
||||
boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType);
|
||||
|
||||
public boolean dettach();
|
||||
|
||||
public boolean unmanaged();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
/**
|
||||
|
|
@ -109,4 +110,6 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
|
|||
Long clusterId, String[] tags);
|
||||
|
||||
List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags);
|
||||
|
||||
List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
|
||||
|
|
@ -427,4 +428,14 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
|
|||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType) {
|
||||
SearchCriteriaService<StoragePoolVO, StoragePoolVO> sc = SearchCriteria2.create(StoragePoolVO.class);
|
||||
sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dataCenterId);
|
||||
sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
|
||||
sc.addAnd(sc.getEntity().getScope(), Op.EQ, ScopeType.ZONE);
|
||||
sc.addAnd(sc.getEntity().getHypervisor(), Op.EQ, hypervisorType);
|
||||
return sc.list();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import javax.persistence.TemporalType;
|
|||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
|
|
@ -102,6 +103,10 @@ public class StoragePoolVO implements StoragePool{
|
|||
@Enumerated(value = EnumType.STRING)
|
||||
private ScopeType scope;
|
||||
|
||||
@Column(name = "hypervisor")
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private HypervisorType hypervisor;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -276,6 +281,14 @@ public class StoragePoolVO implements StoragePool{
|
|||
return this.scope;
|
||||
}
|
||||
|
||||
public HypervisorType getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
|
||||
public void setHypervisor(HypervisorType hypervisor) {
|
||||
this.hypervisor = hypervisor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof StoragePoolVO) || obj == null) {
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ public interface NetworkManager {
|
|||
|
||||
String allocatePublicIpForGuestNic(Long networkId, DataCenter dc, Pod pod, Account caller, String requestedIp) throws InsufficientAddressCapacityException;
|
||||
|
||||
NicVO savePlaceholderNic(Network network, String ip4Address, Type vmType);
|
||||
NicVO savePlaceholderNic(Network network, String ip4Address, String ip6Address, Type vmType);
|
||||
|
||||
DhcpServiceProvider getDhcpServiceProvider(Network network);
|
||||
|
||||
|
|
|
|||
|
|
@ -112,4 +112,8 @@ public interface VolumeManager extends VolumeApiService {
|
|||
DiskProfile allocateTemplatedVolume(Type type, String name,
|
||||
DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm,
|
||||
Account owner);
|
||||
|
||||
String getVmNameFromVolumeId(long volumeId);
|
||||
|
||||
String getStoragePoolOfVolume(long volumeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
|
||||
public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
|
||||
Map<String, String> details, String owner) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
|
|||
public List<AlertVO> listOlderAlerts(Date oldTime) {
|
||||
if (oldTime == null) return null;
|
||||
SearchCriteria<AlertVO> sc = createSearchCriteria();
|
||||
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
|
||||
sc.addAnd("createdDate", SearchCriteria.Op.LT, oldTime);
|
||||
sc.addAnd("archived", SearchCriteria.Op.EQ, false);
|
||||
return listIncludingRemovedBy(sc, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,4 +34,5 @@ public interface ClusterDao extends GenericDao<ClusterVO, Long> {
|
|||
Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds);
|
||||
List<Long> listDisabledClusters(long zoneId, Long podId);
|
||||
List<Long> listClustersWithDisabledPods(long zoneId);
|
||||
List<ClusterVO> listClustersByDcId(long zoneId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
protected final SearchBuilder<ClusterVO> AvailHyperSearch;
|
||||
protected final SearchBuilder<ClusterVO> ZoneSearch;
|
||||
protected final SearchBuilder<ClusterVO> ZoneHyTypeSearch;
|
||||
protected final SearchBuilder<ClusterVO> ZoneClusterSearch;
|
||||
|
||||
private static final String GET_POD_CLUSTER_MAP_PREFIX = "SELECT pod_id, id FROM cloud.cluster WHERE cluster.id IN( ";
|
||||
private static final String GET_POD_CLUSTER_MAP_SUFFIX = " )";
|
||||
|
|
@ -85,12 +86,16 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType());
|
||||
AvailHyperSearch.done();
|
||||
|
||||
ZoneClusterSearch = createSearchBuilder();
|
||||
ZoneClusterSearch.and("dataCenterId", ZoneClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
ZoneClusterSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByZoneId(long zoneId) {
|
||||
SearchCriteria<ClusterVO> sc = ZoneSearch.create();
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +228,13 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
return customSearch(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listClustersByDcId(long zoneId) {
|
||||
SearchCriteria<ClusterVO> sc = ZoneClusterSearch.create();
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Long id) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
|
|
|||
|
|
@ -288,5 +288,5 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
|
|||
|
||||
return parentDomains;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,10 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<Status, Stat
|
|||
* @return
|
||||
*/
|
||||
List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag);
|
||||
|
||||
List<HostVO> findByPodId(Long podId);
|
||||
|
||||
List<HostVO> findByClusterId(Long clusterId);
|
||||
|
||||
List<HostVO> listByDataCenterId(long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.cloud.cluster.agentlb.HostTransferMapVO;
|
|||
import com.cloud.cluster.agentlb.dao.HostTransferMapDao;
|
||||
import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.host.Host;
|
||||
|
|
@ -86,6 +87,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
protected SearchBuilder<HostVO> GuidSearch;
|
||||
protected SearchBuilder<HostVO> DcSearch;
|
||||
protected SearchBuilder<HostVO> PodSearch;
|
||||
protected SearchBuilder<HostVO> ClusterSearch;
|
||||
protected SearchBuilder<HostVO> TypeSearch;
|
||||
protected SearchBuilder<HostVO> StatusSearch;
|
||||
protected SearchBuilder<HostVO> ResourceStateSearch;
|
||||
|
|
@ -201,6 +203,9 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
|
||||
DcSearch = createSearchBuilder();
|
||||
DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
DcSearch.and("type", DcSearch.entity().getType(), Op.EQ);
|
||||
DcSearch.and("status", DcSearch.entity().getStatus(), Op.EQ);
|
||||
DcSearch.and("resourceState", DcSearch.entity().getResourceState(), Op.EQ);
|
||||
DcSearch.done();
|
||||
|
||||
ClusterStatusSearch = createSearchBuilder();
|
||||
|
|
@ -215,9 +220,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
TypeNameZoneSearch.done();
|
||||
|
||||
PodSearch = createSearchBuilder();
|
||||
PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
PodSearch.and("podId", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
PodSearch.done();
|
||||
|
||||
ClusterSearch = createSearchBuilder();
|
||||
ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||
ClusterSearch.done();
|
||||
|
||||
TypeSearch = createSearchBuilder();
|
||||
TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
|
||||
TypeSearch.done();
|
||||
|
|
@ -373,7 +382,17 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
List<HostVO> hosts = listBy(sc);
|
||||
return hosts.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<HostVO> listByDataCenterId(long id) {
|
||||
SearchCriteria<HostVO> sc = DcSearch.create();
|
||||
sc.setParameters("dcId", id);
|
||||
sc.setParameters("status", Status.Up);
|
||||
sc.setParameters("type", Host.Type.Routing);
|
||||
sc.setParameters("resourceState", ResourceState.Enabled);
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO findByGuid(String guid) {
|
||||
|
|
@ -906,6 +925,20 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> findByPodId(Long podId) {
|
||||
SearchCriteria<HostVO> sc = PodSearch.create();
|
||||
sc.setParameters("podId", podId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> findByClusterId(Long clusterId) {
|
||||
SearchCriteria<HostVO> sc = ClusterSearch.create();
|
||||
sc.setParameters("clusterId", clusterId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> findHypervisorHostInCluster(long clusterId) {
|
||||
SearchCriteria<HostVO> sc = TypeClusterStatusSearch.create();
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ package com.cloud.upgrade;
|
|||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.upgrade.dao.DbUpgrade;
|
||||
import com.cloud.upgrade.dao.Upgrade217to218;
|
||||
import com.cloud.upgrade.dao.Upgrade218to224DomainVlans;
|
||||
|
|
@ -43,7 +40,6 @@ 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;
|
||||
|
||||
import com.cloud.utils.component.SystemIntegrityChecker;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package com.cloud.upgrade.dao;
|
||||
|
||||
import com.cloud.deploy.DeploymentPlanner;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -64,6 +65,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
upgradeVmwareLabels(conn);
|
||||
persistLegacyZones(conn);
|
||||
createPlaceHolderNics(conn);
|
||||
updateRemoteAccessVpn(conn);
|
||||
updateSystemVmTemplates(conn);
|
||||
|
|
@ -77,6 +79,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
updateNetworkACLs(conn);
|
||||
addHostDetailsIndex(conn);
|
||||
updateNetworksForPrivateGateways(conn);
|
||||
correctExternalNetworkDevicesSetup(conn);
|
||||
removeFirewallServiceFromSharedNetworkOfferingWithSGService(conn);
|
||||
fix22xKVMSnapshots(conn);
|
||||
addIndexForAlert(conn);
|
||||
|
|
@ -110,16 +113,215 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
|
||||
private void updateSystemVmTemplates(Connection conn) {
|
||||
PreparedStatement sql = null;
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
boolean xenserver = false;
|
||||
boolean kvm = false;
|
||||
boolean VMware = false;
|
||||
boolean Hyperv = false;
|
||||
boolean LXC = false;
|
||||
s_logger.debug("Updating System Vm template IDs");
|
||||
try{
|
||||
//Get all hypervisors in use
|
||||
try {
|
||||
pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next()){
|
||||
if("XenServer".equals(rs.getString(1))){
|
||||
xenserver = true;
|
||||
} else if("KVM".equals(rs.getString(1))){
|
||||
kvm = true;
|
||||
} else if("VMware".equals(rs.getString(1))){
|
||||
VMware = true;
|
||||
} else if("Hyperv".equals(rs.getString(1))) {
|
||||
Hyperv = true;
|
||||
} else if("LXC".equals(rs.getString(1))) {
|
||||
LXC = true;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while listing hypervisors in use", e);
|
||||
}
|
||||
|
||||
s_logger.debug("Updating XenSever System Vms");
|
||||
//XenServer
|
||||
try {
|
||||
//Get 4.2.0 xenserer system Vm template Id
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name like 'systemvm-xenserver-4.2' and removed is null order by id desc limit 1");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
long templateId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
// change template type to SYSTEM
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
// update templete ID of system Vms
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'XenServer'");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} else {
|
||||
if (xenserver){
|
||||
throw new CloudRuntimeException("4.2.0 XenServer SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn("4.2.0 XenServer SystemVm template not found. XenServer hypervisor is not used, so not failing upgrade");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while updating XenServer systemVm template", e);
|
||||
}
|
||||
|
||||
//KVM
|
||||
s_logger.debug("Updating KVM System Vms");
|
||||
try {
|
||||
//Get 4.2.0 KVM system Vm template Id
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-kvm-4.2' and removed is null order by id desc limit 1");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
long templateId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
// change template type to SYSTEM
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
// update templete ID of system Vms
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'KVM'");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} else {
|
||||
if (kvm){
|
||||
throw new CloudRuntimeException("4.2.0 KVM SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn("4.2.0 KVM SystemVm template not found. KVM hypervisor is not used, so not failing upgrade");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while updating KVM systemVm template", e);
|
||||
}
|
||||
|
||||
//VMware
|
||||
s_logger.debug("Updating VMware System Vms");
|
||||
try {
|
||||
//Get 4.2.0 VMware system Vm template Id
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-vmware-4.2' and removed is null order by id desc limit 1");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
long templateId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
// change template type to SYSTEM
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
// update templete ID of system Vms
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'VMware'");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} else {
|
||||
if (VMware){
|
||||
throw new CloudRuntimeException("4.2.0 VMware SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn("4.2.0 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while updating VMware systemVm template", e);
|
||||
}
|
||||
|
||||
//Hyperv
|
||||
s_logger.debug("Updating Hyperv System Vms");
|
||||
try {
|
||||
//Get 4.2.0 Hyperv system Vm template Id
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-hyperv-4.2' and removed is null order by id desc limit 1");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
long templateId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
// change template type to SYSTEM
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
// update templete ID of system Vms
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'Hyperv'");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} else {
|
||||
if (Hyperv){
|
||||
throw new CloudRuntimeException("4.2.0 HyperV SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn("4.2.0 Hyperv SystemVm template not found. Hyperv hypervisor is not used, so not failing upgrade");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while updating Hyperv systemVm template", e);
|
||||
}
|
||||
|
||||
//LXC
|
||||
s_logger.debug("Updating LXC System Vms");
|
||||
try {
|
||||
//Get 4.2.0 LXC system Vm template Id
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-lxc-4.2' and removed is null order by id desc limit 1");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
long templateId = rs.getLong(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
// change template type to SYSTEM
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
// update templete ID of system Vms
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'LXC'");
|
||||
pstmt.setLong(1, templateId);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} else {
|
||||
if (LXC){
|
||||
throw new CloudRuntimeException("4.2.0 LXC SystemVm template not found. Cannot upgrade system Vms");
|
||||
} else {
|
||||
s_logger.warn("4.2.0 LXC SystemVm template not found. LXC hypervisor is not used, so not failing upgrade");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Error while updating LXC systemVm template", e);
|
||||
}
|
||||
s_logger.debug("Updating System Vm Template IDs Complete");
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
|
||||
if (pstmt != null) {
|
||||
pstmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
pstmt = null;
|
||||
try {
|
||||
sql = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
|
||||
sql.executeUpdate();
|
||||
pstmt = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Failed to upgrade vm template data store uuid: " + e.toString());
|
||||
} finally {
|
||||
if (sql != null) {
|
||||
if (pstmt != null) {
|
||||
try {
|
||||
sql.close();
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
|
|
@ -277,6 +479,180 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
|
||||
private void persistLegacyZones(Connection conn) {
|
||||
List<Long> listOfLegacyZones = new ArrayList<Long>();
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement clustersQuery = null;
|
||||
PreparedStatement clusterDetailsQuery = null;
|
||||
ResultSet rs = null;
|
||||
ResultSet clusters = null;
|
||||
ResultSet clusterDetails = null;
|
||||
ResultSet dcInfo = null;
|
||||
Long vmwareDcId = 1L;
|
||||
Long zoneId;
|
||||
Long clusterId;
|
||||
String clusterHypervisorType;
|
||||
boolean legacyZone;
|
||||
boolean ignoreZone;
|
||||
Long count;
|
||||
String dcOfPreviousCluster = null;
|
||||
String dcOfCurrentCluster = null;
|
||||
String[] tokens;
|
||||
String url;
|
||||
String user = "";
|
||||
String password = "";
|
||||
String vc = "";
|
||||
String dcName = "";
|
||||
String guid;
|
||||
String key;
|
||||
String value;
|
||||
|
||||
try {
|
||||
clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` where removed is NULL");
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`data_center` where removed is NULL");
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
zoneId = rs.getLong("id");
|
||||
legacyZone = false;
|
||||
ignoreZone = true;
|
||||
count = 0L;
|
||||
// Legacy zone term is meant only for VMware
|
||||
// Legacy zone is a zone with atleast 2 clusters & with multiple DCs or VCs
|
||||
clusters = clustersQuery.executeQuery();
|
||||
if (!clusters.next()) {
|
||||
continue; // Ignore the zone without any clusters
|
||||
} else {
|
||||
dcOfPreviousCluster = null;
|
||||
dcOfCurrentCluster = null;
|
||||
do {
|
||||
clusterHypervisorType = clusters.getString("hypervisor_type");
|
||||
clusterId = clusters.getLong("id");
|
||||
if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
|
||||
ignoreZone = false;
|
||||
clusterDetailsQuery = conn.prepareStatement("select value from `cloud`.`cluster_details` where name='url' and cluster_id=?");
|
||||
clusterDetailsQuery.setLong(1, clusterId);
|
||||
clusterDetails = clusterDetailsQuery.executeQuery();
|
||||
clusterDetails.next();
|
||||
url = clusterDetails.getString("value");
|
||||
tokens = url.split("/"); // url format - http://vcenter/dc/cluster
|
||||
vc = tokens[2];
|
||||
dcName = tokens[3];
|
||||
if (count > 0) {
|
||||
dcOfPreviousCluster = dcOfCurrentCluster;
|
||||
dcOfCurrentCluster = dcName + "@" + vc;
|
||||
if (!dcOfPreviousCluster.equals(dcOfCurrentCluster)) {
|
||||
legacyZone = true;
|
||||
s_logger.debug("Marking the zone " + zoneId + " as legacy zone.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.debug("Ignoring zone " + zoneId + " with hypervisor type " + clusterHypervisorType);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
} while (clusters.next());
|
||||
if (ignoreZone) {
|
||||
continue; // Ignore the zone with hypervisors other than VMware
|
||||
}
|
||||
}
|
||||
if (legacyZone) {
|
||||
listOfLegacyZones.add(zoneId);
|
||||
} else {
|
||||
assert(clusterDetails != null) : "Couldn't retrieve details of cluster!";
|
||||
s_logger.debug("Discovered non-legacy zone " + zoneId + ". Processing the zone to associate with VMware datacenter.");
|
||||
|
||||
clusterDetailsQuery = conn.prepareStatement("select name, value from `cloud`.`cluster_details` where cluster_id=?");
|
||||
clusterDetailsQuery.setLong(1, clusterId);
|
||||
clusterDetails = clusterDetailsQuery.executeQuery();
|
||||
while (clusterDetails.next()) {
|
||||
key = clusterDetails.getString(1);
|
||||
value = clusterDetails.getString(2);
|
||||
if (key.equalsIgnoreCase("username")) {
|
||||
user = value;
|
||||
} else if (key.equalsIgnoreCase("password")) {
|
||||
password = value;
|
||||
}
|
||||
}
|
||||
guid = dcName + "@" + vc;
|
||||
|
||||
pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vmware_data_center` (uuid, name, guid, vcenter_host, username, password) values(?, ?, ?, ?, ?, ?)");
|
||||
pstmt.setString(1, UUID.randomUUID().toString());
|
||||
pstmt.setString(2, dcName);
|
||||
pstmt.setString(3, guid);
|
||||
pstmt.setString(4, vc);
|
||||
pstmt.setString(5, user);
|
||||
pstmt.setString(6, password);
|
||||
pstmt.executeUpdate();
|
||||
|
||||
pstmt = conn.prepareStatement("SELECT id FROM `cloud`.`vmware_data_center` where guid=?");
|
||||
pstmt.setString(1, guid);
|
||||
dcInfo = pstmt.executeQuery();
|
||||
if(dcInfo.next()) {
|
||||
vmwareDcId = dcInfo.getLong("id");
|
||||
}
|
||||
|
||||
pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vmware_data_center_zone_map` (zone_id, vmware_data_center_id) values(?, ?)");
|
||||
pstmt.setLong(1, zoneId);
|
||||
pstmt.setLong(2, vmwareDcId);
|
||||
pstmt.executeUpdate();
|
||||
}
|
||||
}
|
||||
updateLegacyZones(conn, listOfLegacyZones);
|
||||
} catch (SQLException e) {
|
||||
String msg = "Unable to discover legacy zones." + e.getMessage();
|
||||
s_logger.error(msg);
|
||||
throw new CloudRuntimeException(msg, e);
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (pstmt != null) {
|
||||
pstmt.close();
|
||||
}
|
||||
if (dcInfo != null) {
|
||||
dcInfo.close();
|
||||
}
|
||||
if (clusters != null) {
|
||||
clusters.close();
|
||||
}
|
||||
if (clusterDetails != null) {
|
||||
clusterDetails.close();
|
||||
}
|
||||
if (clustersQuery != null) {
|
||||
clustersQuery.close();
|
||||
}
|
||||
if (clusterDetailsQuery != null) {
|
||||
clusterDetailsQuery.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLegacyZones(Connection conn, List<Long> zones) {
|
||||
PreparedStatement legacyZonesQuery = null;
|
||||
//Insert legacy zones into table for legacy zones.
|
||||
try {
|
||||
legacyZonesQuery = conn.prepareStatement("INSERT INTO `cloud`.`legacy_zones` (zone_id) VALUES (?)");
|
||||
for(Long zoneId : zones) {
|
||||
legacyZonesQuery.setLong(1, zoneId);
|
||||
legacyZonesQuery.executeUpdate();
|
||||
s_logger.debug("Inserted zone " + zoneId + " into cloud.legacyzones table");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable add zones to cloud.legacyzones table.", e);
|
||||
} finally {
|
||||
try {
|
||||
if (legacyZonesQuery != null) {
|
||||
legacyZonesQuery.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createPlaceHolderNics(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
|
@ -849,4 +1225,363 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Corrects upgrade for deployment with F5 and SRX devices (pre 3.0) to network offering &
|
||||
// network service provider paradigm
|
||||
private void correctExternalNetworkDevicesSetup(Connection conn) {
|
||||
PreparedStatement zoneSearchStmt = null, pNetworkStmt = null, f5DevicesStmt = null, srxDevicesStmt = null;
|
||||
ResultSet zoneResults = null, pNetworksResults = null, f5DevicesResult = null, srxDevicesResult = null;
|
||||
|
||||
try {
|
||||
zoneSearchStmt = conn.prepareStatement("SELECT id, networktype FROM `cloud`.`data_center`");
|
||||
zoneResults = zoneSearchStmt.executeQuery();
|
||||
while (zoneResults.next()) {
|
||||
long zoneId = zoneResults.getLong(1);
|
||||
String networkType = zoneResults.getString(2);
|
||||
|
||||
if (!com.cloud.dc.DataCenter.NetworkType.Advanced.toString().equalsIgnoreCase(networkType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pNetworkStmt = conn.prepareStatement("SELECT id FROM `cloud`.`physical_network` where data_center_id=?");
|
||||
pNetworkStmt.setLong(1, zoneId);
|
||||
pNetworksResults = pNetworkStmt.executeQuery();
|
||||
while (pNetworksResults.next()) {
|
||||
long physicalNetworkId = pNetworksResults.getLong(1);
|
||||
PreparedStatement fetchF5NspStmt = conn.prepareStatement("SELECT id from `cloud`.`physical_network_service_providers` where physical_network_id=" + physicalNetworkId
|
||||
+ " and provider_name = 'F5BigIp'");
|
||||
ResultSet rsF5NSP = fetchF5NspStmt.executeQuery();
|
||||
boolean hasF5Nsp = rsF5NSP.next();
|
||||
fetchF5NspStmt.close();
|
||||
|
||||
// if there is no 'F5BigIP' physical network service provider added into physical network then
|
||||
// add 'F5BigIP' as network service provider and add the entry in 'external_load_balancer_devices'
|
||||
if (!hasF5Nsp) {
|
||||
f5DevicesStmt = conn.prepareStatement("SELECT id FROM host WHERE data_center_id=? AND type = 'ExternalLoadBalancer' AND removed IS NULL");
|
||||
f5DevicesStmt.setLong(1, zoneId);
|
||||
f5DevicesResult = f5DevicesStmt.executeQuery();
|
||||
// add F5BigIP provider and provider instance to physical network if there are any external load
|
||||
// balancers added in the zone
|
||||
while (f5DevicesResult.next()) {
|
||||
long f5HostId = f5DevicesResult.getLong(1);;
|
||||
addF5ServiceProvider(conn, physicalNetworkId, zoneId);
|
||||
addF5LoadBalancer(conn, f5HostId, physicalNetworkId);
|
||||
}
|
||||
}
|
||||
|
||||
PreparedStatement fetchSRXNspStmt = conn.prepareStatement("SELECT id from `cloud`.`physical_network_service_providers` where physical_network_id=" + physicalNetworkId
|
||||
+ " and provider_name = 'JuniperSRX'");
|
||||
ResultSet rsSRXNSP = fetchSRXNspStmt.executeQuery();
|
||||
boolean hasSrxNsp = rsSRXNSP.next();
|
||||
fetchSRXNspStmt.close();
|
||||
|
||||
// if there is no 'JuniperSRX' physical network service provider added into physical network then
|
||||
// add 'JuniperSRX' as network service provider and add the entry in 'external_firewall_devices'
|
||||
if (!hasSrxNsp) {
|
||||
srxDevicesStmt = conn.prepareStatement("SELECT id FROM host WHERE data_center_id=? AND type = 'ExternalFirewall' AND removed IS NULL");
|
||||
srxDevicesStmt.setLong(1, zoneId);
|
||||
srxDevicesResult = srxDevicesStmt.executeQuery();
|
||||
// add JuniperSRX provider and provider instance to physical network if there are any external
|
||||
// firewall instances added in to the zone
|
||||
while (srxDevicesResult.next()) {
|
||||
long srxHostId = srxDevicesResult.getLong(1);
|
||||
// add SRX provider and provider instance to physical network
|
||||
addSrxServiceProvider(conn, physicalNetworkId, zoneId);
|
||||
addSrxFirewall(conn, srxHostId, physicalNetworkId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not the network service provider has been provisioned in to physical network, mark all guest network
|
||||
// to be using network offering 'Isolated with external providers'
|
||||
fixZoneUsingExternalDevices(conn);
|
||||
|
||||
if (zoneResults != null) {
|
||||
try {
|
||||
zoneResults.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (zoneSearchStmt != null) {
|
||||
try {
|
||||
zoneSearchStmt.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception while adding PhysicalNetworks", e);
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void addF5LoadBalancer(Connection conn, long hostId, long physicalNetworkId){
|
||||
PreparedStatement pstmtUpdate = null;
|
||||
try{
|
||||
s_logger.debug("Adding F5 Big IP load balancer with host id " + hostId + " in to physical network" + physicalNetworkId);
|
||||
String insertF5 = "INSERT INTO `cloud`.`external_load_balancer_devices` (physical_network_id, host_id, provider_name, " +
|
||||
"device_name, capacity, is_dedicated, device_state, allocation_state, is_inline, is_managed, uuid) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
pstmtUpdate = conn.prepareStatement(insertF5);
|
||||
pstmtUpdate.setLong(1, physicalNetworkId);
|
||||
pstmtUpdate.setLong(2, hostId);
|
||||
pstmtUpdate.setString(3, "F5BigIp");
|
||||
pstmtUpdate.setString(4, "F5BigIpLoadBalancer");
|
||||
pstmtUpdate.setLong(5, 0);
|
||||
pstmtUpdate.setBoolean(6, false);
|
||||
pstmtUpdate.setString(7, "Enabled");
|
||||
pstmtUpdate.setString(8, "Shared");
|
||||
pstmtUpdate.setBoolean(9, false);
|
||||
pstmtUpdate.setBoolean(10, false);
|
||||
pstmtUpdate.setString(11, UUID.randomUUID().toString());
|
||||
pstmtUpdate.executeUpdate();
|
||||
}catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception while adding F5 load balancer device" , e);
|
||||
} finally {
|
||||
if (pstmtUpdate != null) {
|
||||
try {
|
||||
pstmtUpdate.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSrxFirewall(Connection conn, long hostId, long physicalNetworkId){
|
||||
PreparedStatement pstmtUpdate = null;
|
||||
try{
|
||||
s_logger.debug("Adding SRX firewall device with host id " + hostId + " in to physical network" + physicalNetworkId);
|
||||
String insertSrx = "INSERT INTO `cloud`.`external_firewall_devices` (physical_network_id, host_id, provider_name, " +
|
||||
"device_name, capacity, is_dedicated, device_state, allocation_state, uuid) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
pstmtUpdate = conn.prepareStatement(insertSrx);
|
||||
pstmtUpdate.setLong(1, physicalNetworkId);
|
||||
pstmtUpdate.setLong(2, hostId);
|
||||
pstmtUpdate.setString(3, "JuniperSRX");
|
||||
pstmtUpdate.setString(4, "JuniperSRXFirewall");
|
||||
pstmtUpdate.setLong(5, 0);
|
||||
pstmtUpdate.setBoolean(6, false);
|
||||
pstmtUpdate.setString(7, "Enabled");
|
||||
pstmtUpdate.setString(8, "Shared");
|
||||
pstmtUpdate.setString(9, UUID.randomUUID().toString());
|
||||
pstmtUpdate.executeUpdate();
|
||||
}catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception while adding SRX firewall device ", e);
|
||||
} finally {
|
||||
if (pstmtUpdate != null) {
|
||||
try {
|
||||
pstmtUpdate.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addF5ServiceProvider(Connection conn, long physicalNetworkId, long zoneId){
|
||||
PreparedStatement pstmtUpdate = null;
|
||||
try{
|
||||
// add physical network service provider - F5BigIp
|
||||
s_logger.debug("Adding PhysicalNetworkServiceProvider F5BigIp" + " in to physical network" + physicalNetworkId);
|
||||
String insertPNSP = "INSERT INTO `cloud`.`physical_network_service_providers` (`uuid`, `physical_network_id` , `provider_name`, `state` ," +
|
||||
"`destination_physical_network_id`, `vpn_service_provided`, `dhcp_service_provided`, `dns_service_provided`, `gateway_service_provided`," +
|
||||
"`firewall_service_provided`, `source_nat_service_provided`, `load_balance_service_provided`, `static_nat_service_provided`," +
|
||||
"`port_forwarding_service_provided`, `user_data_service_provided`, `security_group_service_provided`) VALUES (?,?,?,?,0,0,0,0,0,0,0,1,0,0,0,0)";
|
||||
|
||||
pstmtUpdate = conn.prepareStatement(insertPNSP);
|
||||
pstmtUpdate.setString(1, UUID.randomUUID().toString());
|
||||
pstmtUpdate.setLong(2, physicalNetworkId);
|
||||
pstmtUpdate.setString(3, "F5BigIp");
|
||||
pstmtUpdate.setString(4, "Enabled");
|
||||
pstmtUpdate.executeUpdate();
|
||||
}catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception while adding PhysicalNetworkServiceProvider F5BigIp", e);
|
||||
} finally {
|
||||
if (pstmtUpdate != null) {
|
||||
try {
|
||||
pstmtUpdate.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSrxServiceProvider(Connection conn, long physicalNetworkId, long zoneId){
|
||||
PreparedStatement pstmtUpdate = null;
|
||||
try{
|
||||
// add physical network service provider - JuniperSRX
|
||||
s_logger.debug("Adding PhysicalNetworkServiceProvider JuniperSRX");
|
||||
String insertPNSP = "INSERT INTO `cloud`.`physical_network_service_providers` (`uuid`, `physical_network_id` , `provider_name`, `state` ," +
|
||||
"`destination_physical_network_id`, `vpn_service_provided`, `dhcp_service_provided`, `dns_service_provided`, `gateway_service_provided`," +
|
||||
"`firewall_service_provided`, `source_nat_service_provided`, `load_balance_service_provided`, `static_nat_service_provided`," +
|
||||
"`port_forwarding_service_provided`, `user_data_service_provided`, `security_group_service_provided`) VALUES (?,?,?,?,0,0,0,0,1,1,1,0,1,1,0,0)";
|
||||
|
||||
pstmtUpdate = conn.prepareStatement(insertPNSP);
|
||||
pstmtUpdate.setString(1, UUID.randomUUID().toString());
|
||||
pstmtUpdate.setLong(2, physicalNetworkId);
|
||||
pstmtUpdate.setString(3, "JuniperSRX");
|
||||
pstmtUpdate.setString(4, "Enabled");
|
||||
pstmtUpdate.executeUpdate();
|
||||
}catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception while adding PhysicalNetworkServiceProvider JuniperSRX" , e);
|
||||
} finally {
|
||||
if (pstmtUpdate != null) {
|
||||
try {
|
||||
pstmtUpdate.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This method does two things
|
||||
//
|
||||
// 1) ensure that networks using external load balancer/firewall in deployments prior to release 3.0
|
||||
// has entry in network_external_lb_device_map and network_external_firewall_device_map
|
||||
//
|
||||
// 2) Some keys of host details for F5 and SRX devices were stored in Camel Case in 2.x releases. From 3.0
|
||||
// they are made in lowercase. On upgrade change the host details name to lower case
|
||||
private void fixZoneUsingExternalDevices(Connection conn) {
|
||||
//Get zones to upgrade
|
||||
List<Long> zoneIds = new ArrayList<Long>();
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmtUpdate = null;
|
||||
ResultSet rs = null;
|
||||
long networkOfferingId, networkId;
|
||||
long f5DeviceId, f5HostId;
|
||||
long srxDevivceId, srxHostId;
|
||||
|
||||
try {
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`data_center` where lb_provider='F5BigIp' or firewall_provider='JuniperSRX' or gateway_provider='JuniperSRX'");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
zoneIds.add(rs.getLong(1));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to create network to LB & firewall device mapping for networks that use them", e);
|
||||
}
|
||||
|
||||
if (zoneIds.size() == 0) {
|
||||
return; // no zones using F5 and SRX devices so return
|
||||
}
|
||||
|
||||
// find the default network offering created for external devices during upgrade from 2.2.14
|
||||
try {
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`network_offerings` where unique_name='Isolated with external providers' ");
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.first()) {
|
||||
networkOfferingId = rs.getLong(1);
|
||||
} else {
|
||||
throw new CloudRuntimeException("Cannot upgrade as there is no 'Isolated with external providers' network offering crearted .");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to create network to LB & firewalla device mapping for networks that use them", e);
|
||||
}
|
||||
|
||||
for (Long zoneId : zoneIds) {
|
||||
try {
|
||||
// find the F5 device id in the zone
|
||||
pstmt = conn.prepareStatement("SELECT id FROM host WHERE data_center_id=? AND type = 'ExternalLoadBalancer' AND removed IS NULL");
|
||||
pstmt.setLong(1, zoneId);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.first()) {
|
||||
f5HostId = rs.getLong(1);
|
||||
} else {
|
||||
throw new CloudRuntimeException("Cannot upgrade as there is no F5 load balancer device found in data center " + zoneId);
|
||||
}
|
||||
pstmt = conn.prepareStatement("SELECT id FROM external_load_balancer_devices WHERE host_id=?");
|
||||
pstmt.setLong(1, f5HostId);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.first()) {
|
||||
f5DeviceId = rs.getLong(1);
|
||||
} else {
|
||||
throw new CloudRuntimeException("Cannot upgrade as there is no F5 load balancer device with host ID " + f5HostId + " found in external_load_balancer_device");
|
||||
}
|
||||
|
||||
// find the SRX device id in the zone
|
||||
pstmt = conn.prepareStatement("SELECT id FROM host WHERE data_center_id=? AND type = 'ExternalFirewall' AND removed IS NULL");
|
||||
pstmt.setLong(1, zoneId);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.first()) {
|
||||
srxHostId = rs.getLong(1);
|
||||
} else {
|
||||
throw new CloudRuntimeException("Cannot upgrade as there is no SRX firewall device found in data center " + zoneId);
|
||||
}
|
||||
pstmt = conn.prepareStatement("SELECT id FROM external_firewall_devices WHERE host_id=?");
|
||||
pstmt.setLong(1, srxHostId);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.first()) {
|
||||
srxDevivceId = rs.getLong(1);
|
||||
} else {
|
||||
throw new CloudRuntimeException("Cannot upgrade as there is no SRX firewall device found with host ID " + srxHostId + " found in external_firewall_devices");
|
||||
}
|
||||
|
||||
// check if network any uses F5 or SRX devices in the zone
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`networks` where guest_type='Virtual' and data_center_id=? and network_offering_id=? and removed IS NULL");
|
||||
pstmt.setLong(1, zoneId);
|
||||
pstmt.setLong(2, networkOfferingId);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
// get the network Id
|
||||
networkId = rs.getLong(1);
|
||||
|
||||
// add mapping for the network in network_external_lb_device_map
|
||||
String insertLbMapping = "INSERT INTO `cloud`.`network_external_lb_device_map` (uuid, network_id, external_load_balancer_device_id, created) VALUES ( ?, ?, ?, now())";
|
||||
pstmtUpdate = conn.prepareStatement(insertLbMapping);
|
||||
pstmtUpdate.setString(1, UUID.randomUUID().toString());
|
||||
pstmtUpdate.setLong(2, networkId);
|
||||
pstmtUpdate.setLong(3, f5DeviceId);
|
||||
pstmtUpdate.executeUpdate();
|
||||
s_logger.debug("Successfully added entry in network_external_lb_device_map for network " + networkId + " and F5 device ID " + f5DeviceId);
|
||||
|
||||
// add mapping for the network in network_external_firewall_device_map
|
||||
String insertFwMapping = "INSERT INTO `cloud`.`network_external_firewall_device_map` (uuid, network_id, external_firewall_device_id, created) VALUES ( ?, ?, ?, now())";
|
||||
pstmtUpdate = conn.prepareStatement(insertFwMapping);
|
||||
pstmtUpdate.setString(1, UUID.randomUUID().toString());
|
||||
pstmtUpdate.setLong(2, networkId);
|
||||
pstmtUpdate.setLong(3, srxDevivceId);
|
||||
pstmtUpdate.executeUpdate();
|
||||
s_logger.debug("Successfully added entry in network_external_firewall_device_map for network " + networkId + " and SRX device ID " + srxDevivceId);
|
||||
}
|
||||
|
||||
// update host details for F5 and SRX devices
|
||||
s_logger.debug("Updating the host details for F5 and SRX devices");
|
||||
pstmt = conn.prepareStatement("SELECT host_id, name FROM `cloud`.`host_details` WHERE host_id=? OR host_id=?");
|
||||
pstmt.setLong(1, f5HostId);
|
||||
pstmt.setLong(2, srxHostId);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
long hostId = rs.getLong(1);
|
||||
String camlCaseName = rs.getString(2);
|
||||
if (!(camlCaseName.equalsIgnoreCase("numRetries") ||
|
||||
camlCaseName.equalsIgnoreCase("publicZone") ||
|
||||
camlCaseName.equalsIgnoreCase("privateZone") ||
|
||||
camlCaseName.equalsIgnoreCase("publicInterface") ||
|
||||
camlCaseName.equalsIgnoreCase("privateInterface") ||
|
||||
camlCaseName.equalsIgnoreCase("usageInterface") )) {
|
||||
continue;
|
||||
}
|
||||
String lowerCaseName = camlCaseName.toLowerCase();
|
||||
pstmt = conn.prepareStatement("update `cloud`.`host_details` set name=? where host_id=? AND name=?");
|
||||
pstmt.setString(1, lowerCaseName);
|
||||
pstmt.setLong(2, hostId);
|
||||
pstmt.setString(3, camlCaseName);
|
||||
pstmt.executeUpdate();
|
||||
}
|
||||
s_logger.debug("Successfully updated host details for F5 and SRX devices");
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable create a mapping for the networks in network_external_lb_device_map and network_external_firewall_device_map", e);
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (pstmt != null) {
|
||||
pstmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
s_logger.info("Successfully upgraded network using F5 and SRX devices to have a entry in the network_external_lb_device_map and network_external_firewall_device_map");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,180 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.usage;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="usage_vm_disk")
|
||||
public class UsageVmDiskVO {
|
||||
@Id
|
||||
@Column(name="account_id")
|
||||
private long accountId;
|
||||
|
||||
@Column(name="zone_id")
|
||||
private long zoneId;
|
||||
|
||||
@Column(name="vm_id")
|
||||
private Long vmId;
|
||||
|
||||
@Column(name="volume_id")
|
||||
private Long volumeId;
|
||||
|
||||
@Column(name="io_read")
|
||||
private long ioRead;
|
||||
|
||||
@Column(name="io_write")
|
||||
private long ioWrite;
|
||||
|
||||
@Column(name="agg_io_write")
|
||||
private long aggIOWrite;
|
||||
|
||||
@Column(name="agg_io_read")
|
||||
private long aggIORead;
|
||||
|
||||
@Column(name="bytes_read")
|
||||
private long bytesRead;
|
||||
|
||||
@Column(name="bytes_write")
|
||||
private long bytesWrite;
|
||||
|
||||
@Column(name="agg_bytes_write")
|
||||
private long aggBytesWrite;
|
||||
|
||||
@Column(name="agg_bytes_read")
|
||||
private long aggBytesRead;
|
||||
|
||||
@Column(name="event_time_millis")
|
||||
private long eventTimeMillis = 0;
|
||||
|
||||
protected UsageVmDiskVO() {
|
||||
}
|
||||
|
||||
public UsageVmDiskVO(Long accountId, long zoneId, Long vmId, Long volumeId, long ioRead, long ioWrite, long aggIORead, long aggIOWrite,
|
||||
long bytesRead, long bytesWrite, long aggBytesRead, long aggBytesWrite, long eventTimeMillis) {
|
||||
this.accountId = accountId;
|
||||
this.zoneId = zoneId;
|
||||
this.vmId = vmId;
|
||||
this.volumeId = volumeId;
|
||||
this.ioRead = ioRead;
|
||||
this.ioWrite = ioWrite;
|
||||
this.aggIOWrite = aggIOWrite;
|
||||
this.aggIORead = aggIORead;
|
||||
this.bytesRead = bytesRead;
|
||||
this.bytesWrite = bytesWrite;
|
||||
this.aggBytesWrite = aggBytesWrite;
|
||||
this.aggBytesRead = aggBytesRead;
|
||||
this.eventTimeMillis = eventTimeMillis;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
public void setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public Long getIORead() {
|
||||
return ioRead;
|
||||
}
|
||||
|
||||
public void setIORead(Long ioRead) {
|
||||
this.ioRead = ioRead;
|
||||
}
|
||||
|
||||
public Long getIOWrite() {
|
||||
return ioWrite;
|
||||
}
|
||||
|
||||
public void setIOWrite(Long ioWrite) {
|
||||
this.ioWrite = ioWrite;
|
||||
}
|
||||
|
||||
public Long getBytesRead() {
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
public void setBytesRead(Long bytesRead) {
|
||||
this.bytesRead = bytesRead;
|
||||
}
|
||||
|
||||
public Long getBytesWrite() {
|
||||
return bytesWrite;
|
||||
}
|
||||
|
||||
public void setBytesWrite(Long bytesWrite) {
|
||||
this.bytesWrite = bytesWrite;
|
||||
}
|
||||
|
||||
public long getEventTimeMillis() {
|
||||
return eventTimeMillis;
|
||||
}
|
||||
public void setEventTimeMillis(long eventTimeMillis) {
|
||||
this.eventTimeMillis = eventTimeMillis;
|
||||
}
|
||||
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public Long getVolumeId() {
|
||||
return volumeId;
|
||||
}
|
||||
|
||||
public long getAggIOWrite() {
|
||||
return aggIOWrite;
|
||||
}
|
||||
|
||||
public void setAggIOWrite(long aggIOWrite) {
|
||||
this.aggIOWrite = aggIOWrite;
|
||||
}
|
||||
|
||||
public long getAggIORead() {
|
||||
return aggIORead;
|
||||
}
|
||||
|
||||
public void setAggIORead(long aggIORead) {
|
||||
this.aggIORead = aggIORead;
|
||||
}
|
||||
|
||||
public long getAggBytesWrite() {
|
||||
return aggBytesWrite;
|
||||
}
|
||||
|
||||
public void setAggBytesWrite(long aggBytesWrite) {
|
||||
this.aggBytesWrite = aggBytesWrite;
|
||||
}
|
||||
|
||||
public long getAggBytesRead() {
|
||||
return aggBytesRead;
|
||||
}
|
||||
|
||||
public void setAggBytesRead(long aggBytesRead) {
|
||||
this.aggBytesRead = aggBytesRead;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import com.cloud.usage.UsageVO;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.UserStatisticsVO;
|
||||
import com.cloud.user.VmDiskStatisticsVO;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
|
@ -36,4 +37,7 @@ public interface UsageDao extends GenericDao<UsageVO, Long> {
|
|||
Long getLastAccountId();
|
||||
Long getLastUserStatsId();
|
||||
List<Long> listPublicTemplatesByAccount(long accountId);
|
||||
Long getLastVmDiskStatsId();
|
||||
void updateVmDiskStats(List<VmDiskStatisticsVO> vmNetStats);
|
||||
void saveVmDiskStats(List<VmDiskStatisticsVO> vmNetStats);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.springframework.stereotype.Component;
|
|||
import com.cloud.usage.UsageVO;
|
||||
import com.cloud.user.AccountVO;
|
||||
import com.cloud.user.UserStatisticsVO;
|
||||
import com.cloud.user.VmDiskStatisticsVO;
|
||||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
|
|
@ -56,6 +57,13 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
|
|||
private static final String GET_LAST_USER_STATS = "SELECT id FROM cloud_usage.user_statistics ORDER BY id DESC LIMIT 1";
|
||||
private static final String GET_PUBLIC_TEMPLATES_BY_ACCOUNTID = "SELECT id FROM cloud.vm_template WHERE account_id = ? AND public = '1' AND removed IS NULL";
|
||||
|
||||
private static final String GET_LAST_VM_DISK_STATS = "SELECT id FROM cloud_usage.vm_disk_statistics ORDER BY id DESC LIMIT 1";
|
||||
private static final String INSERT_VM_DISK_STATS = "INSERT INTO cloud_usage.vm_disk_statistics (id, data_center_id, account_id, vm_id, volume_id, net_io_read, net_io_write, current_io_read, " +
|
||||
"current_io_write, agg_io_read, agg_io_write, net_bytes_read, net_bytes_write, current_bytes_read, current_bytes_write, agg_bytes_read, agg_bytes_write) " +
|
||||
" VALUES (?,?,?,?,?,?,?,?,?,?, ?, ?, ?, ?,?, ?, ?)";
|
||||
private static final String UPDATE_VM_DISK_STATS = "UPDATE cloud_usage.vm_disk_statistics SET net_io_read=?, net_io_write=?, current_io_read=?, current_io_write=?, agg_io_read=?, agg_io_write=?, " +
|
||||
"net_bytes_read=?, net_bytes_write=?, current_bytes_read=?, current_bytes_write=?, agg_bytes_read=?, agg_bytes_write=? WHERE id=?";
|
||||
|
||||
protected final static TimeZone s_gmtTimeZone = TimeZone.getTimeZone("GMT");
|
||||
|
||||
public UsageDaoImpl () {}
|
||||
|
|
@ -270,4 +278,101 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
|
|||
}
|
||||
return templateList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getLastVmDiskStatsId() {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
PreparedStatement pstmt = null;
|
||||
String sql = GET_LAST_VM_DISK_STATS;
|
||||
try {
|
||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
return Long.valueOf(rs.getLong(1));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("error getting last vm disk stats id", ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVmDiskStats(List<VmDiskStatisticsVO> vmDiskStats) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
txn.start();
|
||||
String sql = UPDATE_VM_DISK_STATS;
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = txn.prepareAutoCloseStatement(sql); // in reality I just want CLOUD_USAGE dataSource connection
|
||||
for (VmDiskStatisticsVO vmDiskStat : vmDiskStats) {
|
||||
pstmt.setLong(1, vmDiskStat.getNetIORead());
|
||||
pstmt.setLong(2, vmDiskStat.getNetIOWrite());
|
||||
pstmt.setLong(3, vmDiskStat.getCurrentIORead());
|
||||
pstmt.setLong(4, vmDiskStat.getCurrentIOWrite());
|
||||
pstmt.setLong(5, vmDiskStat.getAggIORead());
|
||||
pstmt.setLong(6, vmDiskStat.getAggIOWrite());
|
||||
pstmt.setLong(7, vmDiskStat.getNetBytesRead());
|
||||
pstmt.setLong(8, vmDiskStat.getNetBytesWrite());
|
||||
pstmt.setLong(9, vmDiskStat.getCurrentBytesRead());
|
||||
pstmt.setLong(10, vmDiskStat.getCurrentBytesWrite());
|
||||
pstmt.setLong(11, vmDiskStat.getAggBytesRead());
|
||||
pstmt.setLong(12, vmDiskStat.getAggBytesWrite());
|
||||
pstmt.setLong(13, vmDiskStat.getId());
|
||||
pstmt.addBatch();
|
||||
}
|
||||
pstmt.executeBatch();
|
||||
txn.commit();
|
||||
} catch (Exception ex) {
|
||||
txn.rollback();
|
||||
s_logger.error("error saving vm disk stats to cloud_usage db", ex);
|
||||
throw new CloudRuntimeException(ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveVmDiskStats(List<VmDiskStatisticsVO> vmDiskStats) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
txn.start();
|
||||
String sql = INSERT_VM_DISK_STATS;
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = txn.prepareAutoCloseStatement(sql); // in reality I just want CLOUD_USAGE dataSource connection
|
||||
for (VmDiskStatisticsVO vmDiskStat : vmDiskStats) {
|
||||
pstmt.setLong(1, vmDiskStat.getId());
|
||||
pstmt.setLong(2, vmDiskStat.getDataCenterId());
|
||||
pstmt.setLong(3, vmDiskStat.getAccountId());
|
||||
if(vmDiskStat.getVmId() != null){
|
||||
pstmt.setLong(4, vmDiskStat.getVmId());
|
||||
} else {
|
||||
pstmt.setNull(4, Types.BIGINT);
|
||||
}
|
||||
if(vmDiskStat.getVolumeId() != null){
|
||||
pstmt.setLong(5, vmDiskStat.getVolumeId());
|
||||
} else {
|
||||
pstmt.setNull(5, Types.BIGINT);
|
||||
}
|
||||
pstmt.setLong(6, vmDiskStat.getNetIORead());
|
||||
pstmt.setLong(7, vmDiskStat.getNetIOWrite());
|
||||
pstmt.setLong(8, vmDiskStat.getCurrentIORead());
|
||||
pstmt.setLong(9, vmDiskStat.getCurrentIOWrite());
|
||||
pstmt.setLong(10, vmDiskStat.getAggIORead());
|
||||
pstmt.setLong(11, vmDiskStat.getAggIOWrite());
|
||||
pstmt.setLong(12, vmDiskStat.getNetBytesRead());
|
||||
pstmt.setLong(13, vmDiskStat.getNetBytesWrite());
|
||||
pstmt.setLong(14, vmDiskStat.getCurrentBytesRead());
|
||||
pstmt.setLong(15, vmDiskStat.getCurrentBytesWrite());
|
||||
pstmt.setLong(16, vmDiskStat.getAggBytesRead());
|
||||
pstmt.setLong(17, vmDiskStat.getAggBytesWrite());
|
||||
pstmt.addBatch();
|
||||
}
|
||||
pstmt.executeBatch();
|
||||
txn.commit();
|
||||
} catch (Exception ex) {
|
||||
txn.rollback();
|
||||
s_logger.error("error saving vm disk stats to cloud_usage db", ex);
|
||||
throw new CloudRuntimeException(ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.usage.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.usage.UsageVmDiskVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface UsageVmDiskDao extends GenericDao<UsageVmDiskVO, Long> {
|
||||
Map<String, UsageVmDiskVO> getRecentVmDiskStats();
|
||||
void deleteOldStats(long maxEventTime);
|
||||
void saveUsageVmDisks(List<UsageVmDiskVO> usageVmDisks);
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.usage.dao;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.usage.UsageVmDiskVO;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component
|
||||
@Local(value={UsageVmDiskDao.class})
|
||||
public class UsageVmDiskDaoImpl extends GenericDaoBase<UsageVmDiskVO, Long> implements UsageVmDiskDao {
|
||||
private static final Logger s_logger = Logger.getLogger(UsageVMInstanceDaoImpl.class.getName());
|
||||
private static final String SELECT_LATEST_STATS = "SELECT uvd.account_id, uvd.zone_id, uvd.vm_id, uvd.volume_id, uvd.io_read, uvd.io_write, uvd.agg_io_read, uvd.agg_io_write, " +
|
||||
"uvd.bytes_read, uvd.bytes_write, uvd.agg_bytes_read, uvd.agg_bytes_write, uvd.event_time_millis " +
|
||||
"FROM cloud_usage.usage_vm_disk uvd INNER JOIN (SELECT vmdiskusage.account_id as acct_id, vmdiskusage.zone_id as z_id, max(vmdiskusage.event_time_millis) as max_date " +
|
||||
"FROM cloud_usage.usage_vm_disk vmdiskusage " +
|
||||
"GROUP BY vmdiskusage.account_id, vmdiskusage.zone_id " +
|
||||
") joinnet on uvd.account_id = joinnet.acct_id and uvd.zone_id = joinnet.z_id and uvd.event_time_millis = joinnet.max_date";
|
||||
private static final String DELETE_OLD_STATS = "DELETE FROM cloud_usage.usage_vm_disk WHERE event_time_millis < ?";
|
||||
|
||||
private static final String INSERT_USAGE_VM_DISK = "INSERT INTO cloud_usage.usage_vm_disk (account_id, zone_id, vm_id, volume_id, io_read, io_write, agg_io_read, agg_io_write, bytes_read, bytes_write, agg_bytes_read, agg_bytes_write, event_time_millis) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
public UsageVmDiskDaoImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, UsageVmDiskVO> getRecentVmDiskStats() {
|
||||
Transaction txn = Transaction.open(Transaction.USAGE_DB);
|
||||
String sql = SELECT_LATEST_STATS;
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
Map<String, UsageVmDiskVO> returnMap = new HashMap<String, UsageVmDiskVO>();
|
||||
while (rs.next()) {
|
||||
long accountId = rs.getLong(1);
|
||||
long zoneId = rs.getLong(2);
|
||||
long vmId = rs.getLong(3);
|
||||
Long volumeId = rs.getLong(4);
|
||||
long ioRead = rs.getLong(5);
|
||||
long ioWrite = rs.getLong(6);
|
||||
long aggIORead = rs.getLong(7);
|
||||
long aggIOWrite = rs.getLong(8);
|
||||
long bytesRead = rs.getLong(9);
|
||||
long bytesWrite = rs.getLong(10);
|
||||
long aggBytesRead = rs.getLong(11);
|
||||
long aggBytesWrite = rs.getLong(12);
|
||||
long eventTimeMillis = rs.getLong(13);
|
||||
if(vmId != 0){
|
||||
returnMap.put(zoneId + "-" + accountId+ "-Vm-" + vmId+ "-Disk-" + volumeId, new UsageVmDiskVO(accountId, zoneId, vmId, volumeId, ioRead, ioWrite, aggIORead, aggIOWrite, bytesRead, bytesWrite, aggBytesRead, aggBytesWrite, eventTimeMillis));
|
||||
} else {
|
||||
returnMap.put(zoneId + "-" + accountId, new UsageVmDiskVO(accountId, zoneId, vmId, volumeId, ioRead, ioWrite, aggIORead, aggIOWrite, bytesRead, bytesWrite, aggBytesRead, aggBytesWrite, eventTimeMillis));
|
||||
}
|
||||
}
|
||||
return returnMap;
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("error getting recent usage disk stats", ex);
|
||||
} finally {
|
||||
txn.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOldStats(long maxEventTime) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
String sql = DELETE_OLD_STATS;
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
txn.start();
|
||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
||||
pstmt.setLong(1, maxEventTime);
|
||||
pstmt.executeUpdate();
|
||||
txn.commit();
|
||||
} catch (Exception ex) {
|
||||
txn.rollback();
|
||||
s_logger.error("error deleting old usage disk stats", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUsageVmDisks(List<UsageVmDiskVO> usageVmDisks) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
txn.start();
|
||||
String sql = INSERT_USAGE_VM_DISK;
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = txn.prepareAutoCloseStatement(sql); // in reality I just want CLOUD_USAGE dataSource connection
|
||||
for (UsageVmDiskVO usageVmDisk : usageVmDisks) {
|
||||
pstmt.setLong(1, usageVmDisk.getAccountId());
|
||||
pstmt.setLong(2, usageVmDisk.getZoneId());
|
||||
pstmt.setLong(3, usageVmDisk.getVmId());
|
||||
pstmt.setLong(4, usageVmDisk.getVolumeId());
|
||||
pstmt.setLong(5, usageVmDisk.getIORead());
|
||||
pstmt.setLong(6, usageVmDisk.getIOWrite());
|
||||
pstmt.setLong(7, usageVmDisk.getAggIORead());
|
||||
pstmt.setLong(8, usageVmDisk.getAggIOWrite());
|
||||
pstmt.setLong(9, usageVmDisk.getBytesRead());
|
||||
pstmt.setLong(10, usageVmDisk.getBytesWrite());
|
||||
pstmt.setLong(11, usageVmDisk.getAggBytesRead());
|
||||
pstmt.setLong(12, usageVmDisk.getAggBytesWrite());
|
||||
pstmt.setLong(13, usageVmDisk.getEventTimeMillis());
|
||||
pstmt.addBatch();
|
||||
}
|
||||
pstmt.executeBatch();
|
||||
txn.commit();
|
||||
} catch (Exception ex) {
|
||||
txn.rollback();
|
||||
s_logger.error("error saving usage_vm_disk to cloud_usage db", ex);
|
||||
throw new CloudRuntimeException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.user;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="vm_disk_statistics")
|
||||
public class VmDiskStatisticsVO {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private Long id;
|
||||
|
||||
@Column(name="data_center_id", updatable=false)
|
||||
private long dataCenterId;
|
||||
|
||||
@Column(name="account_id", updatable=false)
|
||||
private long accountId;
|
||||
|
||||
@Column(name="vm_id")
|
||||
private Long vmId;
|
||||
|
||||
@Column(name="volume_id")
|
||||
private Long volumeId;
|
||||
|
||||
@Column(name="net_io_read")
|
||||
private long netIORead;
|
||||
|
||||
@Column(name="net_io_write")
|
||||
private long netIOWrite;
|
||||
|
||||
@Column(name="current_io_read")
|
||||
private long currentIORead;
|
||||
|
||||
@Column(name="current_io_write")
|
||||
private long currentIOWrite;
|
||||
|
||||
@Column(name="agg_io_read")
|
||||
private long aggIORead;
|
||||
|
||||
@Column(name="agg_io_write")
|
||||
private long aggIOWrite;
|
||||
|
||||
@Column(name="net_bytes_read")
|
||||
private long netBytesRead;
|
||||
|
||||
@Column(name="net_bytes_write")
|
||||
private long netBytesWrite;
|
||||
|
||||
@Column(name="current_bytes_read")
|
||||
private long currentBytesRead;
|
||||
|
||||
@Column(name="current_bytes_write")
|
||||
private long currentBytesWrite;
|
||||
|
||||
@Column(name="agg_bytes_read")
|
||||
private long aggBytesRead;
|
||||
|
||||
@Column(name="agg_bytes_write")
|
||||
private long aggBytesWrite;
|
||||
|
||||
protected VmDiskStatisticsVO() {
|
||||
}
|
||||
|
||||
public VmDiskStatisticsVO(long accountId, long dcId, Long vmId, Long volumeId) {
|
||||
this.accountId = accountId;
|
||||
this.dataCenterId = dcId;
|
||||
this.vmId = vmId;
|
||||
this.volumeId = volumeId;
|
||||
this.netBytesRead = 0;
|
||||
this.netBytesWrite = 0;
|
||||
this.currentBytesRead = 0;
|
||||
this.currentBytesWrite = 0;
|
||||
this.netBytesRead = 0;
|
||||
this.netBytesWrite = 0;
|
||||
this.currentBytesRead = 0;
|
||||
this.currentBytesWrite = 0;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getDataCenterId() {
|
||||
return dataCenterId;
|
||||
}
|
||||
|
||||
public Long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public Long getVolumeId() {
|
||||
return volumeId;
|
||||
}
|
||||
|
||||
public long getCurrentIORead() {
|
||||
return currentIORead;
|
||||
}
|
||||
|
||||
public void setCurrentIORead(long currentIORead) {
|
||||
this.currentIORead = currentIORead;
|
||||
}
|
||||
|
||||
public long getCurrentIOWrite() {
|
||||
return currentIOWrite;
|
||||
}
|
||||
|
||||
public void setCurrentIOWrite(long currentIOWrite) {
|
||||
this.currentIOWrite = currentIOWrite;
|
||||
}
|
||||
|
||||
public long getNetIORead() {
|
||||
return netIORead;
|
||||
}
|
||||
|
||||
public long getNetIOWrite() {
|
||||
return netIOWrite;
|
||||
}
|
||||
|
||||
public void setNetIORead(long netIORead) {
|
||||
this.netIORead = netIORead;
|
||||
}
|
||||
|
||||
public void setNetIOWrite(long netIOWrite) {
|
||||
this.netIOWrite = netIOWrite;
|
||||
}
|
||||
|
||||
public long getAggIORead() {
|
||||
return aggIORead;
|
||||
}
|
||||
|
||||
public void setAggIORead(long aggIORead) {
|
||||
this.aggIORead = aggIORead;
|
||||
}
|
||||
|
||||
public long getAggIOWrite() {
|
||||
return aggIOWrite;
|
||||
}
|
||||
|
||||
public void setAggIOWrite(long aggIOWrite) {
|
||||
this.aggIOWrite = aggIOWrite;
|
||||
}
|
||||
|
||||
public long getCurrentBytesRead() {
|
||||
return currentBytesRead;
|
||||
}
|
||||
|
||||
public void setCurrentBytesRead(long currentBytesRead) {
|
||||
this.currentBytesRead = currentBytesRead;
|
||||
}
|
||||
|
||||
public long getCurrentBytesWrite() {
|
||||
return currentBytesWrite;
|
||||
}
|
||||
|
||||
public void setCurrentBytesWrite(long currentBytesWrite) {
|
||||
this.currentBytesWrite = currentBytesWrite;
|
||||
}
|
||||
|
||||
public long getNetBytesRead() {
|
||||
return netBytesRead;
|
||||
}
|
||||
|
||||
public long getNetBytesWrite() {
|
||||
return netBytesWrite;
|
||||
}
|
||||
|
||||
public void setNetBytesRead(long netBytesRead) {
|
||||
this.netBytesRead = netBytesRead;
|
||||
}
|
||||
|
||||
public void setNetBytesWrite(long netBytesWrite) {
|
||||
this.netBytesWrite = netBytesWrite;
|
||||
}
|
||||
|
||||
public long getAggBytesRead() {
|
||||
return aggBytesRead;
|
||||
}
|
||||
|
||||
public void setAggBytesRead(long aggBytesRead) {
|
||||
this.aggBytesRead = aggBytesRead;
|
||||
}
|
||||
|
||||
public long getAggBytesWrite() {
|
||||
return aggBytesWrite;
|
||||
}
|
||||
|
||||
public void setAggBytesWrite(long aggBytesWrite) {
|
||||
this.aggBytesWrite = aggBytesWrite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.user.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.user.VmDiskStatisticsVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface VmDiskStatisticsDao extends GenericDao<VmDiskStatisticsVO, Long> {
|
||||
VmDiskStatisticsVO findBy(long accountId, long dcId, long vmId, long volumeId);
|
||||
|
||||
VmDiskStatisticsVO lock(long accountId, long dcId, long vmId, long volumeId);
|
||||
|
||||
List<VmDiskStatisticsVO> listBy(long accountId);
|
||||
|
||||
List<VmDiskStatisticsVO> listActiveAndRecentlyDeleted(Date minRemovedDate, int startIndex, int limit);
|
||||
|
||||
List<VmDiskStatisticsVO> listUpdatedStats();
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.user.dao;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.user.VmDiskStatisticsVO;
|
||||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
@Component
|
||||
@Local(value={VmDiskStatisticsDao.class})
|
||||
public class VmDiskStatisticsDaoImpl extends GenericDaoBase<VmDiskStatisticsVO, Long> implements VmDiskStatisticsDao {
|
||||
private static final Logger s_logger = Logger.getLogger(VmDiskStatisticsDaoImpl.class);
|
||||
private static final String ACTIVE_AND_RECENTLY_DELETED_SEARCH = "SELECT vns.id, vns.data_center_id, vns.account_id, vns.vm_id, vns.volume_id, vns.agg_io_read, vns.agg_io_write, vns.agg_bytes_read, vns.agg_bytes_write " +
|
||||
"FROM vm_disk_statistics vns, account a " +
|
||||
"WHERE vns.account_id = a.id AND (a.removed IS NULL OR a.removed >= ?) " +
|
||||
"ORDER BY vns.id";
|
||||
private static final String UPDATED_VM_NETWORK_STATS_SEARCH = "SELECT id, current_io_read, current_io_write, net_io_read, net_io_write, agg_io_read, agg_io_write, " +
|
||||
"current_bytes_read, current_bytes_write, net_bytes_read, net_bytes_write, agg_bytes_read, agg_bytes_write " +
|
||||
"from vm_disk_statistics " +
|
||||
"where (agg_io_read < net_io_read + current_io_read) OR (agg_io_write < net_io_write + current_io_write) OR " +
|
||||
"(agg_bytes_read < net_bytes_read + current_bytes_read) OR (agg_bytes_write < net_bytes_write + current_bytes_write)";
|
||||
private final SearchBuilder<VmDiskStatisticsVO> AllFieldsSearch;
|
||||
private final SearchBuilder<VmDiskStatisticsVO> AccountSearch;
|
||||
|
||||
|
||||
public VmDiskStatisticsDaoImpl() {
|
||||
AccountSearch = createSearchBuilder();
|
||||
AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountSearch.done();
|
||||
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("dc", AllFieldsSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("volume", AllFieldsSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("vm", AllFieldsSearch.entity().getVmId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VmDiskStatisticsVO findBy(long accountId, long dcId, long vmId, long volumeId) {
|
||||
SearchCriteria<VmDiskStatisticsVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("volume", volumeId);
|
||||
sc.setParameters("vm", vmId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VmDiskStatisticsVO lock(long accountId, long dcId, long vmId, long volumeId) {
|
||||
SearchCriteria<VmDiskStatisticsVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("volume", volumeId);
|
||||
sc.setParameters("vm", vmId);
|
||||
return lockOneRandomRow(sc, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VmDiskStatisticsVO> listBy(long accountId) {
|
||||
SearchCriteria<VmDiskStatisticsVO> sc = AccountSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
return search(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VmDiskStatisticsVO> listActiveAndRecentlyDeleted(Date minRemovedDate, int startIndex, int limit) {
|
||||
List<VmDiskStatisticsVO> vmDiskStats = new ArrayList<VmDiskStatisticsVO>();
|
||||
if (minRemovedDate == null) return vmDiskStats;
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
String sql = ACTIVE_AND_RECENTLY_DELETED_SEARCH + " LIMIT " + startIndex + "," + limit;
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
||||
pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), minRemovedDate));
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
vmDiskStats.add(toEntityBean(rs, false));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("error saving vm disk stats to cloud_usage db", ex);
|
||||
}
|
||||
return vmDiskStats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VmDiskStatisticsVO> listUpdatedStats() {
|
||||
List<VmDiskStatisticsVO> vmDiskStats = new ArrayList<VmDiskStatisticsVO>();
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
PreparedStatement pstmt = null;
|
||||
pstmt = txn.prepareAutoCloseStatement(UPDATED_VM_NETWORK_STATS_SEARCH);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
vmDiskStats.add(toEntityBean(rs, false));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("error lisitng updated vm disk stats", ex);
|
||||
}
|
||||
return vmDiskStats;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,10 +54,9 @@ public interface UserVmDao extends GenericDao<UserVmVO, Long> {
|
|||
/**
|
||||
* List user vm instances with virtualized networking (i.e. not direct attached networking) for the given account and datacenter
|
||||
* @param accountId will search for vm instances belonging to this account
|
||||
* @param dcId will search for vm instances in this zone
|
||||
* @return the list of vm instances owned by the account in the given data center that have virtualized networking (not direct attached networking)
|
||||
*/
|
||||
List<UserVmVO> listVirtualNetworkInstancesByAcctAndZone(long accountId, long dcId, long networkId);
|
||||
List<UserVmVO> listVirtualNetworkInstancesByAcctAndNetwork(long accountId, long networkId);
|
||||
|
||||
List<UserVmVO> listByNetworkIdAndStates(long networkId, State... states);
|
||||
|
||||
|
|
|
|||
|
|
@ -283,11 +283,10 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserVmVO> listVirtualNetworkInstancesByAcctAndZone(long accountId, long dcId, long networkId) {
|
||||
public List<UserVmVO> listVirtualNetworkInstancesByAcctAndNetwork(long accountId, long networkId) {
|
||||
|
||||
SearchCriteria<UserVmVO> sc = AccountDataCenterVirtualSearch.create();
|
||||
sc.setParameters("account", accountId);
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setJoinParameters("nicSearch", "networkId", networkId);
|
||||
|
||||
return listBy(sc);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ public class UserVmData {
|
|||
private String cpuUsed;
|
||||
private Long networkKbsRead;
|
||||
private Long networkKbsWrite;
|
||||
private Long diskKbsRead;
|
||||
private Long diskKbsWrite;
|
||||
private Long diskIORead;
|
||||
private Long diskIOWrite;
|
||||
private Long guestOsId;
|
||||
private Long rootDeviceId;
|
||||
private String rootDeviceType;
|
||||
|
|
@ -364,6 +368,38 @@ public class UserVmData {
|
|||
this.networkKbsWrite = networkKbsWrite;
|
||||
}
|
||||
|
||||
public Long getDiskKbsRead() {
|
||||
return diskKbsRead;
|
||||
}
|
||||
|
||||
public void setDiskKbsRead(Long diskKbsRead) {
|
||||
this.diskKbsRead = diskKbsRead;
|
||||
}
|
||||
|
||||
public Long getDiskKbsWrite() {
|
||||
return diskKbsWrite;
|
||||
}
|
||||
|
||||
public void setDiskKbsWrite(Long diskKbsWrite) {
|
||||
this.diskKbsWrite = diskKbsWrite;
|
||||
}
|
||||
|
||||
public Long getDiskIORead() {
|
||||
return diskIORead;
|
||||
}
|
||||
|
||||
public void setDiskIORead(Long diskIORead) {
|
||||
this.diskIORead = diskIORead;
|
||||
}
|
||||
|
||||
public Long getDiskIOWrite() {
|
||||
return diskIOWrite;
|
||||
}
|
||||
|
||||
public void setDiskIOWrite(Long diskIOWrite) {
|
||||
this.diskIOWrite = diskIOWrite;
|
||||
}
|
||||
|
||||
public Long getGuestOsId() {
|
||||
return guestOsId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,6 @@ public interface ApplicationLoadBalancerRuleDao extends GenericDao<ApplicationLo
|
|||
long countBySourceIp(Ip sourceIp, long sourceIpNetworkId);
|
||||
List<ApplicationLoadBalancerRuleVO> listBySourceIpAndNotRevoked(Ip sourceIp, long sourceNetworkId);
|
||||
List<String> listLbIpsBySourceIpNetworkIdAndScheme(long sourceIpNetworkId, Scheme scheme);
|
||||
long countBySourceIpAndNotRevoked(Ip sourceIp, long sourceIpNetworkId);
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue