mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' into ui-restyle
Conflicts: ui/scripts/sharedFunctions.js
This commit is contained in:
commit
9dd6ff6fc0
|
|
@ -0,0 +1,41 @@
|
|||
// 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.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
|
||||
public class HostVmStateReportEntry {
|
||||
VirtualMachine.PowerState state;
|
||||
String host;
|
||||
|
||||
public HostVmStateReportEntry() {
|
||||
}
|
||||
|
||||
public HostVmStateReportEntry(PowerState state, String host) {
|
||||
this.state = state;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public PowerState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ import com.cloud.network.lb.LoadBalancingRule.LbCondition;
|
|||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbSslCert;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ public class LoadBalancerTO {
|
|||
String srcIp;
|
||||
int srcPort;
|
||||
String protocol;
|
||||
String lbProtocol;
|
||||
String algorithm;
|
||||
boolean revoked;
|
||||
boolean alreadyAdded;
|
||||
|
|
@ -48,6 +50,7 @@ public class LoadBalancerTO {
|
|||
DestinationTO[] destinations;
|
||||
private StickinessPolicyTO[] stickinessPolicies;
|
||||
private HealthCheckPolicyTO[] healthCheckPolicies;
|
||||
private LbSslCert sslCert; /* XXX: Should this be SslCertTO? */
|
||||
private AutoScaleVmGroupTO autoScaleVmGroupTO;
|
||||
final static int MAX_STICKINESS_POLICIES = 1;
|
||||
final static int MAX_HEALTHCHECK_POLICIES = 1;
|
||||
|
|
@ -66,6 +69,8 @@ public class LoadBalancerTO {
|
|||
this.inline = inline;
|
||||
this.destinations = new DestinationTO[destinations.size()];
|
||||
this.stickinessPolicies = null;
|
||||
this.sslCert = null;
|
||||
this.lbProtocol = null;
|
||||
int i = 0;
|
||||
for (LbDestination destination : destinations) {
|
||||
this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.isRevoked(), false);
|
||||
|
|
@ -77,12 +82,12 @@ public class LoadBalancerTO {
|
|||
List<LbStickinessPolicy> stickinessPolicies) {
|
||||
|
||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations,
|
||||
stickinessPolicies, null);
|
||||
stickinessPolicies, null, null, null);
|
||||
}
|
||||
|
||||
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked,
|
||||
boolean alreadyAdded, boolean inline, List<LbDestination> arg_destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies) {
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert, String lbProtocol) {
|
||||
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations);
|
||||
this.stickinessPolicies = null;
|
||||
this.healthCheckPolicies = null;
|
||||
|
|
@ -117,6 +122,9 @@ public class LoadBalancerTO {
|
|||
if (index == 0)
|
||||
this.healthCheckPolicies = null;
|
||||
}
|
||||
|
||||
this.sslCert = sslCert;
|
||||
this.lbProtocol = lbProtocol;
|
||||
}
|
||||
|
||||
protected LoadBalancerTO() {
|
||||
|
|
@ -142,6 +150,10 @@ public class LoadBalancerTO {
|
|||
return protocol;
|
||||
}
|
||||
|
||||
public String getLbProtocol() {
|
||||
return lbProtocol;
|
||||
}
|
||||
|
||||
public boolean isRevoked() {
|
||||
return revoked;
|
||||
}
|
||||
|
|
@ -178,6 +190,10 @@ public class LoadBalancerTO {
|
|||
return this.autoScaleVmGroupTO != null;
|
||||
}
|
||||
|
||||
public LbSslCert getSslCert(){
|
||||
return this.sslCert;
|
||||
}
|
||||
|
||||
public static class StickinessPolicyTO {
|
||||
private String _methodName;
|
||||
private List<Pair<String, String>> _paramsList;
|
||||
|
|
@ -294,6 +310,8 @@ public class LoadBalancerTO {
|
|||
public String getMonitorState() {
|
||||
return monitorState;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static class CounterTO implements Serializable {
|
||||
private final String name;
|
||||
|
|
@ -558,5 +576,4 @@ public class LoadBalancerTO {
|
|||
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
|
||||
autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.to;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public class MonitorServiceTO implements InternalIdentity {
|
||||
long id;
|
||||
String service;
|
||||
String processname;
|
||||
String serviceName;
|
||||
String servicePath;
|
||||
String pidFile;
|
||||
boolean isDefault;
|
||||
|
||||
protected MonitorServiceTO() {
|
||||
}
|
||||
|
||||
public MonitorServiceTO (String service, String processname, String serviceName, String servicepath, String pidFile, boolean isDefault) {
|
||||
this.service = service;
|
||||
this.processname = processname;
|
||||
this.serviceName = serviceName;
|
||||
this.servicePath = servicepath;
|
||||
this.pidFile = pidFile;
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public String getPidFile() {
|
||||
return pidFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
public String getServicePath() {
|
||||
return servicePath;
|
||||
}
|
||||
|
||||
public String getProcessname() {
|
||||
return processname;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ public interface HostAllocator extends Adapter {
|
|||
/**
|
||||
* Determines which physical hosts are suitable to
|
||||
* allocate the guest virtual machines on
|
||||
*
|
||||
*
|
||||
* @param VirtualMachineProfile vmProfile
|
||||
* @param DeploymentPlan plan
|
||||
* @param GuestType type
|
||||
|
|
@ -46,35 +46,57 @@ public interface HostAllocator extends Adapter {
|
|||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
|
||||
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
|
||||
|
||||
|
||||
/**
|
||||
* Determines which physical hosts are suitable to
|
||||
* allocate the guest virtual machines on
|
||||
*
|
||||
* @param VirtualMachineProfile vmProfile
|
||||
* @param DeploymentPlan plan
|
||||
* @param GuestType type
|
||||
* @param ExcludeList avoid
|
||||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
|
||||
* Determines which physical hosts are suitable to allocate the guest
|
||||
* virtual machines on
|
||||
*
|
||||
* Allocators must set any other hosts not considered for allocation in the
|
||||
* ExcludeList avoid. Thus the avoid set and the list of hosts suitable,
|
||||
* together must cover the entire host set in the cluster.
|
||||
*
|
||||
* @param VirtualMachineProfile
|
||||
* vmProfile
|
||||
* @param DeploymentPlan
|
||||
* plan
|
||||
* @param GuestType
|
||||
* type
|
||||
* @param ExcludeList
|
||||
* avoid
|
||||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @param boolean considerReservedCapacity (default should be true, set to
|
||||
* false if host capacity calculation should not look at reserved
|
||||
* capacity)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
|
||||
|
||||
/**
|
||||
* Determines which physical hosts are suitable to
|
||||
* allocate the guest virtual machines on
|
||||
* Determines which physical hosts are suitable to allocate the guest
|
||||
* virtual machines on
|
||||
*
|
||||
* @param VirtualMachineProfile vmProfile
|
||||
* @param DeploymentPlan plan
|
||||
* @param GuestType type
|
||||
* @param ExcludeList avoid
|
||||
* @param List<HostVO> hosts
|
||||
* Allocators must set any other hosts not considered for allocation in the
|
||||
* ExcludeList avoid. Thus the avoid set and the list of hosts suitable,
|
||||
* together must cover the entire host set in the cluster.
|
||||
*
|
||||
*
|
||||
* @param VirtualMachineProfile
|
||||
* vmProfile
|
||||
* @param DeploymentPlan
|
||||
* plan
|
||||
* @param GuestType
|
||||
* type
|
||||
* @param ExcludeList
|
||||
* avoid
|
||||
* @param List
|
||||
* <HostVO> hosts
|
||||
* @param int returnUpTo (use -1 to return all possible hosts)
|
||||
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
|
||||
* @param boolean considerReservedCapacity (default should be true, set to
|
||||
* false if host capacity calculation should not look at reserved
|
||||
* capacity)
|
||||
* @return List<Host> List of hosts that are suitable for VM allocation
|
||||
**/
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
|
||||
|
|
|
|||
|
|
@ -133,6 +133,10 @@ public class EventTypes {
|
|||
public static final String EVENT_LB_HEALTHCHECKPOLICY_CREATE = "LB.HEALTHCHECKPOLICY.CREATE";
|
||||
public static final String EVENT_LB_HEALTHCHECKPOLICY_DELETE = "LB.HEALTHCHECKPOLICY.DELETE";
|
||||
public static final String EVENT_LOAD_BALANCER_UPDATE = "LB.UPDATE";
|
||||
public static final String EVENT_LB_CERT_UPLOAD = "LB.CERT.UPLOAD";
|
||||
public static final String EVENT_LB_CERT_DELETE = "LB.CERT.DELETE";
|
||||
public static final String EVENT_LB_CERT_ASSIGN = "LB.CERT.ASSIGN";
|
||||
public static final String EVENT_LB_CERT_REMOVE = "LB.CERT.REMOVE";
|
||||
|
||||
// Global Load Balancer rules
|
||||
public static final String EVENT_ASSIGN_TO_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.ASSIGN";
|
||||
|
|
@ -511,6 +515,10 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LB_CERT_UPLOAD, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LB_CERT_DELETE, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class.getName());
|
||||
entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class.getName());
|
||||
|
||||
// Account events
|
||||
entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ public interface Host extends StateObject<Status>, Identity, InternalIdentity {
|
|||
*/
|
||||
Long getTotalMemory();
|
||||
|
||||
/**
|
||||
* @return # of cpu sockets in a machine.
|
||||
*/
|
||||
Integer getCpuSockets();
|
||||
|
||||
/**
|
||||
* @return # of cores in a machine. Note two cpus with two cores each returns 4.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package com.cloud.network;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
/**
|
||||
* Nic represents one nic on the VM.
|
||||
*/
|
||||
public interface MonitoringService extends ControlledEntity, Identity, InternalIdentity {
|
||||
/**
|
||||
* @return id in the CloudStack database
|
||||
*/
|
||||
enum Service {
|
||||
Dhcp,
|
||||
LoadBalancing,
|
||||
Ssh,
|
||||
Webserver,
|
||||
}
|
||||
long getId();
|
||||
String getService();
|
||||
String getServiceName();
|
||||
String getPidFile();
|
||||
String getServicePath();
|
||||
}
|
||||
|
|
@ -116,6 +116,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
|
||||
public static final Provider JuniperContrail = new Provider("JuniperContrail", false);
|
||||
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
|
||||
public static final Provider PaloAlto = new Provider("PaloAlto", true);
|
||||
public static final Provider F5BigIp = new Provider("F5BigIp", true);
|
||||
public static final Provider Netscaler = new Provider("Netscaler", true);
|
||||
public static final Provider ExternalDhcpServer = new Provider("ExternalDhcpServer", true);
|
||||
|
|
@ -180,6 +181,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
|
||||
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
|
||||
public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
|
||||
public static final Capability SslTermination = new Capability("SslTermination");
|
||||
public static final Capability LbSchemes = new Capability("LbSchemes");
|
||||
public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets");
|
||||
|
||||
|
|
|
|||
|
|
@ -116,11 +116,11 @@ public interface NetworkService {
|
|||
long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType);
|
||||
|
||||
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType,
|
||||
String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan);
|
||||
String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel);
|
||||
|
||||
PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id);
|
||||
|
||||
PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel);
|
||||
PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel, String hypervLabel);
|
||||
|
||||
boolean deletePhysicalNetworkTrafficType(Long id);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,4 +37,6 @@ public interface PhysicalNetworkTrafficType extends InternalIdentity, Identity {
|
|||
String getVmwareNetworkLabel();
|
||||
|
||||
String getSimulatorNetworkLabel();
|
||||
|
||||
String getHypervNetworkLabel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VirtualNetworkApplianceService {
|
||||
/**
|
||||
|
|
@ -66,4 +69,7 @@ public interface VirtualNetworkApplianceService {
|
|||
|
||||
VirtualRouter findRouter(long routerId);
|
||||
|
||||
List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd);
|
||||
|
||||
public static final String _minVRVersion = "4.2.0";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.lb;
|
||||
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CertService {
|
||||
|
||||
public SslCertResponse uploadSslCert(UploadSslCertCmd certCmd);
|
||||
public void deleteSslCert(DeleteSslCertCmd deleteSslCertCmd);
|
||||
public List<SslCertResponse> listSslCerts(ListSslCertsCmd listSslCertCmd);
|
||||
}
|
||||
|
|
@ -36,9 +36,11 @@ public class LoadBalancingRule {
|
|||
private List<LbStickinessPolicy> stickinessPolicies;
|
||||
private LbAutoScaleVmGroup autoScaleVmGroup;
|
||||
private List<LbHealthCheckPolicy> healthCheckPolicies;
|
||||
private LbSslCert sslCert;
|
||||
private String lbProtocol;
|
||||
|
||||
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
|
||||
this.lb = lb;
|
||||
this.destinations = destinations;
|
||||
this.stickinessPolicies = stickinessPolicies;
|
||||
|
|
@ -46,6 +48,17 @@ public class LoadBalancingRule {
|
|||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
|
||||
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp, LbSslCert sslCert, String lbProtocol) {
|
||||
this.lb = lb;
|
||||
this.destinations = destinations;
|
||||
this.stickinessPolicies = stickinessPolicies;
|
||||
this.healthCheckPolicies = healthCheckPolicies;
|
||||
this.sourceIp = sourceIp;
|
||||
this.sslCert = sslCert;
|
||||
this.lbProtocol = lbProtocol;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return lb.getId();
|
||||
}
|
||||
|
|
@ -90,6 +103,10 @@ public class LoadBalancingRule {
|
|||
return lb.getProtocol();
|
||||
}
|
||||
|
||||
public String getLbProtocol() {
|
||||
return this.lbProtocol;
|
||||
}
|
||||
|
||||
public FirewallRule.Purpose getPurpose() {
|
||||
return FirewallRule.Purpose.LoadBalancing;
|
||||
}
|
||||
|
|
@ -123,6 +140,10 @@ public class LoadBalancingRule {
|
|||
return healthCheckPolicies;
|
||||
}
|
||||
|
||||
public LbSslCert getLbSslCert(){
|
||||
return sslCert;
|
||||
}
|
||||
|
||||
public interface Destination {
|
||||
String getIpAddress();
|
||||
|
||||
|
|
@ -415,6 +436,44 @@ public class LoadBalancingRule {
|
|||
}
|
||||
}
|
||||
|
||||
public static class LbSslCert {
|
||||
private String cert;
|
||||
private String key;
|
||||
private String password=null;
|
||||
private String chain=null;
|
||||
private boolean revoked;
|
||||
|
||||
|
||||
public LbSslCert(String cert, String key, String password, String chain, boolean revoked) {
|
||||
this.cert = cert;
|
||||
this.key = key;
|
||||
this.password = password;
|
||||
this.chain = chain;
|
||||
this.revoked = revoked;
|
||||
}
|
||||
|
||||
public String getCert() {
|
||||
|
||||
return cert;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
public boolean isRevoked(){
|
||||
return revoked;
|
||||
}
|
||||
}
|
||||
|
||||
public Ip getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public interface LoadBalancingRulesService {
|
|||
*/
|
||||
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description,
|
||||
int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
|
||||
long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
|
||||
|
||||
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
|
||||
|
||||
|
|
@ -94,10 +94,16 @@ public interface LoadBalancingRulesService {
|
|||
*/
|
||||
boolean assignToLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
|
||||
boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey);
|
||||
|
||||
boolean removeFromLoadBalancer(long lbRuleId, List<Long> vmIds);
|
||||
|
||||
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
|
||||
|
||||
boolean assignCertToLoadBalancer(long lbRuleId, Long CertId);
|
||||
boolean removeCertFromLoadBalancer(long lbRuleId);
|
||||
|
||||
|
||||
/**
|
||||
* List instances that have either been applied to a load balancer or are eligible to be assigned to a load
|
||||
* balancer.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.cloud.network.lb;
|
||||
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface SslCert extends InternalIdentity, Identity, ControlledEntity {
|
||||
|
||||
public String getCertificate();
|
||||
public String getKey() ;
|
||||
public String getChain();
|
||||
public String getPassword();
|
||||
public String getFingerPrint();
|
||||
|
||||
}
|
||||
|
|
@ -41,4 +41,5 @@ public interface VirtualRouter extends VirtualMachine {
|
|||
* @return
|
||||
*/
|
||||
Long getVpcId();
|
||||
String getTemplateVersion();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,20 +20,21 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public interface VpcProvisioningService {
|
||||
|
||||
|
||||
public VpcOffering getVpcOffering(long vpcOfferingId);
|
||||
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders);
|
||||
|
||||
|
||||
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
|
||||
Map<String, List<String>> serviceProviders, Long serviceOfferingId);
|
||||
|
||||
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
|
||||
Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
|
||||
|
||||
|
||||
/**
|
||||
* @param offId
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteVpcOffering(long offId);
|
||||
|
||||
|
||||
/**
|
||||
* @param vpcOffId
|
||||
* @param vpcOfferingName
|
||||
|
|
|
|||
|
|
@ -89,4 +89,7 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
|
|||
|
||||
Long getIopsWriteRate();
|
||||
|
||||
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
|
||||
|
||||
Integer getHypervisorSnapshotReserve();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,17 +61,17 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
|
|||
/**
|
||||
* @return # of cpu.
|
||||
*/
|
||||
int getCpu();
|
||||
Integer getCpu();
|
||||
|
||||
/**
|
||||
* @return speed in mhz
|
||||
*/
|
||||
int getSpeed();
|
||||
Integer getSpeed();
|
||||
|
||||
/**
|
||||
* @return ram size in megabytes
|
||||
*/
|
||||
int getRamSize();
|
||||
Integer getRamSize();
|
||||
|
||||
/**
|
||||
* @return Does this service plan offer HA?
|
||||
|
|
@ -117,4 +117,6 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
|
|||
String getSystemVmType();
|
||||
|
||||
String getDeploymentPlanner();
|
||||
|
||||
boolean isDynamic();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,4 +185,8 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
void setReservationId(String reserv);
|
||||
Storage.ImageFormat getFormat();
|
||||
Long getVmSnapshotChainSize();
|
||||
|
||||
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
|
||||
|
||||
Integer getHypervisorSnapshotReserve();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public interface VolumeApiService {
|
|||
|
||||
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
|
||||
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account)
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId)
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ public interface UserVmService {
|
|||
* Creates a Basic Zone User VM in the database and returns the VM to the
|
||||
* caller.
|
||||
*
|
||||
*
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -181,13 +182,15 @@ public interface UserVmService {
|
|||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account
|
||||
* parameter is used, domainId must also be used
|
||||
* @param cpuSpeed
|
||||
* @param memory
|
||||
* @param cpuNumber
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
|
|
@ -201,15 +204,16 @@ public interface UserVmService {
|
|||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in
|
||||
* the database and returns the VM to the caller.
|
||||
*
|
||||
*
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -257,13 +261,15 @@ public interface UserVmService {
|
|||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account
|
||||
* parameter is used, domainId must also be used
|
||||
* @param CpuSpeed
|
||||
* @param memory
|
||||
* @param cpuNumber
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
|
|
@ -277,14 +283,15 @@ public interface UserVmService {
|
|||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||
Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
|
||||
* in the database and returns the VM to the caller.
|
||||
*
|
||||
*
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -329,15 +336,17 @@ public interface UserVmService {
|
|||
* @param displayVm
|
||||
* - Boolean flag whether to the display the vm to the end user or not
|
||||
* @param affinityGroupIdList
|
||||
*
|
||||
* @param accountName
|
||||
* - an optional account for the virtual machine. Must be used
|
||||
* with domainId
|
||||
* @param domainId
|
||||
* - an optional domainId for the virtual machine. If the account
|
||||
* parameter is used, domainId must also be used
|
||||
* @param cpuSpeed
|
||||
* @param memory
|
||||
* @param cpuNumber
|
||||
* @return UserVm object if successful.
|
||||
*
|
||||
*
|
||||
* @throws InsufficientCapacityException
|
||||
* if there is insufficient capacity to deploy the VM.
|
||||
* @throws ConcurrentOperationException
|
||||
|
|
@ -349,9 +358,9 @@ public interface UserVmService {
|
|||
* @throws InsufficientResourcesException
|
||||
*/
|
||||
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
|
||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||
IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdkisksize)
|
||||
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ import com.cloud.utils.fsm.StateObject;
|
|||
*/
|
||||
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
|
||||
|
||||
public enum PowerState {
|
||||
PowerUnknown,
|
||||
PowerOn,
|
||||
PowerOff,
|
||||
}
|
||||
|
||||
public enum State {
|
||||
Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."),
|
||||
Running(false, "VM is running. host id has the host that it is running on."),
|
||||
|
|
@ -111,6 +117,15 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
s_fsm.addTransition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging);
|
||||
s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
|
||||
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
|
||||
|
||||
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
|
||||
s_fsm.addTransition(State.Starting, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
|
||||
}
|
||||
|
||||
public static boolean isVmStarted(State oldState, Event e, State newState) {
|
||||
|
|
@ -179,6 +194,10 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
AgentReportMigrated,
|
||||
RevertRequested,
|
||||
SnapshotRequested,
|
||||
|
||||
// added for new VMSync logic
|
||||
FollowAgentPowerOnReport,
|
||||
FollowAgentPowerOffReport,
|
||||
};
|
||||
|
||||
public enum Type {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ public class ApiConstants {
|
|||
public static final String CATEGORY = "category";
|
||||
public static final String CAN_REVERT = "canrevert";
|
||||
public static final String CERTIFICATE = "certificate";
|
||||
public static final String CERTIFICATE_CHAIN = "certchain";
|
||||
public static final String CERTIFICATE_FINGERPRINT = "fingerprint";
|
||||
public static final String CERTIFICATE_ID = "certid";
|
||||
public static final String PRIVATE_KEY = "privatekey";
|
||||
public static final String DOMAIN_SUFFIX = "domainsuffix";
|
||||
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
|
||||
|
|
@ -54,12 +57,14 @@ public class ApiConstants {
|
|||
public static final String CUSTOMIZED_IOPS = "customizediops";
|
||||
public static final String MIN_IOPS = "miniops";
|
||||
public static final String MAX_IOPS = "maxiops";
|
||||
public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String DESTINATION_ZONE_ID = "destzoneid";
|
||||
public static final String DETAILS = "details";
|
||||
public static final String DEVICE_ID = "deviceid";
|
||||
public static final String DISK_OFFERING_ID = "diskofferingid";
|
||||
public static final String DISK_SIZE = "disksize";
|
||||
public static final String ROOT_DISK_SIZE = "rootdisksize";
|
||||
public static final String DISPLAY_NAME = "displayname";
|
||||
public static final String DISPLAY_NETWORK = "displaynetwork";
|
||||
public static final String DISPLAY_NIC = "displaynic";
|
||||
|
|
@ -208,6 +213,7 @@ public class ApiConstants {
|
|||
public static final String SNAPSHOT_ID = "snapshotid";
|
||||
public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
|
||||
public static final String SNAPSHOT_TYPE = "snapshottype";
|
||||
public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
|
||||
public static final String SOURCE_ZONE_ID = "sourcezoneid";
|
||||
public static final String START_DATE = "startdate";
|
||||
public static final String START_IP = "startip";
|
||||
|
|
@ -349,6 +355,7 @@ public class ApiConstants {
|
|||
public static final String XEN_NETWORK_LABEL = "xennetworklabel";
|
||||
public static final String KVM_NETWORK_LABEL = "kvmnetworklabel";
|
||||
public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel";
|
||||
public static final String HYPERV_NETWORK_LABEL = "hypervnetworklabel";
|
||||
public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid";
|
||||
public static final String SERVICE_LIST = "servicelist";
|
||||
public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
|
||||
|
|
@ -526,6 +533,7 @@ public class ApiConstants {
|
|||
public static final String EXPUNGE = "expunge";
|
||||
public static final String FOR_DISPLAY = "fordisplay";
|
||||
public static final String PASSIVE = "passive";
|
||||
public static final String VERSION = "version";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
|
|||
import org.apache.cloudstack.api.response.IsolationMethodResponse;
|
||||
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
|
||||
import org.apache.cloudstack.api.response.LBStickinessResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.LoadBalancerResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
|
|
@ -99,6 +100,7 @@ import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
|||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
|
||||
import org.apache.cloudstack.api.response.TrafficTypeResponse;
|
||||
import org.apache.cloudstack.api.response.UpgradeRouterTemplateResponse;
|
||||
import org.apache.cloudstack.api.response.UsageRecordResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
|
|
@ -446,4 +448,6 @@ public interface ResponseGenerator {
|
|||
|
||||
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
|
||||
|
||||
ListResponse<UpgradeRouterTemplateResponse> createUpgradeRouterTemplateResponse(List<Long> jobIds);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.EnumSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -88,6 +89,9 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.HA_HOST, type=CommandType.BOOLEAN, description="if true, list only hosts dedicated to HA")
|
||||
private Boolean haHost;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
|
||||
private String hypervisor;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -128,6 +132,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public HypervisorType getHypervisor() {
|
||||
return HypervisorType.getType(hypervisor);
|
||||
}
|
||||
|
||||
public EnumSet<HostDetails> getDetails() throws InvalidParameterValueException {
|
||||
EnumSet<HostDetails> dv;
|
||||
if (viewDetails==null || viewDetails.size() <=0){
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ public class AddNetworkDeviceCmd extends BaseCmd {
|
|||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Inject ExternalNetworkDeviceManager nwDeviceMgr;
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall")
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall")
|
||||
private String type;
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "parameters for network device")
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall")
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall")
|
||||
private String type;
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "parameters for network device")
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.MAX_IOPS, type=CommandType.LONG, required=false, description="max iops of the disk offering")
|
||||
private Long maxIops;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE, type=CommandType.INTEGER, required=false, description="Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)")
|
||||
private Integer hypervisorSnapshotReserve;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -150,6 +153,10 @@ public class CreateDiskOfferingCmd extends BaseCmd {
|
|||
return displayOffering;
|
||||
}
|
||||
|
||||
public Integer getHypervisorSnapshotReserve() {
|
||||
return hypervisorSnapshotReserve;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -41,17 +41,17 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.LONG, required=true, description="the CPU number of the service offering")
|
||||
private Long cpuNumber;
|
||||
@Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.INTEGER, required=false, description="the CPU number of the service offering")
|
||||
private Integer cpuNumber;
|
||||
|
||||
@Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.LONG, required=true, description="the CPU speed of the service offering in MHz.")
|
||||
private Long cpuSpeed;
|
||||
@Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.INTEGER, required=false, description="the CPU speed of the service offering in MHz.")
|
||||
private Integer cpuSpeed;
|
||||
|
||||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the service offering")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.MEMORY, type=CommandType.LONG, required=true, description="the total memory of the service offering in MB")
|
||||
private Long memory;
|
||||
@Parameter(name=ApiConstants.MEMORY, type=CommandType.INTEGER, required=false, description="the total memory of the service offering in MB")
|
||||
private Integer memory;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the service offering")
|
||||
private String serviceOfferingName;
|
||||
|
|
@ -109,11 +109,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getCpuNumber() {
|
||||
public Integer getCpuNumber() {
|
||||
return cpuNumber;
|
||||
}
|
||||
|
||||
public Long getCpuSpeed() {
|
||||
public Integer getCpuSpeed() {
|
||||
return cpuSpeed;
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return displayText;
|
||||
}
|
||||
|
||||
public Long getMemory() {
|
||||
public Integer getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +173,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return deploymentPlanner;
|
||||
}
|
||||
|
||||
public boolean getCustomized() {
|
||||
return (cpuNumber == null || memory == null || cpuSpeed == null);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
if (details == null || details.isEmpty()) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
|
||||
private Boolean forVpc;
|
||||
|
||||
|
||||
@Parameter(name=ApiConstants.VERSION, type=CommandType.STRING, description="list virtual router elements by version")
|
||||
private String version;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -115,7 +118,11 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
public Boolean getForVpc() {
|
||||
return forVpc;
|
||||
}
|
||||
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return Role.VIRTUAL_ROUTER.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
// 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.router;
|
||||
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandJobType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ClusterResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UpgradeRouterTemplateResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@APICommand(name = "upgradeRouterTemplate", description="Upgrades router to use newer template", responseObject=BaseResponse.class)
|
||||
public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpgradeRouterTemplateCmd.class.getName());
|
||||
private static final String s_name = "upgraderoutertemplateresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name= ApiConstants.ID, type=CommandType.UUID, entityType = DomainRouterResponse.class,
|
||||
description="upgrades router with the specified Id")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType= ClusterResponse.class,
|
||||
description="upgrades all routers within the specified cluster")
|
||||
private Long clusterId;
|
||||
|
||||
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
|
||||
description="upgrades all routers within the specified pod")
|
||||
private Long podId;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
description="upgrades all routers within the specified zone")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
|
||||
description="upgrades all routers owned by the specified account")
|
||||
private Long accountId;
|
||||
|
||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
|
||||
description="upgrades all routers owned by the specified domain")
|
||||
private Long domainId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getClusterId() {
|
||||
return clusterId;
|
||||
}
|
||||
|
||||
public Long getPodId() {
|
||||
return podId;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
public ApiCommandJobType getInstanceType() {
|
||||
return ApiCommandJobType.DomainRouter;
|
||||
}
|
||||
|
||||
public Long getInstanceId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
CallContext.current().setEventDetails("Upgrading router template");
|
||||
List<Long> result = _routerService.upgradeRouterTemplate(this);
|
||||
if (result != null){
|
||||
ListResponse<UpgradeRouterTemplateResponse> response = _responseGenerator.createUpgradeRouterTemplateResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router template");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,9 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
|||
@Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host")
|
||||
private String vmwareLabel;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERV_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a Hyperv host")
|
||||
private String hypervLabel;
|
||||
|
||||
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="The VLAN id to be used for Management traffic by VMware host")
|
||||
private String vlan;
|
||||
|
||||
|
|
@ -88,6 +91,10 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
|||
return vmwareLabel;
|
||||
}
|
||||
|
||||
public String getHypervLabel() {
|
||||
return hypervLabel;
|
||||
}
|
||||
|
||||
public String getSimulatorLabel() {
|
||||
//simulators will have no labels
|
||||
return null;
|
||||
|
|
@ -130,7 +137,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan());
|
||||
PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan(), getHypervLabel());
|
||||
if (result != null) {
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.TrafficTypeResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -53,6 +54,8 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
|
|||
@Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host")
|
||||
private String vmwareLabel;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERV_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a Hyperv host")
|
||||
private String hypervLabel;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -73,6 +76,10 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
|
|||
return vmwareLabel;
|
||||
}
|
||||
|
||||
public String getHypervLabel() {
|
||||
return hypervLabel;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -89,7 +96,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
|
||||
PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getHypervLabel());
|
||||
if (result != null) {
|
||||
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class AssignVMCmd extends BaseCmd {
|
|||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm");
|
||||
}
|
||||
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
|
||||
response.setResponseName(DeployVMCmd.getResultObjectName());
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,14 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.vpc;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -24,8 +31,8 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.VpcOfferingResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
|
|
@ -56,6 +63,9 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
|||
"If not specified, the provider for the service will be mapped to the default provider on the physical network")
|
||||
private Map<String, String> serviceProviderList;
|
||||
|
||||
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "the ID of the service offering for the VPC router appliance")
|
||||
private Long serviceOfferingId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -96,12 +106,17 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
|||
return serviceProviderMap;
|
||||
}
|
||||
|
||||
public Long getServiceOfferingId() {
|
||||
return serviceOfferingId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders());
|
||||
VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(),
|
||||
getServiceProviders(), getServiceOfferingId());
|
||||
if (vpcOff != null) {
|
||||
this.setEntityId(vpcOff.getId());
|
||||
this.setEntityUuid(vpcOff.getUuid());
|
||||
setEntityId(vpcOff.getId());
|
||||
setEntityUuid(vpcOff.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC offering");
|
||||
}
|
||||
|
|
@ -109,11 +124,11 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
VpcOffering vpc = _vpcProvSvc.getVpcOffering(this.getEntityId());
|
||||
VpcOffering vpc = _vpcProvSvc.getVpcOffering(getEntityId());
|
||||
if (vpc != null) {
|
||||
VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(vpc);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC offering");
|
||||
}
|
||||
|
|
@ -122,7 +137,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
|||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VPC_OFFERING_CREATE;
|
||||
return EventTypes.EVENT_VPC_OFFERING_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -137,7 +152,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.user.loadbalancer;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "assignCertToLoadBalancer", description = "Assigns a certificate to a Load Balancer Rule", responseObject = SuccessResponse.class)
|
||||
public class AssignCertToLoadBalancerCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger
|
||||
.getLogger(AssignCertToLoadBalancerCmd.class.getName());
|
||||
|
||||
private static final String s_name = "assignCertToLoadBalancer";
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
required = true, description = "the ID of the load balancer rule")
|
||||
Long lbRuleId;
|
||||
|
||||
@Parameter(name = ApiConstants.CERTIFICATE_ID, type = CommandType.UUID, entityType = SslCertResponse.class,
|
||||
required = true, description = "the ID of the certificate")
|
||||
Long certId;
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
if ( _lbService.assignCertToLoadBalancer( getLbRuleId(), getCertId()) ) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign certificate to loadbalancer");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_LB_CERT_ASSIGN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Assigining a certificate to a loadbalancer";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLbRuleId());
|
||||
if (lb == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return lb.getAccountId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long getCertId(){
|
||||
return certId;
|
||||
}
|
||||
|
||||
public Long getLbRuleId(){
|
||||
return lbRuleId;
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +102,9 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
"rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="The protocol for the LB")
|
||||
private String lbProtocol;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -227,6 +230,10 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getLbProtocol(){
|
||||
return lbProtocol;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -282,7 +289,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
|
|||
try {
|
||||
LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(),
|
||||
getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(),
|
||||
getNetworkId(), getEntityOwnerId(), getOpenFirewall());
|
||||
getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol());
|
||||
this.setEntityId(result.getId());
|
||||
this.setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException e) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.loadbalancer;
|
||||
|
||||
|
||||
import com.cloud.network.lb.CertService;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = "deleteSslCert", description="Delete a certificate to cloudstack", responseObject=SuccessResponse.class)
|
||||
public class DeleteSslCertCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteSslCertCmd.class.getName());
|
||||
|
||||
private static final String s_name = "deletesslcertresponse";
|
||||
|
||||
@Inject
|
||||
CertService _certService;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name= ApiConstants.ID, type=CommandType.UUID, entityType = SslCertResponse.class, required=true, description="Id of SSL certificate")
|
||||
private Long id;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
try {
|
||||
_certService.deleteSslCert(this);
|
||||
SuccessResponse rsp = new SuccessResponse();
|
||||
rsp.setResponseName(getCommandName());
|
||||
rsp.setObjectName("success");
|
||||
this.setResponseObject(rsp);
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
// 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.user.loadbalancer;
|
||||
|
||||
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import com.cloud.network.lb.CertService;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "listSslCerts", description="Lists SSL certificates", responseObject=SslCertResponse.class)
|
||||
public class ListSslCertsCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteSslCertCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listsslcertsresponse";
|
||||
|
||||
@Inject
|
||||
CertService _certService;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name= ApiConstants.CERTIFICATE_ID, type=CommandType.UUID, entityType = SslCertResponse.class, required=false, description="Id of SSL certificate")
|
||||
private Long certId;
|
||||
|
||||
@Parameter(name= ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class, required=false, description="Account Id")
|
||||
private Long accountId;
|
||||
|
||||
@Parameter(name= ApiConstants.LBID, type=CommandType.UUID, entityType = FirewallRuleResponse.class, required=false, description="Loadbalancer Rule Id")
|
||||
private Long lbId;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getCertId() {
|
||||
return certId;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public Long getLbId(){
|
||||
return lbId;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
|
||||
|
||||
try {
|
||||
List<SslCertResponse> certResponseList = _certService.listSslCerts(this);
|
||||
ListResponse<SslCertResponse> response = new ListResponse<SslCertResponse>();
|
||||
|
||||
response.setResponses(certResponseList);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
// 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.user.loadbalancer;
|
||||
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.api.response.FirewallRuleResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
@APICommand(name = "removeCertFromLoadBalancer", description = "Removes a certificate from a Load Balancer Rule", responseObject = SuccessResponse.class)
|
||||
public class RemoveCertFromLoadBalancerCmd extends BaseAsyncCmd{
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(RemoveCertFromLoadBalancerCmd.class.getName());
|
||||
|
||||
private static final String s_name = "removeCertFromLoadBalancer";
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
|
||||
required = true, description = "the ID of the load balancer rule")
|
||||
Long lbRuleId;
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
boolean result = _lbService.removeCertFromLoadBalancer(getLbRuleId());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove certificate from load balancer rule");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_LB_CERT_REMOVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Removing a certificate from a loadbalancer with ID " + getLbRuleId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLbRuleId());
|
||||
if (lb == null) {
|
||||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
return lb.getAccountId();
|
||||
}
|
||||
|
||||
public Long getLbRuleId(){
|
||||
return this.lbRuleId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
// 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.user.loadbalancer;
|
||||
|
||||
|
||||
import org.apache.cloudstack.api.response.SslCertResponse;
|
||||
import com.cloud.exception.*;
|
||||
import com.cloud.network.lb.CertService;
|
||||
import org.apache.cloudstack.api.*;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = "uploadSslCert", description="Upload a certificate to cloudstack", responseObject=SslCertResponse.class)
|
||||
public class UploadSslCertCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UploadSslCertCmd.class.getName());
|
||||
|
||||
private static final String s_name = "uploadsslcertresponse";
|
||||
|
||||
@Inject CertService _certService;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name= ApiConstants.CERTIFICATE, type=CommandType.STRING, required=true, description="SSL certificate",length=16384)
|
||||
private String cert;
|
||||
|
||||
@Parameter(name=ApiConstants.PRIVATE_KEY, type=CommandType.STRING, required=true, description="Private key", length=16384)
|
||||
private String key;
|
||||
|
||||
@Parameter(name=ApiConstants.CERTIFICATE_CHAIN, type=CommandType.STRING, description="Certificate chain of trust", length=2097152)
|
||||
private String chain;
|
||||
|
||||
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="Password for the private key")
|
||||
private String password;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getCert() {
|
||||
return cert;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
|
||||
try{
|
||||
SslCertResponse response = _certService.uploadSslCert(this);
|
||||
setResponseObject(response);
|
||||
response.setResponseName(getCommandName());
|
||||
} catch (Exception e){
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -65,12 +65,22 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.")
|
||||
private Long policyId;
|
||||
|
||||
@Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true")
|
||||
private Boolean quiescevm;
|
||||
|
||||
private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Boolean getQuiescevm() {
|
||||
if (quiescevm == null) {
|
||||
return false;
|
||||
} else {
|
||||
return quiescevm;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
|
|
@ -168,7 +178,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
CallContext.current().setEventDetails("Volume Id: "+getVolumeId());
|
||||
Snapshot snapshot;
|
||||
try {
|
||||
snapshot = _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()));
|
||||
snapshot = _volumeService.takeSnapshot(this.getVolumeId(), this.getPolicyId(), this.getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm());
|
||||
if (snapshot != null) {
|
||||
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
|
|
@ -188,6 +188,18 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
@Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, since="4.2", description="an optional field, whether to the display the vm to the end user or not.")
|
||||
private Boolean displayVm;
|
||||
|
||||
@Parameter(name=ApiConstants.CPU_SPEED, type = CommandType.INTEGER, since="4.3", description = "optional field to specify the cpu speed when using dynamic compute offering.")
|
||||
private Integer cpuSpeed;
|
||||
|
||||
@Parameter(name=ApiConstants.MEMORY, type = CommandType.INTEGER, since="4.3", description = "optional field to specify the memory when using dynamic compute offering")
|
||||
private Integer memory;
|
||||
|
||||
@Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.INTEGER, since="4.3", description = "optional field to specify the number of cpu cores when using dynamic offering.")
|
||||
private Integer cpuNumber;
|
||||
|
||||
@Parameter(name=ApiConstants.ROOT_DISK_SIZE, type=CommandType.LONG, since="4.3", description = "optional field to specify the number of cpu cores when using dynamic offering.")
|
||||
private Long rootdisksize;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -227,6 +239,22 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
return displayVm;
|
||||
}
|
||||
|
||||
public Integer getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
public Integer getCpuSpeed() {
|
||||
return cpuSpeed;
|
||||
}
|
||||
|
||||
public Integer getCpuNumber() {
|
||||
return cpuNumber;
|
||||
}
|
||||
|
||||
public Long getRootdisksize() {
|
||||
return rootdisksize;
|
||||
}
|
||||
|
||||
public List<Long> getSecurityGroupIdList() {
|
||||
if (securityGroupNameList != null && securityGroupIdList != null) {
|
||||
throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
|
||||
|
|
@ -495,19 +523,19 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
|
||||
} else {
|
||||
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize);
|
||||
}
|
||||
} else {
|
||||
if (zone.isSecurityGroupEnabled()) {
|
||||
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize );
|
||||
|
||||
} else {
|
||||
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
|
||||
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
|
||||
}
|
||||
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
|
||||
diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
|
||||
diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
@SerializedName("redundantstate") @Param(description="the state of redundant virtual router")
|
||||
private String redundantState;
|
||||
|
||||
@SerializedName("templateversion") @Param(description="the version of template")
|
||||
private String templateVersion;
|
||||
@SerializedName("version") @Param(description="the version of template")
|
||||
private String version;
|
||||
|
||||
@SerializedName("scriptsversion") @Param(description="the version of scripts")
|
||||
private String scriptsVersion;
|
||||
|
|
@ -160,6 +160,9 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
responseObject = NicResponse.class, since="4.0")
|
||||
private Set<NicResponse> nics;
|
||||
|
||||
@SerializedName("requiresupgrade") @Param(description="true if the router template requires upgrader")
|
||||
private boolean requiresUpgrade;
|
||||
|
||||
public DomainRouterResponse(){
|
||||
nics = new LinkedHashSet<NicResponse>();
|
||||
}
|
||||
|
|
@ -308,12 +311,12 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
this.isRedundantRouter = isRedundantRouter;
|
||||
}
|
||||
|
||||
public String getTemplateVersion() {
|
||||
return this.templateVersion;
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setTemplateVersion(String templateVersion) {
|
||||
this.templateVersion = templateVersion;
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getScriptsVersion() {
|
||||
|
|
@ -364,4 +367,12 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public boolean requiresUpgrade() {
|
||||
return requiresUpgrade;
|
||||
}
|
||||
|
||||
public void setRequiresUpgrade(boolean requiresUpgrade) {
|
||||
this.requiresUpgrade = requiresUpgrade;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ public class HostResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.HYPERVISOR) @Param(description="the host hypervisor")
|
||||
private HypervisorType hypervisor;
|
||||
|
||||
@SerializedName("cpusockets") @Param(description="the number of CPU sockets on the host")
|
||||
private Integer cpuSockets;
|
||||
|
||||
@SerializedName("cpunumber") @Param(description="the CPU number of the host")
|
||||
private Integer cpuNumber;
|
||||
|
||||
|
|
@ -225,6 +228,10 @@ public class HostResponse extends BaseResponse {
|
|||
this.hypervisor = hypervisor;
|
||||
}
|
||||
|
||||
public void setCpuSockets(Integer cpuSockets) {
|
||||
this.cpuSockets = cpuSockets;
|
||||
}
|
||||
|
||||
public void setCpuNumber(Integer cpuNumber) {
|
||||
this.cpuNumber = cpuNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.network.lb.SslCert;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import java.util.List;
|
||||
//import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
@EntityReference(value= SslCert.class)
|
||||
public class SslCertResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "SSL certificate ID")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.CERTIFICATE)
|
||||
@Param(description = "certificate")
|
||||
private String certificate;
|
||||
|
||||
@SerializedName(ApiConstants.PRIVATE_KEY)
|
||||
@Param(description = "private key")
|
||||
private String privatekey;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "account for the certificate")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.CERTIFICATE_CHAIN)
|
||||
@Param(description = "certificate chain")
|
||||
private String certchain;
|
||||
|
||||
@SerializedName(ApiConstants.CERTIFICATE_FINGERPRINT)
|
||||
@Param(description = "certificate fingerprint")
|
||||
private String fingerprint;
|
||||
|
||||
@SerializedName(ApiConstants.LOAD_BALANCER_RULE_LIST)
|
||||
@Param(description = "List of loabalancers this certificate is bound to")
|
||||
List<String> lbIds;
|
||||
|
||||
public SslCertResponse() {
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setCertificate(String cert) {
|
||||
this.certificate = cert;
|
||||
}
|
||||
|
||||
public void setPrivatekey(String key) {
|
||||
this.privatekey = key;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public void setCertchain(String chain) {
|
||||
this.certchain = chain;
|
||||
}
|
||||
|
||||
public void setFingerprint(String fingerprint){
|
||||
this.fingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public void setLbIds(List<String> lbIds){
|
||||
this.lbIds = lbIds;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,9 @@ public class TrafficTypeResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.VMWARE_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a VMware host")
|
||||
private String vmwareNetworkLabel;
|
||||
|
||||
@SerializedName(ApiConstants.HYPERV_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a HyperV host")
|
||||
private String hypervNetworkLabel;
|
||||
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
|
|
@ -82,10 +85,17 @@ public class TrafficTypeResponse extends BaseResponse {
|
|||
public String getKvmLabel() {
|
||||
return kvmNetworkLabel;
|
||||
}
|
||||
public String getHypervLabel() {
|
||||
return hypervNetworkLabel;
|
||||
}
|
||||
|
||||
public void setXenLabel(String xenLabel) {
|
||||
this.xenNetworkLabel = xenLabel;
|
||||
}
|
||||
|
||||
public void setHypervLabel(String hypervLabel) {
|
||||
this.hypervNetworkLabel = hypervLabel;
|
||||
}
|
||||
|
||||
public void setKvmLabel(String kvmLabel) {
|
||||
this.kvmNetworkLabel = kvmLabel;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.jobs.JobInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@EntityReference(value = JobInfo.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class UpgradeRouterTemplateResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.JOB_ID) @Param(description="the id of AsyncJob")
|
||||
private String asyncJobId;
|
||||
|
||||
public String getAsyncJobId() {
|
||||
return asyncJobId;
|
||||
}
|
||||
|
||||
public void setAsyncJobId(String asyncJobId) {
|
||||
this.asyncJobId = asyncJobId;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ public interface ExternalNetworkDeviceManager extends Manager {
|
|||
public static final NetworkDevice NetscalerSDXLoadBalancer = new NetworkDevice("NetscalerSDXLoadBalancer", Network.Provider.Netscaler.getName());
|
||||
public static final NetworkDevice F5BigIpLoadBalancer = new NetworkDevice("F5BigIpLoadBalancer", Network.Provider.F5BigIp.getName());
|
||||
public static final NetworkDevice JuniperSRXFirewall = new NetworkDevice("JuniperSRXFirewall", Network.Provider.JuniperSRX.getName());
|
||||
public static final NetworkDevice PaloAltoFirewall = new NetworkDevice("PaloAltoFirewall", Network.Provider.PaloAlto.getName());
|
||||
public static final NetworkDevice NiciraNvp = new NetworkDevice("NiciraNvp", Network.Provider.NiciraNvp.getName());
|
||||
public static final NetworkDevice CiscoVnmc = new NetworkDevice("CiscoVnmc", Network.Provider.CiscoVnmc.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ label.custom.disk.iops=Custom IOPS
|
|||
label.disk.iops.min=Min IOPS
|
||||
label.disk.iops.max=Max IOPS
|
||||
label.disk.iops.total=IOPS Total
|
||||
label.hypervisor.snapshot.reserve=Hypervisor Snapshot Reserve
|
||||
label.view.secondary.ips=View secondary IPs
|
||||
message.validate.invalid.characters=Invalid characters found; please correct.
|
||||
message.acquire.ip.nic=Please confirm that you would like to acquire a new secondary IP for this NIC.<br/>NOTE: You need to manually configure the newly-acquired secondary IP inside the virtual machine.
|
||||
|
|
@ -308,6 +309,7 @@ label.add.new.F5=Add new F5
|
|||
label.add.new.gateway=Add new gateway
|
||||
label.add.new.NetScaler=Add new NetScaler
|
||||
label.add.new.SRX=Add new SRX
|
||||
label.add.new.PA=Add new Palo Alto
|
||||
label.add.new.tier=Add new tier
|
||||
label.add.NiciraNvp.device=Add Nvp Controller
|
||||
label.add.physical.network=Add physical network
|
||||
|
|
@ -322,6 +324,7 @@ label.add.secondary.storage=Add Secondary Storage
|
|||
label.add.security.group=Add Security Group
|
||||
label.add.service.offering=Add Service Offering
|
||||
label.add.SRX.device=Add SRX device
|
||||
label.add.PA.device=Add Palo Alto device
|
||||
label.add.static.nat.rule=Add static NAT rule
|
||||
label.add.static.route=Add static route
|
||||
label.add.system.service.offering=Add System Service Offering
|
||||
|
|
@ -483,6 +486,7 @@ label.delete.NetScaler=Delete NetScaler
|
|||
label.delete.NiciraNvp=Remove Nvp Controller
|
||||
label.delete.project=Delete project
|
||||
label.delete.SRX=Delete SRX
|
||||
label.delete.PA=Delete Palo Alto
|
||||
label.delete.VPN.connection=delete VPN connection
|
||||
label.delete.VPN.customer.gateway=delete VPN Customer Gateway
|
||||
label.delete.VPN.gateway=delete VPN Gateway
|
||||
|
|
@ -880,6 +884,8 @@ label.os.type=OS Type
|
|||
label.owned.public.ips=Owned Public IP Addresses
|
||||
label.owner.account=Owner Account
|
||||
label.owner.domain=Owner Domain
|
||||
label.PA.log.profile=Palo Alto Log Profile
|
||||
label.PA.threat.profile=Palo Alto Threat Profile
|
||||
label.parent.domain=Parent Domain
|
||||
label.password.enabled=Password Enabled
|
||||
label.password=Password
|
||||
|
|
@ -1052,6 +1058,7 @@ label.specify.vlan=Specify VLAN
|
|||
label.specify.vxlan=Specify VXLAN
|
||||
label.SR.name = SR Name-Label
|
||||
label.srx=SRX
|
||||
label.PA=Palo Alto
|
||||
label.start.IP=Start IP
|
||||
label.start.port=Start Port
|
||||
label.start.reserved.system.IP=Start Reserved system IP
|
||||
|
|
@ -1370,6 +1377,7 @@ message.confirm.action.force.reconnect=Please confirm that you want to force rec
|
|||
message.confirm.delete.F5=Please confirm that you would like to delete F5
|
||||
message.confirm.delete.NetScaler=Please confirm that you would like to delete NetScaler
|
||||
message.confirm.delete.SRX=Please confirm that you would like to delete SRX
|
||||
message.confirm.delete.PA=Please confirm that you would like to delete Palo Alto
|
||||
message.confirm.destroy.router=Please confirm that you would like to destroy this router
|
||||
message.confirm.disable.provider=Please confirm that you would like to disable this provider
|
||||
message.confirm.enable.provider=Please confirm that you would like to enable this provider
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@
|
|||
<artifactId>cloud-plugin-network-contrail</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-palo-alto</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-ovs</artifactId>
|
||||
|
|
|
|||
|
|
@ -165,6 +165,14 @@ deleteLBHealthCheckPolicy=15
|
|||
listLoadBalancerRuleInstances=15
|
||||
updateLoadBalancerRule=15
|
||||
|
||||
##### SSL offload commands
|
||||
|
||||
uploadSslCert=15
|
||||
deleteSslCert=15
|
||||
listSslCerts=15
|
||||
assignCertToLoadBalancer=15
|
||||
removeCertFromLoadBalancer=15
|
||||
|
||||
#### autoscale commands
|
||||
createCounter=1
|
||||
createCondition=15
|
||||
|
|
@ -197,6 +205,7 @@ listRouters=7
|
|||
listVirtualRouterElements=7
|
||||
configureVirtualRouterElement=7
|
||||
createVirtualRouterElement=7
|
||||
upgradeRouterTemplate=1
|
||||
|
||||
#### system vm commands
|
||||
startSystemVm=1
|
||||
|
|
@ -533,6 +542,17 @@ configureSrxFirewall=1
|
|||
listSrxFirewalls=1
|
||||
listSrxFirewallNetworks=1
|
||||
|
||||
#### Palo Alto firewall commands
|
||||
addExternalFirewall=1
|
||||
deleteExternalFirewall=1
|
||||
listExternalFirewalls=1
|
||||
|
||||
addPaloAltoFirewall=1
|
||||
deletePaloAltoFirewall=1
|
||||
configurePaloAltoFirewall=1
|
||||
listPaloAltoFirewalls=1
|
||||
listPaloAltoFirewallNetworks=1
|
||||
|
||||
####Netapp integration commands
|
||||
createVolumeOnFiler=15
|
||||
destroyVolumeOnFiler=15
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ db.cloud.name=cloud
|
|||
db.cloud.maxActive=250
|
||||
db.cloud.maxIdle=30
|
||||
db.cloud.maxWait=10000
|
||||
db.cloud.autoReconnect=true
|
||||
db.cloud.validationQuery=SELECT 1
|
||||
db.cloud.testOnBorrow=true
|
||||
db.cloud.testWhileIdle=true
|
||||
|
|
@ -63,7 +62,6 @@ db.usage.name=cloud_usage
|
|||
db.usage.maxActive=100
|
||||
db.usage.maxIdle=30
|
||||
db.usage.maxWait=10000
|
||||
db.usage.autoReconnect=true
|
||||
db.usage.url.params=
|
||||
|
||||
# awsapi database settings
|
||||
|
|
@ -84,3 +82,25 @@ db.simulator.maxIdle=30
|
|||
db.simulator.maxWait=10000
|
||||
db.simulator.autoReconnect=true
|
||||
|
||||
|
||||
# High Availability And Cluster Properties
|
||||
db.ha.enabled=false
|
||||
# cloud stack Database
|
||||
db.cloud.slaves=localhost,localhost
|
||||
db.cloud.autoReconnect=true
|
||||
db.cloud.failOverReadOnly=false
|
||||
db.cloud.reconnectAtTxEnd=true
|
||||
db.cloud.autoReconnectForPools=true
|
||||
db.cloud.secondsBeforeRetryMaster=3600
|
||||
db.cloud.queriesBeforeRetryMaster=5000
|
||||
db.cloud.initialTimeout=3600
|
||||
|
||||
#usage Database
|
||||
db.usage.slaves=localhost,localhost
|
||||
db.usage.autoReconnect=true
|
||||
db.usage.failOverReadOnly=false
|
||||
db.usage.reconnectAtTxEnd=true
|
||||
db.usage.autoReconnectForPools=true
|
||||
db.usage.secondsBeforeRetryMaster=3600
|
||||
db.usage.queriesBeforeRetryMaster=5000
|
||||
db.usage.initialTimeout=3600
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package com.cloud.agent.api;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.agent.api.to.VolumeTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
|
||||
public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
|
||||
|
|
@ -27,4 +26,18 @@ public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
|
|||
super(vmName, snapshot, volumeTOs, guestOSType);
|
||||
}
|
||||
|
||||
public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO> volumeTOs, String guestOSType, boolean reloadVm) {
|
||||
this(vmName, snapshot, volumeTOs, guestOSType);
|
||||
setReloadVm(reloadVm);
|
||||
}
|
||||
|
||||
private boolean reloadVm = false;
|
||||
|
||||
public boolean isReloadVm() {
|
||||
return reloadVm;
|
||||
}
|
||||
|
||||
public void setReloadVm(boolean reloadVm) {
|
||||
this.reloadVm = reloadVm;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||
return host;
|
||||
}
|
||||
}
|
||||
Integer cpuSockets;
|
||||
int cpus;
|
||||
long speed;
|
||||
long memory;
|
||||
|
|
@ -133,6 +134,10 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
|
|||
_clusterVMStates = allStates;
|
||||
}
|
||||
|
||||
public Integer getCpuSockets() {
|
||||
return cpuSockets;
|
||||
}
|
||||
|
||||
public int getCpus() {
|
||||
return cpus;
|
||||
}
|
||||
|
|
@ -165,6 +170,10 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
|
|||
this.speed = speed;
|
||||
}
|
||||
|
||||
public void setCpuSockets(Integer cpuSockets) {
|
||||
this.cpuSockets = cpuSockets;
|
||||
}
|
||||
|
||||
public void setCpus(int cpus) {
|
||||
this.cpus = cpus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand {
|
|||
public String lbStatsAuth = "admin1:AdMiN123";
|
||||
public String lbStatsUri = "/admin?stats";
|
||||
public String maxconn ="";
|
||||
public String lbProtocol;
|
||||
public boolean keepAliveEnabled = false;
|
||||
NicTO nic;
|
||||
Long vpcId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
// 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.routing;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.cloud.agent.api.to.MonitorServiceTO;
|
||||
|
||||
/**
|
||||
*
|
||||
* AccessDetails allow different components to put in information about
|
||||
* how to access the components inside the command.
|
||||
*/
|
||||
public class SetMonitorServiceCommand extends NetworkElementCommand {
|
||||
MonitorServiceTO[] services;
|
||||
|
||||
protected SetMonitorServiceCommand() {
|
||||
}
|
||||
|
||||
public SetMonitorServiceCommand(List<MonitorServiceTO> services) {
|
||||
this.services = services.toArray(new MonitorServiceTO[services.size()]);
|
||||
}
|
||||
|
||||
public MonitorServiceTO[] getRules() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public String getConfiguration() {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (MonitorServiceTO service: services) {
|
||||
sb.append("[").append(service.getService()).append("]").append(":");
|
||||
sb.append("processname=").append(service.getProcessname()).append(":");
|
||||
sb.append("servicename=").append(service.getServiceName()).append(":");
|
||||
sb.append("pidfile=").append(service.getPidFile()).append(":");
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -818,6 +818,12 @@ public class VirtualRoutingResource implements Manager {
|
|||
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
|
||||
}
|
||||
|
||||
public String configureMonitor(final String routerIP, final String config) {
|
||||
|
||||
String args= " -c " + config;
|
||||
return routerProxy("monitor_service.sh", routerIP, args);
|
||||
}
|
||||
|
||||
public String assignGuestNetwork(final String dev, final String routerIP,
|
||||
final String routerGIP, final String gateway, final String cidr,
|
||||
final String netmask, final String dns, final String domainName) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class SnapshotObjectTO implements DataTO {
|
|||
private String name;
|
||||
private HypervisorType hypervisorType;
|
||||
private long id;
|
||||
private boolean quiescevm;
|
||||
|
||||
public SnapshotObjectTO() {
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ public class SnapshotObjectTO implements DataTO {
|
|||
this.dataStore = snapshot.getDataStore().getTO();
|
||||
this.setName(snapshot.getName());
|
||||
this.hypervisorType = snapshot.getHypervisorType();
|
||||
this.quiescevm = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -129,6 +131,14 @@ public class SnapshotObjectTO implements DataTO {
|
|||
this.hypervisorType = hypervisorType;
|
||||
}
|
||||
|
||||
public boolean getquiescevm() {
|
||||
return this.quiescevm;
|
||||
}
|
||||
|
||||
public void setQuiescevm(boolean quiescevm) {
|
||||
this.quiescevm = quiescevm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder("SnapshotTO[datastore=").append(dataStore).append("|volume=").append(volume).append("|path")
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ public class CheckOnHostCommandTest {
|
|||
|
||||
public Long getTotalMemory() {
|
||||
return 100000000000L;
|
||||
}
|
||||
|
||||
public Integer getCpuSockets() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
public Integer getCpus() {
|
||||
|
|
@ -289,6 +293,12 @@ public class CheckOnHostCommandTest {
|
|||
assertTrue(m == 100000000000L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCpuSockets() {
|
||||
Integer cpuSockets = host.getCpuSockets();
|
||||
assertTrue(cpuSockets == 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCpus() {
|
||||
int cpus = host.getCpus();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ if [ "$1" = configure ]; then
|
|||
|
||||
OLDCONFDIR="/etc/cloud/management"
|
||||
NEWCONFDIR="/etc/cloudstack/management"
|
||||
CONFFILES="db.properties cloud.keystore key"
|
||||
CONFFILES="db.properties key"
|
||||
|
||||
# Copy old configuration so the admin doesn't have to do that
|
||||
# Only do so when we are installing for the first time
|
||||
|
|
@ -45,6 +45,9 @@ if [ "$1" = configure ]; then
|
|||
cp -a $OLDCONFDIR/$FILE $NEWCONFDIR/$FILE
|
||||
fi
|
||||
done
|
||||
if [ -f "$OLDCONFDIR/cloud.keystore" ]; then
|
||||
cp -a $OLDCONFDIR/cloud.keystore $NEWCONFDIR/cloudmanagementserver.keystore
|
||||
fi
|
||||
fi
|
||||
|
||||
chmod 0640 /etc/cloudstack/management/db.properties
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ import com.cloud.utils.fsm.NoTransitionException;
|
|||
* Manages allocating resources to vms.
|
||||
*/
|
||||
public interface VirtualMachineManager extends Manager {
|
||||
|
||||
|
||||
public interface Topics {
|
||||
public static final String VM_POWER_STATE = "vm.powerstate";
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a new virtual machine instance in the CloudStack DB. This
|
||||
* orchestrates the creation of all virtual resources needed in CloudStack
|
||||
|
|
|
|||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.engine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* Rules specifies all rules about developing and using CloudStack Orchestration
|
||||
* Platforms APIs. This class is not actually used in CloudStack Orchestration
|
||||
* Platform but must be read by all who wants to use and develop against
|
||||
* CloudStack Orchestration Platform.
|
||||
*
|
||||
* Make sure to make changes here when there are changes to how the APIs should
|
||||
* be used and developed.
|
||||
*
|
||||
* Changes to this class must be approved by the maintainer of this project.
|
||||
*
|
||||
*/
|
||||
public class Rules {
|
||||
public static List<String> whenUsing() {
|
||||
List<String> rules = new ArrayList<String>();
|
||||
rules.add("Always be prepared to handle RuntimeExceptions.");
|
||||
return rules;
|
||||
}
|
||||
|
||||
public static List<String> whenWritingNewApis() {
|
||||
List<String> rules = new ArrayList<String>();
|
||||
rules.add("You may think you're the greatest developer in the " +
|
||||
"world but every change to the API must be reviewed and approved. ");
|
||||
rules.add("Every API must have unit tests written against it. And not it's unit tests");
|
||||
rules.add("");
|
||||
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
private static void printRule(String rule) {
|
||||
System.out.print("API Rule: ");
|
||||
String skip = "";
|
||||
int brk = 0;
|
||||
while (true) {
|
||||
int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' ');
|
||||
if (stop < 0) {
|
||||
break;
|
||||
}
|
||||
System.out.print(skip);
|
||||
skip = " ";
|
||||
System.out.println(rule.substring(brk, stop).trim());
|
||||
brk = stop;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:");
|
||||
for (String rule : whenUsing()) {
|
||||
printRule(rule);
|
||||
}
|
||||
System.out.println("");
|
||||
System.out.println("When writing APIs, you must follow these rules:");
|
||||
for (String rule : whenWritingNewApis()) {
|
||||
printRule(rule);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public interface VolumeOrchestrationService {
|
|||
|
||||
boolean canVmRestartOnAnotherServer(long vmId);
|
||||
|
||||
DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, VirtualMachineTemplate template, VirtualMachine vm, Account owner);
|
||||
DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, Long rootDisksize, VirtualMachineTemplate template, VirtualMachine vm, Account owner);
|
||||
|
||||
String getVmNameFromVolumeId(long volumeId);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public interface OrchestrationService {
|
|||
* @param computeTags tags for the compute
|
||||
* @param rootDiskTags tags for the root disk
|
||||
* @param networks networks that this VM should join
|
||||
* @param rootDiskSize size the root disk in case of templates.
|
||||
* @return VirtualMachineEntity
|
||||
*/
|
||||
@POST
|
||||
|
|
@ -73,7 +74,8 @@ public interface OrchestrationService {
|
|||
@QueryParam("compute-tags") List<String> computeTags,
|
||||
@QueryParam("root-disk-tags") List<String> rootDiskTags,
|
||||
@QueryParam("network-nic-map") Map<String, NicProfile> networkNicMap,
|
||||
@QueryParam("deploymentplan") DeploymentPlan plan
|
||||
@QueryParam("deploymentplan") DeploymentPlan plan,
|
||||
@QueryParam("root-disk-size") Long rootDiskSize
|
||||
) throws InsufficientCapacityException;
|
||||
|
||||
@POST
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public interface DataStoreProvider {
|
|||
static final String S3_IMAGE = "S3";
|
||||
static final String SWIFT_IMAGE = "Swift";
|
||||
static final String SAMPLE_IMAGE = "Sample";
|
||||
|
||||
static final String SMB = "NFS";
|
||||
static final String DEFAULT_PRIMARY = "DefaultPrimary";
|
||||
|
||||
static enum DataStoreProviderType {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public interface SnapshotInfo extends DataObject, Snapshot {
|
|||
VolumeInfo getBaseVolume();
|
||||
|
||||
void addPayload(Object data);
|
||||
Object getPayload();
|
||||
|
||||
Long getDataCenterId();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ import com.cloud.vm.VirtualMachineProfile;
|
|||
public interface StoragePoolAllocator extends Adapter {
|
||||
/**
|
||||
* Determines which storage pools are suitable for the guest virtual machine
|
||||
* and returns a list of pools suitable.
|
||||
*
|
||||
* Allocators must set any other pools not considered for allocation in the
|
||||
* ExcludeList avoid. Thus the avoid set and the list of pools suitable,
|
||||
* together must cover the entire pool set in the cluster.
|
||||
*
|
||||
* @param DiskProfile
|
||||
* dskCh
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.event.dao.UsageEventDetailsDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
|
|
@ -38,6 +39,8 @@ import com.cloud.event.dao.UsageEventDao;
|
|||
import com.cloud.user.Account;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import org.springframework.beans.factory.annotation.Autowire;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class UsageEventUtils {
|
||||
|
||||
|
|
@ -103,6 +106,19 @@ public class UsageEventUtils {
|
|||
publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID);
|
||||
}
|
||||
|
||||
public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId,
|
||||
String resourceName, Long offeringId, Long templateId, String resourceType,
|
||||
String entityType, String entityUUID, Map<String, String> details) {
|
||||
saveUsageEvent(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType, details);
|
||||
publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID);
|
||||
}
|
||||
|
||||
private static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType, Map<String,String> details) {
|
||||
UsageEventVO usageEvent = new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType);
|
||||
_usageEventDao.persist(usageEvent);
|
||||
_usageEventDao.saveDetails(usageEvent.getId(), details);
|
||||
}
|
||||
|
||||
public static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, Long size) {
|
||||
_usageEventDao.persist( new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, size));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
|
||||
import com.cloud.network.lb.LoadBalancingRule.LbSslCert;
|
||||
import com.cloud.network.rules.LbStickinessMethod;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.network.rules.LoadBalancerContainer.Scheme;
|
||||
|
|
@ -33,7 +34,8 @@ import com.cloud.user.Account;
|
|||
public interface LoadBalancingRulesManager {
|
||||
|
||||
LoadBalancer createPublicLoadBalancer(String xId, String name, String description,
|
||||
int srcPort, int destPort, long sourceIpId, String protocol, String algorithm, boolean openFirewall, CallContext caller)
|
||||
int srcPort, int destPort, long sourceIpId, String protocol, String algorithm,
|
||||
boolean openFirewall, CallContext caller, String lbProtocol)
|
||||
throws NetworkRuleConflictException;
|
||||
|
||||
boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId);
|
||||
|
|
@ -42,6 +44,7 @@ public interface LoadBalancingRulesManager {
|
|||
List<LbStickinessPolicy> getStickinessPolicies(long lbId);
|
||||
List<LbStickinessMethod> getStickinessMethods(long networkid);
|
||||
List<LbHealthCheckPolicy> getHealthCheckPolicies(long lbId);
|
||||
LbSslCert getLbSslCert(long lbId);
|
||||
|
||||
/**
|
||||
* Remove vm from all load balancers
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
} else if (template.getFormat() == ImageFormat.BAREMETAL) {
|
||||
// Do nothing
|
||||
} else {
|
||||
volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), template, vmFinal, owner);
|
||||
volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), template, vmFinal, owner);
|
||||
}
|
||||
|
||||
for (Map.Entry<? extends DiskOffering, Long> offering : dataDiskOfferingsFinal.entrySet()) {
|
||||
|
|
@ -674,7 +674,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
ItWorkVO work = start.third();
|
||||
|
||||
VMInstanceVO startedVm = null;
|
||||
ServiceOfferingVO offering = _offeringDao.findById(vm.getServiceOfferingId());
|
||||
ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
|
||||
VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, vm.getTemplateId());
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
@ -2771,7 +2771,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
|
||||
@Override
|
||||
public void checkIfCanUpgrade(VirtualMachine vmInstance, long newServiceOfferingId) {
|
||||
ServiceOfferingVO newServiceOffering = _offeringDao.findById(newServiceOfferingId);
|
||||
ServiceOfferingVO newServiceOffering = _offeringDao.findById(vmInstance.getId(), newServiceOfferingId);
|
||||
if (newServiceOffering == null) {
|
||||
throw new InvalidParameterValueException("Unable to find a service offering with id " + newServiceOfferingId);
|
||||
}
|
||||
|
|
@ -2793,7 +2793,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
newServiceOffering.getName() + ")");
|
||||
}
|
||||
|
||||
ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
|
||||
ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
|
||||
|
||||
// Check that the service offering being upgraded to has the same Guest IP type as the VM's current service offering
|
||||
// NOTE: With the new network refactoring in 2.2, we shouldn't need the check for same guest IP type anymore.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.HostVmStateReportEntry;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
|
||||
public interface VirtualMachinePowerStateSync {
|
||||
|
||||
void resetHostSyncState(long hostId);
|
||||
|
||||
void processHostVmStateReport(long hostId, Map<String, HostVmStateReportEntry> report);
|
||||
|
||||
// to adapt legacy ping report
|
||||
void processHostVmStatePingReport(long hostId, Map<String, PowerState> report);
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
// 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.messagebus.MessageBus;
|
||||
import org.apache.cloudstack.framework.messagebus.PublishScope;
|
||||
|
||||
import com.cloud.agent.api.HostVmStateReportEntry;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStateSync {
|
||||
private static final Logger s_logger = Logger.getLogger(VirtualMachinePowerStateSyncImpl.class);
|
||||
|
||||
@Inject MessageBus _messageBus;
|
||||
@Inject VMInstanceDao _instanceDao;
|
||||
@Inject VirtualMachineManager _vmMgr;
|
||||
|
||||
public VirtualMachinePowerStateSyncImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetHostSyncState(long hostId) {
|
||||
s_logger.info("Reset VM power state sync for host: " + hostId);
|
||||
_instanceDao.resetHostPowerStateTracking(hostId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportEntry> report) {
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("Process host VM state report from ping process. host: " + hostId);
|
||||
|
||||
Map<Long, VirtualMachine.PowerState> translatedInfo = convertToInfos(report);
|
||||
processReport(hostId, translatedInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processHostVmStatePingReport(long hostId, Map<String, PowerState> report) {
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("Process host VM state report from ping process. host: " + hostId);
|
||||
|
||||
Map<Long, VirtualMachine.PowerState> translatedInfo = convertHostPingInfos(report);
|
||||
processReport(hostId, translatedInfo);
|
||||
}
|
||||
|
||||
private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo) {
|
||||
|
||||
for(Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) {
|
||||
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
|
||||
|
||||
if(_instanceDao.updatePowerState(entry.getKey(), hostId, entry.getValue())) {
|
||||
|
||||
if(s_logger.isDebugEnabled())
|
||||
s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue());
|
||||
|
||||
_messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Long, VirtualMachine.PowerState> convertHostPingInfos(Map<String, PowerState> states) {
|
||||
final HashMap<Long, VirtualMachine.PowerState> map = new HashMap<Long, VirtualMachine.PowerState>();
|
||||
if (states == null) {
|
||||
return map;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, PowerState> entry : states.entrySet()) {
|
||||
VMInstanceVO vm = findVM(entry.getKey());
|
||||
if(vm != null) {
|
||||
map.put(vm.getId(), entry.getValue());
|
||||
break;
|
||||
} else {
|
||||
s_logger.info("Unable to find matched VM in CloudStack DB. name: " + entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<Long, VirtualMachine.PowerState> convertToInfos(Map<String, HostVmStateReportEntry> states) {
|
||||
final HashMap<Long, VirtualMachine.PowerState> map = new HashMap<Long, VirtualMachine.PowerState>();
|
||||
if (states == null) {
|
||||
return map;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, HostVmStateReportEntry> entry : states.entrySet()) {
|
||||
VMInstanceVO vm = findVM(entry.getKey());
|
||||
if(vm != null) {
|
||||
map.put(vm.getId(), entry.getValue().getState());
|
||||
break;
|
||||
} else {
|
||||
s_logger.info("Unable to find matched VM in CloudStack DB. name: " + entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private VMInstanceVO findVM(String vmName) {
|
||||
return _instanceDao.findVMByInstanceName(vmName);
|
||||
}
|
||||
}
|
||||
|
|
@ -325,6 +325,9 @@ public class EngineHostVO implements EngineHost, Identity {
|
|||
@Column(name="pod_id")
|
||||
private Long podId;
|
||||
|
||||
@Column(name="cpu_sockets")
|
||||
private Integer cpuSockets;
|
||||
|
||||
@Column(name="cpus")
|
||||
private Integer cpus;
|
||||
|
||||
|
|
@ -648,6 +651,11 @@ public class EngineHostVO implements EngineHost, Identity {
|
|||
this.guid = guid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCpuSockets() {
|
||||
return cpuSockets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCpus() {
|
||||
return cpus;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
Long diskSize,
|
||||
List<String> computeTags,
|
||||
List<String> rootDiskTags,
|
||||
Map<String, NicProfile> networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException {
|
||||
Map<String, NicProfile> networkNicMap, DeploymentPlan plan, Long rootDiskSize) throws InsufficientCapacityException {
|
||||
|
||||
// VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager);
|
||||
|
||||
|
|
@ -191,8 +191,9 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
Pair<DiskOfferingVO, Long> rootDiskOffering = new Pair<DiskOfferingVO, Long>(null, null);
|
||||
LinkedHashMap<DiskOfferingVO, Long> dataDiskOfferings = new LinkedHashMap<DiskOfferingVO, Long>();
|
||||
|
||||
ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId());
|
||||
ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
|
||||
rootDiskOffering.first(offering);
|
||||
rootDiskOffering.second(rootDiskSize);
|
||||
|
||||
if(vm.getDiskOfferingId() != null){
|
||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(vm.getDiskOfferingId());
|
||||
|
|
@ -238,7 +239,7 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
VMInstanceVO vm = _vmDao.findByUuid(id);
|
||||
|
||||
Pair<DiskOffering, Long> rootDiskOffering = new Pair<DiskOffering, Long>(null, null);
|
||||
ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId());
|
||||
ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
|
||||
rootDiskOffering.first(offering);
|
||||
|
||||
LinkedHashMap<DiskOffering, Long> dataDiskOfferings = new LinkedHashMap<DiskOffering, Long>();
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
AsyncCallFuture<VolumeApiResult> future = null;
|
||||
boolean isNotCreatedFromTemplate = volume.getTemplateId() == null ? true : false;
|
||||
if (isNotCreatedFromTemplate) {
|
||||
volume = updateHypervisorSnapshotReserveForVolume(diskOffering, volume, hyperType);
|
||||
future = volService.createVolumeAsync(volume, store);
|
||||
} else {
|
||||
TemplateInfo templ = tmplFactory.getTemplate(template.getId(), DataStoreRole.Image);
|
||||
|
|
@ -435,6 +436,29 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
throw new CloudRuntimeException("create volume failed even after template re-deploy");
|
||||
}
|
||||
|
||||
// For managed storage on Xen and VMware, we need to potentially make space for hypervisor snapshots.
|
||||
// The disk offering can collect this information and pass it on to the volume that's about to be created.
|
||||
// Ex. if you want a 10 GB CloudStack volume to reside on managed storage on Xen, this leads to an SR
|
||||
// that is a total size of (10 GB * (hypervisorSnapshotReserveSpace / 100) + 10 GB).
|
||||
private VolumeInfo updateHypervisorSnapshotReserveForVolume(DiskOffering diskOffering, VolumeInfo volumeInfo, HypervisorType hyperType) {
|
||||
Integer hypervisorSnapshotReserve = diskOffering.getHypervisorSnapshotReserve();
|
||||
|
||||
if (hyperType == HypervisorType.KVM) {
|
||||
hypervisorSnapshotReserve = null;
|
||||
}
|
||||
else if (hypervisorSnapshotReserve == null || hypervisorSnapshotReserve < 0) {
|
||||
hypervisorSnapshotReserve = 0;
|
||||
}
|
||||
|
||||
VolumeVO volume = _volsDao.findById(volumeInfo.getId());
|
||||
|
||||
volume.setHypervisorSnapshotReserve(hypervisorSnapshotReserve);
|
||||
|
||||
_volsDao.update(volume.getId(), volume);
|
||||
|
||||
return volFactory.getVolume(volume.getId());
|
||||
}
|
||||
|
||||
public String getRandomVolumeName() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -562,11 +586,13 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
}
|
||||
|
||||
@Override
|
||||
public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, VirtualMachineTemplate template, VirtualMachine vm, Account owner) {
|
||||
public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, Long rootDisksize, VirtualMachineTemplate template, VirtualMachine vm, Account owner) {
|
||||
assert (template.getFormat() != ImageFormat.ISO) : "ISO is not a template really....";
|
||||
|
||||
Long size = _tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
|
||||
|
||||
if (rootDisksize != null) {
|
||||
size = (rootDisksize * 1024 * 1024 * 1024);
|
||||
}
|
||||
VolumeVO vol = new VolumeVO(type,
|
||||
name,
|
||||
vm.getDataCenterId(),
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@
|
|||
<bean id="externalPublicIpStatisticsDaoImpl" class="com.cloud.usage.dao.ExternalPublicIpStatisticsDaoImpl" />
|
||||
<bean id="firewallRulesCidrsDaoImpl" class="com.cloud.network.dao.FirewallRulesCidrsDaoImpl" />
|
||||
<bean id="firewallRulesDaoImpl" class="com.cloud.network.dao.FirewallRulesDaoImpl" />
|
||||
<bean id="MonitoringServiceDaoImpl" class="com.cloud.network.dao.MonitoringServiceDaoImpl" />
|
||||
<bean id="globalLoadBalancerDaoImpl" class="org.apache.cloudstack.region.gslb.GlobalLoadBalancerDaoImpl" />
|
||||
<bean id="globalLoadBalancerLbRuleMapDaoImpl" class="org.apache.cloudstack.region.gslb.GlobalLoadBalancerLbRuleMapDaoImpl" />
|
||||
<bean id="guestOSCategoryDaoImpl" class="com.cloud.storage.dao.GuestOSCategoryDaoImpl" />
|
||||
|
|
@ -188,6 +189,7 @@
|
|||
<bean id="launchPermissionDaoImpl" class="com.cloud.storage.dao.LaunchPermissionDaoImpl" />
|
||||
<bean id="loadBalancerDaoImpl" class="com.cloud.network.dao.LoadBalancerDaoImpl" />
|
||||
<bean id="loadBalancerVMMapDaoImpl" class="com.cloud.network.dao.LoadBalancerVMMapDaoImpl" />
|
||||
<bean id="loadBalancerCertMapDaoImpl" class="com.cloud.network.dao.LoadBalancerCertMapDaoImpl" />
|
||||
<bean id="managementServerHostDaoImpl" class="com.cloud.cluster.dao.ManagementServerHostDaoImpl" />
|
||||
<bean id="managementServerHostPeerDaoImpl" class="com.cloud.cluster.dao.ManagementServerHostPeerDaoImpl" />
|
||||
<bean id="networkAccountDaoImpl" class="com.cloud.network.dao.NetworkAccountDaoImpl" />
|
||||
|
|
@ -251,6 +253,7 @@
|
|||
<bean id="snapshotDaoImpl" class="com.cloud.storage.dao.SnapshotDaoImpl" />
|
||||
<bean id="snapshotPolicyDaoImpl" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl" />
|
||||
<bean id="snapshotScheduleDaoImpl" class="com.cloud.storage.dao.SnapshotScheduleDaoImpl" />
|
||||
<bean id="sslCertDao" class="com.cloud.network.dao.SslCertDaoImpl" />
|
||||
<bean id="staticRouteDaoImpl" class="com.cloud.network.vpc.dao.StaticRouteDaoImpl" />
|
||||
<bean id="storageNetworkIpAddressDaoImpl" class="com.cloud.dc.dao.StorageNetworkIpAddressDaoImpl" />
|
||||
<bean id="storageNetworkIpRangeDaoImpl" class="com.cloud.dc.dao.StorageNetworkIpRangeDaoImpl" />
|
||||
|
|
@ -262,6 +265,7 @@
|
|||
<bean id="uploadDaoImpl" class="com.cloud.storage.dao.UploadDaoImpl" />
|
||||
<bean id="usageDaoImpl" class="com.cloud.usage.dao.UsageDaoImpl" />
|
||||
<bean id="usageEventDaoImpl" class="com.cloud.event.dao.UsageEventDaoImpl" />
|
||||
<bean id="usageEventDetailsDaoImpl" class="com.cloud.event.dao.UsageEventDetailsDaoImpl" />
|
||||
<bean id="usageIPAddressDaoImpl" class="com.cloud.usage.dao.UsageIPAddressDaoImpl" />
|
||||
<bean id="usageJobDaoImpl" class="com.cloud.usage.dao.UsageJobDaoImpl" />
|
||||
<bean id="usageLoadBalancerPolicyDaoImpl" class="com.cloud.usage.dao.UsageLoadBalancerPolicyDaoImpl" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.event;
|
||||
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="usage_event_details")
|
||||
public class UsageEventDetailsVO {
|
||||
|
||||
@Id
|
||||
@Column(name="id")
|
||||
long id;
|
||||
|
||||
@Column(name = "usage_event_id", nullable = false)
|
||||
long usageEventId;
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
String key;
|
||||
|
||||
@Column(name = "value")
|
||||
String value;
|
||||
|
||||
public UsageEventDetailsVO() {
|
||||
}
|
||||
|
||||
|
||||
public UsageEventDetailsVO(long usageEventId, String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.usageEventId = usageEventId;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setUsageEventId(long usageEventId) {
|
||||
this.usageEventId = usageEventId;
|
||||
}
|
||||
|
||||
public long getUsageEventId() {
|
||||
return usageEventId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ package com.cloud.event.dao;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.event.UsageEventVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
|
@ -32,4 +33,6 @@ public interface UsageEventDao extends GenericDao<UsageEventVO, Long> {
|
|||
|
||||
List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId);
|
||||
|
||||
void saveDetails(long eventId, Map<String, String> details);
|
||||
|
||||
}
|
||||
|
|
@ -20,9 +20,11 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -51,7 +53,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
|
|||
private static final String COPY_ALL_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) " +
|
||||
"SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
|
||||
private static final String MAX_EVENT = "select max(id) from cloud.usage_event where created <= ?";
|
||||
|
||||
@Inject protected UsageEventDetailsDao usageEventDetailsDao;
|
||||
|
||||
public UsageEventDaoImpl () {
|
||||
latestEventsSearch = createSearchBuilder();
|
||||
|
|
@ -184,4 +186,9 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
|
|||
return listBy(sc, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDetails(long eventId, Map<String, String> details) {
|
||||
usageEventDetailsDao.persist(eventId, details);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package com.cloud.event.dao;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.event.UsageEventDetailsVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
|
||||
public interface UsageEventDetailsDao extends GenericDao<UsageEventDetailsVO, Long> {
|
||||
Map<String, String> findDetails(long eventId);
|
||||
|
||||
void persist(long eventId, Map<String, String> details);
|
||||
|
||||
UsageEventDetailsVO findDetail(long eventId, String key);
|
||||
|
||||
void deleteDetails(long eventId);
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.event.dao;
|
||||
|
||||
import com.cloud.event.UsageEventDetailsVO;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Local(value={UsageEventDetailsDao.class})
|
||||
public class UsageEventDetailsDaoImpl extends GenericDaoBase<UsageEventDetailsVO, Long> implements UsageEventDetailsDao {
|
||||
public static final Logger s_logger = Logger.getLogger(UsageEventDetailsDaoImpl.class.getName());
|
||||
|
||||
protected final SearchBuilder<UsageEventDetailsVO> EventDetailsSearch;
|
||||
protected final SearchBuilder<UsageEventDetailsVO> DetailSearch;
|
||||
|
||||
public UsageEventDetailsDaoImpl() {
|
||||
|
||||
EventDetailsSearch =createSearchBuilder();
|
||||
EventDetailsSearch.and("eventId", EventDetailsSearch.entity().getUsageEventId(), SearchCriteria.Op.EQ);
|
||||
EventDetailsSearch.done();
|
||||
|
||||
DetailSearch = createSearchBuilder();
|
||||
DetailSearch.and("eventId", DetailSearch.entity().getUsageEventId(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.and("key", DetailSearch.entity().getKey(), SearchCriteria.Op.EQ);
|
||||
DetailSearch.done();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDetails(long eventId) {
|
||||
SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
|
||||
sc.setParameters("eventId", eventId);
|
||||
|
||||
List<UsageEventDetailsVO> results = search(sc, null);
|
||||
for (UsageEventDetailsVO result : results) {
|
||||
remove(result.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsageEventDetailsVO findDetail(long eventId, String key) {
|
||||
SearchCriteria<UsageEventDetailsVO> sc = DetailSearch.create();
|
||||
sc.setParameters("eventId", eventId);
|
||||
sc.setParameters("key", key);
|
||||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> findDetails(long eventId) {
|
||||
SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
|
||||
sc.setParameters("eventId", eventId);
|
||||
|
||||
List<UsageEventDetailsVO> results = search(sc, null);
|
||||
Map<String, String> details = new HashMap<String, String>(results.size());
|
||||
for (UsageEventDetailsVO result : results) {
|
||||
details.put(result.getKey(), result.getValue());
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(long eventId, Map<String, String> details) {
|
||||
TransactionLegacy txn = TransactionLegacy.currentTxn();
|
||||
txn.start();
|
||||
SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
|
||||
sc.setParameters("eventId", eventId);
|
||||
expunge(sc);
|
||||
|
||||
for (Map.Entry<String, String> detail : details.entrySet()) {
|
||||
UsageEventDetailsVO vo = new UsageEventDetailsVO(eventId, detail.getKey(), detail.getValue());
|
||||
persist(vo);
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -321,6 +321,9 @@ public class HostVO implements Host {
|
|||
@Column(name="pod_id")
|
||||
private Long podId;
|
||||
|
||||
@Column(name="cpu_sockets")
|
||||
private Integer cpuSockets;
|
||||
|
||||
@Column(name="cpus")
|
||||
private Integer cpus;
|
||||
|
||||
|
|
@ -501,6 +504,10 @@ public class HostVO implements Host {
|
|||
this.privateIpAddress = ipAddress;
|
||||
}
|
||||
|
||||
public void setCpuSockets(Integer cpuSockets) {
|
||||
this.cpuSockets = cpuSockets;
|
||||
}
|
||||
|
||||
public void setCpus(Integer cpus) {
|
||||
this.cpus = cpus;
|
||||
}
|
||||
|
|
@ -621,6 +628,11 @@ public class HostVO implements Host {
|
|||
this.guid = guid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCpuSockets() {
|
||||
return cpuSockets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCpus() {
|
||||
return cpus;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import com.cloud.network.LBHealthCheckPolicyVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface LoadBalancerCertMapDao extends GenericDao<LoadBalancerCertMapVO,Long> {
|
||||
List<LoadBalancerCertMapVO> listByCertId(Long certId);
|
||||
List<LoadBalancerCertMapVO> listByAccountId(Long accountId);
|
||||
LoadBalancerCertMapVO findByLbRuleId(Long id);
|
||||
}
|
||||
|
|
@ -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 com.cloud.network.dao;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
@Local(value = {LoadBalancerCertMapDao.class})
|
||||
public class LoadBalancerCertMapDaoImpl extends GenericDaoBase<LoadBalancerCertMapVO, Long> implements LoadBalancerCertMapDao {
|
||||
|
||||
private final SearchBuilder<LoadBalancerCertMapVO> listByCertId;
|
||||
private final SearchBuilder<LoadBalancerCertMapVO> findByLbRuleId;
|
||||
|
||||
|
||||
@Inject SslCertDao _sslCertDao;
|
||||
|
||||
public LoadBalancerCertMapDaoImpl() {
|
||||
|
||||
listByCertId = createSearchBuilder();
|
||||
listByCertId.and("certificateId", listByCertId.entity().getCertId(), SearchCriteria.Op.EQ);
|
||||
listByCertId.done();
|
||||
|
||||
findByLbRuleId = createSearchBuilder();
|
||||
findByLbRuleId.and("loadBalancerId", findByLbRuleId.entity().getLbId(), SearchCriteria.Op.EQ);
|
||||
findByLbRuleId.done();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoadBalancerCertMapVO> listByCertId(Long certId) {
|
||||
SearchCriteria<LoadBalancerCertMapVO> sc = listByCertId.create();
|
||||
sc.setParameters("certificateId", certId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoadBalancerCertMapVO findByLbRuleId(Long LbId) {
|
||||
SearchCriteria<LoadBalancerCertMapVO> sc = findByLbRuleId.create();
|
||||
sc.setParameters("loadBalancerId", LbId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoadBalancerCertMapVO> listByAccountId(Long accountId) {
|
||||
|
||||
SearchBuilder<LoadBalancerCertMapVO> listByAccountId;
|
||||
SearchBuilder<SslCertVO> certsForAccount;
|
||||
|
||||
listByAccountId = createSearchBuilder();
|
||||
certsForAccount = _sslCertDao.createSearchBuilder();
|
||||
certsForAccount.and("accountId", certsForAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
listByAccountId.join("certsForAccount", certsForAccount, certsForAccount.entity().getId(), listByAccountId.entity().getLbId(), JoinBuilder.JoinType.INNER);
|
||||
certsForAccount.done();
|
||||
listByAccountId.done();
|
||||
|
||||
SearchCriteria<LoadBalancerCertMapVO> sc = listByAccountId.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.dao;
|
||||
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="load_balancer_cert_map")
|
||||
public class LoadBalancerCertMapVO implements InternalIdentity {
|
||||
|
||||
@Id
|
||||
@Column(name="id")
|
||||
private Long id;
|
||||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name="load_balancer_id")
|
||||
private Long lbId;
|
||||
|
||||
@Column(name="certificate_id")
|
||||
private Long certId;
|
||||
|
||||
@Column(name="revoke")
|
||||
private boolean revoke = false;
|
||||
|
||||
|
||||
public LoadBalancerCertMapVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public LoadBalancerCertMapVO(Long lbId, Long certId, boolean revoke) {
|
||||
|
||||
this.lbId = lbId;
|
||||
this.certId = certId;
|
||||
this.revoke = revoke;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
// Getters
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public Long getLbId() {
|
||||
return lbId;
|
||||
}
|
||||
|
||||
public Long getCertId() {
|
||||
return certId;
|
||||
}
|
||||
|
||||
public boolean isRevoke() {
|
||||
return revoke;
|
||||
}
|
||||
|
||||
//Setters
|
||||
public void setLbId(Long lbId) {
|
||||
this.lbId = lbId;
|
||||
}
|
||||
|
||||
public void setCertId(Long certId) {
|
||||
this.certId = certId;
|
||||
}
|
||||
|
||||
public void setRevoke(boolean revoke) {
|
||||
this.revoke = revoke;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,10 +59,15 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
@Column(name="scheme")
|
||||
Scheme scheme = Scheme.Public;
|
||||
|
||||
@Column(name="lb_protocol")
|
||||
String lbProtocol;
|
||||
|
||||
|
||||
public LoadBalancerVO() {
|
||||
}
|
||||
|
||||
public LoadBalancerVO(String xId, String name, String description, long srcIpId, int srcPort, int dstPort, String algorithm, long networkId, long accountId, long domainId) {
|
||||
public LoadBalancerVO(String xId, String name, String description, long srcIpId, int srcPort, int dstPort, String algorithm, long networkId,
|
||||
long accountId, long domainId, String lbProtocol) {
|
||||
super(xId, srcIpId, srcPort, NetUtils.TCP_PROTO, networkId, accountId, domainId, Purpose.LoadBalancing, null, null, null, null);
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
|
|
@ -70,6 +75,7 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
this.defaultPortStart = dstPort;
|
||||
this.defaultPortEnd = dstPort;
|
||||
this.scheme = Scheme.Public;
|
||||
this.lbProtocol = lbProtocol;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -101,6 +107,14 @@ public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLbProtocol(){
|
||||
return lbProtocol;
|
||||
}
|
||||
|
||||
public void setLbProtocol(String lbProtocol){
|
||||
this.lbProtocol = lbProtocol;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MonitoringServiceDao extends GenericDao<MonitoringServiceVO, Long> {
|
||||
|
||||
List<MonitoringServiceVO> listAllServices();
|
||||
List<MonitoringServiceVO> listDefaultServices(boolean isDefault);
|
||||
|
||||
MonitoringServiceVO getServiceByName(String service);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
// 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.network.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Local(value=MonitoringServiceDao.class)
|
||||
public class MonitoringServiceDaoImpl extends GenericDaoBase<MonitoringServiceVO, Long> implements MonitoringServiceDao {
|
||||
private final SearchBuilder<MonitoringServiceVO> AllFieldsSearch;
|
||||
|
||||
public MonitoringServiceDaoImpl() {
|
||||
super();
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultService(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("processname", AllFieldsSearch.entity().getProcessname(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("servicename", AllFieldsSearch.entity().getServiceName(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("servicepath", AllFieldsSearch.entity().getServicePath(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("servicePidFile", AllFieldsSearch.entity().getPidFile(), SearchCriteria.Op.EQ);
|
||||
|
||||
AllFieldsSearch.done();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<MonitoringServiceVO> listAllServices() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MonitoringServiceVO> listDefaultServices(boolean isDefault) {
|
||||
SearchCriteria<MonitoringServiceVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("isDefault", isDefault);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonitoringServiceVO getServiceByName(String service) {
|
||||
SearchCriteria<MonitoringServiceVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("service", service);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
// 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.network.dao;
|
||||
|
||||
import com.cloud.network.MonitoringService;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "monitoring_services")
|
||||
public class MonitoringServiceVO implements MonitoringService {
|
||||
|
||||
public MonitoringServiceVO(String service, String processname, String serviceName, String servicePath,
|
||||
String pidFile, boolean defaultService) {
|
||||
this.service = service;
|
||||
this.processname = processname;
|
||||
this.servicename = serviceName;
|
||||
this.servicePath = servicePath;
|
||||
this.servicePidFile= pidFile;
|
||||
this.defaultService = defaultService;
|
||||
|
||||
}
|
||||
|
||||
protected MonitoringServiceVO() {
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
long id;
|
||||
|
||||
@Column(name = "service")
|
||||
String service;
|
||||
|
||||
@Column(name="process_name", updatable=false)
|
||||
String processname;
|
||||
|
||||
@Column(name="service_name", updatable=false)
|
||||
String servicename;
|
||||
|
||||
@Column(name="service_path", updatable=false)
|
||||
private String servicePath;
|
||||
|
||||
@Column(name="pidFile", updatable=false)
|
||||
private String servicePidFile;
|
||||
|
||||
@Column(name="isDefault")
|
||||
private boolean defaultService;
|
||||
|
||||
|
||||
@Column(name = "uuid")
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getService() {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServiceName() {
|
||||
return this.servicename; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPidFile() {
|
||||
return this.servicePidFile;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServicePath() {
|
||||
return this.servicePidFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return 0; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
return 0; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public boolean isDefaultService() {
|
||||
return defaultService;
|
||||
}
|
||||
|
||||
public String getProcessname() {
|
||||
return processname;
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
|||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> vmWareAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> simulatorAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> ovmAllFieldsSearch;
|
||||
final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> hypervAllFieldsSearch;
|
||||
|
||||
protected PhysicalNetworkTrafficTypeDaoImpl() {
|
||||
super();
|
||||
|
|
@ -55,6 +56,13 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
|||
kvmAllFieldsSearch.selectFields(kvmAllFieldsSearch.entity().getKvmNetworkLabel());
|
||||
kvmAllFieldsSearch.done();
|
||||
|
||||
hypervAllFieldsSearch = createSearchBuilder(String.class);
|
||||
hypervAllFieldsSearch.and("physicalNetworkId", hypervAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
hypervAllFieldsSearch.and("trafficType", hypervAllFieldsSearch.entity().getTrafficType(), Op.EQ);
|
||||
hypervAllFieldsSearch.selectFields(hypervAllFieldsSearch.entity().getHypervNetworkLabel());
|
||||
hypervAllFieldsSearch.done();
|
||||
|
||||
|
||||
xenAllFieldsSearch = createSearchBuilder(String.class);
|
||||
xenAllFieldsSearch.and("physicalNetworkId", xenAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
xenAllFieldsSearch.and("trafficType", xenAllFieldsSearch.entity().getTrafficType(), Op.EQ);
|
||||
|
|
@ -114,7 +122,10 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
|||
sc = ovmAllFieldsSearch.create();
|
||||
} else if (hType == HypervisorType.BareMetal) {
|
||||
return null;
|
||||
} else {
|
||||
} else if (hType == HypervisorType.Hyperv) {
|
||||
sc = hypervAllFieldsSearch.create();
|
||||
}
|
||||
else {
|
||||
assert(false) : "We don't handle this hypervisor type";
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,19 +61,23 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType
|
|||
@Column(name = "simulator_network_label")
|
||||
private String simulatorNetworkLabel;
|
||||
|
||||
@Column(name = "hyperv_network_label")
|
||||
private String hypervNetworkLabel;
|
||||
|
||||
@Column(name = "vlan")
|
||||
private String vlan;
|
||||
|
||||
public PhysicalNetworkTrafficTypeVO() {
|
||||
}
|
||||
|
||||
public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) {
|
||||
public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan, String hypervLabel) {
|
||||
this.physicalNetworkId = physicalNetworkId;
|
||||
this.trafficType = trafficType;
|
||||
this.xenNetworkLabel = xenLabel;
|
||||
this.kvmNetworkLabel = kvmLabel;
|
||||
this.vmwareNetworkLabel = vmwareLabel;
|
||||
this.simulatorNetworkLabel = simulatorLabel;
|
||||
this.hypervNetworkLabel = hypervLabel;
|
||||
this.setVlan(vlan);
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -146,4 +150,13 @@ public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType
|
|||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public void setHypervNetworkLabel(String hypervNetworkLable) {
|
||||
this.hypervNetworkLabel = hypervNetworkLable;
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getHypervNetworkLabel() {
|
||||
return hypervNetworkLabel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.dao;
|
||||
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SslCertDao extends GenericDao<SslCertVO, Long> {
|
||||
List<SslCertVO> listByAccountId(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.cloud.network.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@Local(value = {SslCertDao.class})
|
||||
public class SslCertDaoImpl extends GenericDaoBase<SslCertVO, Long> implements SslCertDao {
|
||||
|
||||
private final SearchBuilder<SslCertVO> listByAccountId;
|
||||
|
||||
public SslCertDaoImpl() {
|
||||
listByAccountId = createSearchBuilder();
|
||||
listByAccountId.and("accountId", listByAccountId.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
listByAccountId.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SslCertVO> listByAccountId(Long accountId) {
|
||||
SearchCriteria<SslCertVO> sc = listByAccountId.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
// 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.network.dao;
|
||||
|
||||
|
||||
import com.cloud.network.lb.SslCert;
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name="sslcerts")
|
||||
public class SslCertVO implements SslCert {
|
||||
|
||||
@Id
|
||||
@Column(name="id")
|
||||
private Long id;
|
||||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name="certificate",length=16384)
|
||||
private String certificate;
|
||||
|
||||
|
||||
@Column(name="chain",length=2097152)
|
||||
private String chain;
|
||||
|
||||
@Encrypt
|
||||
@Column(name="key",length=16384)
|
||||
private String key;
|
||||
|
||||
@Encrypt
|
||||
@Column(name="password")
|
||||
private String password;
|
||||
|
||||
@Column(name="account_id")
|
||||
private Long accountId;
|
||||
|
||||
@Column(name = "domain_id")
|
||||
long domainId;
|
||||
|
||||
@Column(name = "fingerprint")
|
||||
String fingerPrint;
|
||||
|
||||
|
||||
|
||||
|
||||
public SslCertVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public SslCertVO(String cert, String key, String password, String chain, Long accountId, Long domainId, String fingerPrint) {
|
||||
this.certificate = cert;
|
||||
this.key = key;
|
||||
this.chain = chain;
|
||||
this.password = password;
|
||||
this.accountId = accountId;
|
||||
this.domainId = domainId;
|
||||
this.fingerPrint = fingerPrint;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
|
||||
// Getters
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCertificate() {
|
||||
return certificate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFingerPrint() {
|
||||
return fingerPrint;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
|
|||
|
||||
CountByAccountId = createSearchBuilder(Long.class);
|
||||
CountByAccountId.select(null, Func.COUNT, CountByAccountId.entity().getId());
|
||||
CountByAccountId.and("offeringId", CountByAccountId.entity().getAccountId(), Op.EQ);
|
||||
CountByAccountId.and("accountId", CountByAccountId.entity().getAccountId(), Op.EQ);
|
||||
CountByAccountId.and("removed", CountByAccountId.entity().getRemoved(), Op.NULL);
|
||||
CountByAccountId.done();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@ package com.cloud.service;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.*;
|
||||
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
|
|
@ -34,14 +29,18 @@ import com.cloud.vm.VirtualMachine;
|
|||
@DiscriminatorValue(value="Service")
|
||||
@PrimaryKeyJoinColumn(name="id")
|
||||
public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
|
||||
public enum DynamicParameters {
|
||||
cpuSpeed, cpuNumber, memory
|
||||
};
|
||||
|
||||
@Column(name="cpu")
|
||||
private int cpu;
|
||||
private Integer cpu;
|
||||
|
||||
@Column(name="speed")
|
||||
private int speed;
|
||||
private Integer speed;
|
||||
|
||||
@Column(name="ram_size")
|
||||
private int ramSize;
|
||||
private Integer ramSize;
|
||||
|
||||
@Column(name="nw_rate")
|
||||
private Integer rateMbps;
|
||||
|
|
@ -83,7 +82,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
super();
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
|
||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText,
|
||||
boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
|
||||
super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true);
|
||||
this.cpu = cpu;
|
||||
this.ramSize = ramSize;
|
||||
|
|
@ -97,7 +97,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
|
||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
|
||||
boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
|
||||
super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
|
||||
this.cpu = cpu;
|
||||
this.ramSize = ramSize;
|
||||
|
|
@ -110,12 +111,14 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
|
||||
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId);
|
||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse,
|
||||
boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
|
||||
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse,
|
||||
vm_type, domainId);
|
||||
this.hostTag = hostTag;
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps,
|
||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps,
|
||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage,
|
||||
boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId,
|
||||
String hostTag, String deploymentPlanner) {
|
||||
|
|
@ -159,7 +162,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCpu() {
|
||||
public Integer getCpu() {
|
||||
return cpu;
|
||||
}
|
||||
|
||||
|
|
@ -176,12 +179,12 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSpeed() {
|
||||
public Integer getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRamSize() {
|
||||
public Integer getRamSize() {
|
||||
return ramSize;
|
||||
}
|
||||
|
||||
|
|
@ -252,4 +255,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
public void setDetails(Map<String, String> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public boolean isDynamic() {
|
||||
return cpu == null || speed == null || ramSize == null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue