This commit is contained in:
SowjanyaPatha 2017-07-27 04:26:03 -04:00
commit 31f27da93d
329 changed files with 9867 additions and 1539 deletions

View File

@ -1 +1 @@
cloudstack
system

View File

@ -16,6 +16,7 @@
# under the License.
sudo: required
dist: trusty
group: edge
language: java
jdk:
- oraclejdk8
@ -92,6 +93,7 @@ env:
smoke/misc/test_vm_sync"
- TESTS="component/find_hosts_for_migration
component/test_accounts
component/test_acl_isolatednetwork_delete
component/test_acl_listsnapshot
component/test_acl_listvm
@ -145,7 +147,6 @@ env:
# - TESTS="component/test_project_resources"
# - TESTS="component/test_cpu_domain_limits"
# - TESTS="component/test_acl_isolatednetwork"
# - TESTS="component/test_accounts"
# - TESTS="component/test_organization_states"
before_install: travis_wait 30 ./tools/travis/before_install.sh

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@ -45,6 +45,10 @@ public class LoadBalancerTO {
boolean revoked;
boolean alreadyAdded;
boolean inline;
String srcIpVlan;
String srcIpGateway;
String srcIpNetmask;
Long networkId;
DestinationTO[] destinations;
private StickinessPolicyTO[] stickinessPolicies;
private HealthCheckPolicyTO[] healthCheckPolicies;
@ -82,6 +86,15 @@ public class LoadBalancerTO {
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, argDestinations, stickinessPolicies, null, null, null);
}
public LoadBalancerTO(String id, List<DestinationTO> destinations) {
this.uuid = id;
int i = 0;
this.destinations = new DestinationTO[destinations.size()];
for (DestinationTO destination : destinations) {
this.destinations[i++] = new DestinationTO(destination.getDestIp(), destination.getDestPort(), destination.getMonitorState());
}
}
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
List<LbDestination> argDestinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert,
String lbProtocol) {
@ -194,21 +207,53 @@ public class LoadBalancerTO {
return this.sslCert;
}
public String getSrcIpVlan() {
return srcIpVlan;
}
public void setSrcIpVlan(String srcIpVlan) {
this.srcIpVlan = srcIpVlan;
}
public Long getNetworkId() {
return networkId;
}
public void setNetworkId(long id) {
this.networkId = id;
}
public String getSrcIpGateway() {
return srcIpGateway;
}
public void setSrcIpGateway(String srcIpGateway) {
this.srcIpGateway = srcIpGateway;
}
public String getSrcIpNetmask() {
return srcIpNetmask;
}
public void setSrcIpNetmask(String srcIpNetmask) {
this.srcIpNetmask = srcIpNetmask;
}
public static class StickinessPolicyTO {
private String _methodName;
private List<Pair<String, String>> _paramsList;
private String methodName;
private List<Pair<String, String>> params;
public String getMethodName() {
return _methodName;
return methodName;
}
public List<Pair<String, String>> getParams() {
return _paramsList;
return params;
}
public StickinessPolicyTO(String methodName, List<Pair<String, String>> paramsList) {
this._methodName = methodName;
this._paramsList = paramsList;
this.methodName = methodName;
this.params = paramsList;
}
}
@ -219,7 +264,7 @@ public class LoadBalancerTO {
private int healthcheckInterval;
private int healthcheckThresshold;
private int unhealthThresshold;
private boolean revoke = false;
private boolean revoked = false;
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold,
boolean revoke) {
@ -230,7 +275,7 @@ public class LoadBalancerTO {
this.healthcheckInterval = healthcheckInterval;
this.healthcheckThresshold = healthcheckThresshold;
this.unhealthThresshold = unhealthThresshold;
this.revoke = revoke;
this.revoked = revoke;
}
public HealthCheckPolicyTO() {
@ -262,11 +307,11 @@ public class LoadBalancerTO {
}
public void setRevoke(boolean revoke) {
this.revoke = revoke;
this.revoked = revoke;
}
public boolean isRevoked() {
return revoke;
return revoked;
}
}
@ -285,6 +330,12 @@ public class LoadBalancerTO {
this.alreadyAdded = alreadyAdded;
}
public DestinationTO(String destIp, int destPort, String monitorState) {
this.destIp = destIp;
this.destPort = destPort;
this.monitorState = monitorState;
}
protected DestinationTO() {
}

View File

@ -32,6 +32,8 @@ public interface Capacity extends InternalIdentity, Identity {
public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9;
public static final short CAPACITY_TYPE_GPU = 19;
public static final short CAPACITY_TYPE_CPU_CORE = 90;
public Long getHostOrPoolId();
public Long getDataCenterId();
@ -49,4 +51,6 @@ public interface Capacity extends InternalIdentity, Identity {
public long getReservedCapacity();
public Float getUsedPercentage();
public Long getAllocatedCapacity();
}

View File

@ -391,6 +391,10 @@ public class EventTypes {
public static final String EVENT_EXTERNAL_LB_DEVICE_DELETE = "PHYSICAL.LOADBALANCER.DELETE";
public static final String EVENT_EXTERNAL_LB_DEVICE_CONFIGURE = "PHYSICAL.LOADBALANCER.CONFIGURE";
// external NCC device events
public static final String EVENT_EXTERNAL_NCC_DEVICE_ADD = "PHYSICAL.NCC.ADD";
public static final String EVENT_EXTERNAL_NCC_DEVICE_DELETE = "PHYSICAL.NCC.DELETE";
// external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD = "SWITCH.MGMT.ADD";
public static final String EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE = "SWITCH.MGMT.DELETE";
@ -545,6 +549,14 @@ public class EventTypes {
//Usage related events
public static final String EVENT_USAGE_REMOVE_USAGE_RECORDS = "USAGE.REMOVE.USAGE.RECORDS";
// Netscaler Service Package events
public static final String EVENT_NETSCALER_SERVICEPACKAGE_ADD = "NETSCALER.SERVICEPACKAGE.ADD";
public static final String EVENT_NETSCALER_SERVICEPACKAGE_DELETE = "NETSCALER.SERVICEPACKAGE.DELETE";
public static final String EVENT_NETSCALER_VM_START = "NETSCALERVM.START";
public static final String EVENT_NETSCALER_VM_STOP = "NETSCALERVM.STOP";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@ -918,6 +930,10 @@ public class EventTypes {
//Usage
entityEventDetails.put(EVENT_USAGE_REMOVE_USAGE_RECORDS, Usage.class);
// Netscaler Service Packages
entityEventDetails.put(EVENT_NETSCALER_SERVICEPACKAGE_ADD, "NETSCALER.SERVICEPACKAGE.CREATE");
entityEventDetails.put(EVENT_NETSCALER_SERVICEPACKAGE_DELETE, "NETSCALER.SERVICEPACKAGE.DELETE");
}
public static String getEntityForEvent(String eventName) {

View File

@ -31,7 +31,7 @@ import com.cloud.utils.fsm.StateObject;
public interface Host extends StateObject<Status>, Identity, InternalIdentity {
public enum Type {
Storage(false), Routing(false), SecondaryStorage(false), SecondaryStorageCmdExecutor(false), ConsoleProxy(true), ExternalFirewall(false), ExternalLoadBalancer(
false), ExternalVirtualSwitchSupervisor(false), PxeServer(false), BaremetalPxe(false), BaremetalDhcp(false), TrafficMonitor(false),
false), ExternalVirtualSwitchSupervisor(false), PxeServer(false), BaremetalPxe(false), BaremetalDhcp(false), TrafficMonitor(false), NetScalerControlCenter(false),
ExternalDhcp(false), SecondaryStorageVM(true), LocalSecondaryStorage(false), L2Networking(false);
boolean _virtual;

View File

@ -19,6 +19,7 @@ package com.cloud.network;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
@ -26,6 +27,7 @@ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
@ -38,6 +40,7 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.Pair;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
@ -182,4 +185,8 @@ public interface NetworkService {
boolean configureNicSecondaryIp(NicSecondaryIp secIp, boolean isZoneSgEnabled);
List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd);
AcquirePodIpCmdResponse allocatePodIp(Account account, String zoneId, String podId) throws ResourceAllocationException, ConcurrentOperationException;
boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException;
}

View File

@ -21,7 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface VirtualRouterProvider extends InternalIdentity, Identity {
public enum Type {
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm
}
public Type getType();

View File

@ -23,7 +23,7 @@ import com.cloud.vm.VirtualMachine;
*/
public interface VirtualRouter extends VirtualMachine {
public enum Role {
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM, NETSCALER_VM
}
public enum UpdateState {

View File

@ -38,7 +38,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
}
public enum Detail {
InternalLbProvider, PublicLbProvider
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription
}
public final static String SystemPublicNetwork = "System-Public-Network";
@ -133,4 +133,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean getSupportsStrechedL2();
boolean getSupportsPublicAccess();
String getServicePackage();
}

View File

@ -23,9 +23,13 @@ import com.cloud.configuration.ResourceCount;
import com.cloud.configuration.ResourceLimit;
import com.cloud.domain.Domain;
import com.cloud.exception.ResourceAllocationException;
import org.apache.cloudstack.framework.config.ConfigKey;
public interface ResourceLimitService {
static final ConfigKey<Long> ResourceCountCheckInterval = new ConfigKey<Long>("Advanced", Long.class, "resourcecount.check.interval", "300",
"Time (in seconds) to wait before retrying resource count check task. Default is 300, Setting this to 0 will not run the task", false);
/**
* Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
*

View File

@ -22,8 +22,9 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface User extends OwnedBy, InternalIdentity {
// UNKNOWN and NATIVE can be used interchangeably
public enum Source {
LDAP, SAML2, SAML2DISABLED, UNKNOWN
LDAP, SAML2, SAML2DISABLED, UNKNOWN, NATIVE
}
public static final long UID_SYSTEM = 1;

View File

@ -482,4 +482,8 @@ public interface UserVmService {
*/
public boolean isDisplayResourceEnabled(Long vmId);
void collectVmDiskStatistics(UserVm userVm);
void collectVmNetworkStatistics (UserVm userVm);
}

View File

@ -214,6 +214,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
public enum Type {
User(false), DomainRouter(true), ConsoleProxy(true), SecondaryStorageVm(true), ElasticIpVm(true), ElasticLoadBalancerVm(true), InternalLoadBalancerVm(true),
NetScalerVm(true),
/*
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no

View File

@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.vm;
public interface VmNetworkStats {
// vm related network stats
public long getBytesSent();
public long getBytesReceived();
}

View File

@ -652,6 +652,8 @@ public class ApiConstants {
public static final String OVM3_CLUSTER = "ovm3cluster";
public static final String OVM3_VIP = "ovm3vip";
public static final String CLEAN_UP_DETAILS = "cleanupdetails";
public static final String NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid";
public static final String NETSCALER_SERVICEPACKAGE_ID = "netscalerservicepackageid";
public static final String ZONE_ID_LIST = "zoneids";
public static final String DESTINATION_ZONE_ID_LIST = "destzoneids";
@ -664,4 +666,8 @@ public class ApiConstants {
public enum VMDetails {
all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp;
}
public enum DomainDetails {
all, resource, min;
}
}

View File

@ -0,0 +1,92 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.address;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
@APICommand(name = "acquirePodIpAddress", description = "Allocates IP addresses in respective Pod of a Zone", responseObject = AcquirePodIpCmdResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AcquirePodIpCmdByAdmin extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AcquirePodIpCmdByAdmin.class.getName());
private static final String s_name = "acquirepodipaddress";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone")
private String zoneId;
@Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID")
private String podId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
private String getZoneId() {
return zoneId;
}
public String getPodId() {
return podId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException {
AcquirePodIpCmdResponse podIp = null;
podIp = _networkService.allocatePodIp(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getPodId());
if (podIp != null) {
podIp.setResponseName(getCommandName());
podIp.setObjectName(getCommandName());
setResponseObject(podIp);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign IP address");
}
}
@Override
public long getEntityOwnerId() {
return CallContext.current().getCallingAccount().getAccountId();
}
}

View File

@ -0,0 +1,79 @@
//Licensed to the Apache Software Foundation (ASF) under one
//or more contributor license agreements. See the NOTICE file
//distributed with this work for additional information
//regarding copyright ownership. The ASF licenses this file
//to you under the Apache License, Version 2.0 (the
//"License"); you may not use this file except in compliance
//with the License. You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing,
//software distributed under the License is distributed on an
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
//KIND, either express or implied. See the License for the
//specific language governing permissions and limitations
//under the License.
package org.apache.cloudstack.api.command.admin.address;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
import org.apache.cloudstack.api.response.AcquireIPAddressResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
@APICommand(name = "releasePodIpAddress", description = "Releases a Pod IP back to the Pod", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ReleasePodIpCmdByAdmin extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ReleasePublicIpRangeCmd.class.getName());
private static final String s_name = "releasepodipresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, entityType = AcquireIPAddressResponse.class, required = true, description = "UUID of the Pod IP")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() {
boolean result = _networkService.releasePodIp(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setDisplayText("IP is released sucessfully");
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod ip ");
}
}
}

View File

@ -16,10 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiConstants.DomainDetails;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
@ -27,6 +32,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.domain.Domain;
import com.cloud.exception.InvalidParameterValueException;
@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class, responseView = ResponseView.Restricted, entityType = {Domain.class},
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@ -53,6 +59,12 @@ public class ListDomainsCmd extends BaseListCmd {
description = "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
private Boolean listAll;
@Parameter(name = ApiConstants.DETAILS,
type = CommandType.LIST,
collectionType = CommandType.STRING,
description = "comma separated list of domain details requested, value can be a list of [ all, resource, min]")
private List<String> viewDetails;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -73,6 +85,25 @@ public class ListDomainsCmd extends BaseListCmd {
return listAll == null ? false : listAll;
}
public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
EnumSet<DomainDetails> dv;
if (viewDetails == null || viewDetails.size() <= 0) {
dv = EnumSet.of(DomainDetails.all);
} else {
try {
ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
for (String detail : viewDetails) {
dc.add(DomainDetails.valueOf(detail));
}
dv = EnumSet.copyOf(dc);
} catch (IllegalArgumentException e) {
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " +
EnumSet.allOf(DomainDetails.class));
}
}
return dv;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -273,10 +273,23 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
}
Collection paramsCollection = details.values();
Map<String, String> params = (Map<String, String>)(paramsCollection.toArray())[0];
Object objlist[]= paramsCollection.toArray();
Map<String, String> params = (Map<String, String>)(objlist[0]);
for(int i=1; i< objlist.length; i++)
{
params.putAll((Map<String, String>)(objlist[i]));
}
return params;
}
public String getServicePackageId() {
Map<String, String> data = getDetails();
if (data == null)
return null;
return data.get(NetworkOffering.Detail.servicepackageuuid+ "");
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -17,6 +17,8 @@
package org.apache.cloudstack.api.command.admin.resource;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.log4j.Logger;
@ -65,7 +67,8 @@ public class ListCapacityCmd extends BaseListCmd {
@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, description = "lists capacity by type" + "* CAPACITY_TYPE_MEMORY = 0" + "* CAPACITY_TYPE_CPU = 1"
+ "* CAPACITY_TYPE_STORAGE = 2" + "* CAPACITY_TYPE_STORAGE_ALLOCATED = 3" + "* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4" + "* CAPACITY_TYPE_PRIVATE_IP = 5"
+ "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" + "* CAPACITY_TYPE_VLAN = 7" + "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" + "* CAPACITY_TYPE_LOCAL_STORAGE = 9.")
+ "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" + "* CAPACITY_TYPE_VLAN = 7" + "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" + "* CAPACITY_TYPE_LOCAL_STORAGE = 9"
+ "* CAPACITY_TYPE_GPU = 19" + "* CAPACITY_TYPE_CPU_CORE = 90.")
private Integer type;
@Parameter(name = ApiConstants.SORT_BY, type = CommandType.STRING, since = "3.0.0", description = "Sort the results. Available values: Usage")
@ -127,6 +130,17 @@ public class ListCapacityCmd extends BaseListCmd {
ListResponse<CapacityResponse> response = new ListResponse<CapacityResponse>();
List<CapacityResponse> capacityResponses = _responseGenerator.createCapacityResponse(result, s_percentFormat);
Collections.sort(capacityResponses, new Comparator<CapacityResponse>() {
public int compare(CapacityResponse resp1, CapacityResponse resp2) {
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
if (res != 0) {
return res;
} else {
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
}
}
});
response.setResponses(capacityResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -64,6 +64,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB")
private String lbProtocol;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -88,6 +91,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
return display;
}
public String getLbProtocol() {
return lbProtocol;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -73,6 +73,9 @@ public class UploadSslCertCmd extends BaseCmd {
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning the SSL certificate")
private Long domainId;
@Parameter(name = ApiConstants.NAME , type = CommandType.STRING, required = true, description = "Name for the uploaded certificate")
private String name;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -105,10 +108,15 @@ public class UploadSslCertCmd extends BaseCmd {
return projectId;
}
public String getName() {
return name;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException {

View File

@ -148,7 +148,6 @@ public class RegisterTemplateCmd extends BaseCmd {
collectionType = CommandType.UUID,
entityType = ZoneResponse.class,
required=false,
since="4.10.0.0",
description="A list of zone ids where the template will be hosted. Use this parameter if the template needs " +
"to be registered to multiple zones in one go. Use zoneid if the template " +
"needs to be registered to only one zone." +

View File

@ -0,0 +1,286 @@
//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 java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.IpAddress;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = IpAddress.class)
@SuppressWarnings("unused")
public class AcquireIPAddressResponse extends BaseResponse implements ControlledEntityResponse {
@SerializedName(ApiConstants.ID)
@Param(description = "public IP address id")
private String id;
@SerializedName(ApiConstants.IP_ADDRESS)
@Param(description = "public IP address")
private String ipAddress;
@SerializedName("allocated")
@Param(description = "date the public IP address was acquired")
private Date allocated;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the ID of the zone the public IP address belongs to")
private String zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "the name of the zone the public IP address belongs to")
private String zoneName;
@SerializedName("issourcenat")
@Param(description = "true if the IP address is a source nat address, false otherwise")
private Boolean sourceNat;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account the public IP address is associated with")
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the ipaddress")
private String projectId;
@SerializedName(ApiConstants.PROJECT)
@Param(description = "the project name of the address")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID the public IP address is associated with")
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain the public IP address is associated with")
private String domainName;
@SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK)
@Param(description = "the virtual network for the IP address")
private Boolean forVirtualNetwork;
@SerializedName(ApiConstants.VLAN_ID)
@Param(description = "the ID of the VLAN associated with the IP address." + " This parameter is visible to ROOT admins only")
private String vlanId;
@SerializedName("vlanname")
@Param(description = "the VLAN associated with the IP address")
private String vlanName;
@SerializedName("isstaticnat")
@Param(description = "true if this ip is for static nat, false otherwise")
private Boolean staticNat;
@SerializedName(ApiConstants.IS_SYSTEM)
@Param(description = "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)")
private Boolean isSystem;
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID)
@Param(description = "virutal machine id the ip address is assigned to (not null only for static nat Ip)")
private String virtualMachineId;
@SerializedName("vmipaddress")
@Param(description = "virutal machine (dnat) ip address (not null only for static nat Ip)")
private String virtualMachineIp;
@SerializedName("virtualmachinename")
@Param(description = "virutal machine name the ip address is assigned to (not null only for static nat Ip)")
private String virtualMachineName;
@SerializedName("virtualmachinedisplayname")
@Param(description = "virutal machine display name the ip address is assigned to (not null only for static nat Ip)")
private String virtualMachineDisplayName;
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID)
@Param(description = "the ID of the Network associated with the IP address")
private String associatedNetworkId;
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME)
@Param(description = "the name of the Network associated with the IP address")
private String associatedNetworkName;
@SerializedName(ApiConstants.NETWORK_ID)
@Param(description = "the ID of the Network where ip belongs to")
private String networkId;
@SerializedName(ApiConstants.STATE)
@Param(description = "State of the ip address. Can be: Allocatin, Allocated and Releasing")
private String state;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
@Param(description = "the physical network this belongs to")
private String physicalNetworkId;
@SerializedName(ApiConstants.PURPOSE)
@Param(description = "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value")
private String purpose;
@SerializedName(ApiConstants.VPC_ID)
@Param(description = "VPC the ip belongs to")
private String vpcId;
@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
@SerializedName(ApiConstants.IS_PORTABLE)
@Param(description = "is public IP portable across the zones")
private Boolean isPortable;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
@Override
public String getObjectId() {
return this.getId();
}
public void setAllocated(Date allocated) {
this.allocated = allocated;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setSourceNat(Boolean sourceNat) {
this.sourceNat = sourceNat;
}
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
this.forVirtualNetwork = forVirtualNetwork;
}
public void setVlanId(String vlanId) {
this.vlanId = vlanId;
}
public void setVlanName(String vlanName) {
this.vlanName = vlanName;
}
public void setStaticNat(Boolean staticNat) {
this.staticNat = staticNat;
}
public void setAssociatedNetworkId(String networkId) {
this.associatedNetworkId = networkId;
}
public void setNetworkId(String networkId) {
this.networkId = networkId;
}
public void setVirtualMachineId(String virtualMachineId) {
this.virtualMachineId = virtualMachineId;
}
public void setVirtualMachineIp(String virtualMachineIp) {
this.virtualMachineIp = virtualMachineIp;
}
public void setVirtualMachineName(String virtualMachineName) {
this.virtualMachineName = virtualMachineName;
}
public void setVirtualMachineDisplayName(String virtualMachineDisplayName) {
this.virtualMachineDisplayName = virtualMachineDisplayName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void setState(String state) {
this.state = state;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setPhysicalNetworkId(String physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public void setIsSystem(Boolean isSystem) {
this.isSystem = isSystem;
}
public void setPurpose(String purpose) {
this.purpose = purpose;
}
public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}
public void setTags(List<ResourceTagResponse> tags) {
this.tags = tags;
}
public void setAssociatedNetworkName(String associatedNetworkName) {
this.associatedNetworkName = associatedNetworkName;
}
public void setPortable(Boolean portable) {
this.isPortable = portable;
}
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
}

View File

@ -0,0 +1,113 @@
//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 com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
public class AcquirePodIpCmdResponse extends BaseResponse {
@SerializedName(ApiConstants.IP_ADDRESS)
@Param(description = "Allocated IP address")
private String ipAddress;
@SerializedName(ApiConstants.POD_ID)
@Param(description = "the ID of the pod the IP address belongs to")
private Long podId;
@SerializedName(ApiConstants.GATEWAY)
@Param(description = "Gateway for Pod ")
private String gateway;
@SerializedName(ApiConstants.CIDR)
@Param(description = "CIDR of the Pod")
private String cidrAddress;
@SerializedName(ApiConstants.NIC_ID)
@Param(description = "the ID of the nic")
private Long instanceId;
@SerializedName(ApiConstants.HOST_MAC)
@Param(description = "MAC address of the pod the IP")
private Long macAddress;
@SerializedName(ApiConstants.ID)
@Param(description = "the ID of the pod the IP address")
private long id;
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public void setInstanceId(Long instanceId) {
this.instanceId = instanceId;
}
public void setPodId(long podId) {
this.podId = podId;
}
public void setMacAddress(long macAddress) {
this.macAddress = macAddress;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public void setCidrAddress(String cidrAddress) {
this.cidrAddress = cidrAddress;
}
public long getId() {
return id;
}
public Long getInstanceId() {
return instanceId;
}
public long getPodId() {
return podId;
}
public String getIpAddress() {
return ipAddress;
}
public long getMacAddress() {
return macAddress;
}
public String getCidrAddress() {
return cidrAddress;
}
public String getGateway() {
return gateway;
}
public void setId(long id) {
this.id = id;
}
}

View File

@ -28,6 +28,10 @@ public class CapacityResponse extends BaseResponse {
@Param(description = "the capacity type")
private Short capacityType;
@SerializedName(ApiConstants.NAME)
@Param(description="the capacity name")
private String capacityName;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the Zone ID")
private String zoneId;
@ -52,6 +56,10 @@ public class CapacityResponse extends BaseResponse {
@Param(description = "the Cluster name")
private String clusterName;
@SerializedName("capacityallocated")
@Param(description="the capacity currently in allocated")
private Long capacityAllocated;
@SerializedName("capacityused")
@Param(description = "the capacity currently in use")
private Long capacityUsed;
@ -72,6 +80,14 @@ public class CapacityResponse extends BaseResponse {
this.capacityType = capacityType;
}
public String getCapacityName() {
return capacityName;
}
public void setCapacityName(String capacityName) {
this.capacityName = capacityName;
}
public String getZoneId() {
return zoneId;
}
@ -120,6 +136,14 @@ public class CapacityResponse extends BaseResponse {
this.clusterName = clusterName;
}
public Long getCapacityAllocated() {
return capacityAllocated;
}
public void setCapacityAllocated(Long capacityAllocated) {
this.capacityAllocated = capacityAllocated;
}
public Long getCapacityUsed() {
return capacityUsed;
}

View File

@ -208,6 +208,12 @@ public class ClusterResponse extends BaseResponse {
if (details == null) {
return;
}
this.resourceDetails = new HashMap<>(details);
resourceDetails = new HashMap<>(details);
if (resourceDetails.containsKey("username")) {
resourceDetails.remove("username");
}
if (resourceDetails.containsKey("password")) {
resourceDetails.remove("password");
}
}
}

View File

@ -95,6 +95,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "the id of the zone the rule belongs to")
private String zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "the name of the zone the load balancer rule belongs to", since = "4.11")
private String zoneName;
@SerializedName(ApiConstants.PROTOCOL)
@Param(description = "the protocol of the loadbalanacer rule")
private String lbProtocol;
@ -166,6 +170,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -72,6 +72,10 @@ public class SslCertResponse extends BaseResponse {
@Param(description = "List of loabalancers this certificate is bound to")
List<String> lbIds;
@SerializedName(ApiConstants.NAME)
@Param(description = "name")
private String name;
public SslCertResponse() {
}
@ -83,6 +87,10 @@ public class SslCertResponse extends BaseResponse {
this.certificate = cert;
}
public void setName(String name) {
this.name = name;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}

View File

@ -17,6 +17,7 @@
package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.List;
import com.google.gson.annotations.SerializedName;
@ -141,7 +142,13 @@ public class SystemVmResponse extends BaseResponse {
@Param(description = "the number of active console sessions for the console proxy system vm")
private Integer activeViewerSessions;
// private Long objectId;
@SerializedName("guestvlan")
@Param(description = "guest vlan range")
private String guestVlan;
@SerializedName("publicvlan")
@Param(description = "public vlan range")
private List<String> publicVlan;
@Override
public String getObjectId() {
@ -355,4 +362,20 @@ public class SystemVmResponse extends BaseResponse {
public void setLinkLocalNetmask(String linkLocalNetmask) {
this.linkLocalNetmask = linkLocalNetmask;
}
public String getGuestVlan() {
return guestVlan;
}
public void setGuestVlan(String guestVlan) {
this.guestVlan = guestVlan;
}
public List<String> getPublicVlan() {
return publicVlan;
}
public void setPublicVlan(List<String> publicVlan) {
this.publicVlan = publicVlan;
}
}

View File

@ -117,6 +117,10 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements
@Param(description = "the size of the template")
private Long size;
@SerializedName(ApiConstants.PHYSICAL_SIZE)
@Param(description = "the physical size of the template")
private Long physicalSize;
@SerializedName("templatetype")
@Param(description = "the type of the template")
private String templateType;
@ -275,6 +279,10 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements
this.size = size;
}
public void setPhysicalSize(Long physicalSize) {
this.physicalSize = physicalSize;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}

View File

@ -66,6 +66,10 @@ public class UserResponse extends BaseResponse {
@Param(description = "the account type of the user")
private Short accountType;
@SerializedName("usersource")
@Param(description = "the source type of the user in lowercase, such as native, ldap, saml2")
private String userSource;
@SerializedName(ApiConstants.ROLE_ID)
@Param(description = "the ID of the role")
private String roleId;
@ -260,4 +264,15 @@ public class UserResponse extends BaseResponse {
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public String getUserSource() {
return userSource;
}
public void setUserSource(User.Source userSource) {
this.userSource = userSource.toString().toLowerCase();
if (this.userSource.equals(User.Source.UNKNOWN.toString().toLowerCase())) {
this.userSource = User.Source.NATIVE.toString().toLowerCase();
}
}
}

View File

@ -31,5 +31,5 @@ public interface SslCert extends InternalIdentity, Identity, ControlledEntity {
public String getPassword();
public String getFingerPrint();
public String getName();
}

View File

@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<repositories>

View File

@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@ -20,12 +20,21 @@
package com.cloud.agent.api;
public class ExternalNetworkResourceUsageCommand extends Command {
Long networkid;
public ExternalNetworkResourceUsageCommand() {
}
public ExternalNetworkResourceUsageCommand(Long networkid) {
this.networkid = networkid;
}
@Override
public boolean executeInSequence() {
return false;
}
public Long getNetworkid() {
return networkid;
}
}

View File

@ -24,7 +24,7 @@ import java.util.List;
import com.cloud.agent.api.LogLevel.Log4jLevel;
@LogLevel(Log4jLevel.Trace)
@LogLevel(Log4jLevel.Debug)
public class GetVmDiskStatsAnswer extends Answer {
String hostName;

View File

@ -0,0 +1,50 @@
//
// 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.Debug)
public class GetVmNetworkStatsAnswer extends Answer {
String hostName;
HashMap<String, List<VmNetworkStatsEntry>> vmNetworkStatsMap;
public GetVmNetworkStatsAnswer(GetVmNetworkStatsCommand cmd, String details, String hostName, HashMap<String, List<VmNetworkStatsEntry>> vmNetworkStatsMap) {
super(cmd, true, details);
this.hostName = hostName;
this.vmNetworkStatsMap = vmNetworkStatsMap;
}
public String getHostName() {
return hostName;
}
public HashMap<String, List<VmNetworkStatsEntry>> getVmNetworkStatsMap() {
return vmNetworkStatsMap;
}
protected GetVmNetworkStatsAnswer() {
//no-args constructor for json serialization-deserialization
}
}

View File

@ -0,0 +1,57 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.api;
import java.util.List;
import com.cloud.agent.api.LogLevel.Log4jLevel;
@LogLevel(Log4jLevel.Trace)
public class GetVmNetworkStatsCommand extends Command {
List<String> vmNames;
String hostGuid;
String hostName;
protected GetVmNetworkStatsCommand() {
}
public GetVmNetworkStatsCommand(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;
}
}

View File

@ -0,0 +1,65 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.api;
public class NetScalerImplementNetworkCommand extends Command {
private String _networkDetails;
public NetScalerImplementNetworkCommand() {
super();
}
private String dcId;
private Long hostId;
public NetScalerImplementNetworkCommand(String dcId) {
super();
this.dcId = dcId;
}
public NetScalerImplementNetworkCommand(String dcId, Long hostId, String networkDetails) {
this(dcId);
this.hostId = hostId;
this._networkDetails = networkDetails;
}
public void setDetails(String details) {
_networkDetails = details;
}
public String getDetails() {
return _networkDetails;
}
public String getDataCenterId() {
return dcId;
}
@Override
public boolean executeInSequence() {
//TODO checkout whether we need to mark it true ??
//Marking it true is causing another guest network execution in queue
return false;
}
public Long getHostId() {
return hostId;
}
}

View File

@ -19,9 +19,12 @@
package com.cloud.agent.api;
import com.cloud.agent.api.LogLevel.Log4jLevel;
public class SecStorageVMSetupCommand extends Command {
String[] allowedInternalSites = new String[0];
String copyUserName;
@LogLevel(Log4jLevel.Off)
String copyPassword;
public SecStorageVMSetupCommand() {

View File

@ -26,4 +26,7 @@ public class StartupExternalLoadBalancerCommand extends StartupCommand {
super(Host.Type.ExternalLoadBalancer);
}
public StartupExternalLoadBalancerCommand(Host.Type type) {
super(type);
}
}

View File

@ -0,0 +1,74 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.api;
import com.cloud.vm.VmNetworkStats;
public class VmNetworkStatsEntry implements VmNetworkStats {
String vmName;
String macAddress;
long bytesSent;
long bytesReceived;
public VmNetworkStatsEntry() {
}
public VmNetworkStatsEntry(String vmName, String macAddress, long bytesSent, long bytesReceived) {
this.bytesSent = bytesSent;
this.bytesReceived = bytesReceived;
this.vmName = vmName;
this.macAddress = macAddress;
}
public void setVmName(String vmName) {
this.vmName = vmName;
}
public String getVmName() {
return vmName;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
public String getMacAddress() {
return macAddress;
}
public void setBytesSent(long bytesSent) {
this.bytesSent = bytesSent;
}
@Override
public long getBytesSent() {
return bytesSent;
}
public void setBytesReceived(long bytesReceived) {
this.bytesReceived = bytesReceived;
}
@Override
public long getBytesReceived() {
return bytesReceived;
}
}

View File

@ -26,16 +26,20 @@ import com.cloud.agent.api.to.LoadBalancerTO;
*/
public class HealthCheckLBConfigCommand extends NetworkElementCommand {
LoadBalancerTO[] loadBalancers;
long networkId;
protected HealthCheckLBConfigCommand() {
}
public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers, long networkid) {
this.loadBalancers = loadBalancers;
this.networkId = networkid;
}
public LoadBalancerTO[] getLoadBalancers() {
return loadBalancers;
}
public long getNetworkId() {
return networkId;
}
}

8
debian/changelog vendored
View File

@ -1,4 +1,10 @@
cloudstack (4.10.0.0-SNAPSHOT) unstable; urgency=low
cloudstack (4.11.0.0-SNAPSHOT) unstable; urgency=low
* Update the version to 4.11.0.0-SNAPSHOT
-- the Apache CloudStack project <dev@cloudstack.apache.org> Mon, 03 Jul 2017 10:06:42 +0530
cloudstack (4.11.0.0-SNAPSHOT-SNAPSHOT) unstable; urgency=low
* Update the version to 4.10.0.snapshot

View File

@ -18,7 +18,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -60,19 +60,21 @@ import com.cloud.vm.VirtualMachineProfile;
*
*/
public interface NetworkOrchestrationService {
static final String NetworkLockTimeoutCK = "network.lock.timeout";
static final String GuestDomainSuffixCK = "guest.domain.suffix";
static final String NetworkThrottlingRateCK = "network.throttling.rate";
static final String MinVRVersionCK = "minreq.sysvmtemplate.version";
String NetworkLockTimeoutCK = "network.lock.timeout";
String GuestDomainSuffixCK = "guest.domain.suffix";
String NetworkThrottlingRateCK = "network.throttling.rate";
String MinVRVersionCK = "minreq.sysvmtemplate.version";
static final ConfigKey<String> MinVRVersion = new ConfigKey<String>(String.class, MinVRVersionCK, "Advanced", "4.10.0",
ConfigKey<String> MinVRVersion = new ConfigKey<String>(String.class, MinVRVersionCK, "Advanced", "4.10.0",
"What version should the Virtual Routers report", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
"Lock wait timeout (seconds) while implementing network", true, Scope.Global, null);
static final ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
"Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "200",
ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "200",
"Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone);
List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)

View File

@ -57,20 +57,22 @@ import com.cloud.vm.VirtualMachineProfile;
*/
public interface VolumeOrchestrationService {
static final ConfigKey<Long> CustomDiskOfferingMinSize = new ConfigKey<Long>("Advanced",
ConfigKey<Long> CustomDiskOfferingMinSize = new ConfigKey<Long>("Advanced",
Long.class,
"custom.diskoffering.size.min",
"1",
"Minimum size in GB for custom disk offering.",
true
);
static final ConfigKey<Long> CustomDiskOfferingMaxSize = new ConfigKey<Long>("Advanced",
ConfigKey<Long> CustomDiskOfferingMaxSize = new ConfigKey<Long>("Advanced",
Long.class,
"custom.diskoffering.size.max",
"1024",
"Maximum size in GB for custom disk offering.",
true
);
VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType)
throws ConcurrentOperationException, StorageUnavailableException;

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -18,7 +18,7 @@ package com.cloud.network;
import java.util.List;
import com.cloud.utils.db.DB;
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
import org.apache.cloudstack.framework.config.ConfigKey;
import com.cloud.dc.DataCenter;
@ -34,16 +34,18 @@ import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNat;
import com.cloud.user.Account;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.NicProfile;
import com.cloud.vm.VirtualMachineProfile;
public interface IpAddressManager {
static final String UseSystemPublicIpsCK = "use.system.public.ips";
static final ConfigKey<Boolean> UseSystemPublicIps = new ConfigKey<Boolean>("Advanced", Boolean.class, UseSystemPublicIpsCK, "true",
"If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been consumed ips will be acquired from the system pool",
true, ConfigKey.Scope.Account);
String UseSystemPublicIpsCK = "use.system.public.ips";
ConfigKey<Boolean> UseSystemPublicIps = new ConfigKey<Boolean>("Advanced", Boolean.class, UseSystemPublicIpsCK, "true",
"If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been consumed ips will be acquired from the system pool",
true, ConfigKey.Scope.Account);
static final ConfigKey<Boolean> RulesContinueOnError = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rule.delete.ignoreerror", "true",
ConfigKey<Boolean> RulesContinueOnError = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rule.delete.ignoreerror", "true",
"When true, ip address delete (ipassoc) failures are ignored", true);
/**
@ -51,58 +53,55 @@ public interface IpAddressManager {
*
* @param dcId
* @param podId
* TODO
* @param owner
* @param type
* @param networkId
* @param requestedIp
* TODO
* @param allocatedBy
* TODO
* @param isSystem
* @return
* @throws InsufficientAddressCapacityException
*/
PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isSystem)
throws InsufficientAddressCapacityException;
throws InsufficientAddressCapacityException;
/**
* Do all of the work of releasing public ip addresses. Note that if this method fails, there can be side effects.
*
* @param userId
* @param caller
* TODO
* @param IpAddress
* @param caller
* @return true if it did; false if it didn't
*/
boolean disassociatePublicIpAddress(long id, long userId, Account caller);
boolean applyRules(List<? extends FirewallRule> rules, FirewallRule.Purpose purpose, NetworkRuleApplier applier, boolean continueOnError)
throws ResourceUnavailableException;
throws ResourceUnavailableException;
/**
* @throws ResourceAllocationException TODO
* @throws InsufficientCapacityException
* Associates an ip address list to an account. The list of ip addresses are all addresses associated
* with the
* given vlan id.
* @param userId
* @param accountId
* @param zoneId
* @param vlanId
* @throws InsufficientAddressCapacityException
* @throws
* @param guestNetwork
* @throws InsufficientCapacityException
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
* @throws ResourceAllocationException
* Associates an ip address list to an account. The list of ip addresses are all addresses associated
* with the
* given vlan id.
*/
boolean associateIpAddressListToAccount(long userId, long accountId, long zoneId, Long vlanId, Network guestNetwork) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, ResourceAllocationException;
ConcurrentOperationException, ResourceUnavailableException, ResourceAllocationException;
boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException;
boolean applyIpAssociations(Network network, boolean rulesRevoked, boolean continueOnError, List<? extends PublicIpAddress> publicIps)
throws ResourceUnavailableException;
throws ResourceUnavailableException;
IPAddressVO markIpAsUnavailable(long addrId);
public String acquireGuestIpAddress(Network network, String requestedIp);
String acquireGuestIpAddress(Network network, String requestedIp);
boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException;
@ -111,7 +110,7 @@ public interface IpAddressManager {
boolean handleSystemIpRelease(IpAddress ip);
void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network, String requestedIpv4, String requestedIpv6)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException;
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException;
/**
* @param owner
@ -123,28 +122,34 @@ public interface IpAddressManager {
PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork) throws InsufficientAddressCapacityException, ConcurrentOperationException;
/**
*
* @param ipAddrId
* @param networkId
* @param releaseOnFailure TODO
* @param releaseOnFailure
* @return
* @throws ResourceAllocationException
* @throws ResourceUnavailableException
* @throws InsufficientAddressCapacityException
* @throws ConcurrentOperationException
*/
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;
InsufficientAddressCapacityException, ConcurrentOperationException;
IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID) throws ConcurrentOperationException,
ResourceAllocationException, InsufficientAddressCapacityException;
ResourceAllocationException, InsufficientAddressCapacityException;
boolean releasePortableIpAddress(long addrId);
IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException,
ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException;
ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException;
IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId);
void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;;
InsufficientAddressCapacityException, ConcurrentOperationException;;
/**
* @param addr
@ -162,22 +167,26 @@ public interface IpAddressManager {
* @throws InsufficientAddressCapacityException
*/
PublicIp assignDedicateIpAddress(Account owner, Long guestNtwkId, Long vpcId, long dcId, boolean isSourceNat) throws ConcurrentOperationException,
InsufficientAddressCapacityException;
InsufficientAddressCapacityException;
IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone, Boolean displayIp) throws ConcurrentOperationException,
ResourceAllocationException, InsufficientAddressCapacityException;
ResourceAllocationException, InsufficientAddressCapacityException;
PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp,
boolean isSystem) throws InsufficientAddressCapacityException;
boolean isSystem) throws InsufficientAddressCapacityException;
@DB
void allocateNicValues(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network, String requestedIpv4,
String requestedIpv6) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException;
String requestedIpv6) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException;
int getRuleCountForIp(Long addressId, FirewallRule.Purpose purpose, FirewallRule.State state);
public String allocateGuestIP(Network network, String requestedIp) throws InsufficientAddressCapacityException;
String allocateGuestIP(Network network, String requestedIp) throws InsufficientAddressCapacityException;
String allocatePublicIpForGuestNic(Network network, Long podId, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
AcquirePodIpCmdResponse allocatePodIp(String zoneId, String podId) throws ConcurrentOperationException, ResourceAllocationException;
void releasePodIp(Long id) throws CloudRuntimeException;
}

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -236,6 +236,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Inject
protected UserVmDao _userVmDao;
@Inject
protected UserVmService _userVmService;
@Inject
protected CapacityManager _capacityMgr;
@Inject
protected NicDao _nicsDao;
@ -404,7 +406,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
try {
_networkMgr.allocate(vmProfile, auxiliaryNetworks);
if (!vmProfile.getBootArgs().contains("ExternalLoadBalancerVm"))
_networkMgr.allocate(vmProfile, auxiliaryNetworks);
} catch (final ConcurrentOperationException e) {
throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e);
}
@ -3636,6 +3639,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
final VMInstanceVO router = _vmDao.findById(vm.getId());
if (router.getState() == State.Running) {
// collect vm network statistics before unplug a nic
UserVmVO userVm = _userVmDao.findById(vm.getId());
if (userVm != null && userVm.getType() == VirtualMachine.Type.User) {
_userVmService.collectVmNetworkStatistics(userVm);
}
try {
final Commands cmds = new Commands(Command.OnError.Stop);
final UnPlugNicCommand unplugNicCmd = new UnPlugNicCommand(nic, vm.getName());

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -17,6 +17,8 @@
package com.cloud.capacity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -75,6 +77,9 @@ public class CapacityVO implements Capacity {
@Transient
private Float usedPercentage;
@Transient
private Long allocatedCapacity;
public CapacityVO() {
}
@ -208,8 +213,37 @@ public class CapacityVO implements Capacity {
this.usedPercentage = usedPercentage;
}
public Long getAllocatedCapacity() {
return allocatedCapacity;
}
public void setAllocatedCapacity(Long allocatedCapacity) {
this.allocatedCapacity = allocatedCapacity;
}
@Override
public String getUuid() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
private static Map<Short, String> capacityNames = null;
static {
capacityNames = new HashMap<Short, String>();
capacityNames.put(CAPACITY_TYPE_MEMORY, "MEMORY");
capacityNames.put(CAPACITY_TYPE_CPU, "CPU");
capacityNames.put(CAPACITY_TYPE_STORAGE, "STORAGE");
capacityNames.put(CAPACITY_TYPE_STORAGE_ALLOCATED, "STORAGE_ALLOCATED");
capacityNames.put(CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP, "VIRTUAL_NETWORK_PUBLIC_IP");
capacityNames.put(CAPACITY_TYPE_PRIVATE_IP, "PRIVATE_IP");
capacityNames.put(CAPACITY_TYPE_SECONDARY_STORAGE, "SECONDARY_STORAGE");
capacityNames.put(CAPACITY_TYPE_VLAN, "VLAN");
capacityNames.put(CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP, "DIRECT_ATTACHED_PUBLIC_IP");
capacityNames.put(CAPACITY_TYPE_LOCAL_STORAGE, "LOCAL_STORAGE");
capacityNames.put(CAPACITY_TYPE_GPU, "GPU");
capacityNames.put(CAPACITY_TYPE_CPU_CORE, "CPU_CORE");
}
public static String getCapacityName (Short capacityType) {
return capacityNames.get(capacityType);
}
}

View File

@ -187,6 +187,17 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
+
"from op_host_capacity capacity where cluster_id = ? and capacity_type = ?;";
private static final String LIST_ALLOCATED_CAPACITY_GROUP_BY_CAPACITY_AND_ZONE = "SELECT v.data_center_id, SUM(cpu) AS cpucore, " +
"SUM(cpu * speed) AS cpu, SUM(ram_size * 1024 * 1024) AS memory " +
"FROM (SELECT vi.data_center_id, (CASE WHEN ISNULL(service_offering.cpu) THEN custom_cpu.value ELSE service_offering.cpu end) AS cpu, " +
"(CASE WHEN ISNULL(service_offering.speed) THEN custom_speed.value ELSE service_offering.speed end) AS speed, " +
"(CASE WHEN ISNULL(service_offering.ram_size) THEN custom_ram_size.value ELSE service_offering.ram_size end) AS ram_size " +
"FROM (((vm_instance vi LEFT JOIN service_offering ON(((vi.service_offering_id = service_offering.id))) " +
"LEFT JOIN user_vm_details custom_cpu ON(((custom_cpu.vm_id = vi.id) AND (custom_cpu.name = 'CpuNumber')))) " +
"LEFT JOIN user_vm_details custom_speed ON(((custom_speed.vm_id = vi.id) AND (custom_speed.name = 'CpuSpeed')))) " +
"LEFT JOIN user_vm_details custom_ram_size ON(((custom_ram_size.vm_id = vi.id) AND (custom_ram_size.name = 'memory')))) " +
"WHERE ISNULL(vi.removed) AND vi.state NOT IN ('Destroyed', 'Error', 'Expunging')";
public CapacityDaoImpl() {
_hostIdTypeSearch = createSearchBuilder();
_hostIdTypeSearch.and("hostId", _hostIdTypeSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ);
@ -407,6 +418,33 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
PreparedStatement pstmt = null;
List<SummedCapacity> results = new ArrayList<SummedCapacity>();
StringBuilder allocatedSql = new StringBuilder(LIST_ALLOCATED_CAPACITY_GROUP_BY_CAPACITY_AND_ZONE);
HashMap<Long, Long> sumCpuCore = new HashMap<Long, Long>();
HashMap<Long, Long> sumCpu = new HashMap<Long, Long>();
HashMap<Long, Long> sumMemory = new HashMap<Long, Long>();
if (zoneId != null){
allocatedSql.append(" AND vi.data_center_id = ?");
}
allocatedSql.append(" ) AS v GROUP BY v.data_center_id");
try {
if (podId == null && clusterId == null) {
// add allocated capacity of zone in result
pstmt = txn.prepareAutoCloseStatement(allocatedSql.toString());
if (zoneId != null){
pstmt.setLong(1, zoneId);
}
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
sumCpuCore.put(rs.getLong(1), rs.getLong(2));
sumCpu.put(rs.getLong(1), rs.getLong(3));
sumMemory.put(rs.getLong(1), rs.getLong(4));
}
}
} catch (SQLException e) {
throw new CloudRuntimeException("DB Exception on: " + allocatedSql, e);
}
StringBuilder sql = new StringBuilder(LIST_CAPACITY_GROUP_BY_CAPACITY_PART1);
List<Long> resourceIdList = new ArrayList<Long>();
@ -427,7 +465,11 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
resourceIdList.add(capacityType.longValue());
}
sql.append(LIST_CAPACITY_GROUP_BY_CAPACITY_DATA_CENTER_POD_CLUSTER);
if (podId == null && clusterId == null) {
sql.append(" GROUP BY capacity_type, data_center_id");
} else {
sql.append(LIST_CAPACITY_GROUP_BY_CAPACITY_DATA_CENTER_POD_CLUSTER);
}
try {
pstmt = txn.prepareAutoCloseStatement(sql.toString());
@ -438,6 +480,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
Long capacityZoneId = rs.getLong(6);
Long capacityPodId = null;
Long capacityClusterId = null;
@ -450,6 +493,16 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
(short)rs.getLong(5), rs.getLong(6),
capacityPodId, capacityClusterId);
if (podId == null && clusterId == null) {
Short sumCapacityType = summedCapacity.getCapacityType();
if (sumCapacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {
summedCapacity.setAllocatedCapacity(sumMemory.get(capacityZoneId));
} else if (sumCapacityType == CapacityVO.CAPACITY_TYPE_CPU) {
summedCapacity.setAllocatedCapacity(sumCpu.get(capacityZoneId));
} else if (sumCapacityType == CapacityVO.CAPACITY_TYPE_CPU_CORE) {
summedCapacity.setAllocatedCapacity(sumCpuCore.get(capacityZoneId));
}
}
results.add(summedCapacity);
}
HashMap<String, SummedCapacity> capacityMap = new HashMap<String, SummedCapacity>();
@ -460,7 +513,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
}
else {
// sum the values based on the zoneId.
key=String.valueOf(result.getDataCenterId())+String.valueOf(result.getCapacityType());
key=String.valueOf(result.getDataCenterId()) + "-" + String.valueOf(result.getCapacityType());
}
SummedCapacity tempCapacity=null;
if (capacityMap.containsKey(key)) {
@ -589,6 +642,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
}
public static class SummedCapacity {
public Long sumAllocated;
public long sumUsed;
public long sumReserved;
public long sumTotal;
@ -679,6 +733,12 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
public void setClusterId(Long clusterId) {
this.clusterId=clusterId;
}
public Long getAllocatedCapacity() {
return sumAllocated;
}
public void setAllocatedCapacity(Long sumAllocated) {
this.sumAllocated = sumAllocated;
}
}
@Override

View File

@ -47,4 +47,6 @@ public interface DataCenterIpAddressDao extends GenericDao<DataCenterIpAddressVO
boolean deleteIpAddressByPod(long podId);
void releasePodIpAddress(long id);
}

View File

@ -176,6 +176,19 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
update(vo, sc);
}
@Override
public void releasePodIpAddress(long id) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Releasing ip address for ID=" + id);
}
DataCenterIpAddressVO vo = this.findById(id);
vo.setTakenAt(null);
vo.setInstanceId(null);
vo.setReservationId(null);
persist(vo);
}
@Override
public void releaseIpAddress(long nicId) {
if (s_logger.isDebugEnabled()) {

View File

@ -32,4 +32,6 @@ public interface HostPodDao extends GenericDao<HostPodVO, Long> {
public List<Long> listDisabledPods(long zoneId);
public List<Long> listAllPods(Long zoneId);
public List<HostPodVO> listAllPodsByCidr(long zoneId, String cidr);
}

View File

@ -137,4 +137,12 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
}
return customSearch(sc, null);
}
@Override
public List<HostPodVO> listAllPodsByCidr(long zoneId, String cidr) {
SearchCriteria<HostPodVO> sc = DataCenterAndNameSearch.create();
sc.setParameters("dataCenterId", zoneId);
sc.setParameters("cidr_address", cidr);
return listBy(sc);
}
}

View File

@ -642,7 +642,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create();
sc.setParameters("lastPinged", lastPingSecondsAfter);
sc.setParameters("types", Type.ExternalDhcp, Type.ExternalFirewall, Type.ExternalLoadBalancer, Type.BaremetalDhcp, Type.BaremetalPxe, Type.TrafficMonitor,
Type.L2Networking);
Type.L2Networking, Type.NetScalerControlCenter);
List<HostVO> hosts = lockRows(sc, null, true);
for (HostVO host : hosts) {

View File

@ -120,4 +120,6 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long>, StateDao<State,
List<NetworkVO> listByAclId(long aclId);
int getNonSystemNetworkCountByVpcId(long vpcId);
List<NetworkVO> listNetworkVO(List<Long> idset);
}

View File

@ -24,9 +24,10 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.persistence.TableGenerator;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import com.cloud.network.Network;
import com.cloud.network.Network.Event;
import com.cloud.network.Network.GuestType;
@ -42,6 +43,7 @@ import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.server.ResourceTag.ResourceObjectType;
import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.JoinBuilder;
@ -56,7 +58,7 @@ import com.cloud.utils.net.NetUtils;
@Component
@DB()
public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements NetworkDao {
public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>implements NetworkDao {
SearchBuilder<NetworkVO> AllFieldsSearch;
SearchBuilder<NetworkVO> AccountSearch;
SearchBuilder<NetworkVO> RelatedConfigSearch;
@ -275,7 +277,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
return listBy(sc, null);
}
public List<NetworkVO> findBy(final TrafficType trafficType, final Mode mode, final BroadcastDomainType broadcastType, final long networkOfferingId, final long dataCenterId) {
final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
sc.setParameters("trafficType", trafficType);
@ -680,4 +681,13 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
final List<Integer> results = customSearch(sc, null);
return results.get(0);
}
@Override
public List<NetworkVO> listNetworkVO(List<Long> idset) {
final SearchCriteria<NetworkVO> sc_2 = createSearchCriteria();
final Filter searchFilter_2 = new Filter(NetworkVO.class, "id", false, null, null);
sc_2.addAnd("networkOfferingId", SearchCriteria.Op.IN, idset);
sc_2.addAnd("removed", SearchCriteria.Op.EQ, null);
return this.search(sc_2, searchFilter_2);
}
}

View File

@ -60,11 +60,14 @@ public class SslCertVO implements SslCert {
@Column(name = "fingerprint")
String fingerPrint;
@Column(name = "name")
String name;
public SslCertVO() {
uuid = UUID.randomUUID().toString();
}
public SslCertVO(String cert, String key, String password, String chain, Long accountId, Long domainId, String fingerPrint) {
public SslCertVO(String cert, String key, String password, String chain, Long accountId, Long domainId, String fingerPrint, String name) {
certificate = cert;
this.key = key;
this.chain = chain;
@ -73,6 +76,7 @@ public class SslCertVO implements SslCert {
this.domainId = domainId;
this.fingerPrint = fingerPrint;
uuid = UUID.randomUUID().toString();
this.name = name;
}
// Getters
@ -121,6 +125,11 @@ public class SslCertVO implements SslCert {
return fingerPrint;
}
@Override
public String getName() {
return name;
}
@Override
public Class<?> getEntityType() {
return SslCert.class;

View File

@ -156,6 +156,9 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name = "public_lb")
boolean publicLb;
@Column(name="service_package_id")
String servicePackageUuid = null;
@Override
public boolean isKeepAliveEnabled() {
return keepAliveEnabled;
@ -500,8 +503,17 @@ public class NetworkOfferingVO implements NetworkOffering {
return supportsStrechedL2;
}
public void setServicePackage(String servicePackageUuid) {
this.servicePackageUuid = servicePackageUuid;
}
@Override
public boolean getSupportsPublicAccess() {
return supportsPublicAccess;
}
@Override
public String getServicePackage() {
return servicePackageUuid;
}
}

View File

@ -61,4 +61,7 @@ public interface NetworkOfferingDao extends GenericDao<NetworkOfferingVO, Long>
NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details);
List<Long> listNetworkOfferingID();
boolean isUsingServicePackage(String uuid);
}

View File

@ -16,12 +16,14 @@
// under the License.
package com.cloud.offerings.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import javax.persistence.EntityExistsException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;
import com.cloud.network.Network;
@ -32,6 +34,7 @@ import com.cloud.offering.NetworkOffering.Detail;
import com.cloud.offerings.NetworkOfferingDetailsVO;
import com.cloud.offerings.NetworkOfferingVO;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder;
@ -189,4 +192,33 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
return vo;
}
@Override
public List<Long> listNetworkOfferingID() {
final SearchCriteria<NetworkOfferingVO> sc_1 = createSearchCriteria();
final Filter searchFilter_1 = new Filter(NetworkOfferingVO.class, "created", false, null, null);
sc_1.addAnd("servicePackageUuid", SearchCriteria.Op.NEQ, null);
sc_1.addAnd("removed", SearchCriteria.Op.EQ, null);
List<NetworkOfferingVO> set_of_servicePackageUuid = this.search(sc_1, searchFilter_1);
List<Long> id_set = new ArrayList<Long>();
for (NetworkOfferingVO node : set_of_servicePackageUuid) {
if (node.getServicePackage() != null && !node.getServicePackage().isEmpty()) {
id_set.add(node.getId());
}
}
return id_set;
}
@Override
public boolean isUsingServicePackage(String uuid) {
final SearchCriteria<NetworkOfferingVO> sc = createSearchCriteria();
final Filter searchFilter= new Filter(NetworkOfferingVO.class, "created", false, null, null);
sc.addAnd("state", SearchCriteria.Op.EQ, NetworkOffering.State.Enabled);
sc.addAnd("servicePackageUuid", SearchCriteria.Op.EQ, uuid);
List<NetworkOfferingVO> list = this.search(sc, searchFilter);
if(CollectionUtils.isNotEmpty(list))
return true;
return false;
}
}

View File

@ -771,7 +771,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
_templateZoneDao.persist(tmpltZoneVO);
} else {
tmpltZoneVO.setRemoved(null);
tmpltZoneVO.setRemoved(GenericDaoBase.DATE_TO_NULL);
tmpltZoneVO.setLastUpdated(new Date());
_templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
}

View File

@ -67,6 +67,7 @@ import com.cloud.upgrade.dao.Upgrade490to4910;
import com.cloud.upgrade.dao.Upgrade4910to4920;
import com.cloud.upgrade.dao.Upgrade4920to4930;
import com.cloud.upgrade.dao.Upgrade4930to41000;
import com.cloud.upgrade.dao.Upgrade41000to41100;
import com.cloud.upgrade.dao.UpgradeSnapshot217to224;
import com.cloud.upgrade.dao.UpgradeSnapshot223to224;
import com.cloud.upgrade.dao.VersionDao;
@ -104,210 +105,347 @@ import static java.util.Collections.sort;
public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
private static final Logger s_logger = Logger.getLogger(DatabaseUpgradeChecker.class);
private final ImmutableList<CloudStackVersion> availableVersions;
protected Map<CloudStackVersion, DbUpgrade[]> _upgradeMap = new HashMap<>();
@Inject
VersionDao _dao;
private final ImmutableList<CloudStackVersion> availableVersions;
public DatabaseUpgradeChecker() {
_dao = new VersionDaoImpl();
_upgradeMap.put(CloudStackVersion.parse("2.1.7"), new DbUpgrade[] {new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(),
new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.1.7"),
new DbUpgrade[] {new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(),
new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(),
new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.1.8"), new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.1.8"),
new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(),
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.1.9"), new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.1.9"),
new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(),
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.1"), new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(),
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.1"),
new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.2"), new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.2"),
new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.3"), new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.3"),
new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.4"), new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.4"),
new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.5"), new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.5"),
new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(),
new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(),
new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.6"), new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.6"),
new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(),
new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.7"), new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.7"),
new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(),
new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.8"), new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
, new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.8"),
new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.9"), new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.9"),
new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.10"), new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.10"),
new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.12"), new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.12"),
new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.13"), new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.13"),
new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(),
new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(),
new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.14"), new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.14"),
new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(),
new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.0"), new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.0"),
new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.1"), new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.1"),
new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.2"), new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.2"),
new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.0.0"), new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.0.0"),
new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(),
new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.0.1"), new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.0.1"),
new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(),
new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.0.2"), new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.0.2"),
new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(),
new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.1.0"), new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.1.0"),
new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.1.1"), new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.1.1"),
new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.2.0"), new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.2.0"),
new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(),
new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(),
new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.2.1"), new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.2.1"),
new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(),
new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.3.0"), new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.3.0"),
new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.3.1"), new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.3.1"),
new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.3.2"), new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.3.2"),
new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.4.0"), new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.4.0"),
new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.4.1"), new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000() });
_upgradeMap.put(CloudStackVersion.parse("4.4.1"),
new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.4.2"), new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.4.2"),
new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.4.3"), new DbUpgrade[] {new Upgrade443to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.4.3"),
new DbUpgrade[] {new Upgrade443to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.4.4"), new DbUpgrade[] {new Upgrade444to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.4.4"),
new DbUpgrade[] {new Upgrade444to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.5.0"), new DbUpgrade[] {new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.5.0"),
new DbUpgrade[] {new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(),
new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.5.1"), new DbUpgrade[] {new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.5.1"),
new DbUpgrade[] {new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(),
new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.5.2"), new DbUpgrade[] {new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.5.2"),
new DbUpgrade[] {new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.5.3"), new DbUpgrade[] {new Upgrade453to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.5.3"),
new DbUpgrade[] {new Upgrade453to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.6.0"), new DbUpgrade[] {new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.6.0"),
new DbUpgrade[] {new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.6.1"), new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.6.1"),
new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.6.2"), new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.6.2"),
new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.7.0"), new DbUpgrade[] {new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.7.0"),
new DbUpgrade[] {new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.7.1"), new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.7.1"),
new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.7.2"), new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.7.2"),
new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(),
new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.8.0"), new DbUpgrade[] {new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.8.0"),
new DbUpgrade[] {new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(),
new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.8.1"), new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.8.1"),
new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.8.2.0"), new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.8.2.0"),
new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.9.0"), new DbUpgrade[] {new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.9.0"),
new DbUpgrade[] {new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.9.1.0"), new DbUpgrade[] {new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.9.1.0"),
new DbUpgrade[] {new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.9.2.0"), new DbUpgrade[] {new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.9.2.0"),
new DbUpgrade[] {new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.9.3.0"), new DbUpgrade[] {new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("4.9.3.0"),
new DbUpgrade[] {new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("4.10.0.0"),
new DbUpgrade[] {new Upgrade41000to41100()});
//CP Upgrades
_upgradeMap.put(CloudStackVersion.parse("3.0.3"), new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.3"),
new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(),
new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(),
new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.4"), new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.4"),
new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(),
new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(),
new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.5"), new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.5"),
new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(),
new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(),
new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.6"), new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.6"),
new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("3.0.7"), new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("3.0.7"),
new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(),
new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(),
new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.15"), new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.15"),
new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(),
new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
_upgradeMap.put(CloudStackVersion.parse("2.2.16"), new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000()});
_upgradeMap.put(CloudStackVersion.parse("2.2.16"),
new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(),
new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(),
new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(),
new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100()});
final List<CloudStackVersion> sortedVersions = newArrayList(_upgradeMap.keySet());
sort(sortedVersions);
@ -317,7 +455,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
protected void runScript(Connection conn, File file) {
try(FileReader reader = new FileReader(file);) {
try (FileReader reader = new FileReader(file);) {
ScriptRunner runner = new ScriptRunner(conn, false, true);
runner.runScript(reader);
} catch (FileNotFoundException e) {
@ -368,12 +506,11 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
checkArgument(currentVersion != null);
checkArgument(currentVersion.compareTo(dbVersion) > 0);
final DbUpgrade[] upgrades = _upgradeMap.containsKey(dbVersion) ? _upgradeMap.get(dbVersion) :
findMostRecentUpgradePath(dbVersion);
final DbUpgrade[] upgrades = _upgradeMap.containsKey(dbVersion) ? _upgradeMap.get(dbVersion) : findMostRecentUpgradePath(dbVersion);
// When there is no upgrade defined for the target version, we assume that there were no schema changes or
// data migrations required. Based on that assumption, we add a noop DbUpgrade to the end of the list ...
final CloudStackVersion tailVersion = upgrades.length > 0 ? CloudStackVersion.parse(upgrades[upgrades.length-1].getUpgradedVersion()) : dbVersion;
final CloudStackVersion tailVersion = upgrades.length > 0 ? CloudStackVersion.parse(upgrades[upgrades.length - 1].getUpgradedVersion()) : dbVersion;
if (currentVersion.compareTo(tailVersion) != 0) {
return concat(upgrades, new NoopDbUpgrade(tailVersion, currentVersion));
@ -398,16 +535,15 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
if (!supportsRollingUpgrade && false) { // FIXME: Needs to detect if there are management servers running
// ClusterManagerImpl.arePeersRunning(null)) {
String errorMessage =
"Unable to run upgrade because the upgrade sequence does not support rolling update and there are other management server nodes running";
String errorMessage = "Unable to run upgrade because the upgrade sequence does not support rolling update and there are other management server nodes running";
s_logger.error(errorMessage);
throw new CloudRuntimeException(errorMessage);
}
for (DbUpgrade upgrade : upgrades) {
VersionVO version;
s_logger.debug("Running upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" +
upgrade.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
s_logger.debug("Running upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade
.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
TransactionLegacy txn = TransactionLegacy.open("Upgrade");
txn.start();
try {
@ -443,8 +579,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
// Run the corresponding '-cleanup.sql' script
txn = TransactionLegacy.open("Cleanup");
try {
s_logger.info("Cleanup upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" +
upgrade.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
s_logger.info("Cleanup upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade
.getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion());
txn.start();
Connection conn;
@ -525,7 +661,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
super();
upgradedVersion = toVersion.toString();
upgradeRange = new String[] { fromVersion.toString(), toVersion.toString() };
upgradeRange = new String[] {fromVersion.toString(), toVersion.toString()};
}

View File

@ -0,0 +1,66 @@
// 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.upgrade.dao;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import org.apache.log4j.Logger;
import java.io.File;
import java.sql.Connection;
public class Upgrade41000to41100 implements DbUpgrade {
final static Logger LOG = Logger.getLogger(Upgrade41000to41100.class);
@Override
public String[] getUpgradableVersionRange() {
return new String[] {"4.10.0.0", "4.11.0.0"};
}
@Override
public String getUpgradedVersion() {
return "4.11.0.0";
}
@Override
public boolean supportsRollingUpgrade() {
return false;
}
@Override
public File[] getPrepareScripts() {
String script = Script.findScript("", "db/schema-41000to41100.sql");
if (script == null) {
throw new CloudRuntimeException("Unable to find db/schema-41000to41100.sql");
}
return new File[] {new File(script)};
}
@Override
public void performDataMigration(Connection conn) {
}
@Override
public File[] getCleanupScripts() {
String script = Script.findScript("", "db/schema-41000to41100-cleanup.sql");
if (script == null) {
throw new CloudRuntimeException("Unable to find db/schema-41000to41100-cleanup.sql");
}
return new File[] {new File(script)};
}
}

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<artifactId>cloud-engine-service</artifactId>
<packaging>war</packaging>

View File

@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -62,6 +62,7 @@ import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
import org.apache.cloudstack.storage.image.store.TemplateObject;
@ -398,9 +399,27 @@ public class VolumeServiceImpl implements VolumeService {
s_logger.info("Volume " + vo.getId() + " is not referred anywhere, remove it from volumes table");
volDao.remove(vo.getId());
}
SnapshotDataStoreVO snapStoreVo = _snapshotStoreDao.findByVolume(vo.getId(), DataStoreRole.Primary);
if(snapStoreVo != null){
_snapshotStoreDao.remove(snapStoreVo.getId());
if (snapStoreVo != null) {
long storagePoolId = snapStoreVo.getDataStoreId();
StoragePoolVO storagePoolVO = storagePoolDao.findById(storagePoolId);
if (storagePoolVO.isManaged()) {
DataStore primaryDataStore = dataStoreMgr.getPrimaryDataStore(storagePoolId);
Map<String, String> mapCapabilities = primaryDataStore.getDriver().getCapabilities();
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
Boolean supportsStorageSystemSnapshots = new Boolean(value);
if (!supportsStorageSystemSnapshots) {
_snapshotStoreDao.remove(snapStoreVo.getId());
}
}
else {
_snapshotStoreDao.remove(snapStoreVo.getId());
}
}
} else {
vo.processEvent(Event.OperationFailed);

View File

@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -11,11 +11,11 @@
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-framework-db</artifactId>
<name>Apache CloudStack Framework - Event Notification</name>
<name>Apache CloudStack Framework - Database</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -158,6 +158,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
protected static final String FOR_UPDATE_CLAUSE = " FOR UPDATE ";
protected static final String SHARE_MODE_CLAUSE = " LOCK IN SHARE MODE";
protected static final String SELECT_LAST_INSERT_ID_SQL = "SELECT LAST_INSERT_ID()";
public static final Date DATE_TO_NULL = new Date(Long.MIN_VALUE);
protected static final SequenceFetcher s_seqFetcher = SequenceFetcher.getInstance();
@ -1537,7 +1538,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
}
} else if (attr.field.getType() == Date.class) {
final Date date = (Date)value;
if (date == null) {
if (date == null || date.equals(DATE_TO_NULL)) {
pstmt.setObject(j, null);
return;
}

View File

@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
</parent>
<build>
<defaultGoal>install</defaultGoal>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -32,7 +32,6 @@ import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -47,8 +46,10 @@ import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
@RunWith(MockitoJUnitRunner.class)
public class QuotaAlertManagerImplTest extends TestCase {
@ -179,7 +180,11 @@ public class QuotaAlertManagerImplTest extends TestCase {
public void testGetDifferenceDays() {
Date now = new Date();
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, now) == 0L);
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, new DateTime(now).plusDays(1).toDate()) == 1L);
Calendar c = Calendar.getInstance();
c.setTimeZone(TimeZone.getTimeZone("UTC"));
Calendar c2 = (Calendar) c.clone();
c2.add(Calendar.DATE, 1);
assertEquals(1L, QuotaAlertManagerImpl.getDifferenceDays(c.getTime(), c2.getTime()));
}
@Test

View File

@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cloud-framework-rest</artifactId>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>

View File

@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.10.0.0-SNAPSHOT</version>
<version>4.11.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>

Some files were not shown because too many files have changed in this diff Show More