Merge branch 'master' into gslb-wip

Conflicts:
	api/src/org/apache/cloudstack/api/ResponseGenerator.java
	api/src/org/apache/cloudstack/region/Region.java
	plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
	plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
	plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
	server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
	server/src/org/apache/cloudstack/region/RegionVO.java
This commit is contained in:
Murali Reddy 2013-03-19 17:20:44 +05:30
commit 45110b65dc
196 changed files with 6912 additions and 3528 deletions

1
.gitignore vendored
View File

@ -59,6 +59,7 @@ tools/cli/build/
*.iso
*.tar.gz
*.tgz
target-eclipse
awsapi/modules/*
!.gitignore
.classpath

View File

@ -370,7 +370,7 @@ Within the scripts/vm/hypervisor/xenserver directory
from OpenStack, LLC http://www.openstack.org
swift
Within the tools/appliance/definitions/systemvmtemplate directory
Within the tools/appliance/definitions/systemvmtemplate and tools/appliance/definitions/systemvmtemplate64 directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2010-2012 Patrick Debois

View File

@ -38,10 +38,13 @@ import java.util.UUID;
import javax.naming.ConfigurationException;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.xml.DOMConfigurator;
import com.cloud.agent.Agent.ExitStatus;
import com.cloud.agent.dao.StorageComponent;
@ -377,6 +380,18 @@ public class AgentShell implements IAgentShell {
public void init(String[] args) throws ConfigurationException {
// PropertiesUtil is used both in management server and agent packages,
// it searches path under class path and common J2EE containers
// For KVM agent, do it specially here
File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
if(file == null || !file.exists()) {
file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
}
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
s_logger.info("Agent started");
final Class<?> c = this.getClass();
_version = c.getPackage().getImplementationVersion();
if (_version == null) {

View File

@ -35,6 +35,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
private SwiftTO swift;
private S3TO s3;
StorageFilerTO pool;
private Long secHostId;
protected BackupSnapshotCommand() {
@ -49,12 +50,14 @@ public class BackupSnapshotCommand extends SnapshotCommand {
* @param firstBackupUuid This is the backup of the first ever snapshot taken by the volume.
* @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
* @param isVolumeInactive True if the volume belongs to a VM that is not running or is detached.
* @param secHostId This is the Id of the secondary storage.
*/
public BackupSnapshotCommand(String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
Long snapshotId,
Long secHostId,
String volumePath,
StoragePool pool,
String snapshotUuid,
@ -71,6 +74,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
this.prevBackupUuid = prevBackupUuid;
this.isVolumeInactive = isVolumeInactive;
this.vmName = vmName;
this.secHostId = secHostId;
setVolumePath(volumePath);
setWait(wait);
}
@ -111,4 +115,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
return snapshotId;
}
public Long getSecHostId() {
return secHostId;
}
}

View File

@ -18,6 +18,7 @@ package com.cloud.agent.api;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.zip.DeflaterOutputStream;
import org.apache.commons.codec.binary.Base64;
@ -80,6 +81,7 @@ public class SecurityGroupRulesCmd extends Command {
Long msId;
IpPortAndProto [] ingressRuleSet;
IpPortAndProto [] egressRuleSet;
private List<String> secIps;
public SecurityGroupRulesCmd() {
super();
@ -103,6 +105,23 @@ public class SecurityGroupRulesCmd extends Command {
}
public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet, List<String> secIps) {
super();
this.guestIp = guestIp;
this.vmName = vmName;
this.ingressRuleSet = ingressRuleSet;
this.egressRuleSet = egressRuleSet;
this.guestMac = guestMac;
this.signature = signature;
this.seqNum = seqNum;
this.vmId = vmId;
if (signature == null) {
String stringified = stringifyRules();
this.signature = DigestUtils.md5Hex(stringified);
}
this.secIps = secIps;
}
@Override
public boolean executeInSequence() {
return true;
@ -131,6 +150,10 @@ public class SecurityGroupRulesCmd extends Command {
return guestIp;
}
public List<String> getSecIps() {
return secIps;
}
public String getVmName() {
return vmName;
@ -165,6 +188,20 @@ public class SecurityGroupRulesCmd extends Command {
}
public String getSecIpsString() {
StringBuilder sb = new StringBuilder();
List<String> ips = getSecIps();
if (ips == null) {
return "0:";
} else {
for (String ip : ips) {
sb.append(ip).append(":");
}
}
return sb.toString();
}
public String stringifyCompressedRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {

View File

@ -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.agent.api.routing;
import java.util.List;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.api.to.NicTO;
/**
* LoadBalancerConfigCommand sends the load balancer configuration
*/
public class HealthCheckLBConfigAnswer extends Answer {
List<LoadBalancerTO> loadBalancers;
protected HealthCheckLBConfigAnswer() {
}
public HealthCheckLBConfigAnswer(List<LoadBalancerTO> loadBalancers) {
this.loadBalancers = loadBalancers;
}
public List<LoadBalancerTO> getLoadBalancers() {
return loadBalancers;
}
}

View File

@ -0,0 +1,39 @@
// 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 com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.api.to.NicTO;
/**
* LoadBalancerConfigCommand sends the load balancer configuration
*/
public class HealthCheckLBConfigCommand extends NetworkElementCommand {
LoadBalancerTO[] loadBalancers;
protected HealthCheckLBConfigCommand() {
}
public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
this.loadBalancers = loadBalancers;
}
public LoadBalancerTO[] getLoadBalancers() {
return loadBalancers;
}
}

View File

@ -31,6 +31,7 @@ import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmGroup;
import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile;
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.utils.Pair;
@ -46,8 +47,10 @@ public class LoadBalancerTO {
boolean inline;
DestinationTO[] destinations;
private StickinessPolicyTO[] stickinessPolicies;
private HealthCheckPolicyTO[] healthCheckPolicies;
private AutoScaleVmGroupTO autoScaleVmGroupTO;
final static int MAX_STICKINESS_POLICIES = 1;
final static int MAX_HEALTHCHECK_POLICIES = 1;
public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline, List<LbDestination> destinations) {
if (destinations == null) { // for autoscaleconfig destinations will be null;
@ -69,23 +72,52 @@ public class LoadBalancerTO {
}
}
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) {
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) {
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations,
stickinessPolicies, 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) {
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations);
this.stickinessPolicies = null;
this.healthCheckPolicies = null;
if (stickinessPolicies != null && stickinessPolicies.size() > 0) {
this.stickinessPolicies = new StickinessPolicyTO[MAX_STICKINESS_POLICIES];
int index = 0;
for (LbStickinessPolicy stickinesspolicy : stickinessPolicies) {
if (!stickinesspolicy.isRevoked()) {
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(), stickinesspolicy.getParams());
this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(),
stickinesspolicy.getParams());
index++;
if (index == MAX_STICKINESS_POLICIES) break;
}
if (index == MAX_STICKINESS_POLICIES)
break;
}
if (index == 0) this.stickinessPolicies = null;
}
if (index == 0)
this.stickinessPolicies = null;
}
if (healthCheckPolicies != null && healthCheckPolicies.size() > 0) {
this.healthCheckPolicies = new HealthCheckPolicyTO[MAX_HEALTHCHECK_POLICIES];
int index = 0;
for (LbHealthCheckPolicy hcp : healthCheckPolicies) {
this.healthCheckPolicies[0] = new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(),
hcp.getResponseTime(), hcp.getHealthcheckInterval(), hcp.getHealthcheckThresshold(),
hcp.getUnhealthThresshold(), hcp.isRevoked());
index++;
if (index == MAX_HEALTHCHECK_POLICIES)
break;
}
if (index == 0)
this.healthCheckPolicies = null;
}
}
protected LoadBalancerTO() {
}
@ -126,6 +158,10 @@ public class LoadBalancerTO {
return stickinessPolicies;
}
public HealthCheckPolicyTO[] getHealthCheckPolicies() {
return healthCheckPolicies;
}
public DestinationTO[] getDestinations() {
return destinations;
}
@ -158,6 +194,65 @@ public class LoadBalancerTO {
this._methodName = methodName;
this._paramsList = paramsList;
}
}
public static class HealthCheckPolicyTO {
private String pingPath;
private String description;
private int responseTime;
private int healthcheckInterval;
private int healthcheckThresshold;
private int unhealthThresshold;
private boolean revoke = false;
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval,
int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
this.description = description;
this.pingPath = pingPath;
this.responseTime = responseTime;
this.healthcheckInterval = healthcheckInterval;
this.healthcheckThresshold = healthcheckThresshold;
this.unhealthThresshold = unhealthThresshold;
this.revoke = revoke;
}
public HealthCheckPolicyTO() {
}
public String getpingPath() {
return pingPath;
}
public String getDescription() {
return description;
}
public int getResponseTime() {
return responseTime;
}
public int getHealthcheckInterval() {
return healthcheckInterval;
}
public int getHealthcheckThresshold() {
return healthcheckThresshold;
}
public int getUnhealthThresshold() {
return unhealthThresshold;
}
public void setRevoke(boolean revoke) {
this.revoke = revoke;
}
public boolean isRevoked() {
return revoke;
}
}
public static class DestinationTO {
@ -165,6 +260,7 @@ public class LoadBalancerTO {
int destPort;
boolean revoked;
boolean alreadyAdded;
String monitorState;
public DestinationTO(String destIp, int destPort, boolean revoked, boolean alreadyAdded) {
this.destIp = destIp;
this.destPort = destPort;
@ -190,6 +286,14 @@ public class LoadBalancerTO {
public boolean isAlreadyAdded() {
return alreadyAdded;
}
public void setMonitorState(String state) {
this.monitorState = state;
}
public String getMonitorState() {
return monitorState;
}
}
public static class CounterTO implements Serializable {
private final String name;

View File

@ -16,12 +16,15 @@
// under the License.
package com.cloud.agent.api.to;
import java.util.List;
public class NicTO extends NetworkTO {
int deviceId;
Integer networkRateMbps;
Integer networkRateMulticastMbps;
boolean defaultNic;
String uuid;
List <String> nicSecIps;
public NicTO() {
super();
@ -69,4 +72,12 @@ public class NicTO extends NetworkTO {
public String toString() {
return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString();
}
public void setNicSecIps(List<String> secIps) {
this.nicSecIps = secIps;
}
public List<String> getNicSecIps() {
return nicSecIps;
}
}

View File

@ -62,5 +62,4 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
public String getUuid();
int getRegionId();
}

View File

@ -110,6 +110,8 @@ public class EventTypes {
public static final String EVENT_LOAD_BALANCER_DELETE = "LB.DELETE";
public static final String EVENT_LB_STICKINESSPOLICY_CREATE = "LB.STICKINESSPOLICY.CREATE";
public static final String EVENT_LB_STICKINESSPOLICY_DELETE = "LB.STICKINESSPOLICY.DELETE";
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";
// Global Load Balancer rules

View File

@ -188,6 +188,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Capability InlineMode = new Capability("InlineMode");
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
private String name;

View File

@ -257,4 +257,6 @@ public interface NetworkModel {
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
String getStartIpv6Address(long id);
}

View File

@ -18,6 +18,7 @@ package com.cloud.network.element;
import java.util.List;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.lb.LoadBalancingRule;
@ -25,6 +26,7 @@ import com.cloud.network.lb.LoadBalancingRule;
public interface LoadBalancingServiceProvider extends NetworkElement, IpDeployingRequester {
/**
* Apply rules
*
* @param network
* @param rules
* @return
@ -34,10 +36,14 @@ public interface LoadBalancingServiceProvider extends NetworkElement, IpDeployin
/**
* Validate rules
*
* @param network
* @param rule
* @return true/false. true should be return if there are no validations. false should be return if any oneof the validation fails.
* @return true/false. true should be return if there are no validations.
*false should be return if any oneof the validation fails.
* @throws
*/
boolean validateLBRule(Network network, LoadBalancingRule rule);
List<LoadBalancerTO> updateHealthChecks(Network network, List<LoadBalancingRule> lbrules);
}

View File

@ -32,11 +32,14 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
private List<LbDestination> destinations;
private List<LbStickinessPolicy> stickinessPolicies;
private LbAutoScaleVmGroup autoScaleVmGroup;
private List<LbHealthCheckPolicy> healthCheckPolicies;
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies) {
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
this.healthCheckPolicies = healthCheckPolicies;
}
@Override
@ -136,11 +139,17 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
return stickinessPolicies;
}
public List<LbHealthCheckPolicy> getHealthCheckPolicies() {
return healthCheckPolicies;
}
public interface Destination {
String getIpAddress();
int getDestinationPortStart();
int getDestinationPortEnd();
boolean isRevoked();
}
@ -174,6 +183,64 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
}
}
public static class LbHealthCheckPolicy {
private String pingpath;
private String description;
private int responseTime;
private int healthcheckInterval;
private int healthcheckThresshold;
private int unhealthThresshold;
private boolean _revoke;
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
int healthcheckThresshold, int unhealthThresshold) {
this(pingpath, description, responseTime, healthcheckInterval, healthcheckThresshold, unhealthThresshold, false);
}
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
this.pingpath = pingpath;
this.description = description;
this.responseTime = responseTime;
this.healthcheckInterval = healthcheckInterval;
this.healthcheckThresshold = healthcheckThresshold;
this.unhealthThresshold = unhealthThresshold;
this._revoke = revoke;
}
public LbHealthCheckPolicy() {
}
public String getpingpath() {
return pingpath;
}
public String getDescription() {
return description;
}
public int getResponseTime() {
return responseTime;
}
public int getHealthcheckInterval() {
return healthcheckInterval;
}
public int getHealthcheckThresshold() {
return healthcheckThresshold;
}
public int getUnhealthThresshold() {
return unhealthThresshold;
}
public boolean isRevoked() {
return _revoke;
}
}
public static class LbDestination implements Destination {
private int portStart;
private int portEnd;
@ -191,10 +258,12 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
public String getIpAddress() {
return ip;
}
@Override
public int getDestinationPortStart() {
return portStart;
}
@Override
public int getDestinationPortEnd() {
return portEnd;
@ -230,15 +299,16 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
return null;
}
@Override
public TrafficType getTrafficType() {
return null;
}
@Override
public FirewallRuleType getType() {
return FirewallRuleType.User;
}
public LbAutoScaleVmGroup getAutoScaleVmGroup() {
return autoScaleVmGroup;
}
@ -274,8 +344,7 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
private final AutoScalePolicy policy;
private boolean revoked;
public LbAutoScalePolicy(AutoScalePolicy policy, List<LbCondition> conditions)
{
public LbAutoScalePolicy(AutoScalePolicy policy, List<LbCondition> conditions) {
this.policy = policy;
this.conditions = conditions;
}
@ -309,7 +378,9 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
private final String networkId;
private final String vmName;
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId, String templateId, String vmName, String networkId) {
public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey,
String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId,
String templateId, String vmName, String networkId) {
this.profile = profile;
this.autoScaleUserApiKey = autoScaleUserApiKey;
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
@ -369,7 +440,8 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
private final LbAutoScaleVmProfile profile;
private final String currentState;
public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List<LbAutoScalePolicy> policies, LbAutoScaleVmProfile profile, String currentState) {
public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List<LbAutoScalePolicy> policies,
LbAutoScaleVmProfile profile, String currentState) {
this.vmGroup = vmGroup;
this.policies = policies;
this.profile = profile;

View File

@ -18,8 +18,10 @@ package com.cloud.network.lb;
import java.util.List;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
@ -28,6 +30,8 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.uservm.UserVm;
@ -66,6 +70,22 @@ public interface LoadBalancingRulesService {
public boolean applyLBStickinessPolicy(CreateLBStickinessPolicyCmd cmd) throws ResourceUnavailableException;
boolean deleteLBStickinessPolicy(long stickinessPolicyId, boolean apply);
/**
* Create a healthcheck policy to a load balancer from the given healthcheck
* parameters in (name,value) pairs.
*
* @param cmd
* the command specifying the stickiness method name, params
* (name,value pairs), policy name and description.
* @return the newly created stickiness policy if successfull, null
* otherwise
* @thows NetworkRuleConflictException
*/
public HealthCheckPolicy createLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd);
public boolean applyLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd) throws ResourceUnavailableException;
boolean deleteLBHealthCheckPolicy(long healthCheckPolicyId, boolean apply);
/**
* Assign a virtual machine, or list of virtual machines, to a load balancer.
*/
@ -104,8 +124,18 @@ public interface LoadBalancingRulesService {
*/
List<? extends StickinessPolicy> searchForLBStickinessPolicies(ListLBStickinessPoliciesCmd cmd);
/**
* List healthcheck policies based on the given criteria
*
* @param cmd
* the command specifies the load balancing rule id.
* @return list of healthcheck policies that match the criteria.
*/
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
List<LoadBalancingRule> listByNetworkId(long networkId);
LoadBalancer findById(long LoadBalancer);
public void updateLBHealthChecks() throws ResourceUnavailableException;
}

View File

@ -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 com.cloud.network.rules;
import java.util.List;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
/**
*/
public interface HealthCheckPolicy extends InternalIdentity, Identity {
public long getLoadBalancerId();
public String getpingpath();
public String getDescription();
public int getResponseTime();
public int getHealthcheckInterval();
public int getHealthcheckThresshold();
public int getUnhealthThresshold();
public boolean isRevoke();
}

View File

@ -24,6 +24,7 @@ import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupC
import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd;
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd;
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd;
import org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@ -45,5 +46,6 @@ public interface SecurityGroupService {
public List<? extends SecurityRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd);
public List<? extends SecurityRule> authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressCmd cmd);
public boolean securityGroupRulesForVmSecIp(Long nicId, Long networkId,
String secondaryIp, boolean ruleAction);
}

View File

@ -37,6 +37,7 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
featured, // returns templates that have been marked as featured and public
self, // returns templates that have been registered or created by the calling user
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
shared, // including templates that have been granted to the calling user by another user
sharedexecutable, // ready templates that have been granted to the calling user by another user
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a
community, // returns templates that have been marked as public but not featured

View File

@ -63,7 +63,5 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
public Long getDefaultZoneId();
public int getRegionId();
public String getUuid();
}

View File

@ -62,7 +62,7 @@ public interface AccountService {
* @return the user if created successfully, null otherwise
*/
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
Map<String, String> details);
Map<String, String> details, String accountUUID, String userUUID);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@ -77,7 +77,7 @@ public interface AccountService {
User getSystemUser();
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
boolean isAdmin(short accountType);

View File

@ -27,7 +27,7 @@ import com.cloud.utils.Pair;
public interface DomainService {
Domain createDomain(String name, Long parentId, String networkDomain);
Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID);
Domain getDomain(long id);

View File

@ -73,5 +73,4 @@ public interface User extends OwnedBy, InternalIdentity {
boolean isRegistered();
public int getRegionId();
}

View File

@ -356,8 +356,9 @@ public interface UserVmService {
* @param cmd
* - the command specifying vmId and new serviceOfferingId
* @return the vm
* @throws ResourceAllocationException
*/
UserVm upgradeVirtualMachine(UpgradeVMCmd cmd);
UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationException;
UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOperationException;

View File

@ -468,6 +468,11 @@ public class ApiConstants {
public static final String UCS_BLADE_ID = "bladeid";
public static final String VM_GUEST_IP = "vmguestip";
public static final String OLDER_THAN = "olderthan";
public static final String HEALTHCHECK_RESPONSE_TIMEOUT = "responsetimeout";
public static final String HEALTHCHECK_INTERVAL_TIME = "intervaltime";
public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
public static final String HEALTHCHECK_PINGPATH = "pingpath";
public enum HostDetails {
all, capacity, events, stats, min;

View File

@ -1,468 +0,0 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
public class ApiConstants {
public static final String ACCOUNT = "account";
public static final String ACCOUNTS = "accounts";
public static final String ACCOUNT_TYPE = "accounttype";
public static final String ACCOUNT_ID = "accountid";
public static final String ALGORITHM = "algorithm";
public static final String ALLOCATED_ONLY = "allocatedonly";
public static final String API_KEY = "userapikey";
public static final String APPLIED = "applied";
public static final String AVAILABLE = "available";
public static final String BITS = "bits";
public static final String BOOTABLE = "bootable";
public static final String BIND_DN = "binddn";
public static final String BIND_PASSWORD = "bindpass";
public static final String CATEGORY = "category";
public static final String CERTIFICATE = "certificate";
public static final String PRIVATE_KEY = "privatekey";
public static final String DOMAIN_SUFFIX = "domainsuffix";
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
public static final String CIDR = "cidr";
public static final String IP6_CIDR = "ip6cidr";
public static final String CIDR_LIST = "cidrlist";
public static final String CLEANUP = "cleanup";
public static final String CLUSTER_ID = "clusterid";
public static final String CLUSTER_NAME = "clustername";
public static final String CLUSTER_TYPE = "clustertype";
public static final String COMPONENT = "component";
public static final String CPU_NUMBER = "cpunumber";
public static final String CPU_SPEED = "cpuspeed";
public static final String CREATED = "created";
public static final String CUSTOMIZED = "customized";
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 DISPLAY_NAME = "displayname";
public static final String DISPLAY_TEXT = "displaytext";
public static final String DNS1 = "dns1";
public static final String DNS2 = "dns2";
public static final String DOMAIN = "domain";
public static final String DOMAIN_ID = "domainid";
public static final String DURATION = "duration";
public static final String EMAIL = "email";
public static final String END_DATE = "enddate";
public static final String END_IP = "endip";
public static final String END_IPV6 = "endipv6";
public static final String END_PORT = "endport";
public static final String ENTRY_TIME = "entrytime";
public static final String FETCH_LATEST = "fetchlatest";
public static final String FIRSTNAME = "firstname";
public static final String FORCED = "forced";
public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
public static final String FORMAT = "format";
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
public static final String GATEWAY = "gateway";
public static final String IP6_GATEWAY = "ip6gateway";
public static final String GROUP = "group";
public static final String GROUP_ID = "groupid";
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
public static final String HA_ENABLE = "haenable";
public static final String HOST_ID = "hostid";
public static final String HOST_NAME = "hostname";
public static final String HYPERVISOR = "hypervisor";
public static final String INLINE = "inline";
public static final String INSTANCE = "instance";
public static final String ICMP_CODE = "icmpcode";
public static final String ICMP_TYPE = "icmptype";
public static final String ID = "id";
public static final String IDS = "ids";
public static final String INTERNAL_DNS1 = "internaldns1";
public static final String INTERNAL_DNS2 = "internaldns2";
public static final String INTERVAL_TYPE = "intervaltype";
public static final String IP_ADDRESS = "ipaddress";
public static final String IP6_ADDRESS = "ip6address";
public static final String IP_ADDRESS_ID = "ipaddressid";
public static final String IS_ASYNC = "isasync";
public static final String IP_AVAILABLE = "ipavailable";
public static final String IP_LIMIT = "iplimit";
public static final String IP_TOTAL = "iptotal";
public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
public static final String IS_EXTRACTABLE = "isextractable";
public static final String IS_FEATURED = "isfeatured";
public static final String IS_PUBLIC = "ispublic";
public static final String IS_PERSISTENT = "ispersistent";
public static final String IS_READY = "isready";
public static final String IS_RECURSIVE = "isrecursive";
public static final String ISO_FILTER = "isofilter";
public static final String ISO_GUEST_OS_NONE = "None";
public static final String JOB_ID = "jobid";
public static final String JOB_STATUS = "jobstatus";
public static final String LASTNAME = "lastname";
public static final String LEVEL = "level";
public static final String LENGTH = "length";
public static final String LIMIT_CPU_USE = "limitcpuuse";
public static final String LOCK = "lock";
public static final String LUN = "lun";
public static final String LBID = "lbruleid";
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MEMORY = "memory";
public static final String MODE = "mode";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
public static final String NETWORK_DOMAIN = "networkdomain";
public static final String NETMASK = "netmask";
public static final String NEW_NAME = "newname";
public static final String NUM_RETRIES = "numretries";
public static final String OFFER_HA = "offerha";
public static final String IS_SYSTEM_OFFERING = "issystem";
public static final String IS_DEFAULT_USE = "defaultuse";
public static final String OP = "op";
public static final String OS_CATEGORY_ID = "oscategoryid";
public static final String OS_TYPE_ID = "ostypeid";
public static final String PARAMS = "params";
public static final String PARENT_DOMAIN_ID = "parentdomainid";
public static final String PASSWORD = "password";
public static final String NEW_PASSWORD = "new_password";
public static final String PASSWORD_ENABLED = "passwordenabled";
public static final String SSHKEY_ENABLED = "sshkeyenabled";
public static final String PATH = "path";
public static final String POD_ID = "podid";
public static final String POD_IDS = "podids";
public static final String POLICY_ID = "policyid";
public static final String PORT = "port";
public static final String PORTAL = "portal";
public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
public static final String PRIVATE_INTERFACE = "privateinterface";
public static final String PRIVATE_IP = "privateip";
public static final String PRIVATE_PORT = "privateport";
public static final String PRIVATE_START_PORT = "privateport";
public static final String PRIVATE_END_PORT = "privateendport";
public static final String PRIVATE_ZONE = "privatezone";
public static final String PROTOCOL = "protocol";
public static final String PUBLIC_INTERFACE = "publicinterface";
public static final String PUBLIC_IP_ID = "publicipid";
public static final String PUBLIC_IP = "publicip";
public static final String PUBLIC_PORT = "publicport";
public static final String PUBLIC_START_PORT = "publicport";
public static final String PUBLIC_END_PORT = "publicendport";
public static final String PUBLIC_ZONE = "publiczone";
public static final String RECEIVED_BYTES = "receivedbytes";
public static final String REQUIRES_HVM = "requireshvm";
public static final String RESOURCE_TYPE = "resourcetype";
public static final String RESPONSE = "response";
public static final String QUERY_FILTER = "queryfilter";
public static final String SCHEDULE = "schedule";
public static final String SCOPE = "scope";
public static final String SECRET_KEY = "usersecretkey";
public static final String SINCE = "since";
public static final String KEY = "key";
public static final String SEARCH_BASE = "searchbase";
public static final String SECURITY_GROUP_IDS = "securitygroupids";
public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
public static final String SECURITY_GROUP_NAME = "securitygroupname";
public static final String SECURITY_GROUP_ID = "securitygroupid";
public static final String SENT = "sent";
public static final String SENT_BYTES = "sentbytes";
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
public static final String SHOW_CAPACITIES = "showcapacities";
public static final String SIZE = "size";
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 SOURCE_ZONE_ID = "sourcezoneid";
public static final String START_DATE = "startdate";
public static final String START_IP = "startip";
public static final String START_IPV6 = "startipv6";
public static final String START_PORT = "startport";
public static final String STATE = "state";
public static final String STATUS = "status";
public static final String STORAGE_TYPE = "storagetype";
public static final String SYSTEM_VM_TYPE = "systemvmtype";
public static final String TAGS = "tags";
public static final String TARGET_IQN = "targetiqn";
public static final String TEMPLATE_FILTER = "templatefilter";
public static final String TEMPLATE_ID = "templateid";
public static final String ISO_ID = "isoid";
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
public static final String TYPE = "type";
public static final String TRUST_STORE = "truststore";
public static final String TRUST_STORE_PASSWORD = "truststorepass";
public static final String URL = "url";
public static final String USAGE_INTERFACE = "usageinterface";
public static final String USER_DATA = "userdata";
public static final String USER_ID = "userid";
public static final String USE_SSL = "ssl";
public static final String USERNAME = "username";
public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
public static final String VALUE = "value";
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
public static final String VLAN = "vlan";
public static final String VLAN_ID = "vlanid";
public static final String VM_AVAILABLE = "vmavailable";
public static final String VM_LIMIT = "vmlimit";
public static final String VM_TOTAL = "vmtotal";
public static final String VNET = "vnet";
public static final String VOLUME_ID = "volumeid";
public static final String ZONE_ID = "zoneid";
public static final String ZONE_NAME = "zonename";
public static final String NETWORK_TYPE = "networktype";
public static final String PAGE = "page";
public static final String PAGE_SIZE = "pagesize";
public static final String COUNT = "count";
public static final String TRAFFIC_TYPE = "traffictype";
public static final String NETWORK_OFFERING_ID = "networkofferingid";
public static final String NETWORK_IDS = "networkids";
public static final String NETWORK_ID = "networkid";
public static final String NIC_ID = "nicid";
public static final String SPECIFY_VLAN = "specifyvlan";
public static final String IS_DEFAULT = "isdefault";
public static final String IS_SYSTEM = "issystem";
public static final String AVAILABILITY = "availability";
public static final String NETWORKRATE = "networkrate";
public static final String HOST_TAGS = "hosttags";
public static final String SSH_KEYPAIR = "keypair";
public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
public static final String HOST_CPU_NUM = "hostcpunum";
public static final String HOST_MEM_CAPACITY = "hostmemcapacity";
public static final String HOST_MAC = "hostmac";
public static final String HOST_TAG = "hosttag";
public static final String PXE_SERVER_TYPE = "pxeservertype";
public static final String LINMIN_USERNAME = "linminusername";
public static final String LINMIN_PASSWORD = "linminpassword";
public static final String LINMIN_APID = "linminapid";
public static final String DHCP_SERVER_TYPE = "dhcpservertype";
public static final String LINK_LOCAL_IP = "linklocalip";
public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress";
public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask";
public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid";
public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress";
public static final String PRIVATE_NETMASK = "privatenetmask";
public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
public static final String ALLOCATION_STATE = "allocationstate";
public static final String MANAGED_STATE = "managedstate";
public static final String STORAGE_ID = "storageid";
public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
public static final String PING_DIR = "pingdir";
public static final String TFTP_DIR = "tftpdir";
public static final String PING_CIFS_USERNAME = "pingcifsusername";
public static final String PING_CIFS_PASSWORD = "pingcifspassword";
public static final String CHECKSUM = "checksum";
public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
public static final String ZONE_TOKEN = "zonetoken";
public static final String DHCP_PROVIDER = "dhcpprovider";
public static final String RESULT = "success";
public static final String LUN_ID = "lunId";
public static final String IQN = "iqn";
public static final String AGGREGATE_NAME = "aggregatename";
public static final String POOL_NAME = "poolname";
public static final String VOLUME_NAME = "volumename";
public static final String SNAPSHOT_POLICY = "snapshotpolicy";
public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
public static final String IP_NETWORK_LIST = "iptonetworklist";
public static final String PARAM_LIST = "param";
public static final String FOR_LOAD_BALANCING = "forloadbalancing";
public static final String KEYBOARD = "keyboard";
public static final String OPEN_FIREWALL = "openfirewall";
public static final String TEMPLATE_TAG = "templatetag";
public static final String HYPERVISOR_VERSION = "hypervisorversion";
public static final String MAX_GUESTS_LIMIT = "maxguestslimit";
public static final String PROJECT_ID = "projectid";
public static final String PROJECT_IDS = "projectids";
public static final String PROJECT = "project";
public static final String ROLE = "role";
public static final String USER = "user";
public static final String ACTIVE_ONLY = "activeonly";
public static final String TOKEN = "token";
public static final String ACCEPT = "accept";
public static final String SORT_KEY = "sortkey";
public static final String ACCOUNT_DETAILS = "accountdetails";
public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
public static final String PROVIDER = "provider";
public static final String NETWORK_SPEED = "networkspeed";
public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
public static final String ISOLATION_METHODS = "isolationmethods";
public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
public static final String ENABLED = "enabled";
public static final String SERVICE_NAME = "servicename";
public static final String DHCP_RANGE = "dhcprange";
public static final String UUID = "uuid";
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
public static final String LOCAL_STORAGE_ENABLED = "localstorageenabled";
public static final String GUEST_IP_TYPE = "guestiptype";
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 NETWORK_SERVICE_PROVIDER_ID = "nspid";
public static final String SERVICE_LIST = "servicelist";
public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
public static final String SUPPORTED_SERVICES = "supportedservices";
public static final String NSP_ID = "nspid";
public static final String ACL_TYPE = "acltype";
public static final String SUBDOMAIN_ACCESS = "subdomainaccess";
public static final String LOAD_BALANCER_DEVICE_ID = "lbdeviceid";
public static final String LOAD_BALANCER_DEVICE_NAME = "lbdevicename";
public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
public static final String FIREWALL_DEVICE_STATE = "fwdevicestate";
public static final String FIREWALL_DEVICE_CAPACITY = "fwdevicecapacity";
public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated";
public static final String SERVICE = "service";
public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname";
public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
public static final String RESOURCE_STATE = "resourcestate";
public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
public static final String REQUIRED = "required";
public static final String RESTART_REQUIRED = "restartrequired";
public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
public static final String CONSERVE_MODE = "conservemode";
public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
public static final String KEYWORD = "keyword";
public static final String LIST_ALL = "listall";
public static final String SPECIFY_IP_RANGES = "specifyipranges";
public static final String IS_SOURCE_NAT = "issourcenat";
public static final String IS_STATIC_NAT = "isstaticnat";
public static final String SORT_BY = "sortby";
public static final String CHANGE_CIDR = "changecidr";
public static final String PURPOSE = "purpose";
public static final String IS_TAGGED = "istagged";
public static final String INSTANCE_NAME = "instancename";
public static final String START_VM = "startvm";
public static final String HA_HOST = "hahost";
public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
public static final String DEFAULT_ZONE_ID = "defaultzoneid";
public static final String GUID = "guid";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
// Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this later.
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity";
public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
public static final String VSM_USERNAME = "vsmusername";
public static final String VSM_PASSWORD = "vsmpassword";
public static final String VSM_IPADDRESS = "vsmipaddress";
public static final String VSM_MGMT_VLAN_ID = "vsmmgmtvlanid";
public static final String VSM_PKT_VLAN_ID = "vsmpktvlanid";
public static final String VSM_CTRL_VLAN_ID = "vsmctrlvlanid";
public static final String VSM_STORAGE_VLAN_ID = "vsmstoragevlanid";
public static final String VSM_DOMAIN_ID = "vsmdomainid";
public static final String VSM_CONFIG_MODE = "vsmconfigmode";
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
public static final String ADD_VSM_FLAG = "addvsmflag";
public static final String END_POINT = "endpoint";
public static final String REGION_ID = "regionid";
public static final String IS_PROPAGATE = "ispropagate";
public static final String VPC_OFF_ID = "vpcofferingid";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
public static final String GATEWAY_ID = "gatewayid";
public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
public static final String RESOURCE_IDS = "resourceids";
public static final String RESOURCE_ID = "resourceid";
public static final String CUSTOMER = "customer";
public static final String S2S_VPN_GATEWAY_ID = "s2svpngatewayid";
public static final String S2S_CUSTOMER_GATEWAY_ID = "s2scustomergatewayid";
public static final String IPSEC_PSK = "ipsecpsk";
public static final String GUEST_IP = "guestip";
public static final String REMOVED = "removed";
public static final String IKE_POLICY = "ikepolicy";
public static final String ESP_POLICY = "esppolicy";
public static final String IKE_LIFETIME = "ikelifetime";
public static final String ESP_LIFETIME = "esplifetime";
public static final String DPD = "dpd";
public static final String FOR_VPC = "forvpc";
public static final String SHRINK_OK = "shrinkok";
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
public static final String S3_ACCESS_KEY = "accesskey";
public static final String S3_SECRET_KEY = "secretkey";
public static final String S3_END_POINT = "endpoint";
public static final String S3_BUCKET_NAME = "bucket";
public static final String S3_HTTPS_FLAG = "usehttps";
public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout";
public static final String S3_MAX_ERROR_RETRY = "maxerrorretry";
public static final String S3_SOCKET_TIMEOUT = "sockettimeout";
public static final String INCL_ZONES = "includezones";
public static final String EXCL_ZONES = "excludezones";
public static final String SOURCE = "source";
public static final String COUNTER_ID = "counterid";
public static final String AGGR_OPERATOR = "aggroperator";
public static final String AGGR_FUNCTION = "aggrfunction";
public static final String AGGR_VALUE = "aggrvalue";
public static final String THRESHOLD = "threshold";
public static final String RELATIONAL_OPERATOR = "relationaloperator";
public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams";
public static final String MIN_MEMBERS = "minmembers";
public static final String MAX_MEMBERS = "maxmembers";
public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod";
public static final String VMPROFILE_ID = "vmprofileid";
public static final String VMGROUP_ID = "vmgroupid";
public static final String CS_URL = "csurl";
public static final String SCALEUP_POLICY_IDS = "scaleuppolicyids";
public static final String SCALEDOWN_POLICY_IDS = "scaledownpolicyids";
public static final String SCALEUP_POLICIES = "scaleuppolicies";
public static final String SCALEDOWN_POLICIES = "scaledownpolicies";
public static final String INTERVAL = "interval";
public static final String QUIETTIME = "quiettime";
public static final String ACTION = "action";
public static final String CONDITION_ID = "conditionid";
public static final String CONDITION_IDS = "conditionids";
public static final String COUNTERPARAM_LIST = "counterparam";
public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
<<<<<<< HEAD
public static final String UCS_DN = "ucsdn";
=======
public static final String VM_SNAPSHOT_DESCRIPTION = "description";
public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
>>>>>>> CLOUDSTACK-684 Support VM Snapshot
public enum HostDetails {
all, capacity, events, stats, min;
}
public enum VMDetails {
all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min;
}
public enum LDAPParams {
hostname, port, usessl, queryfilter, searchbase, dn, passwd, truststore, truststorepass;
@Override
public String toString() {
return "ldap." + name();
}
}
}

View File

@ -47,6 +47,7 @@ import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
@ -118,7 +119,12 @@ import com.cloud.network.*;
import com.cloud.network.Network.Service;
import com.cloud.network.as.*;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.*;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.vpc.PrivateGateway;
@ -202,6 +208,11 @@ public interface ResponseGenerator {
LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb);
LBHealthCheckResponse createLBHealthCheckPolicyResponse(List<? extends HealthCheckPolicy> healthcheckPolicies,
LoadBalancer lb);
LBHealthCheckResponse createLBHealthCheckPolicyResponse(HealthCheckPolicy healthcheckPolicy, LoadBalancer lb);
PodResponse createPodResponse(Pod pod, Boolean showCapacities);
ZoneResponse createZoneResponse(DataCenter dataCenter, Boolean showCapacities);

View File

@ -78,6 +78,11 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map<String, String> details;
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from external provisioning system")
private String accountUUID;
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
private String userUUID;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -133,6 +138,14 @@ public class CreateAccountCmd extends BaseCmd {
return params;
}
public String getAccountUUID() {
return accountUUID;
}
public String getUserUUID() {
return userUUID;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -151,7 +164,7 @@ public class CreateAccountCmd extends BaseCmd {
public void execute(){
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
getDomainId(), getNetworkDomain(), getDetails());
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());

View File

@ -49,6 +49,9 @@ public class CreateDomainCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain")
private String networkDomain;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region")
private String domainUUID;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -65,6 +68,10 @@ public class CreateDomainCmd extends BaseCmd {
return networkDomain;
}
public String getDomainUUID() {
return domainUUID;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -82,7 +89,7 @@ public class CreateDomainCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():""));
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain());
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID());
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());

View File

@ -49,12 +49,6 @@ public class AddRegionCmd extends BaseCmd {
@Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="Region service endpoint")
private String endPoint;
@Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key of Admin user")
private String apiKey;
@Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user")
private String secretKey;
@Inject public RegionService _regionService;
/////////////////////////////////////////////////////
@ -73,14 +67,6 @@ public class AddRegionCmd extends BaseCmd {
return endPoint;
}
public String getApiKey() {
return apiKey;
}
public String getSecretKey() {
return secretKey;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -97,7 +83,7 @@ public class AddRegionCmd extends BaseCmd {
@Override
public void execute(){
Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint());
if (region != null) {
RegionResponse response = _responseGenerator.createRegionResponse(region);
response.setResponseName(getCommandName());

View File

@ -49,12 +49,6 @@ public class UpdateRegionCmd extends BaseCmd {
@Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
private String endPoint;
@Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="new API key for the Region")
private String apiKey;
@Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region")
private String secretKey;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
@ -73,13 +67,6 @@ public class UpdateRegionCmd extends BaseCmd {
return endPoint;
}
public String getApiKey() {
return apiKey;
}
public String getSecretKey() {
return secretKey;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -96,7 +83,7 @@ public class UpdateRegionCmd extends BaseCmd {
@Override
public void execute(){
Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint());
if (region != null) {
RegionResponse response = _responseGenerator.createRegionResponse(region);
response.setResponseName(getCommandName());

View File

@ -65,6 +65,9 @@ public class CreateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.")
private String username;
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
private String userUUID;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -101,6 +104,10 @@ public class CreateUserCmd extends BaseCmd {
return username;
}
public String getUserUUID() {
return userUUID;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -132,7 +139,7 @@ public class CreateUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName());
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId());
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID());
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());

View File

@ -33,7 +33,7 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@APICommand(name = "deleteUser", description="Creates a user for an account", responseObject=UserResponse.class)
@APICommand(name = "deleteUser", description="Deletes a user for an account", responseObject=SuccessResponse.class)
public class DeleteUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteUserCmd.class.getName());
@ -42,7 +42,7 @@ public class DeleteUserCmd extends BaseCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="id of the user to be deleted")
private Long id;
@Inject RegionService _regionService;

View File

@ -35,7 +35,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@APICommand(name = "assignVirtualMachine", description="Move a user VM to another user under same domain.", responseObject=UserVmResponse.class, since="3.0.0")
@APICommand(name = "assignVirtualMachine", description="Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.", responseObject=UserVmResponse.class, since="3.0.0")
public class AssignVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName());
@ -46,7 +46,7 @@ public class AssignVMCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
required=true, description="the vm ID of the user VM to be moved")
required=true, description="id of the VM to be moved")
private Long virtualMachineId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="account name of the new VM owner.")
@ -58,11 +58,11 @@ public class AssignVMCmd extends BaseCmd {
//Network information
@Parameter(name=ApiConstants.NETWORK_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=NetworkResponse.class,
description="list of network ids that will be part of VM network after move in advanced network setting.")
description="list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.")
private List<Long> networkIds;
@Parameter(name=ApiConstants.SECURITY_GROUP_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=SecurityGroupResponse.class,
description="comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is moved in a zone with Basic Network support.")
description="list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.")
private List<Long> securityGroupIdList;
/////////////////////////////////////////////////////

View File

@ -52,7 +52,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
private String hypervisor;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
description="list all isos by id")
description="list ISO by id")
private Long id;
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if the ISO is publicly available to all users, false otherwise.")
@ -61,11 +61,14 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.IS_READY, type=CommandType.BOOLEAN, description="true if this ISO is ready to be deployed")
private Boolean ready;
@Parameter(name=ApiConstants.ISO_FILTER, type=CommandType.STRING, description="possible values are \"featured\", \"self\", \"self-executable\",\"executable\", and \"community\". " +
"* featured-ISOs that are featured and are publicself-ISOs that have been registered/created by the owner. " +
"* selfexecutable-ISOs that have been registered/created by the owner that can be used to deploy a new VM. " +
"* executable-all ISOs that can be used to deploy a new VM " +
"* community-ISOs that are public.")
@Parameter(name=ApiConstants.ISO_FILTER, type=CommandType.STRING, description="possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " +
"* featured : templates that have been marked as featured and public. " +
"* self : templates that have been registered or created by the calling user. " +
"* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " +
"* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " +
"* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " +
"* community : templates that have been marked as public but not featured. " +
"* all : all templates (only usable by admins).")
private String isoFilter = TemplateFilter.selfexecutable.toString();
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list all isos by name")

View File

@ -0,0 +1,168 @@
// 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.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.HealthCheckPolicy;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "createLBHealthCheckPolicy", description = "Creates a Load Balancer healthcheck policy ", responseObject = LBHealthCheckResponse.class, since="4.2.0")
@SuppressWarnings("rawtypes")
public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger
.getLogger(CreateLBHealthCheckPolicyCmd.class.getName());
private static final String s_name = "createlbhealthcheckpolicyresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the load balancer rule")
private Long lbRuleId;
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer HealthCheck policy")
private String description;
@Parameter(name = ApiConstants.HEALTHCHECK_PINGPATH, type = CommandType.STRING, required = false, description = "HTTP Ping Path")
private String pingPath;
@Parameter(name = ApiConstants.HEALTHCHECK_RESPONSE_TIMEOUT, type = CommandType.INTEGER, required = false, description = "Time to wait when receiving a response from the health check (2sec - 60 sec)")
private int responsTimeOut;
@Parameter(name = ApiConstants.HEALTHCHECK_INTERVAL_TIME, type = CommandType.INTEGER, required = false, description = "Amount of time between health checks (1 sec - 20940 sec)")
private int healthCheckInterval;
@Parameter(name = ApiConstants.HEALTHCHECK_HEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, description = "Number of consecutive health check success before declaring an instance healthy")
private int healthyThreshold;
@Parameter(name = ApiConstants.HEALTHCHECK_UNHEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, description = "Number of consecutive health check failures before declaring an instance unhealthy")
private int unhealthyThreshold;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getLbRuleId() {
return lbRuleId;
}
public String getDescription() {
return description;
}
public String getPingPath() {
return pingPath;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
Account account = UserContext.current().getCaller();
if (account != null) {
return account.getId();
}
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
public int getResponsTimeOut() {
return responsTimeOut;
}
public int getHealthCheckInterval() {
return healthCheckInterval;
}
public int getHealthyThreshold() {
return healthyThreshold;
}
public int getUnhealthyThreshold() {
return unhealthyThreshold;
}
@Override
public void execute() throws ResourceAllocationException, ResourceUnavailableException {
HealthCheckPolicy policy = null;
boolean success = false;
try {
UserContext.current().setEventDetails("Load balancer healthcheck policy Id : " + getEntityId());
success = _lbService.applyLBHealthCheckPolicy(this);
if (success) {
// State might be different after the rule is applied, so get new object here
policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId());
LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
setResponseObject(hcResponse);
hcResponse.setResponseName(getCommandName());
}
} finally {
if (!success || (policy == null)) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create healthcheck policy ");
}
}
}
@Override
public void create() {
try {
HealthCheckPolicy result = _lbService.createLBHealthCheckPolicy(this);
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (InvalidParameterValueException e) {
s_logger.warn("Exception: ", e);
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR , e.getMessage());
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_LB_HEALTHCHECKPOLICY_CREATE;
}
@Override
public String getEventDescription() {
return "Create Load Balancer HealthCheck policy";
}
}

View File

@ -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 org.apache.cloudstack.api.command.user.loadbalancer;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since="4.2.0")
public class DeleteLBHealthCheckPolicyCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteLBHealthCheckPolicyCmd.class.getName());
private static final String s_name = "deletelbhealthcheckpolicyresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBHealthCheckResponse.class,
required = true, description = "the ID of the load balancer HealthCheck policy")
private Long id;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getId() {
return id;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
Account account = UserContext.current().getCaller();
if (account != null) {
return account.getId();
}
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
@Override
public String getEventType() {
return EventTypes.EVENT_LB_HEALTHCHECKPOLICY_DELETE;
}
@Override
public String getEventDescription() {
return "deleting load balancer HealthCheck policy: " + getId();
}
@Override
public void execute() {
UserContext.current().setEventDetails("Load balancer healthcheck policy Id: " + getId());
boolean result = _lbService.deleteLBHealthCheckPolicy(getId() , true);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer healthcheck policy");
}
}
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
HealthCheckPolicy policy = _entityMgr.findById(HealthCheckPolicy.class,
getId());
if (policy == null) {
throw new InvalidParameterValueException("Unable to find load balancer healthcheck rule: " + id);
}
LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
if (lb == null) {
throw new InvalidParameterValueException("Unable to find load balancer rule for healthcheck rule: " + id);
}
return lb.getNetworkId();
}
}

View File

@ -0,0 +1,85 @@
// 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 java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since="4.2.0")
public class ListLBHealthCheckPoliciesCmd extends BaseListCmd {
public static final Logger s_logger = Logger
.getLogger(ListLBHealthCheckPoliciesCmd.class.getName());
private static final String s_name = "listlbhealthcheckpoliciesresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
required = true, description = "the ID of the load balancer rule")
private Long lbRuleId;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getLbRuleId() {
return lbRuleId;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void execute() {
List<LBHealthCheckResponse> hcpResponses = new ArrayList<LBHealthCheckResponse>();
LoadBalancer lb = _lbService.findById(getLbRuleId());
ListResponse<LBHealthCheckResponse> response = new ListResponse<LBHealthCheckResponse>();
if (lb != null) {
List<? extends HealthCheckPolicy> healthCheckPolicies = _lbService.searchForLBHealthCheckPolicies(this);
LBHealthCheckResponse spResponse = _responseGenerator.createLBHealthCheckPolicyResponse(healthCheckPolicies, lb);
hcpResponses.add(spResponse);
response.setResponses(hcpResponses);
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -55,11 +55,14 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the template name")
private String templateName;
@Parameter(name=ApiConstants.TEMPLATE_FILTER, type=CommandType.STRING, required=true, description="possible values are \"featured\", \"self\", \"self-executable\", \"executable\", and \"community\"." +
"* featured-templates that are featured and are public" +
"* self-templates that have been registered/created by the owner" +
"* selfexecutable-templates that have been registered/created by the owner that can be used to deploy a new VM" +
"* executable-all templates that can be used to deploy a new VM* community-templates that are public.")
@Parameter(name=ApiConstants.TEMPLATE_FILTER, type=CommandType.STRING, required=true, description="possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " +
"* featured : templates that have been marked as featured and public. " +
"* self : templates that have been registered or created by the calling user. " +
"* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " +
"* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " +
"* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " +
"* community : templates that have been marked as public but not featured. " +
"* all : all templates (only usable by admins).")
private String templateFilter;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,

View File

@ -28,6 +28,8 @@ import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
@ -83,6 +85,9 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
public Long getNetworkId() {
Nic nic = _entityMgr.findById(Nic.class, nicId);
if (nic == null) {
throw new InvalidParameterValueException("Can't find network id for specified nic");
}
Long networkId = nic.getNetworkId();
return networkId;
}
@ -98,6 +103,13 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
return null;
}
}
public NetworkType getNetworkType() {
Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
return dc.getNetworkType();
}
@Override
public long getEntityOwnerId() {
Account caller = UserContext.current().getCaller();
@ -134,7 +146,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
UserContext.current().setEventDetails("Nic Id: " + getNicId() );
String ip;
String SecondaryIp = null;
String secondaryIp = null;
if ((ip = getIpaddress()) != null) {
if (!NetUtils.isValidIp(ip)) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid ip address " + ip);
@ -142,15 +154,24 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
}
try {
SecondaryIp = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
secondaryIp = _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNicId(), getNetworkId(), getIpaddress());
} catch (InsufficientAddressCapacityException e) {
throw new InvalidParameterValueException("Allocating guest ip for nic failed");
}
if (SecondaryIp != null) {
s_logger.info("Associated ip address to NIC : " + SecondaryIp);
if (secondaryIp != null) {
if (getNetworkType() == NetworkType.Basic) {
// add security group rules for the secondary ip addresses
boolean success = false;
success = _securityGroupService.securityGroupRulesForVmSecIp(getNicId(), getNetworkId(), secondaryIp, (boolean) true);
if (success == false) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set security group rules for the secondary ip");
}
}
s_logger.info("Associated ip address to NIC : " + secondaryIp);
NicSecondaryIpResponse response = new NicSecondaryIpResponse();
response = _responseGenerator.createSecondaryIPToNicResponse(ip, getNicId(), getNetworkId());
response = _responseGenerator.createSecondaryIPToNicResponse(secondaryIp, getNicId(), getNetworkId());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {

View File

@ -27,15 +27,21 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
@APICommand(name = "removeIpFromNic", description="Assigns secondary IP to NIC.", responseObject=SuccessResponse.class)
public class RemoveIpFromVmNicCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RemoveIpFromVmNicCmd.class.getName());
private static final String s_name = "unassignsecondaryipaddrtonicresponse";
private static final String s_name = "removeipfromnicresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -43,7 +49,7 @@ public class RemoveIpFromVmNicCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, required = true, entityType = NicSecondaryIpResponse.class,
description="the ID of the secondary ip address to nic")
private long id;
private Long id;
// unexposed parameter needed for events logging
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, expose=false)
@ -57,7 +63,7 @@ public class RemoveIpFromVmNicCmd extends BaseAsyncCmd {
return "nic_secondary_ips";
}
public long getIpAddressId() {
public Long getIpAddressId() {
return id;
}
@ -80,6 +86,11 @@ public class RemoveIpFromVmNicCmd extends BaseAsyncCmd {
return EventTypes.EVENT_NET_IP_ASSIGN;
}
public NicSecondaryIp getIpEntry() {
NicSecondaryIp nicSecIp = _entityMgr.findById(NicSecondaryIp.class, getIpAddressId());
return nicSecIp;
}
@Override
public String getEventDescription() {
return ("Disassociating ip address with id=" + id);
@ -98,15 +109,53 @@ public class RemoveIpFromVmNicCmd extends BaseAsyncCmd {
return "addressinfo";
}
public Long getNetworkId() {
NicSecondaryIp nicSecIp = _entityMgr.findById(NicSecondaryIp.class, getIpAddressId());
if (nicSecIp != null) {
Long networkId = nicSecIp.getNetworkId();
return networkId;
} else {
return null;
}
}
public NetworkType getNetworkType() {
Network ntwk = _entityMgr.findById(Network.class, getNetworkId());
if (ntwk != null) {
DataCenter dc = _entityMgr.findById(DataCenter.class, ntwk.getDataCenterId());
return dc.getNetworkType();
}
return null;
}
@Override
public void execute() throws InvalidParameterValueException {
UserContext.current().setEventDetails("Ip Id: " + getIpAddressId());
boolean result = _networkService.releaseSecondaryIpFromNic(getIpAddressId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove secondary ip address for the nic");
UserContext.current().setEventDetails("Ip Id: " + id);
NicSecondaryIp nicSecIp = getIpEntry();
if (nicSecIp == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid IP id is passed");
}
if (getNetworkType() == NetworkType.Basic) {
//remove the security group rules for this secondary ip
boolean success = false;
success = _securityGroupService.securityGroupRulesForVmSecIp(nicSecIp.getNicId(), nicSecIp.getNetworkId(),nicSecIp.getIp4Address(), false);
if (success == false) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set security group rules for the secondary ip");
}
}
try {
boolean result = _networkService.releaseSecondaryIpFromNic(id);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove secondary ip address for the nic");
}
} catch (InvalidParameterValueException e) {
throw new InvalidParameterValueException("Removing guest ip from nic failed");
}
}

View File

@ -22,12 +22,12 @@ import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@ -88,7 +88,7 @@ public class UpgradeVMCmd extends BaseCmd {
}
@Override
public void execute(){
public void execute() throws ResourceAllocationException{
UserContext.current().setEventDetails("Vm Id: "+getId());
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
@ -157,7 +158,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
private Set<NicResponse> nics;
public DomainRouterResponse(){
nics = new HashSet<NicResponse>();
nics = new LinkedHashSet<NicResponse>();
}
@ -344,7 +345,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
public void addNic(NicResponse nic) {
this.nics.add(nic);
}
public String getIp6Dns1() {
return ip6Dns1;
}

View File

@ -0,0 +1,98 @@
// 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.rules.HealthCheckPolicy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
public class LBHealthCheckPolicyResponse extends BaseResponse {
@SerializedName("id")
@Param(description = "the LB HealthCheck policy ID")
private String id;
@SerializedName("pingpath")
@Param(description = "the pingpath of the healthcheck policy")
private String pingpath;
@SerializedName("description")
@Param(description = "the description of the healthcheck policy")
private String description;
@SerializedName("state")
@Param(description = "the state of the policy")
private String state;
@SerializedName("responsetime")
@Param(description = "Time to wait when receiving a response from the health check")
private int responseTime;
@SerializedName("healthcheckinterval")
@Param(description = "Amount of time between health checks")
private int healthcheckInterval;
@SerializedName("healthcheckthresshold")
@Param(description = "Number of consecutive health check success before declaring an instance healthy")
private int healthcheckthresshold;
@SerializedName("unhealthcheckthresshold")
@Param(description = "Number of consecutive health check failures before declaring an instance unhealthy.")
private int unhealthcheckthresshold;
public void setId(String id) {
this.id = id;
}
public String getpingpath() {
return pingpath;
}
public void setpingpath(String pingpath) {
this.pingpath = pingpath;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public LBHealthCheckPolicyResponse(HealthCheckPolicy healthcheckpolicy) {
if (healthcheckpolicy.isRevoke()) {
this.setState("Revoked");
}
if (healthcheckpolicy.getUuid() != null)
setId(healthcheckpolicy.getUuid());
this.pingpath = healthcheckpolicy.getpingpath();
this.healthcheckInterval = healthcheckpolicy.getHealthcheckInterval();
this.responseTime = healthcheckpolicy.getResponseTime();
this.healthcheckthresshold = healthcheckpolicy.getHealthcheckThresshold();
this.unhealthcheckthresshold = healthcheckpolicy.getUnhealthThresshold();
setObjectName("healthcheckpolicy");
}
}

View File

@ -0,0 +1,102 @@
// 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.rules.HealthCheckPolicy;
import org.apache.cloudstack.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import java.util.List;
import java.util.UUID;
@EntityReference(value=HealthCheckPolicy.class)
public class LBHealthCheckResponse extends BaseResponse {
@SerializedName("lbruleid")
@Param(description = "the LB rule ID")
private String lbRuleId;
@SerializedName("account")
@Param(description = "the account of the HealthCheck policy")
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID of the HealthCheck policy")
private String domainId;
@SerializedName("domain")
@Param(description = "the domain of the HealthCheck policy")
private String domainName;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the id of the zone the HealthCheck policy belongs to")
private String zoneId;
@SerializedName("healthcheckpolicy")
@Param(description = "the list of healthcheckpolicies", responseObject = LBHealthCheckPolicyResponse.class)
private List<LBHealthCheckPolicyResponse> healthCheckPolicies;
public void setlbRuleId(String lbRuleId) {
this.lbRuleId = lbRuleId;
}
public void setRules(List<LBHealthCheckPolicyResponse> policies) {
this.healthCheckPolicies = policies;
}
public List<LBHealthCheckPolicyResponse> getHealthCheckPolicies() {
return healthCheckPolicies;
}
public void setHealthCheckPolicies(List<LBHealthCheckPolicyResponse> healthCheckPolicies) {
this.healthCheckPolicies = healthCheckPolicies;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public LBHealthCheckResponse() {
}
public LBHealthCheckResponse(HealthCheckPolicy healthcheckpolicy) {
setObjectName("healthcheckpolicy");
}
}

View File

@ -20,28 +20,38 @@ import java.util.List;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.rules.FirewallRule;
import com.cloud.serializer.Param;
import com.cloud.vm.NicSecondaryIp;
import com.google.gson.annotations.SerializedName;
@EntityReference(value=NicSecondaryIp.class)
@SuppressWarnings("unused")
public class NicSecondaryIpResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the secondary private IP addr")
private Long id;
private String id;
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="Secondary IP address")
private String ipAddr;
@SerializedName(ApiConstants.NIC_ID) @Param(description="the ID of the nic")
private Long nicId;
private String nicId;
@SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the network")
private Long nwId;
private String nwId;
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="the ID of the vm")
private Long vmId;
private String vmId;
public Long getId() {
@Override
public String getObjectId() {
return this.getId();
}
public String getId() {
return id;
}
@ -53,32 +63,32 @@ public class NicSecondaryIpResponse extends BaseResponse {
this.ipAddr = ipAddr;
}
public Long getNicId() {
public String getNicId() {
return nicId;
}
public void setNicId(Long nicId) {
this.nicId = nicId;
public void setNicId(String string) {
this.nicId = string;
}
public Long getNwId() {
public String getNwId() {
return nwId;
}
public void setNwId(Long nwId) {
public void setNwId(String nwId) {
this.nwId = nwId;
}
public Long getVmId() {
public String getVmId() {
return vmId;
}
public void setVmId(Long vmId) {
public void setVmId(String vmId) {
this.vmId = vmId;
}
public Long setId(Long id) {
return id;
public void setId(String id) {
this.id = id;
}

View File

@ -17,6 +17,7 @@
package org.apache.cloudstack.api.response;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
@ -65,9 +66,9 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledVie
private Set<ResourceTagResponse> tags;
public SecurityGroupResponse(){
this.ingressRules = new HashSet<SecurityGroupRuleResponse>();
this.egressRules = new HashSet<SecurityGroupRuleResponse>();
this.tags = new HashSet<ResourceTagResponse>();
this.ingressRules = new LinkedHashSet<SecurityGroupRuleResponse>();
this.egressRules = new LinkedHashSet<SecurityGroupRuleResponse>();
this.tags = new LinkedHashSet<ResourceTagResponse>();
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
@ -169,9 +170,9 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
private String keyPairName;
public UserVmResponse(){
securityGroupList = new HashSet<SecurityGroupResponse>();
nics = new HashSet<NicResponse>();
tags = new HashSet<ResourceTagResponse>();
securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
nics = new LinkedHashSet<NicResponse>();
tags = new LinkedHashSet<ResourceTagResponse>();
}
public void setHypervisor(String hypervisor) {

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
@ -161,7 +162,7 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity
private Set<ResourceTagResponse> tags;
public VolumeResponse(){
tags = new HashSet<ResourceTagResponse>();
tags = new LinkedHashSet<ResourceTagResponse>();
}
@Override

View File

@ -32,9 +32,6 @@ public interface Region {
public String getEndPoint();
public String getApiKey();
public String getSecretKey();
public boolean checkIfServiceEnabled(Service service);

View File

@ -43,22 +43,18 @@ public interface RegionService {
* @param id
* @param name
* @param endPoint
* @param apiKey
* @param secretKey
* @return Return added Region object
*/
public Region addRegion(int id, String name, String endPoint, String apiKey, String secretKey);
public Region addRegion(int id, String name, String endPoint);
/**
* Update details of the Region with specified Id
* @param id
* @param name
* @param endPoint
* @param apiKey
* @param secretKey
* @return Return updated Region object
*/
public Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey);
public Region updateRegion(int id, String name, String endPoint);
/**
* @param id

View File

@ -37,7 +37,7 @@ public class BackupSnapshotAnswerTest {
StoragePool pool = Mockito.mock(StoragePool.class);
bsc = new BackupSnapshotCommand(
"secondaryStoragePoolURL", 101L, 102L, 103L, 104L,
"secondaryStoragePoolURL", 101L, 102L, 103L, 104L, 105L,
"volumePath", pool, "snapshotUuid", "snapshotName",
"prevSnapshotUuid", "prevBackupUuid", false, "vmName", 5);
bsa = new BackupSnapshotAnswer(bsc, true, "results", "bussname", false);

View File

@ -147,14 +147,14 @@ public class BackupSnapshotCommandTest {
BackupSnapshotCommand bsc = new BackupSnapshotCommand(
"http://secondary.Storage.Url",
101L, 102L, 103L, 104L, "vPath", pool,
101L, 102L, 103L, 104L, 105L, "vPath", pool,
"420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
"9012793e-0657-11e2-bebc-0050568b0057",
"7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
BackupSnapshotCommand bsc1 = new BackupSnapshotCommand(
"http://secondary.Storage.Url",
101L, 102L, 103L, 104L, "vPath", pool,
101L, 102L, 103L, 104L, 105L,"vPath", pool,
"420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
"9012793e-0657-11e2-bebc-0050568b0057",
"7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);

View File

@ -64,7 +64,7 @@ public class RegionCmdTest extends TestCase {
Region region = Mockito.mock(Region.class);
Mockito.when(
regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString()))
.thenReturn(region);
addRegionCmd._regionService = regionService;
@ -87,7 +87,7 @@ public class RegionCmdTest extends TestCase {
Region region = Mockito.mock(Region.class);
Mockito.when(
regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString()))
.thenReturn(null);
addRegionCmd._regionService = regionService;

View File

@ -17,6 +17,7 @@
#new labels (begin) **********************************************************************************************
label.use.vm.ip=Use VM IP:
label.menu.regions=Regions
label.region=Region
label.add.region=Add Region

View File

@ -151,6 +151,9 @@ createLBStickinessPolicy=15
deleteLBStickinessPolicy=15
listLoadBalancerRules=15
listLBStickinessPolicies=15
listLBHealthCheckPolicies=15
createLBHealthCheckPolicy=15
deleteLBHealthCheckPolicy=15
listLoadBalancerRuleInstances=15
updateLoadBalancerRule=15

View File

@ -107,11 +107,7 @@
<bean id="hypervisorTemplateAdapter" class="com.cloud.template.HypervisorTemplateAdapter">
<property name="name" value="HypervisorAdapter"/>
</bean>
<bean id="bareMetalTemplateAdapter" class="com.cloud.baremetal.BareMetalTemplateAdapter">
<property name="name" value="BareMetalAdapter"/>
</bean>
</bean>
<!--
Storage pool allocators

View File

@ -1,33 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<components-cloudzones.xml>
<system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
<checker name="PremiumDatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
</system-integrity-checker>
<management-server class="com.cloud.server.ManagementServerExtImpl" library="com.cloud.configuration.CloudZonesComponentLibrary" extends="components-premium.xml:management-server"/>
<configuration-server class="com.cloud.server.ConfigurationServerImpl" extends="components.xml:configuration-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
</configuration-server>
</components-cloudzones.xml>

View File

@ -1,97 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
components.xml is the configuration file for the VM Ops
insertion servers. Someone can quickly pull together an
insertion server by selecting the correct adapters to use.
Here are some places to look for information.
- To find out the general functionality that each Manager
or Adapter provide, look at the javadoc for the interface
that it implements. The interface is usually the
"key" attribute in the declaration.
- To find specific implementation of each Manager or
Adapter, look at the javadoc for the actual class. The
class can be found in the <class> element.
- To find out the configuration parameters for each Manager
or Adapter, look at the javadoc for the actual implementation
class. It should be documented in the description of the
class.
- To know more about the components.xml in general, look for
the javadoc for ComponentLocator.java.
If you found that the Manager or Adapter are not properly
documented, please contact the author.
-->
<components-nonoss.xml>
<system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
<checker name="PremiumDatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
</system-integrity-checker>
<management-server class="com.cloud.server.ManagementServerExtImpl" library="com.cloud.configuration.PremiumComponentLibrary" extends="components.xml:management-server">
<adapters key="com.cloud.ha.Investigator">
<adapter name="VmwareInvestigator" class="com.cloud.ha.VmwareInvestigator"/>
</adapters>
<adapters key="com.cloud.ha.FenceBuilder">
<adapter name="VmwareFenceBuilder" class="com.cloud.ha.VmwareFencer"/>
</adapters>
<adapters key="com.cloud.resource.Discoverer">
<adapter name="VShpereServer" class="com.cloud.hypervisor.vmware.VmwareServerDiscoverer"/>
</adapters>
<adapters key="com.cloud.network.element.NetworkElement">
<adapter name="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
<adapter name="Netscaler" class="com.cloud.network.element.NetscalerElement"/>
<adapter name="F5BigIP" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
<adapter name="CiscoNexus1000vVSM" class="com.cloud.network.element.CiscoNexusVSMElement"/>
</adapters>
<adapters key="com.cloud.hypervisor.HypervisorGuru">
<adapter name="VMwareGuru" class="com.cloud.hypervisor.guru.VMwareGuru"/>
</adapters>
<manager name="VmwareManager" key="com.cloud.hypervisor.vmware.manager.VmwareManager" class="com.cloud.hypervisor.vmware.manager.VmwareManagerImpl"/>
<manager name="NetappManager" key="com.cloud.netapp.NetappManager" class="com.cloud.netapp.NetappManagerImpl"/>
<pluggableservice name="NetscalerExternalLoadBalancerElementService" key="com.cloud.network.element.NetscalerLoadBalancerElementService" class="com.cloud.network.element.NetscalerElement"/>
<pluggableservice name="F5ExternalLoadBalancerElementService" key="com.cloud.network.element.F5ExternalLoadBalancerElementService" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
<pluggableservice name="JuniperSRXFirewallElementService" key="com.cloud.network.element.JuniperSRXFirewallElementService" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
<pluggableservice name="CiscoNexusVSMElementService" key="com.cloud.network.element.CiscoNexusVSMElementService" class="com.cloud.network.element.CiscoNexusVSMElement"/>
<dao name="NetScalerPodDao" class="com.cloud.network.dao.NetScalerPodDaoImpl" singleton="false"/>
<dao name="CiscoNexusVSMDeviceDao" class="com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl" singleton="false"/>
<dao name="NetappPool" class="com.cloud.netapp.dao.PoolDaoImpl" singleton="false"/>
<dao name="NetappVolume" class="com.cloud.netapp.dao.VolumeDaoImpl" singleton="false"/>
<dao name="NetappLun" class="com.cloud.netapp.dao.LunDaoImpl" singleton="false"/>
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
</management-server>
<configuration-server class="com.cloud.server.ConfigurationServerImpl" extends="components.xml:configuration-server">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
</configuration-server>
</components-nonoss.xml>

View File

@ -1,306 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
components.xml is the configuration file for the VM Ops
insertion servers. Someone can quickly pull together an
insertion server by selecting the correct adapters to use.
Here are some places to look for information.
- To find out the general functionality that each Manager
or Adapter provide, look at the javadoc for the interface
that it implements. The interface is usually the
"key" attribute in the declaration.
- To find specific implementation of each Manager or
Adapter, look at the javadoc for the actual class. The
class can be found in the <class> element.
- To find out the configuration parameters for each Manager
or Adapter, look at the javadoc for the actual implementation
class. It should be documented in the description of the
class.
- To know more about the components.xml in general, look for
the javadoc for ComponentLocator.java.
If you found that the Manager or Adapter are not properly
documented, please contact the author.
-->
<components.xml>
<system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
<checker name="EncryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker"/>
<checker name="DatabaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"/>
<checker name="DatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
</system-integrity-checker>
<interceptor library="com.cloud.configuration.DefaultInterceptorLibrary"/>
<management-server class="com.cloud.server.ManagementServerExtImpl" library="com.cloud.configuration.PremiumComponentLibrary">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
<param name="premium">true</param>
</dao>
<adapters key="org.apache.cloudstack.acl.APIChecker">
<adapter name="AccountBasedAPIRateLimit" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl" singleton="true">
<param name="api.throttling.interval">1</param>
<param name="api.throttling.max">25</param>
<param name="api.throttling.cachesize">50000</param>
</adapter>
<adapter name="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/>
</adapters>
<adapters key="com.cloud.agent.manager.allocator.HostAllocator">
<adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.FirstFitRoutingAllocator"/>
<!--adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.RecreateHostAllocator"/-->
<!--adapter name="FirstFit" class="com.cloud.agent.manager.allocator.impl.FirstFitAllocator"/-->
</adapters>
<adapters key="com.cloud.agent.manager.allocator.PodAllocator">
<adapter name="User First" class="com.cloud.agent.manager.allocator.impl.UserConcentratedAllocator"/>
</adapters>
<adapters key="com.cloud.consoleproxy.ConsoleProxyAllocator">
<adapter name="Balance" class="com.cloud.consoleproxy.ConsoleProxyBalanceAllocator"/>
</adapters>
<adapters key="com.cloud.network.guru.NetworkGuru">
<!--
NOTE: The order of those gurus implicates priority of network traffic types the guru implements.
The upper the higher priority. It effects listTafficTypeImplementors API which returns impelmentor
of a specific network traffic.
A fair question is, if two gurus implement the same two network traffic types, but these traffic types
have cross priority, how to rank them? For example:
GuruA (TrafficTypeA, TrafficTypeB)
GuruB (TrafficTypeA, TrafficTypeB)
we want GuruB.TrafficTypeB > GuruA.TrafficTypeB and GuruB.TrafficTypeA < GuruA.TrafficTypeA. As the priority
implicated by order can not map to multiple traffic type, you have to do implement GuruC which inherits GuruB
for TrafficTypeB. Then ranking them in order of:
GuruC (TrafficTypeB)
GuruA (TrafficTypeA, TrafficTypeB)
GuruB (TrafficTypeA, TrafficTypeB)
now GuruC represents TrafficTypeB with highest priority while GuruA represents TrafficTypeA with highest pirority.
However, above case barely happens.
-->
<adapter name="StorageNetworkGuru" class="com.cloud.network.guru.StorageNetworkGuru"/>
<adapter name="ExternalGuestNetworkGuru" class="com.cloud.network.guru.ExternalGuestNetworkGuru"/>
<adapter name="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru"/>
<adapter name="PodBasedNetworkGuru" class="com.cloud.network.guru.PodBasedNetworkGuru"/>
<adapter name="ControlNetworkGuru" class="com.cloud.network.guru.ControlNetworkGuru"/>
<adapter name="DirectNetworkGuru" class="com.cloud.network.guru.DirectNetworkGuru"/>
<adapter name="DirectPodBasedNetworkGuru" class="com.cloud.network.guru.DirectPodBasedNetworkGuru"/>
<adapter name="OvsGuestNetworkGuru" class="com.cloud.network.guru.OvsGuestNetworkGuru"/>
<adapter name="PrivateNetworkGuru" class="com.cloud.network.guru.PrivateNetworkGuru"/>
<adapter name="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru"/>
<adapter name="BigSwitchVnsGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru"/>
</adapters>
<adapters key="com.cloud.cluster.ClusterServiceAdapter">
<adapter name="ClusterService" class="com.cloud.cluster.ClusterServiceServletAdapter"/>
</adapters>
<adapters key="com.cloud.storage.secondary.SecondaryStorageVmAllocator">
<adapter name="Balance" class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator"/>
</adapters>
<adapters key="com.cloud.network.IpAddrAllocator">
<adapter name="Basic" class="com.cloud.network.ExteralIpAddressAllocator"/>
</adapters>
<adapters key="com.cloud.server.auth.UserAuthenticator">
<!-- <adapter name="SHA256SALT" class="com.cloud.server.auth.SHA256SaltedUserAuthenticator"/> -->
<adapter name="MD5" class="com.cloud.server.auth.MD5UserAuthenticator"/>
<adapter name="LDAP" class="com.cloud.server.auth.LDAPUserAuthenticator"/>
</adapters>
<adapters key="com.cloud.ha.Investigator">
<adapter name="SimpleInvestigator" class="com.cloud.ha.CheckOnAgentInvestigator"/>
<adapter name="XenServerInvestigator" class="com.cloud.ha.XenServerInvestigator"/>
<adapter name="PingInvestigator" class="com.cloud.ha.UserVmDomRInvestigator"/>
<adapter name="ManagementIPSysVMInvestigator" class="com.cloud.ha.ManagementIPSystemVMInvestigator"/>
</adapters>
<adapters key="com.cloud.ha.FenceBuilder">
<adapter name="XenServerFenceBuilder" class="com.cloud.ha.XenServerFencer"/>
<adapter name="KVMFenceBuilder" class="com.cloud.ha.KVMFencer"/>
<adapter name="OvmFenceBuilder" class="com.cloud.ovm.hypervisor.OvmFencer"/>
</adapters>
<adapters key="com.cloud.hypervisor.HypervisorGuru">
<adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
<adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
</adapters>
<adapters key="com.cloud.resource.Discoverer">
<adapter name="XCP Agent" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer"/>
<adapter name="SecondaryStorage" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer"/>
<adapter name="KVM Agent" class="com.cloud.hypervisor.kvm.discoverer.KvmServerDiscoverer"/>
<adapter name="Bare Metal Agent" class="com.cloud.baremetal.BareMetalDiscoverer"/>
<adapter name="SCVMMServer" class="com.cloud.hypervisor.hyperv.HypervServerDiscoverer"/>
<adapter name="Ovm Discover" class="com.cloud.ovm.hypervisor.OvmDiscoverer" />
</adapters>
<adapters key="com.cloud.deploy.DeploymentPlanner">
<adapter name="First Fit" class="com.cloud.deploy.FirstFitPlanner"/>
<adapter name="UserDispersing" class="com.cloud.deploy.UserDispersingPlanner"/>
<adapter name="UserConcentratedPod" class="com.cloud.deploy.UserConcentratedPodPlanner"/>
<adapter name="BareMetal Fit" class="com.cloud.deploy.BareMetalPlanner"/>
</adapters>
<adapters key="com.cloud.alert.AlertAdapter">
<adapter name="ClusterAlert" class="com.cloud.alert.ClusterAlertAdapter"/>
<adapter name="ConsoleProxyAlert" class="com.cloud.alert.ConsoleProxyAlertAdapter"/>
<adapter name="SecondaryStorageVmAlert" class="com.cloud.alert.SecondaryStorageVmAlertAdapter"/>
</adapters>
<adapters key="org.apache.cloudstack.acl.SecurityChecker">
<adapter name="DomainChecker" class="com.cloud.acl.DomainChecker"/>
</adapters>
<adapters key="com.cloud.network.element.NetworkElement">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="Ovs" class="com.cloud.network.element.OvsElement"/>
<adapter name="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement"/>
<adapter name="BareMetal" class="com.cloud.network.element.BareMetalElement"/>
<adapter name="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
<adapter name="BigSwitchVns" class="com.cloud.network.element.BigSwitchVnsElement"/>
</adapters>
<adapters key="com.cloud.network.element.FirewallServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.DhcpServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="ExternalDhcpElement" class="com.cloud.network.element.ExternalDhcpElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.UserDataServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.SourceNatServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
</adapters>
<adapters key="com.cloud.network.element.StaticNatServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
</adapters>
<adapters key="com.cloud.network.element.PortForwardingServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
</adapters>
<adapters key="com.cloud.network.element.LoadBalancingServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.RemoteAccessVPNServiceProvider">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.Site2SiteVpnServiceProvider">
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.IpDeployer">
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
</adapters>
<adapters key="com.cloud.network.element.ConnectivityProvider">
<adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
<adapter name="BigSwitchVns" class="com.cloud.network.element.BigSwitchVnsElement"/>
</adapters>
<adapters key="com.cloud.network.element.NetworkACLServiceProvider">
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.network.element.VpcProvider">
<adapter name="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"/>
</adapters>
<adapters key="com.cloud.cluster.agentlb.AgentLoadBalancerPlanner">
<adapter name="ClusterBasedAgentLbPlanner" class="com.cloud.cluster.agentlb.ClusterBasedAgentLoadBalancerPlanner"/>
</adapters>
<adapters key="com.cloud.hypervisor.HypervisorGuru">
<adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
<adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
<adapter name="BareMetalGuru" class="com.cloud.baremetal.BareMetalGuru"/>
<adapter name="HypervGuru" class="com.cloud.hypervisor.guru.HypervGuru"/>
<adapter name="OvmGuru" class="com.cloud.ovm.hypervisor.OvmGuru" />
</adapters>
<adapters key="com.cloud.agent.StartupCommandProcessor">
<adapter name="BasicAgentAuthorizer" class="com.cloud.agent.manager.authn.impl.BasicAgentAuthManager"/>
</adapters>
<manager name="OvsTunnelManager" key="com.cloud.network.ovs.OvsTunnelManager" class="com.cloud.network.ovs.OvsTunnelManagerImpl"/>
<manager name="ElasticLoadBalancerManager" key="com.cloud.network.lb.ElasticLoadBalancerManager" class="com.cloud.network.lb.ElasticLoadBalancerManagerImpl"/>
<pluggableservice name="ApiDiscoveryService" key="org.apache.cloudstack.discovery.ApiDiscoveryService" class="org.apache.cloudstack.discovery.ApiDiscoveryServiceImpl"/>
<pluggableservice name="VirtualRouterElementService" key="com.cloud.network.element.VirtualRouterElementService" class="com.cloud.network.element.VirtualRouterElement"/>
<pluggableservice name="NiciraNvpElementService" key="com.cloud.network.element.NiciraNvpElementService" class="com.cloud.network.element.NiciraNvpElement"/>
<pluggableservice name="ApiRateLimitService" key="org.apache.cloudstack.ratelimit.ApiRateLimitService" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl"/>
<pluggableservice name="BigSwitchVnsElementService" key="com.cloud.network.element.BigSwitchVnsElementService" class="com.cloud.network.element.BigSwitchVnsElement"/>
<dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>
<dao name="OvsTunnelAccountDao" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" singleton="false"/>
<dao name="NiciraNvpDao" class="com.cloud.network.dao.NiciraNvpDaoImpl" singleton="false"/>
<dao name="NiciraNvpNicMappingDao" class="com.cloud.network.dao.NiciraNvpNicMappingDaoImpl" singleton="false"/>
<dao name="NiciraNvpRouterMappingDao" class="com.cloud.network.dao.NiciraNvpRouterMappingDaoImpl" singleton="false"/>
<dao name="ElasticLbVmMapDao" class="com.cloud.network.lb.dao.ElasticLbVmMapDaoImpl" singleton="false"/>
<dao name="BigSwitchVnsDao" class="com.cloud.network.dao.BigSwitchVnsDaoImpl" singleton="false"/>
</management-server>
<configuration-server class="com.cloud.server.ConfigurationServerImpl">
<dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl" singleton="false">
<param name="premium">true</param>
</dao>
<dao name="Snapshot policy defaults" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl" singleton="false"/>
<dao name="DiskOffering configuration server" class="com.cloud.storage.dao.DiskOfferingDaoImpl" singleton="false"/>
<dao name="ServiceOffering configuration server" class="com.cloud.service.dao.ServiceOfferingDaoImpl" singleton="false"/>
<dao name="host zone configuration server" class="com.cloud.dc.dao.DataCenterDaoImpl" singleton="false"/>
<dao name="host pod configuration server" class="com.cloud.dc.dao.HostPodDaoImpl" singleton="false"/>
<dao name="DomainDao" class="com.cloud.domain.dao.DomainDaoImpl" singleton="false"/>
<dao name="NetworkOfferingDao" class="com.cloud.offerings.dao.NetworkOfferingDaoImpl" singleton="false"/>
<dao name="DataCenterDao" class="com.cloud.dc.dao.DataCenterDaoImpl" singleton="false"/>
<dao name="NetworkDao" class="com.cloud.network.dao.NetworkDaoImpl" singleton="false"/>
<dao name="IpAddressDao" class="com.cloud.network.dao.IPAddressDaoImpl" singleton="false"/>
<dao name="VlanDao" class="com.cloud.dc.dao.VlanDaoImpl" singleton="false"/>
<dao name="ResouceCountDao" class="com.cloud.configuration.dao.ResourceCountDaoImpl" singleton="false"/>
<dao name="AccountDao" class="com.cloud.user.dao.AccountDaoImpl" singleton="false"/>
<dao name="UserDao" class="com.cloud.user.dao.UserDaoImpl" singleton="false"/>
<dao name="NetworkOfferingServiceDao" class="com.cloud.offerings.dao.NetworkOfferingServiceMapDaoImpl" singleton="false"/>
<dao name="VirtualRouterProviderDao" class="com.cloud.network.dao.VirtualRouterProviderDaoImpl" singleton="false"/>
<dao name="IdentityDao" class="com.cloud.uuididentity.dao.IdentityDaoImpl" singleton="false"/>
<dao name="Site2SiteCustomerGatewayDao" class="com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnGatewayDao" class="com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnConnectionDao" class="com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl" singleton="false"/>
<dao name="RegionDao" class="org.apache.cloudstack.region.dao.RegionDaoImpl" singleton="false"/>
<dao name="UserIpv6AddressDao" class="com.cloud.network.dao.UserIpv6AddressDaoImpl" singleton="false"/>
</configuration-server>
<awsapi-ec2server class="com.cloud.bridge.service.EC2MainServlet">
<dao name="CloudStackConfigurationDao" class="com.cloud.bridge.persist.dao.CloudStackConfigurationDaoImpl" singleton="false"/>
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
<dao name="CloudStackSvcOfferingDao" class="com.cloud.bridge.persist.dao.CloudStackSvcOfferingDaoImpl" singleton="false"/>
<dao name="OfferingDao" class="com.cloud.bridge.persist.dao.OfferingDaoImpl" singleton="false"/>
<dao name="CloudStackAccountDao" class="com.cloud.bridge.persist.dao.CloudStackAccountDaoImpl" singleton="false"/>
<dao name="CloudStackUserDao" class="com.cloud.bridge.persist.dao.CloudStackUserDaoImpl" singleton="false"/>
</awsapi-ec2server>
<awsapi-s3server class="com.cloud.bridge.service.S3RestServlet">
<dao name="CloudStackConfigurationDao" class="com.cloud.bridge.persist.dao.CloudStackConfigurationDaoImpl" singleton="false"/>
<dao name="MHostDao" class="com.cloud.bridge.persist.dao.MHostDaoImpl" singleton="false"/>
<dao name="SHostDao" class="com.cloud.bridge.persist.dao.SHostDaoImpl" singleton="false"/>
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
<dao name="BucketPolicyDao" class="com.cloud.bridge.persist.dao.BucketPolicyDaoImpl" singleton="false"/>
<dao name="MHostMountDao" class="com.cloud.bridge.persist.dao.MHostMountDaoImpl" singleton="false"/>
<dao name="SAclDao" class="com.cloud.bridge.persist.dao.SAclDaoImpl" singleton="false"/>
<dao name="SBucketDao" class="com.cloud.bridge.persist.dao.SBucketDaoImpl" singleton="false"/>
<dao name="SMetaDao" class="com.cloud.bridge.persist.dao.SMetaDaoImpl" singleton="false"/>
<dao name="SObjectDao" class="com.cloud.bridge.persist.dao.SObjectDaoImpl" singleton="false"/>
<dao name="SObjectItemDao" class="com.cloud.bridge.persist.dao.SObjectItemDaoImpl" singleton="false"/>
<dao name="MultiPartPartsDao" class="com.cloud.bridge.persist.dao.MultiPartPartsDaoImpl" singleton="false"/>
<dao name="MultiPartUploadsDao" class="com.cloud.bridge.persist.dao.MultiPartUploadsDaoImpl" singleton="false"/>
<dao name="MultipartMetaDao" class="com.cloud.bridge.persist.dao.MultipartMetaDaoImpl" singleton="false"/>
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
</awsapi-s3server>
</components.xml>

View File

@ -113,11 +113,7 @@
<bean id="hypervisorTemplateAdapter" class="com.cloud.template.HypervisorTemplateAdapter">
<property name="name" value="HypervisorAdapter"/>
</bean>
<bean id="bareMetalTemplateAdapter" class="com.cloud.baremetal.BareMetalTemplateAdapter">
<property name="name" value="BareMetalAdapter"/>
</bean>
</bean>
<!--
Storage pool allocators

View File

@ -0,0 +1,71 @@
// 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;
public class NetworkRulesVmSecondaryIpCommand extends Command {
private String vmName;
private VirtualMachine.Type type;
private String vmSecIp;
private String vmMac;
private String action;
public NetworkRulesVmSecondaryIpCommand(String vmName, VirtualMachine.Type type) {
this.vmName = vmName;
this.type = type;
}
public NetworkRulesVmSecondaryIpCommand(String vmName, String vmMac,
String secondaryIp, boolean action) {
this.vmName = vmName;
this.vmMac = vmMac;
this.vmSecIp = secondaryIp;
if (action) {
this.action = "-A";
} else {
this.action = "-D";
}
}
public String getVmName() {
return vmName;
}
public VirtualMachine.Type getType() {
return type;
}
public String getVmSecIp() {
return vmSecIp;
}
public String getVmMac() {
return vmMac;
}
public String getAction() {
return action;
}
@Override
public boolean executeInSequence() {
return false;
}
}

View File

@ -66,9 +66,6 @@ public class AccountVO implements Account {
@Column(name="default_zone_id")
private Long defaultZoneId = null;
@Column(name="region_id")
private int regionId;
public AccountVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -78,14 +75,13 @@ public class AccountVO implements Account {
this.uuid = UUID.randomUUID().toString();
}
public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid, int regionId) {
public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid) {
this.accountName = accountName;
this.domainId = domainId;
this.networkDomain = networkDomain;
this.type = type;
this.state = State.enabled;
this.uuid = uuid;
this.regionId = regionId;
}
public void setNeedsCleanup(boolean value) {
@ -183,11 +179,4 @@ public class AccountVO implements Account {
this.uuid = uuid;
}
public int getRegionId() {
return regionId;
}
public void setRegionId(int regionId) {
this.regionId = regionId;
}
}

View File

@ -93,9 +93,6 @@ public class UserVO implements User, Identity, InternalIdentity {
@Column(name="uuid")
private String uuid;
@Column(name="region_id")
private int regionId;
public UserVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -105,7 +102,7 @@ public class UserVO implements User, Identity, InternalIdentity {
this.uuid = UUID.randomUUID().toString();
}
public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid, int regionId) {
public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid) {
this.accountId = accountId;
this.username = username;
this.password = password;
@ -115,7 +112,6 @@ public class UserVO implements User, Identity, InternalIdentity {
this.timezone = timezone;
this.state = State.enabled;
this.uuid = uuid;
this.regionId = regionId;
}
@Override
@ -266,11 +262,4 @@ public class UserVO implements User, Identity, InternalIdentity {
this.uuid = uuid;
}
public int getRegionId() {
return regionId;
}
public void setRegionId(int regionId) {
this.regionId = regionId;
}
}

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
cloudstack (4.2.0-incubating-0.0.snapshot) unstable; urgency=low
* Update the version to 4.2.0 to be in sync with Maven
-- Wido den Hollander <wido@widodh.nl> Wed, 13 Mar 2013 19:15:00 +0100
cloudstack (4.1.0-incubating-0.0.snapshot) unstable; urgency=low
* Incorporate incubating into version, remove epoch

View File

@ -5,9 +5,9 @@
# 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
@ -18,6 +18,8 @@
/etc/cloudstack/server/*
/etc/cloudstack/management/*
/etc/init.d/cloudstack-management
/etc/security/limits.d/cloudstack-limits.conf
/etc/sudoers.d/cloudstack
/var/cache/cloudstack/management
/var/cache/cloudstack/management/work
/var/cache/cloudstack/management/temp

View File

@ -20,7 +20,7 @@ if [ "$1" = configure ]; then
if ! getent passwd cloud >/dev/null; then
adduser --quiet --system --group --no-create-home --home /var/lib/cloudstack/management cloud
else
usermod -m /var/lib/cloudstack/management cloud
usermod -m -d /var/lib/cloudstack/management cloud
fi
chown cloud /var/log/cloudstack/management
fi
fi

View File

@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
/usr/share/cloudstack-usage/lib/cloudstack-usage.jar
/usr/share/cloudstack-usage/lib/*
/usr/share/cloudstack-usage/plugins
/etc/init.d/cloudstack-usage
/var/log/cloudstack/usage
/etc/cloudstack/usage/*

37
debian/cloudstack-usage.postinst vendored Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# 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.
set -e
case "$1" in
configure)
# We copy the db.properties file from the management server to the usage server
# This used to be a symlink, but we don't do that anymore
if [ -f "/etc/cloud/management/db.properties" ]; then
cp -a /etc/cloud/management/db.properties /etc/cloudstack/usage/db.properties
fi
# We also retain the log4j configuration
if [ -f "/etc/cloud/usage/log4j-cloud_usage.xml" ]; then
cp -a /etc/cloud/usage/log4j-cloud_usage.xml /etc/cloudstack/usage/log4j-cloud_usage.xml
fi
;;
esac
exit 0

28
debian/rules vendored
View File

@ -38,12 +38,12 @@ build-indep-stamp: configure
-Dcs.replace.properties=replace.properties.tmp
touch $@
clean:
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp configure-stamp
rm -f replace.properties.tmp
dh_clean
dh_clean
install:
dh_testdir
@ -64,8 +64,8 @@ install:
mkdir $(DESTDIR)/var/log/$(PACKAGE)/agent
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent/plugins
install -D agent/target/cloud-agent-4.2.0-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/$(PACKAGE)-agent.jar
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-4.2.0-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
install -D agent/target/cloud-agent-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/$(PACKAGE)-agent.jar
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
install -D plugins/hypervisors/kvm/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
install -D packaging/debian/init/cloud-agent $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
install -D agent/bindir/cloud-setup-agent.in $(DESTDIR)/usr/bin/cloud-setup-agent
@ -75,6 +75,8 @@ install:
# cloudstack-management
mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server
mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management
mkdir -p $(DESTDIR)/$(SYSCONFDIR)/security/limits.d/
mkdir -p $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/
mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management
mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management/webapps/client
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-management/setup
@ -86,14 +88,20 @@ install:
mkdir $(DESTDIR)/var/lib/$(PACKAGE)/management
mkdir $(DESTDIR)/var/lib/$(PACKAGE)/mnt
cp -r client/target/utilities/scripts/db/* $(DESTDIR)/usr/share/$(PACKAGE)-management/setup/
cp -r client/target/cloud-client-ui-4.2.0-SNAPSHOT/* $(DESTDIR)/usr/share/$(PACKAGE)-management/webapps/client/
cp -r client/target/cloud-client-ui-$(VERSION)-SNAPSHOT/* $(DESTDIR)/usr/share/$(PACKAGE)-management/webapps/client/
cp server/target/conf/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/
cp client/target/conf/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management/
# nast hack for a couple of configuration files
mv $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/cloudstack-limits.conf $(DESTDIR)/$(SYSCONFDIR)/security/limits.d/
mv $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/cloudstack-sudoers $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/cloudstack
chmod 0440 $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/cloudstack
ln -s tomcat6-nonssl.conf $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management/tomcat6.conf
mkdir -p $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management/Catalina/localhost/client
install -D packaging/debian/init/cloud-management $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-management
install -D client/bindir/cloud-update-xenserver-licenses.in $(DESTDIR)/usr/bin/cloud-update-xenserver-licenses
install -D server/target/cloud-server-4.2.0-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/$(PACKAGE)-server.jar
install -D server/target/cloud-server-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/$(PACKAGE)-server.jar
ln -s /usr/share/tomcat6/bin $(DESTDIR)/usr/share/$(PACKAGE)-management/bin
ln -s ../../..$(SYSCONFDIR)/$(PACKAGE)/management $(DESTDIR)/usr/share/$(PACKAGE)-management/conf
ln -s /usr/share/tomcat6/lib $(DESTDIR)/usr/share/$(PACKAGE)-management/lib
@ -115,7 +123,7 @@ install:
install -D client/target/utilities/bin/cloud-set-guest-sshkey $(DESTDIR)/usr/bin
install -D client/target/utilities/bin/cloud-setup-databases $(DESTDIR)/usr/bin
install -D client/target/utilities/bin/cloud-setup-management $(DESTDIR)/usr/bin
install -D services/console-proxy/server/dist/systemvm.iso $(DESTDIR)/usr/share/$(PACKAGE)-common/vms/systemvm.iso
install -D client/target/cloud-client-ui-$(VERSION)-SNAPSHOT/WEB-INF/classes/vms/systemvm.iso $(DESTDIR)/usr/share/$(PACKAGE)-common/vms/systemvm.iso
# cloudstack-python
mkdir -p $(DESTDIR)/usr/lib/python2.7/dist-packages
@ -124,9 +132,11 @@ install:
# cloudstack-usage
mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage
mkdir $(DESTDIR)/var/log/$(PACKAGE)/usage
install -D usage/target/cloud-usage-4.2.0-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage/plugins
install -D usage/target/cloud-usage-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar
install -D usage/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/
cp usage/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/
ln -s ../management/db.properties $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/db.properties
install -D packaging/debian/init/cloud-usage $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage
# cloudstack-awsapi

View File

@ -92,11 +92,11 @@
<tbody>
<row>
<entry><para>Name</para></entry>
<entry><para>systemvm-vmware-3.0.0</para></entry>
<entry><para>systemvm-vmware-4.0</para></entry>
</row>
<row>
<entry><para>Description</para></entry>
<entry><para>systemvm-vmware-3.0.0</para></entry>
<entry><para>systemvm-vmware-4.0</para></entry>
</row>
<row>
<entry><para>URL</para></entry>

View File

@ -34,8 +34,10 @@
AutoScaling to launch an additional VM whenever CPU usage exceeds 80 percent for 15 minutes, or
to remove a VM whenever CPU usage is less than 20 percent for 30 minutes.</para>
<para>&PRODUCT; uses the NetScaler load balancer to monitor all aspects of a system's health and
work in unison with &PRODUCT; to initiate scale-up or scale-down actions. The supported
NetScaler version is 10.0.</para>
work in unison with &PRODUCT; to initiate scale-up or scale-down actions.</para>
<note>
<para>AutoScale is supported on NetScaler Release 10 Build 73.e and beyond.</para>
</note>
<formalpara>
<title>Prerequisites</title>
<para>Before you configure an AutoScale rule, consider the following:</para>

View File

@ -24,7 +24,7 @@
<section id="cloudmonkey">
<title>CloudMonkey</title>
<para>CloudMonkey is the &PRODUCT; Command Line Interface (CLI). It is written in Python and leverages Marvin. CloudMonkey can be used both as an interactive shell and as a command line tool which simplifies &PRODUCT; configuration and management.</para>
<para>CloudMonkey is the &PRODUCT; Command Line Interface (CLI). It is written in Python. CloudMonkey can be used both as an interactive shell and as a command line tool which simplifies &PRODUCT; configuration and management. It can be used with &PRODUCT; CloudStack 4.0-incubating and above</para>
<warning>
<para>CloudMonkey is still under development and should be considered a Work In Progress (WIP), the wiki is the most up to date documentation:</para>
<para><ulink url="https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html">https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html</ulink></para>
@ -32,13 +32,15 @@
<section id="gettingcloudmonkey">
<title>Installing CloudMonkey</title>
<para>There are two ways to get CloudMonkey:</para>
<para><itemizedlist>
<para>CloudMonkey is dependent on <emphasis>readline, pygments, prettytable</emphasis>, when installing from source you will need to resolve those dependencies. Using the cheese shop, the dependencies will be automatically installed.</para>
<para>There are three ways to get CloudMonkey. Via the official &PRODUCT; source releases or via a community maintained distribution at <ulink url="http://pypi.python.org/pypi/cloudmonkey/">the cheese shop</ulink>. Developers can also get it directly from the git repository in <emphasis>tools/cli/</emphasis>.</para>
<para>
<itemizedlist>
<listitem>
<para>Via the official Apache &PRODUCT; releases (starting with 4.1).</para>
<para>Via the official Apache &PRODUCT; releases as well as the git repository.</para>
<programlisting>
<![CDATA[
$ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git
$ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git # (optional if using a release download)
$ mvn clean install -P developer
$ cd tools/cli # cloudmonkey-x.x.x.tar.gz will be built in dist
$ python setup.py build
@ -56,42 +58,80 @@ $ python setup.py install
<section id="configuringcloudmonkey">
<title>Configuration</title>
<para>To configure CloudMonkey you can edit the .cloudmonkey_config file in the user's home directory as shown below. The values can also be set interactively at the cloudmonkey prompt</para>
<para>To configure CloudMonkey you can edit the ~/.cloudmonkey/config file in the user's home directory as shown below. The values can also be set interactively at the cloudmonkey prompt. Logs are kept in ~/.cloudmonkey/log, and history is stored in ~/.cloudmonkey/history. Discovered apis are listed in ~/.cloudmonkey/cache. Only the log and history files can be custom paths and can be configured by setting appropriate file paths in ~/.cloudmonkey/config</para>
<programlisting>
$ cat .cloudmonkey_config
[CLI]
protocol = http
$ cat ~/.cloudmonkey/config
[core]
log_file = /Users/sebastiengoasguen/.cloudmonkey/log
asyncblock = true
paramcompletion = false
history_file = /Users/sebastiengoasguen/.cloudmonkey/history
[ui]
color = true
prompt = cloudmonkey>
history_file = /Users/sebastiengoasguen/.cloudmonkey_history
host = localhost
prompt = >
tabularize = false
[user]
secretkey =VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ
apikey = plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdMkAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg
[server]
path = /client/api
host = localhost
protocol = http
port = 8080
apikey = plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg
secretkey = VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ
timeout = 600
log_file = /Users/sebastiengoasguen/.cloudmonkey_log
timeout = 3600
</programlisting>
<para>The values can also be set at the cloudmonkey prompt. The API and secret keys are obtained via the &PRODUCT; UI or via a raw api call.</para>
<para>The values can also be set at the CloudMonkey prompt. The API and secret keys are obtained via the &PRODUCT; UI or via a raw api call.</para>
<programlisting>
<![CDATA[
$ cloudmonkey
☁ Apache CloudStack cloudmonkey 4.0.0. Type help or ? to list commands.
cloudmonkey> set prompt myprompt>
☁ Apache CloudStack cloudmonkey 4.1.0-snapshot. Type help or ? to list commands.
> set prompt myprompt>
myprompt> set host localhost
myprompt> set port 8080
myprompt> set apikey <your api key>
myprompt> set secretkey <your secret key>
]]>
</programlisting>
<para>You can use cloudmonkey to interact with a local cloud, and even with a remote public cloud. You just need to set the host value properly and obtain the keys from the cloud administrator.</para>
<para>You can use CloudMonkey to interact with a local cloud, and even with a remote public cloud. You just need to set the host value properly and obtain the keys from the cloud administrator.</para>
</section>
<section id="cliapidiscovery">
<title>API Discovery</title>
<note>
<para>In &PRODUCT; 4.0.* releases, the list of api calls available will be pre-cached, while starting with &PRODUCT; 4.1 releases and above an API discovery service is enabled. CloudMonkey will discover automatically the api calls available on the management server. The sync command in CloudMonkey pulls a list of apis which are accessible to your user role, along with help docs etc. and stores them in ~/.cloudmonkey/cache. This allows cloudmonkey to be adaptable to changes in mgmt server, so in case the sysadmin enables a plugin such as Nicira NVP for that user role, the users can get those changes. New verbs and grammar (DSL) rules are created on the fly.</para>
</note>
<para>To discover the APIs available do:</para>
<programlisting>
> sync
324 APIs discovered and cached
</programlisting>
</section>
<section id="clitabularoutput">
<title>Tabular Output</title>
<para>The number of key/value pairs returned by the api calls can be large resulting in a very long output. To enable easier viewing of the output, a tabular formatting can be setup. You may enable tabular listing and even choose set of column fields, this allows you to create your own field using the filter param which takes in comma separated argument. If argument has a space, put them under double quotes. The create table will have the same sequence of field filters provided</para>
<para>To enable it, use the <emphasis>set</emphasis> function and create filters like so:</para>
<programlisting>
> set tabularize true
> list users filter=id,domain,account
count = 1
user:
+--------------------------------------+--------+---------+
| id | domain | account |
+--------------------------------------+--------+---------+
| 7ed6d5da-93b2-4545-a502-23d20b48ef2a | ROOT | admin |
+--------------------------------------+--------+---------+
</programlisting>
</section>
<section id="interactivecli">
<title>Interactive Shell Usage</title>
<para>To start learning cloudmonkey, the best is to use the interactive shell. Simply type cloudmonkey at the prompt and you should get the interactive shell.</para>
<para>At the cloudmonkey prompt press the tab key twice, you will see all potential verbs available. Pick on, enter a space and then press tab twice. You will see all actions available for that verb</para>
<para>To start learning CloudMonkey, the best is to use the interactive shell. Simply type CloudMonkey at the prompt and you should get the interactive shell.</para>
<para>At the CloudMonkey prompt press the tab key twice, you will see all potential verbs available. Pick on, enter a space and then press tab twice. You will see all actions available for that verb</para>
<programlisting>
<![CDATA[
cloudmonkey>

View File

@ -660,7 +660,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
Long accountId = baseVolume.getAccountId();
HostVO secHost = getSecHost(baseVolume.getId(), baseVolume.getDataCenterId());
Long secHostId = secHost.getId();
String secondaryStoragePoolUrl = secHost.getStorageUrl();
String snapshotUuid = srcSnapshot.getPath();
// In order to verify that the snapshot is not empty,
@ -693,7 +693,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
StoragePool srcPool = (StoragePool)dataStoreMgr.getPrimaryDataStore(baseVolume.getPoolId());
String value = configDao.getValue(Config.BackupSnapshotWait.toString());
int _backupsnapshotwait = NumbersUtil.parseInt(value, Integer.parseInt(Config.BackupSnapshotWait.getDefaultValue()));
BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(secondaryStoragePoolUrl, dcId, accountId, baseVolume.getId(), srcSnapshot.getId(), baseVolume.getPath(), srcPool, snapshotUuid,
BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(secondaryStoragePoolUrl, dcId, accountId, baseVolume.getId(), srcSnapshot.getId(), secHostId, baseVolume.getPath(), srcPool, snapshotUuid,
srcSnapshot.getName(), prevSnapshotUuid, prevBackupUuid, isVolumeInactive, vmName, _backupsnapshotwait);
if ( swift != null ) {

View File

@ -567,7 +567,6 @@ public class VolumeServiceImpl implements VolumeService {
AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>();
VolumeObject vo = (VolumeObject) volume;
vo.stateTransit(Volume.Event.UploadRequested);
CreateVolumeContext<VolumeApiResult> context = new CreateVolumeContext<VolumeApiResult>(null, vo, future);
AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> caller = AsyncCallbackDispatcher.create(this);

View File

@ -30,7 +30,7 @@ whatami=cloud-external-ipallocator
SHORTNAME="$whatami"
PIDFILE=/var/run/"$whatami".pid
LOCKFILE=/var/lock/subsys/"$SHORTNAME"
LOGFILE=/var/log/cloud/ipallocator/ipallocator.log
LOGFILE=/var/log/cloudstack/ipallocator/ipallocator.log
PROGNAME="External IPAllocator"
unset OPTIONS

View File

@ -78,7 +78,8 @@ Requires: mkisofs
Requires: MySQL-python
Requires: python-paramiko
Requires: ipmitool
Requires: %{name}-common = %{_ver}
Requires: %{name}-common = %{_ver}
Requires: %{name}-awsapi = %{_ver}
Obsoletes: cloud-client < 4.1.0
Obsoletes: cloud-client-ui < 4.1.0
Obsoletes: cloud-daemonize < 4.1.0
@ -145,13 +146,15 @@ Apache CloudStack command line interface
%package awsapi
Summary: Apache CloudStack AWS API compatibility wrapper
Requires: %{name}-management = %{_ver}
Obsoletes: cloud-aws-api < 4.1.0
Provides: cloud-aws-api
%description awsapi
Apache Cloudstack AWS API compatibility wrapper
%package docs
Summary: Apache CloudStack documentation
%description docs
Apache CloudStack documentations
#%package docs
#Summary: Apache CloudStack documentation
#%description docs
#Apache CloudStack documentations
%prep
echo Doing CloudStack build
@ -316,6 +319,10 @@ if [ "$1" == "1" ] ; then
/sbin/chkconfig --level 345 cloud-management on > /dev/null 2>&1 || true
fi
if [ -d "%{_datadir}/%{name}-management" ] ; then
ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080
fi
if [ ! -f %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util ] ; then
echo Please download vhd-util from http://download.cloud.com.s3.amazonaws.com/tools/vhd-util and put it in
echo %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/
@ -328,16 +335,14 @@ if getent passwd cloud | grep -q /var/lib/cloud; then
fi
%post awsapi
if [ -d "%{_datadir}/%{name}-management" ] ; then
ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080
fi
#%post awsapi
#if [ -d "%{_datadir}/%{name}-management" ] ; then
# ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080
#fi
#No default permission as the permission setup is complex
%files management
%defattr(-,root,root,-)
%doc LICENSE
%doc NOTICE
%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina
%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost
%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost/client
@ -432,9 +437,9 @@ fi
%doc LICENSE
%doc NOTICE
%files docs
%doc LICENSE
%doc NOTICE
#%files docs
#%doc LICENSE
#%doc NOTICE
%files awsapi
%defattr(0644,cloud,cloud,0755)

View File

@ -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.
module cloudstack-agent 1.0;
require {
type nfs_t;
type system_conf_t;
type mount_t;
type qemu_t;
class file unlink;
class filesystem getattr;
}
#============= mount_t ==============
allow mount_t system_conf_t:file unlink;
#============= qemu_t ==============
allow qemu_t nfs_t:filesystem getattr;

View File

@ -1,7 +1,7 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: cloud usage
# Provides: cloudstack usage
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Default-Start: 3 4 5
@ -32,17 +32,15 @@
. /lib/lsb/init-functions
SHORTNAME="cloud-usage"
SHORTNAME="cloudstack-usage"
PIDFILE=/var/run/"$SHORTNAME".pid
LOGFILE=/var/log/cloud/usage/usage-server.log
PROGNAME="CloudStack Usage Monitor"
CLASS="com.cloud.usage.UsageServer"
PROG="jsvc"
DAEMON="/usr/bin/jsvc"
USER=@MSUSER@
unset OPTIONS
[ -r @SYSCONFDIR@/default/"$SHORTNAME" ] && source @SYSCONFDIR@/default/"$SHORTNAME"
[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME"
# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-sun"
@ -54,14 +52,12 @@ for jdir in $JDK_DIRS; do
done
export JAVA_HOME
SCP="@SYSTEMCLASSPATH@"
DCP="@DEPSCLASSPATH@"
UCP="@USAGECLASSPATH@"
JCP="/usr/share/java/commons-daemon.jar"
UCP=`ls /usr/share/cloudstack-usage/lib/*.jar | tr '\n' ':' | sed s'/.$//'`
PCP=`ls /usr/share/cloudstack-usage/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'`
# We need to append the JSVC daemon JAR to the classpath
# AgentShell implements the JSVC daemon methods
export CLASSPATH="$SCP:$DCP:$UCP:$JCP:@USAGESYSCONFDIR@"
export CLASSPATH="/usr/share/java/commons-daemon.jar:$UCP:$PCP:/etc/cloudstack/usage"
start() {
if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
@ -79,7 +75,7 @@ start() {
exit 1
fi
if start_daemon -p $PIDFILE $DAEMON -cp "$CLASSPATH" -pidfile "$PIDFILE" -user "$USER" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
if start_daemon -p $PIDFILE $DAEMON -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
RETVAL=$?
then
rc=0

View File

@ -593,9 +593,16 @@ setup_redundant_router() {
fi
}
setup_aesni() {
if [ `grep aes /proc/cpuinfo | wc -l` -gt 0 ]
then
modprobe aesni_intel
fi
}
setup_router() {
log_it "Setting up virtual router system vm"
oldmd5=
[ -f "/etc/udev/rules.d/70-persistent-net.rules" ] && oldmd5=$(md5sum "/etc/udev/rules.d/70-persistent-net.rules" | awk '{print $1}')
@ -643,10 +650,8 @@ setup_router() {
fi
fi
setup_aesni
setup_dnsmasq
setup_apache2 $ETH0_IP
sed -i /gateway/d /etc/hosts

View File

@ -22,7 +22,7 @@ then
lasttime=$(cat [RROUTER_BIN_PATH]/keepalived.ts2)
thistime=$(cat [RROUTER_BIN_PATH]/keepalived.ts)
diff=$(($thistime - $lasttime))
if [ $diff -gt 100 ]
if [ $diff -lt 30]
then
echo Keepalived process is dead! >> [RROUTER_LOG]
service keepalived stop >> [RROUTER_LOG] 2>&1

View File

@ -73,6 +73,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
s_logger.debug(String.format("getting api commands of service: %s", service.getClass().getName()));
cmdClasses.addAll(service.getCommands());
}
cmdClasses.addAll(this.getCommands());
cacheResponseMap(cmdClasses);
long endTime = System.nanoTime();
s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");

View File

@ -110,6 +110,7 @@ import com.cloud.agent.api.ModifySshKeysCommand;
import com.cloud.agent.api.ModifyStoragePoolAnswer;
import com.cloud.agent.api.ModifyStoragePoolCommand;
import com.cloud.agent.api.NetworkRulesSystemVmCommand;
import com.cloud.agent.api.NetworkRulesVmSecondaryIpCommand;
import com.cloud.agent.api.NetworkUsageAnswer;
import com.cloud.agent.api.NetworkUsageCommand;
import com.cloud.agent.api.PingCommand;
@ -1176,6 +1177,8 @@ ServerResource {
return execute((ResizeVolumeCommand) cmd);
} else if (cmd instanceof CheckNetworkCommand) {
return execute((CheckNetworkCommand) cmd);
} else if (cmd instanceof NetworkRulesVmSecondaryIpCommand) {
return execute((NetworkRulesVmSecondaryIpCommand) cmd);
} else {
s_logger.warn("Unsupported command ");
return Answer.createUnsupportedCommandAnswer(cmd);
@ -2339,7 +2342,7 @@ ServerResource {
boolean result = add_network_rules(cmd.getVmName(),
Long.toString(cmd.getVmId()), cmd.getGuestIp(),
cmd.getSignature(), Long.toString(cmd.getSeqNum()),
cmd.getGuestMac(), cmd.stringifyRules(), vif, brname);
cmd.getGuestMac(), cmd.stringifyRules(), vif, brname, cmd.getSecIpsString());
if (!result) {
s_logger.warn("Failed to program network rules for vm "
@ -3096,7 +3099,18 @@ ServerResource {
default_network_rules_for_systemvm(conn, vmName);
break;
} else {
default_network_rules(conn, vmName, nic, vmSpec.getId());
List<String> nicSecIps = nic.getNicSecIps();
String secIpsStr;
StringBuilder sb = new StringBuilder();
if (nicSecIps != null) {
for (String ip : nicSecIps) {
sb.append(ip).append(":");
}
secIpsStr = sb.toString();
} else {
secIpsStr = "0:";
}
default_network_rules(conn, vmName, nic, vmSpec.getId(), secIpsStr);
}
}
}
@ -3496,7 +3510,7 @@ ServerResource {
sscmd.setDataCenter(_dcId);
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
} catch (CloudRuntimeException e) {
s_logger.debug("Unable to initialize local storage pool: " + e);
}
if (sscmd != null) {
@ -3937,26 +3951,43 @@ ServerResource {
try {
dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
.getBytes()));
int persist = dm.isPersistent();
if (force) {
if (dm.getInfo().state != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF) {
if (dm.isActive() == 1) {
dm.destroy();
if (persist == 1) {
dm.undefine();
}
}
} else {
if (dm.getInfo().state == DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF) {
if (dm.isActive() == 0) {
return null;
}
dm.shutdown();
int retry = _stopTimeout / 2000;
/* Wait for the domain gets into shutoff state */
while ((dm.getInfo().state != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF)
&& (retry >= 0)) {
Thread.sleep(2000);
retry--;
/* Wait for the domain gets into shutoff state. When it does
the dm object will no longer work, so we need to catch it. */
try {
while ( dm.isActive() == 1 && (retry >= 0)) {
Thread.sleep(2000);
retry--;
}
} catch (LibvirtException e) {
String error = e.toString();
if (error.contains("Domain not found")) {
s_logger.debug("successfully shut down vm " + vmName);
} else {
s_logger.debug("Error in waiting for vm shutdown:" + error);
}
}
if (retry < 0) {
s_logger.warn("Timed out waiting for domain " + vmName
+ " to shutdown gracefully");
return Script.ERR_TIMEOUT;
} else {
if (persist == 1) {
dm.undefine();
}
}
}
} catch (LibvirtException e) {
@ -4347,7 +4378,7 @@ ServerResource {
}
protected boolean default_network_rules(Connect conn, String vmName,
NicTO nic, Long vmId) {
NicTO nic, Long vmId, String secIpStr) {
if (!_can_bridge_firewall) {
return false;
}
@ -4371,6 +4402,7 @@ ServerResource {
cmd.add("--vmmac", nic.getMac());
cmd.add("--vif", vif);
cmd.add("--brname", brname);
cmd.add("--nicsecips", secIpStr);
String result = cmd.execute();
if (result != null) {
return false;
@ -4433,7 +4465,7 @@ ServerResource {
private boolean add_network_rules(String vmName, String vmId,
String guestIP, String sig, String seq, String mac, String rules,
String vif, String brname) {
String vif, String brname, String secIps) {
if (!_can_bridge_firewall) {
return false;
}
@ -4449,6 +4481,7 @@ ServerResource {
cmd.add("--vmmac", mac);
cmd.add("--vif", vif);
cmd.add("--brname", brname);
cmd.add("--nicsecips", secIps);
if (rules != null) {
cmd.add("--rules", newRules);
}
@ -4459,6 +4492,25 @@ ServerResource {
return true;
}
private boolean network_rules_vmSecondaryIp (Connect conn, String vmName, String secIp, String action) {
if (!_can_bridge_firewall) {
return false;
}
Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
cmd.add("network_rules_vmSecondaryIp");
cmd.add("--vmname", vmName);
cmd.add("--nicsecips", secIp);
cmd.add("--action", action);
String result = cmd.execute();
if (result != null) {
return false;
}
return true;
}
private boolean cleanup_rules() {
if (!_can_bridge_firewall) {
return false;
@ -4547,6 +4599,20 @@ ServerResource {
return new Answer(cmd, success, "");
}
private Answer execute(NetworkRulesVmSecondaryIpCommand cmd) {
boolean success = false;
Connect conn;
try {
conn = LibvirtConnection.getConnection();
success = network_rules_vmSecondaryIp(conn, cmd.getVmName(), cmd.getVmSecIp(), cmd.getAction());
} catch (LibvirtException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new Answer(cmd, success, "");
}
@Override
public void setName(String name) {
// TODO Auto-generated method stub

View File

@ -120,14 +120,18 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
StoragePool sp = null;
try {
s_logger.debug(spd.toString());
sp = conn.storagePoolDefineXML(spd.toString(), 0);
sp.create(0);
sp = conn.storagePoolCreateXML(spd.toString(), 0);
return sp;
} catch (LibvirtException e) {
s_logger.error(e.toString());
if (sp != null) {
try {
sp.undefine();
if (sp.isPersistent() == 1) {
sp.destroy();
sp.undefine();
} else {
sp.destroy();
}
sp.free();
} catch (LibvirtException l) {
s_logger.debug("Failed to define nfs storage pool with: "
@ -150,15 +154,18 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
StoragePool sp = null;
try {
s_logger.debug(spd.toString());
sp = conn.storagePoolDefineXML(spd.toString(), 0);
sp.create(0);
sp = conn.storagePoolCreateXML(spd.toString(), 0);
return sp;
} catch (LibvirtException e) {
s_logger.error(e.toString());
if (sp != null) {
try {
sp.undefine();
if (sp.isPersistent() == 1) {
sp.destroy();
sp.undefine();
} else {
sp.destroy();
}
sp.free();
} catch (LibvirtException l) {
s_logger.debug("Failed to define shared mount point storage pool with: "
@ -181,14 +188,18 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
StoragePool sp = null;
try {
s_logger.debug(spd.toString());
sp = conn.storagePoolDefineXML(spd.toString(), 0);
sp.create(0);
sp = conn.storagePoolCreateXML(spd.toString(), 0);
return sp;
} catch (LibvirtException e) {
s_logger.error(e.toString());
if (sp != null) {
try {
sp.undefine();
if (sp.isPersistent() == 1) {
sp.destroy();
sp.undefine();
} else {
sp.destroy();
}
sp.free();
} catch (LibvirtException l) {
s_logger.debug("Failed to define clvm storage pool with: "
@ -236,14 +247,18 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
try {
s_logger.debug(spd.toString());
sp = conn.storagePoolDefineXML(spd.toString(), 0);
sp.create(0);
sp = conn.storagePoolCreateXML(spd.toString(), 0);
return sp;
} catch (LibvirtException e) {
s_logger.debug(e.toString());
if (sp != null) {
try {
sp.undefine();
if (sp.isPersistent() == 1) {
sp.destroy();
sp.undefine();
} else {
sp.destroy();
}
sp.free();
} catch (LibvirtException l) {
s_logger.debug("Failed to define RBD storage pool with: " + l.toString());
@ -293,58 +308,6 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
return parser.parseStorageVolumeXML(volDefXML);
}
public StoragePool createFileBasedStoragePool(Connect conn,
String localStoragePath, String uuid) {
if (!(_storageLayer.exists(localStoragePath) && _storageLayer
.isDirectory(localStoragePath))) {
return null;
}
File path = new File(localStoragePath);
if (!(path.canWrite() && path.canRead() && path.canExecute())) {
return null;
}
StoragePool pool = null;
try {
pool = conn.storagePoolLookupByUUIDString(uuid);
} catch (LibvirtException e) {
}
if (pool == null) {
LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(poolType.DIR,
uuid, uuid, null, null, localStoragePath);
try {
pool = conn.storagePoolDefineXML(spd.toString(), 0);
pool.create(0);
} catch (LibvirtException e) {
if (pool != null) {
try {
pool.destroy();
pool.undefine();
} catch (LibvirtException e1) {
}
pool = null;
}
throw new CloudRuntimeException(e.toString());
}
}
try {
StoragePoolInfo spi = pool.getInfo();
if (spi.state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) {
pool.create(0);
}
} catch (LibvirtException e) {
throw new CloudRuntimeException(e.toString());
}
return pool;
}
@Override
public KVMStoragePool getStoragePool(String uuid) {
StoragePool storage = null;
@ -437,15 +400,59 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
try {
sp = conn.storagePoolLookupByUUIDString(name);
if (sp.getInfo().state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) {
if (sp != null && sp.isActive() == 0) {
sp.undefine();
sp = null;
s_logger.debug("Found existing defined storage pool " + name + ". It wasn't running, so we undefined it.");
}
if (sp != null) {
s_logger.debug("Found existing defined storage pool " + name + ", using it.");
}
} catch (LibvirtException e) {
sp = null;
s_logger.debug("createStoragePool didn't find existing running pool: " + e + ", need to create it");
}
// libvirt strips trailing slashes off of path, we will too in order to match
// existing paths
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
if (sp == null) {
// see if any existing pool by another name is using our storage path.
// if anyone is, undefine the pool so we can define it as requested.
// This should be safe since a pool in use can't be removed, and no
// volumes are affected by unregistering the pool with libvirt.
s_logger.debug("Didn't find an existing storage pool " + name
+ " by UUID, checking for pools with duplicate paths");
try {
String[] poolnames = conn.listStoragePools();
for (String poolname : poolnames) {
s_logger.debug("Checking path of existing pool " + poolname
+ " against pool we want to create");
StoragePool p = conn.storagePoolLookupByName(poolname);
LibvirtStoragePoolDef pdef = getStoragePoolDef(conn, p);
if (pdef.getTargetPath().equals(path)) {
s_logger.debug("Storage pool utilizing path '" + path + "' already exists as pool "
+ poolname + ", undefining so we can re-define with correct name " + name);
if (p.isPersistent() == 1) {
p.destroy();
p.undefine();
} else {
p.destroy();
}
}
}
} catch (LibvirtException e) {
s_logger.error("Failure in attempting to see if an existing storage pool might "
+ "be using the path of the pool to be created:" + e);
}
s_logger.debug("Attempting to create storage pool " + name);
if (type == StoragePoolType.NetworkFilesystem) {
sp = createNfsStoragePool(conn, name, host, path);
} else if (type == StoragePoolType.SharedMountPoint
@ -459,8 +466,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
}
try {
StoragePoolInfo spi = sp.getInfo();
if (spi.state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) {
if (sp.isActive() == 0) {
s_logger.debug("attempting to activate pool " + name);
sp.create(0);
}
@ -479,7 +486,15 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
return pool;
} catch (LibvirtException e) {
throw new CloudRuntimeException(e.toString());
String error = e.toString();
if (error.contains("Storage source conflict")) {
throw new CloudRuntimeException("A pool matching this location already exists in libvirt, "
+ " but has a different UUID/Name. Cannot create new pool without first "
+ " removing it. Check for inactive pools via 'virsh pool-list --all'. "
+ error);
} else {
throw new CloudRuntimeException(error);
}
}
}
@ -511,8 +526,12 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
}
try {
sp.destroy();
sp.undefine();
if (sp.isPersistent() == 1) {
sp.destroy();
sp.undefine();
} else {
sp.destroy();
}
sp.free();
if (s != null) {
s.undefine();

View File

@ -21,6 +21,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -915,7 +916,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
// wait if there are already VM snapshot task running
ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
ManagedObjectReference[] tasks = (ManagedObjectReference[]) context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo) (context.getVimClient().getDynamicProperty(taskMor, "info"));
if(info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")){
@ -1048,7 +1049,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
// wait if there are already VM revert task running
ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager();
ManagedObjectReference[] tasks = (ManagedObjectReference[]) context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
List<ManagedObjectReference> tasks = (ArrayList<ManagedObjectReference>)context.getVimClient().getDynamicProperty(taskmgr, "recentTask");
for (ManagedObjectReference taskMor : tasks) {
TaskInfo info = (TaskInfo) (context.getVimClient().getDynamicProperty(taskMor, "info"));
if(info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("RevertToSnapshot_Task")){

View File

@ -5034,7 +5034,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
boolean bRefresh = false;
if(firewallMo != null) {
HostFirewallInfo firewallInfo = firewallMo.getFirewallInfo();
if(firewallInfo != null) {
if(firewallInfo != null && firewallInfo.getRuleset() != null) {
for(HostFirewallRuleset rule : firewallInfo.getRuleset()) {
if("vncServer".equalsIgnoreCase(rule.getKey())) {
bRefresh = true;

View File

@ -576,13 +576,12 @@ public class CitrixHelper {
_xenServer610GuestOsMap.put("CentOS 5.6 (64-bit)", "CentOS 5 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 5.7 (32-bit)", "CentOS 5 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 5.7 (64-bit)", "CentOS 5 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 6.0 (32-bit)", "CentOS 6.0 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.0 (64-bit)", "CentOS 6.0 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 6.1 (32-bit)", "CentOS 6.1 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.1 (64-bit)", "CentOS 6.1 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 6.2 (32-bit)", "CentOS 6.2 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.2 (64-bit)", "CentOS 6.2 (64-bit)");
_xenServer610GuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.0 (32-bit)", "CentOS 6 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.0 (64-bit)", "CentOS 6 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 6.1 (32-bit)", "CentOS 6 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.1 (64-bit)", "CentOS 6 (64-bit)");
_xenServer610GuestOsMap.put("CentOS 6.2 (32-bit)", "CentOS 6 (32-bit)");
_xenServer610GuestOsMap.put("CentOS 6.2 (64-bit)", "CentOS 6 (64-bit)");
_xenServer610GuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)");
_xenServer610GuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
@ -601,12 +600,12 @@ public class CitrixHelper {
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 5.6 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 5.7 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 5.7 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.0 (32-bit)", "Oracle Enterprise Linux 6.0 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.0 (64-bit)", "Oracle Enterprise Linux 6.0 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.1 (32-bit)", "Oracle Enterprise Linux 6.1 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.1 (64-bit)", "Oracle Enterprise Linux 6.1 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.2 (32-bit)", "Oracle Enterprise Linux 6.2 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.2 (64-bit)", "Oracle Enterprise Linux 6.2 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.0 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.0 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.1 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.1 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.2 (32-bit)", "Oracle Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Oracle Enterprise Linux 6.2 (64-bit)", "Oracle Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)");
@ -627,12 +626,12 @@ public class CitrixHelper {
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 5.6 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 5.7 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 5.7 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6.0 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6.0 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.1 (32-bit)", "Red Hat Enterprise Linux 6.1 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.1 (64-bit)", "Red Hat Enterprise Linux 6.1 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.2 (32-bit)", "Red Hat Enterprise Linux 6.2 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.2 (64-bit)", "Red Hat Enterprise Linux 6.2 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.1 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.1 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.2 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)");
_xenServer610GuestOsMap.put("Red Hat Enterprise Linux 6.2 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)");
_xenServer610GuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 10 SP1 (32-bit)");
_xenServer610GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1 (32-bit)");
_xenServer610GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 (64-bit)");
@ -662,13 +661,15 @@ public class CitrixHelper {
_xenServer610GuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)");
_xenServer610GuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)");
_xenServer610GuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)");
_xenServer610GuestOsMap.put("Windows Server 8 (64-bit)", "Windows Server 8 (64-bit) (experimental)");
_xenServer610GuestOsMap.put("Windows Server 8 (64-bit)", "Windows Server 2012 (64-bit) (experimental)");
_xenServer610GuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)");
_xenServer610GuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)");
_xenServer610GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit)");
_xenServer610GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit)");
_xenServer610GuestOsMap.put("Ubuntu 10.10 (32-bit)", "Ubuntu Maverick Meerkat 10.10 (32-bit) (experimental)");
_xenServer610GuestOsMap.put("Ubuntu 10.10 (64-bit)", "Ubuntu Maverick Meerkat 10.10 (64-bit) (experimental)");
_xenServer610GuestOsMap.put("Ubuntu 12.04 (32-bit)", "Ubuntu Precise Pangolin 12.04 (32-bit)");
_xenServer610GuestOsMap.put("Ubuntu 12.04 (64-bit)", "Ubuntu Precise Pangolin 12.04 (64-bit)");
_xenServer610GuestOsMap.put("Other Linux (32-bit)", "Other install media");
_xenServer610GuestOsMap.put("Other Linux (64-bit)", "Other install media");
_xenServer610GuestOsMap.put("Other (32-bit)", "Other install media");

View File

@ -118,6 +118,7 @@ import com.cloud.agent.api.ModifySshKeysCommand;
import com.cloud.agent.api.ModifyStoragePoolAnswer;
import com.cloud.agent.api.ModifyStoragePoolCommand;
import com.cloud.agent.api.NetworkRulesSystemVmCommand;
import com.cloud.agent.api.NetworkRulesVmSecondaryIpCommand;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.PingRoutingCommand;
import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
@ -597,6 +598,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return execute((DeleteVMSnapshotCommand)cmd);
} else if (clazz == RevertToVMSnapshotCommand.class) {
return execute((RevertToVMSnapshotCommand)cmd);
} else if (clazz == NetworkRulesVmSecondaryIpCommand.class) {
return execute((NetworkRulesVmSecondaryIpCommand)cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
@ -1468,7 +1471,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
for (NicTO nic : nics) {
if ( nic.isSecurityGroupEnabled() || nic.getIsolationUri() != null
&& nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
result = callHostPlugin(conn, "vmops", "default_network_rules", "vmName", vmName, "vmIP", nic.getIp(), "vmMAC", nic.getMac(), "vmID", Long.toString(vmSpec.getId()));
List<String> nicSecIps = nic.getNicSecIps();
String secIpsStr;
StringBuilder sb = new StringBuilder();
if (nicSecIps != null) {
for (String ip : nicSecIps) {
sb.append(ip).append(":");
}
secIpsStr = sb.toString();
} else {
secIpsStr = "0:";
}
result = callHostPlugin(conn, "vmops", "default_network_rules", "vmName", vmName, "vmIP", nic.getIp(), "vmMAC", nic.getMac(), "vmID", Long.toString(vmSpec.getId()), "secIps", secIpsStr);
if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
s_logger.warn("Failed to program default network rules for " + vmName+" on nic with ip:"+nic.getIp()+" mac:"+nic.getMac());
@ -3538,7 +3552,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
protected String backupSnapshot(Connection conn, String primaryStorageSRUuid, Long dcId, Long accountId,
Long volumeId, String secondaryStorageMountPath, String snapshotUuid, String prevBackupUuid, Boolean isISCSI, int wait) {
Long volumeId, String secondaryStorageMountPath, String snapshotUuid, String prevBackupUuid, Boolean isISCSI, int wait, Long secHostId) {
String backupSnapshotUuid = null;
if (prevBackupUuid == null) {
@ -3551,7 +3565,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String results = callHostPluginAsync(conn, "vmopsSnapshot", "backupSnapshot", wait,
"primaryStorageSRUuid", primaryStorageSRUuid, "dcId", dcId.toString(), "accountId", accountId.toString(),
"volumeId", volumeId.toString(), "secondaryStorageMountPath", secondaryStorageMountPath,
"snapshotUuid", snapshotUuid, "prevBackupUuid", prevBackupUuid, "backupUuid", backupUuid, "isISCSI", isISCSI.toString());
"snapshotUuid", snapshotUuid, "prevBackupUuid", prevBackupUuid, "backupUuid", backupUuid, "isISCSI", isISCSI.toString(), "secHostId", secHostId.toString());
String errMsg = null;
if (results == null || results.isEmpty()) {
errMsg = "Could not copy backupUuid: " + backupSnapshotUuid + " of volumeId: " + volumeId
@ -5454,7 +5468,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
"signature", cmd.getSignature(),
"seqno", Long.toString(cmd.getSeqNum()),
"deflated", "true",
"rules", cmd.compressStringifiedRules());
"rules", cmd.compressStringifiedRules(),
"secIps", cmd.getSecIpsString());
if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
s_logger.warn("Failed to program network rules for vm " + cmd.getVmName());
@ -6822,6 +6837,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String prevBackupUuid = cmd.getPrevBackupUuid();
String prevSnapshotUuid = cmd.getPrevSnapshotUuid();
int wait = cmd.getWait();
Long secHostId = cmd.getSecHostId();
// By default assume failure
String details = null;
boolean success = false;
@ -6900,7 +6916,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} else if (cmd.getS3() != null) {
backupSnapshotToS3(conn, cmd.getS3(), primaryStorageSRUuid, snapshotPaUuid, isISCSI, wait);
} else {
snapshotBackupUuid = backupSnapshot(conn, primaryStorageSRUuid, dcId, accountId, volumeId, secondaryStorageMountPath, snapshotUuid, prevBackupUuid, isISCSI, wait);
snapshotBackupUuid = backupSnapshot(conn, primaryStorageSRUuid, dcId, accountId, volumeId, secondaryStorageMountPath, snapshotUuid, prevBackupUuid, isISCSI, wait, secHostId);
success = (snapshotBackupUuid != null);
}
}
@ -7506,6 +7522,19 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return new Answer(cmd, success, "");
}
private Answer execute(NetworkRulesVmSecondaryIpCommand cmd) {
boolean success = true;
Connection conn = getConnection();
String result = callHostPlugin(conn, "vmops", "network_rules_vmSecondaryIp", "vmName", cmd.getVmName(), "vmMac", cmd.getVmMac(), "vmSecIp", cmd.getVmSecIp(), "action",
cmd.getAction());
if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
success = false;
}
return new Answer(cmd, success, "");
}
protected SetFirewallRulesAnswer execute(SetFirewallRulesCommand cmd) {
String[] results = new String[cmd.getRules().length];
String callResult;

View File

@ -40,7 +40,7 @@ public class XenServer610Resource extends XenServer56FP1Resource {
@Override
protected String getGuestOsType(String stdType, boolean bootFromCD) {
return CitrixHelper.getXenServer602GuestOsType(stdType, bootFromCD);
return CitrixHelper.getXenServer610GuestOsType(stdType, bootFromCD);
}
@Override

View File

@ -155,6 +155,8 @@ under the License.
</adapters>
<manager name="OvsTunnelManager" key="com.cloud.network.ovs.OvsTunnelManager" class="com.cloud.network.ovs.OvsTunnelManagerImpl"/>
<manager name="ElasticLoadBalancerManager" key="com.cloud.network.lb.ElasticLoadBalancerManager" class="com.cloud.network.lb.ElasticLoadBalancerManagerImpl"/>
<manager name="LBHealthCheckManager" key="com.cloud.network.lb.LBHealthCheckManager" class="com.cloud.network.lb.LBHealthCheckManagerImpl"/>
<pluggableservice name="ApiDiscoveryService" key="org.apache.cloudstack.discovery.ApiDiscoveryService" class="org.apache.cloudstack.discovery.ApiDiscoveryServiceImpl"/>
<pluggableservice name="VirtualRouterElementService" key="com.cloud.network.element.VirtualRouterElementService" class="com.cloud.network.element.VirtualRouterElement"/>
<pluggableservice name="NiciraNvpElementService" key="com.cloud.network.element.NiciraNvpElementService" class="com.cloud.network.element.NiciraNvpElement"/>
<dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>

View File

@ -28,6 +28,7 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
@ -197,4 +198,10 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan
public IpDeployer getIpDeployer(Network network) {
return this;
}
@Override
public List<LoadBalancerTO> updateHealthChecks(Network network, List<LoadBalancingRule> lbrules) {
return null;
}
}

View File

@ -94,6 +94,7 @@ import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.VirtualRouterProviderDao;
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.dao.ElasticLbVmMapDao;
import com.cloud.network.router.VirtualRouter;
@ -367,9 +368,10 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
for (LoadBalancerVO lb : lbs) {
List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId());
LoadBalancingRule loadBalancing = new LoadBalancingRule(
lb, dstList, policyList);
lbRules.add(loadBalancing);
lb, dstList, policyList, hcPolicyList);
lbRules.add(loadBalancing);
}
return applyLBRules(elbVm, lbRules, network.getId());
} else if (elbVm.getState() == State.Stopped
@ -940,7 +942,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
for (LoadBalancerVO lb : lbs) {
List<LbDestination> dstList = _lbMgr.getExistingDestinations(lb.getId());
List<LbStickinessPolicy> policyList = _lbMgr.getStickinessPolicies(lb.getId());
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList);
List<LbHealthCheckPolicy> hcPolicyList = _lbMgr.getHealthCheckPolicies(lb.getId());
LoadBalancingRule loadBalancing = new LoadBalancingRule(lb, dstList, policyList, hcPolicyList);
lbRules.add(loadBalancing);
}

View File

@ -16,6 +16,20 @@
// under the License.
package com.cloud.network.element;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
import org.apache.log4j.Logger;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.commands.*;
import com.cloud.api.response.F5LoadBalancerResponse;
@ -467,4 +481,11 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
}
return this;
}
@Override
public List<LoadBalancerTO> updateHealthChecks(Network network,
List<LoadBalancingRule> lbrules) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -262,7 +262,8 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
lbCapabilities.put(Capability.SupportedStickinessMethods, stickyMethodList);
lbCapabilities.put(Capability.ElasticLb, "true");
//Setting HealthCheck Capability to True for Netscaler element
lbCapabilities.put(Capability.HealthCheckPolicy, "true");
capabilities.put(Service.Lb, lbCapabilities);
Map<Capability, String> staticNatCapabilities = new HashMap<Capability, String>();
@ -627,14 +628,11 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
@Override
public IpDeployer getIpDeployer(Network network) {
ExternalLoadBalancerDeviceVO lbDevice = getExternalLoadBalancerForNetwork(network);
if (lbDevice == null) {
s_logger.error("Cannot find external load balanacer for network " + network.getName());
return null;
}
if (_networkMgr.isNetworkInlineMode(network)) {
return getIpDeployerForInlineMode(network);
}
return this;
}
@ -822,6 +820,20 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
return null;
}
public List<LoadBalancerTO> updateHealthChecks(Network network, List<LoadBalancingRule> lbrules) {
if (canHandle(network, Service.Lb)) {
try {
return getLBHealthChecks(network, lbrules);
} catch (ResourceUnavailableException e) {
s_logger.error("Error in getting the LB Rules from NetScaler " + e);
}
} else {
s_logger.error("Network cannot handle to LB service ");
}
return null;
}
@Override
public boolean applyGlobalLoadBalancerRule(long zoneId, GlobalLoadBalancerConfigCommand gslbConfigCmd) {
@ -834,4 +846,9 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
}
return false;
}
public List<LoadBalancerTO> getLBHealthChecks(Network network, List<? extends FirewallRule> rules)
throws ResourceUnavailableException {
return super.getLBHealthChecks(network, rules);
}
}

View File

@ -11,17 +11,24 @@
// 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
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.resource;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.citrix.netscaler.nitro.exception.nitro_exception;
import com.citrix.netscaler.nitro.resource.base.base_response;
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscalepolicy;
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile;
import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding;
import com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding;
import com.citrix.netscaler.nitro.resource.config.basic.servicegroup;
import com.citrix.netscaler.nitro.resource.config.basic.servicegroup_lbmonitor_binding;
import com.citrix.netscaler.nitro.resource.config.gslb.*;
@ -41,6 +48,36 @@ import com.cloud.agent.api.routing.*;
import com.cloud.agent.api.to.IpAddressTO;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.api.to.LoadBalancerTO.*;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.ExternalNetworkResourceUsageAnswer;
import com.cloud.agent.api.ExternalNetworkResourceUsageCommand;
import com.cloud.agent.api.MaintainAnswer;
import com.cloud.agent.api.MaintainCommand;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.ReadyAnswer;
import com.cloud.agent.api.ReadyCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupExternalLoadBalancerCommand;
import com.cloud.agent.api.routing.CreateLoadBalancerApplianceCommand;
import com.cloud.agent.api.routing.DestroyLoadBalancerApplianceCommand;
import com.cloud.agent.api.routing.HealthCheckLBConfigAnswer;
import com.cloud.agent.api.routing.HealthCheckLBConfigCommand;
import com.cloud.agent.api.routing.IpAssocAnswer;
import com.cloud.agent.api.routing.IpAssocCommand;
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
import com.cloud.agent.api.routing.SetStaticNatRulesAnswer;
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
import com.cloud.agent.api.to.IpAddressTO;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.api.to.LoadBalancerTO.AutoScalePolicyTO;
import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmGroupTO;
import com.cloud.agent.api.to.LoadBalancerTO.AutoScaleVmProfileTO;
import com.cloud.agent.api.to.LoadBalancerTO.ConditionTO;
import com.cloud.agent.api.to.LoadBalancerTO.CounterTO;
import com.cloud.agent.api.to.LoadBalancerTO.DestinationTO;
import com.cloud.agent.api.to.LoadBalancerTO.HealthCheckPolicyTO;
import com.cloud.agent.api.to.LoadBalancerTO.StickinessPolicyTO;
import com.cloud.agent.api.to.StaticNatRuleTO;
import com.cloud.host.Host;
import com.cloud.host.Host.Type;
@ -358,12 +395,14 @@ public class NetscalerResource implements ServerResource {
return execute((SetStaticNatRulesCommand) cmd, numRetries);
} else if (cmd instanceof GlobalLoadBalancerConfigCommand) {
return execute((GlobalLoadBalancerConfigCommand) cmd, numRetries);
} else if (cmd instanceof HealthCheckLBConfigCommand) {
return execute((HealthCheckLBConfigCommand) cmd, numRetries);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
private Answer execute(ReadyCommand cmd) {
private Answer execute(ReadyCommand cmd) {
return new ReadyAnswer(cmd);
}
@ -412,6 +451,65 @@ public class NetscalerResource implements ServerResource {
return new IpAssocAnswer(cmd, results);
}
private Answer execute(HealthCheckLBConfigCommand cmd, int numRetries) {
List<LoadBalancerTO> hcLB = new ArrayList<LoadBalancerTO>();
try {
if (_isSdx) {
return Answer.createUnsupportedCommandAnswer(cmd);
}
LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
if (loadBalancers == null) {
return new HealthCheckLBConfigAnswer(hcLB);
}
for (LoadBalancerTO loadBalancer : loadBalancers) {
HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0)
&& (healthCheckPolicies[0] != null)) {
String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(),
loadBalancer.getSrcPort());
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding
.get(_netscalerService, nsVirtualServerName);
if (serviceBindings != null) {
for (DestinationTO destination : loadBalancer.getDestinations()) {
String nsServiceName = generateNSServiceName(destination.getDestIp(),
destination.getDestPort());
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
destination.setMonitorState(binding.get_curstate());
break;
}
}
}
hcLB.add(loadBalancer);
}
}
}
} catch (ExecutionException e) {
s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
if (shouldRetry(numRetries)) {
return retry(cmd, numRetries);
} else {
return new HealthCheckLBConfigAnswer(hcLB);
}
} catch (Exception e) {
s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
if (shouldRetry(numRetries)) {
return retry(cmd, numRetries);
} else {
return new HealthCheckLBConfigAnswer(hcLB);
}
}
return new HealthCheckLBConfigAnswer(hcLB);
}
private synchronized Answer execute(LoadBalancerConfigCommand cmd, int numRetries) {
try {
if (_isSdx) {
@ -429,12 +527,13 @@ public class NetscalerResource implements ServerResource {
String lbProtocol = getNetScalerProtocol(loadBalancer);
String lbAlgorithm = loadBalancer.getAlgorithm();
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
String nsMonitorName = generateNSMonitorName(srcIp, srcPort);
if(loadBalancer.isAutoScaleVmGroupTO()) {
applyAutoScaleConfig(loadBalancer);
return new Answer(cmd);
}
boolean hasMonitor = false;
boolean deleteMonitor = false;
boolean destinationsToAdd = false;
for (DestinationTO destination : loadBalancer.getDestinations()) {
if (!destination.isRevoked()) {
@ -451,11 +550,28 @@ public class NetscalerResource implements ServerResource {
s_logger.debug("Created load balancing virtual server " + nsVirtualServerName + " on the Netscaler device");
}
// create a new monitor
HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0)
&& (healthCheckPolicies[0] != null)) {
for (HealthCheckPolicyTO healthCheckPolicyTO : healthCheckPolicies) {
if ( !healthCheckPolicyTO.isRevoked() ) {
addLBMonitor(nsMonitorName, lbProtocol, healthCheckPolicyTO);
hasMonitor = true;
}
else {
deleteMonitor = true;
hasMonitor = false;
}
}
}
for (DestinationTO destination : loadBalancer.getDestinations()) {
String nsServerName = generateNSServerName(destination.getDestIp());
String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
if (!destination.isRevoked()) {
// add a new destination to deployed load balancing rule
@ -496,6 +612,26 @@ public class NetscalerResource implements ServerResource {
throw new ExecutionException("Failed to bind service: " + nsServiceName + " to the lb virtual server: " + nsVirtualServerName + " on Netscaler device");
}
}
// After binding the service to the LB Vserver
// successfully, bind the created monitor to the
// service.
if (hasMonitor) {
if (!isServiceBoundToMonitor(nsServiceName, nsMonitorName)) {
bindServiceToMonitor(nsServiceName, nsMonitorName);
}
} else {
// check if any monitor created by CS is already
// existing, if yes, unbind it from services and
// delete it.
if (nsMonitorExist(nsMonitorName)) {
// unbind the service from the monitor and
// delete the monitor
unBindServiceToMonitor(nsServiceName, nsMonitorName);
deleteMonitor = true;
}
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully added LB destination: " + destination.getDestIp() + ":" + destination.getDestPort() + " to load balancer " + srcIp + ":" + srcPort);
}
@ -571,8 +707,13 @@ public class NetscalerResource implements ServerResource {
}
}
removeLBVirtualServer(nsVirtualServerName);
deleteMonitor = true;
}
}
if(deleteMonitor) {
removeLBMonitor(nsMonitorName);
}
}
if (s_logger.isInfoEnabled()) {
@ -1698,23 +1839,64 @@ public class NetscalerResource implements ServerResource {
}
}
private lbmonitor getMonitorIfExisits(String lbMonitorName) throws ExecutionException {
try {
return lbmonitor.get(_netscalerService, lbMonitorName);
} catch (nitro_exception e) {
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
return null;
} else {
throw new ExecutionException(e.getMessage());
}
} catch (Exception e) {
throw new ExecutionException(e.getMessage());
}
}
private boolean isServiceBoundToVirtualServer(String serviceName) throws ExecutionException {
try {
lbvserver[] lbservers = lbvserver.get(_netscalerService);
for (lbvserver vserver : lbservers) {
filtervalue[] filter = new filtervalue[1];
filter[0] = new filtervalue("servicename", serviceName);
lbvserver_service_binding[] result = lbvserver_service_binding.get_filtered(_netscalerService, vserver.get_name(), filter);
lbvserver_service_binding[] result = lbvserver_service_binding.get_filtered(_netscalerService,
vserver.get_name(), filter);
if (result != null && result.length > 0) {
return true;
}
}
return false;
} catch (Exception e) {
throw new ExecutionException("Failed to verify service " + serviceName + " is bound to any virtual server due to " + e.getMessage());
throw new ExecutionException("Failed to verify service " + serviceName
+ " is bound to any virtual server due to " + e.getMessage());
}
}
private boolean isServiceBoundToMonitor(String nsServiceName, String nsMonitorName) throws ExecutionException {
filtervalue[] filter = new filtervalue[1];
filter[0] = new filtervalue("monitor_name", nsMonitorName);
service_lbmonitor_binding[] result;
try {
result = service_lbmonitor_binding.get_filtered(_netscalerService, nsServiceName, filter);
if (result != null && result.length > 0) {
return true;
}
} catch (Exception e) {
throw new ExecutionException("Failed to verify service " + nsServiceName
+ " is bound to any monitor due to " + e.getMessage());
}
return false;
}
private boolean nsMonitorExist(String nsMonitorname) throws ExecutionException {
if (getMonitorIfExisits(nsMonitorname) != null)
return true;
else
return false;
}
private boolean nsServiceExists(String serviceName) throws ExecutionException {
try {
if (com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName) != null) {
@ -1955,6 +2137,126 @@ public class NetscalerResource implements ServerResource {
}
}
// Monitor related methods
private void addLBMonitor(String nsMonitorName, String lbProtocol, HealthCheckPolicyTO hcp)
throws ExecutionException {
try {
// check if the monitor exists
boolean csMonitorExisis = false;
lbmonitor csMonitor = getMonitorIfExisits(nsMonitorName);
if (csMonitor != null) {
if (!csMonitor.get_type().equalsIgnoreCase(lbProtocol)) {
throw new ExecutionException("Can not update monitor :" + nsMonitorName + " as current protocol:"
+ csMonitor.get_type() + " of monitor is different from the " + " intended protocol:"
+ lbProtocol);
}
csMonitorExisis = true;
}
if (!csMonitorExisis) {
lbmonitor csMon = new lbmonitor();
csMon.set_monitorname(nsMonitorName);
csMon.set_type(lbProtocol);
if (lbProtocol.equalsIgnoreCase("HTTP")) {
csMon.set_httprequest(hcp.getpingPath());
s_logger.trace("LB Protocol is HTTP, Applying ping path on HealthCheck Policy");
} else {
s_logger.debug("LB Protocol is not HTTP, Skipping to apply ping path on HealthCheck Policy");
}
csMon.set_interval(hcp.getHealthcheckInterval());
csMon.set_resptimeout(hcp.getResponseTime());
csMon.set_failureretries(hcp.getUnhealthThresshold());
csMon.set_successretries(hcp.getHealthcheckThresshold());
s_logger.debug("Monitor properites going to get created :interval :: " + csMon.get_interval() + "respTimeOUt:: " + csMon.get_resptimeout()
+"failure retires(unhealththresshold) :: " + csMon.get_failureretries() + "successtries(healththresshold) ::" + csMon.get_successretries());
lbmonitor.add(_netscalerService, csMon);
} else {
s_logger.debug("Monitor :" + nsMonitorName + " is already existing. Skipping to delete and create it");
}
} catch (nitro_exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
} catch (Exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
}
}
private void bindServiceToMonitor(String nsServiceName, String nsMonitorName) throws ExecutionException {
try {
com.citrix.netscaler.nitro.resource.config.basic.service serviceObject = new com.citrix.netscaler.nitro.resource.config.basic.service();
serviceObject = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService,
nsServiceName);
if (serviceObject != null) {
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor = new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
serviceMonitor.set_monitor_name(nsMonitorName);
serviceMonitor.set_name(nsServiceName);
serviceMonitor.set_monstate("ENABLED");
s_logger.debug("Trying to bind the monitor :" + nsMonitorName + " to the service :" + nsServiceName);
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding.add(_netscalerService,
serviceMonitor);
s_logger.debug("Successfully binded the monitor :" + nsMonitorName + " to the service :"
+ nsServiceName);
}
} catch (nitro_exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
} catch (Exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
}
}
private void unBindServiceToMonitor(String nsServiceName, String nsMonitorName) throws ExecutionException {
try {
com.citrix.netscaler.nitro.resource.config.basic.service serviceObject = new com.citrix.netscaler.nitro.resource.config.basic.service();
serviceObject = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService,
nsServiceName);
if (serviceObject != null) {
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor = new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
serviceMonitor.set_monitor_name(nsMonitorName);
serviceMonitor.set_name(nsServiceName);
s_logger.debug("Trying to unbind the monitor :" + nsMonitorName + " from the service :"
+ nsServiceName);
service_lbmonitor_binding.delete(_netscalerService, serviceMonitor);
s_logger.debug("Successfully unbinded the monitor :" + nsMonitorName + " from the service :"
+ nsServiceName);
}
} catch (nitro_exception e) {
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
return;
} else {
throw new ExecutionException("Failed to unbind monitor :" + nsMonitorName + "from the service :"
+ nsServiceName + "due to " + e.getMessage());
}
} catch (Exception e) {
throw new ExecutionException("Failed to unbind monitor :" + nsMonitorName + "from the service :"
+ nsServiceName + "due to " + e.getMessage());
}
}
private void removeLBMonitor(String nsMonitorName) throws ExecutionException {
try {
if (nsMonitorExist(nsMonitorName)) {
lbmonitor monitorObj = lbmonitor.get(_netscalerService, nsMonitorName);
monitorObj.set_respcode(null);
lbmonitor.delete(_netscalerService, monitorObj);
s_logger.info("Successfully deleted monitor : " + nsMonitorName);
}
} catch (nitro_exception e) {
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
return;
} else {
throw new ExecutionException("Failed to delete monitor :" + nsMonitorName + " due to " + e.getMessage());
}
} catch (Exception e) {
throw new ExecutionException("Failed to delete monitor :" + nsMonitorName + " due to " + e.getMessage());
}
}
public synchronized void applyAutoScaleConfig(LoadBalancerTO loadBalancer) throws Exception, ExecutionException {
AutoScaleVmGroupTO vmGroupTO = loadBalancer.getAutoScaleVmGroupTO();
@ -2704,6 +3006,11 @@ public class NetscalerResource implements ServerResource {
return genObjectName("Cloud-VirtualServer", srcIp, srcPort);
}
private String generateNSMonitorName(String srcIp, long srcPort) {
// maximum length supported by NS is 31
return genObjectName("Cloud-Hc", srcIp, srcPort);
}
private String generateNSServerName(String serverIP) {
return genObjectName("Cloud-Server-", serverIP);
}

467
pom.xml
View File

@ -1,23 +1,15 @@
<!--
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.
-->
<!-- 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. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -43,7 +35,7 @@
</issueManagement>
<properties>
<!--skipTests>true</skipTests-->
<!--skipTests>true</skipTests -->
<cs.jdk.version>1.6</cs.jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -92,6 +84,7 @@
<cs.java-ipv6.version>0.10</cs.java-ipv6.version>
<cs.replace.properties>build/replace.properties</cs.replace.properties>
<cs.libvirt-java.version>0.4.9</cs.libvirt-java.version>
<cs.target.dir>target</cs.target.dir>
</properties>
<distributionManagement>
@ -174,11 +167,11 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -188,13 +181,13 @@
<artifactId>junit</artifactId>
<version>${cs.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
@ -205,74 +198,37 @@
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
-->
<!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version> </dependency> -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
@ -285,17 +241,19 @@
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<outputDirectory>${basedir}/${cs.target.dir}/classes</outputDirectory>
<testOutputDirectory>${basedir}/${cs.target.dir}/test-classes</testOutputDirectory>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@ -381,6 +339,11 @@
<exclude>tools/appliance/definitions/systemvmtemplate/definition.rb</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate/preseed.cfg</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate/zerodisk.sh</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate64/base.sh</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate64/cleanup.sh</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate64/definition.rb</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate64/preseed.cfg</exclude>
<exclude>tools/appliance/definitions/systemvmtemplate64/zerodisk.sh</exclude>
<exclude>tools/cli/cloudmonkey.egg-info/*</exclude>
<exclude>tools/devcloud/src/deps/boxes/basebox-build/definition.rb</exclude>
<exclude>tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg</exclude>
@ -448,41 +411,41 @@
<configuration>
<source>${cs.jdk.version}</source>
<target>${cs.jdk.version}</target>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgument>-XDignore.symbol.file=true</compilerArgument>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgument>-XDignore.symbol.file=true</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>remove-old-installers</id>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>true</removeAll>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>remove-old-installers</id>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>true</removeAll>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@ -510,15 +473,31 @@
</modules>
</profile>
<profile>
<id>eclipse</id>
<properties>
<cs.target.dir>target-eclipse</cs.target.dir>
</properties>
</profile>
<profile>
<id>developer</id>
<properties>
<marvin.config>tools/devcloud/devcloud.cfg</marvin.config>
</properties>
<properties>
<marvin.config>tools/devcloud/devcloud.cfg</marvin.config>
</properties>
<modules>
<module>developer</module>
<module>tools</module>
</modules>
</profile>
<profile>
<id>impatient</id>
<properties>
<marvin.config>tools/devcloud/devcloud.cfg</marvin.config>
</properties>
<modules>
<module>developer</module>
<!--module>tools/devcloud</module-->
</modules>
</profile>
<profile>
<id>vmware</id>
<activation>
@ -531,112 +510,112 @@
</modules>
</profile>
<profile>
<id>simulator</id>
<activation>
<property>
<name>deploydb-simulator</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/utils/conf/db.properties</file>
<file>${project.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<!-- DatabaseCreator driver here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
</executableDependency>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<!-- db properties file -->
<argument>${project.basedir}/utils/conf/db.properties</argument>
<argument>${project.basedir}/utils/conf/db.properties.override</argument>
<!-- simulator sql files -->
<argument>${basedir}/target/db/create-schema-simulator.sql</argument>
<argument>${basedir}/target/db/templates.simulator.sql</argument>
<!-- database upgrade-->
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
<argument>--database=simulator</argument>
<argument>--rootpassword=${db.root.password}</argument>
<!-- enable verbosity by -v or dash-dash-verbose -->
</arguments>
<systemProperties>
<systemProperty>
<key>catalina.home</key>
<value>${project.basedir}/utils</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<id>simulator</id>
<activation>
<property>
<name>deploydb-simulator</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/utils/conf/db.properties</file>
<file>${project.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<!-- DatabaseCreator driver here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
</executableDependency>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<!-- db properties file -->
<argument>${project.basedir}/utils/conf/db.properties</argument>
<argument>${project.basedir}/utils/conf/db.properties.override</argument>
<!-- simulator sql files -->
<argument>${basedir}/target/db/create-schema-simulator.sql</argument>
<argument>${basedir}/target/db/templates.simulator.sql</argument>
<!-- database upgrade -->
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
<argument>--database=simulator</argument>
<argument>--rootpassword=${db.root.password}</argument>
<!-- enable verbosity by -v or dash-dash-verbose -->
</arguments>
<systemProperties>
<systemProperty>
<key>catalina.home</key>
<value>${project.basedir}/utils</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -68,7 +68,7 @@ log() {
if [ $shouldwelog -eq 1 ]
then
echo "$d - $1" >> /var/log/cloud/agent/resizevolume.log
echo "$d - $1" >> /var/log/cloudstack/agent/resizevolume.log
fi
}
@ -237,7 +237,7 @@ do
esac
done
shouldwelog=1 #set this to 1 while debugging to get output in /var/log/cloud/agent/resizevolume.log
shouldwelog=1 #set this to 1 while debugging to get output in /var/log/cloudstack/agent/resizevolume.log
if [ "$ptype" == "CLVM" ]
then

View File

@ -610,6 +610,7 @@ def destroy_network_rules_for_vm(session, args):
util.SMlog("Ignoring failure to delete egress chain " + vmchain_egress)
remove_rule_log_for_vm(vm_name)
remove_secip_log_for_vm(vm_name)
if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-', 'l-'] ]:
return 'true'
@ -749,6 +750,43 @@ def default_arp_antispoof(vm_chain, vifs, vm_ip, vm_mac):
return 'true'
@echo
def network_rules_vmSecondaryIp(session, args):
vm_name = args.pop('vmName')
vm_mac = args.pop('vmMac')
ip_secondary = args.pop('vmSecIp')
action = args.pop('action')
util.SMlog("vmMac = "+ vm_mac)
util.SMlog("vmName = "+ vm_name)
#action = "-A"
util.SMlog("action = "+ action)
try:
vm = session.xenapi.VM.get_by_name_label(vm_name)
if len(vm) != 1:
return 'false'
vm_rec = session.xenapi.VM.get_record(vm[0])
vm_vifs = vm_rec.get('VIFs')
vifnums = [session.xenapi.VIF.get_record(vif).get('device') for vif in vm_vifs]
domid = vm_rec.get('domid')
except:
util.SMlog("### Failed to get domid or vif list for vm ##" + vm_name)
return 'false'
if domid == '-1':
util.SMlog("### Failed to get domid for vm (-1): " + vm_name)
return 'false'
vifs = ["vif" + domid + "." + v for v in vifnums]
#vm_name = '-'.join(vm_name.split('-')[:-1])
vmchain = chain_name(vm_name)
add_to_ipset(vmchain, [ip_secondary], action)
#add arptables rules for the secondary ip
arp_rules_vmip(vmchain, vifs, [ip_secondary], vm_mac, action)
return 'true'
@echo
def default_network_rules_systemvm(session, args):
vm_name = args.pop('vmName')
@ -798,6 +836,55 @@ def default_network_rules_systemvm(session, args):
util.SMlog("Failed to log default network rules for systemvm, ignoring")
return 'true'
@echo
def create_ipset_forvm (ipsetname):
result = True
try:
util.SMlog("Creating ipset chain .... " + ipsetname)
util.pread2(['ipset', '-F', ipsetname])
util.pread2(['ipset', '-X', ipsetname])
util.pread2(['ipset', '-N', ipsetname, 'iphash'])
except:
util.SMlog("ipset chain not exists creating.... " + ipsetname)
util.pread2(['ipset', '-N', ipsetname, 'iphash'])
return result
@echo
def add_to_ipset(ipsetname, ips, action):
result = True
for ip in ips:
try:
util.SMlog("vm ip " + ip)
util.pread2(['ipset', action, ipsetname, ip])
except:
util.SMlog("vm ip alreday in ip set" + ip)
continue
return result
@echo
def arp_rules_vmip (vm_chain, vifs, ips, vm_mac, action):
try:
if action == "-A":
action = "-I"
for vif in vifs:
for vm_ip in ips:
#accept any arp requests to this vm as long as the request is for this vm's ip
util.pread2(['arptables', action, vm_chain, '-o', vif, '--opcode', 'Request', '--destination-ip', vm_ip, '-j', 'ACCEPT'])
#accept any arp replies to this vm as long as the mac and ip matches
util.pread2(['arptables', action, vm_chain, '-o', vif, '--opcode', 'Reply', '--destination-mac', vm_mac, '--destination-ip', vm_ip, '-j', 'ACCEPT'])
#accept arp replies into the bridge as long as the source mac and ips match the vm
util.pread2(['arptables', action, vm_chain, '-i', vif, '--opcode', 'Reply', '--source-mac', vm_mac, '--source-ip', vm_ip, '-j', 'ACCEPT'])
#accept any arp requests from this vm. In the future this can be restricted to deny attacks on hosts
#also important to restrict source ip and src mac in these requests as they can be used to update arp tables on destination
util.pread2(['arptables', action, vm_chain, '-i', vif, '--opcode', 'Request', '--source-mac', vm_mac, '--source-ip', vm_ip, '-j', 'RETURN'])
except:
util.SMlog("Failed to program arptables rules for ip")
return 'false'
return 'true'
@echo
def default_network_rules(session, args):
@ -805,6 +892,8 @@ def default_network_rules(session, args):
vm_ip = args.pop('vmIP')
vm_id = args.pop('vmID')
vm_mac = args.pop('vmMAC')
sec_ips = args.pop("secIps")
action = "-A"
try:
vm = session.xenapi.VM.get_by_name_label(vm_name)
@ -854,6 +943,32 @@ def default_network_rules(session, args):
except:
util.pread2(['iptables', '-F', vmchain_default])
vmipset = vm_name
#create ipset and add vm ips to that ip set
if create_ipset_forvm(vmipset) == False:
util.SMlog(" failed to create ipset for rule " + str(tokens))
return 'false'
#add primary nic ip to ipset
if add_to_ipset(vmipset, [vm_ip], action ) == False:
util.SMlog(" failed to add vm " + vm_ip + " ip to set ")
return 'false'
#add secodnary nic ips to ipset
secIpSet = "1"
ips = sec_ips.split(':')
ips.pop()
if ips[0] == "0":
secIpSet = "0";
if secIpSet == "1":
util.SMlog("Adding ipset for secondary ips")
add_to_ipset(vmipset, ips, action)
if write_secip_log_for_vm(vm_name, sec_ips, vm_id) == False:
util.SMlog("Failed to log default network rules, ignoring")
keyword = '--' + get_ipset_keyword()
try:
for v in vifs:
util.pread2(['iptables', '-A', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain_default])
@ -861,16 +976,22 @@ def default_network_rules(session, args):
#don't let vm spoof its ip address
for v in vifs:
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', vm_ip,'-p', 'udp', '--dport', '53', '-j', 'RETURN'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', '!', vm_ip, '-j', 'DROP'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '--destination', '!', vm_ip, '-j', 'DROP'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', vm_ip, '-j', vmchain_egress])
#util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '--source', vm_ip,'-p', 'udp', '--dport', '53', '-j', 'RETURN'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-m', 'set', keyword, vmipset, 'src', '-p', 'udp', '--dport', '53', '-j', 'RETURN'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-m', 'set', '!', keyword, vmipset, 'src', '-j', 'DROP'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-m', 'set', '!', keyword, vmipset, 'dst', '-j', 'DROP'])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-m', 'set', keyword, vmipset, 'src', '-j', vmchain_egress])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain])
except:
util.SMlog("Failed to program default rules for vm " + vm_name)
return 'false'
default_arp_antispoof(vmchain, vifs, vm_ip, vm_mac)
#add default arp rules for secondary ips;
if secIpSet == "1":
util.SMlog("Adding arp rules for sec ip")
arp_rules_vmip(vmchain, vifs, ips, vm_mac, action)
default_ebtables_antispoof_rules(vmchain, vifs, vm_ip, vm_mac)
if write_rule_log_for_vm(vm_name, vm_id, vm_ip, domid, '_initial_', '-1', vm_mac) == False:
@ -994,10 +1115,45 @@ def network_rules_for_rebooted_vm(session, vmName):
destroy_arptables_rules(vmchain)
[vm_ip, vm_mac] = get_vm_mac_ip_from_log(vmchain)
default_arp_antispoof(vmchain, vifs, vm_ip, vm_mac)
#check wether the vm has secondary ips
if is_secondary_ips_set(vm_name) == True:
vmips = get_vm_sec_ips(vm_name)
#add arp rules for the secondaryp ip
for ip in vmips:
arp_rules_vmip(vmchain, vifs, [ip], vm_mac, "-A")
default_ebtables_antispoof_rules(vmchain, vifs, vm_ip, vm_mac)
rewrite_rule_log_for_vm(vm_name, curr_domid)
return True
@echo
def get_vm_sec_ips(vm_name):
logfilename = "/var/run/cloud/" + vm_name +".ip"
lines = (line.rstrip() for line in open(logfilename))
for line in lines:
try:
[_vmName,_vmIP,_vmID] = line.split(',')
break
except ValueError,v:
[_vmName,_vmIP,_vmID] = line.split(',')
_vmIPS = _vmIP.split(":")[:-1]
return _vmIPS
@echo
def is_secondary_ips_set(vm_name):
logfilename = "/var/run/cloud/" + vm_name +".ip"
if not os.path.exists(logfilename):
return False
return True
@echo
def rewrite_rule_log_for_vm(vm_name, new_domid):
logfilename = "/var/run/cloud/" + vm_name +".log"
if not os.path.exists(logfilename):
@ -1194,6 +1350,39 @@ def check_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno):
return [reprogramDefault, reprogramChain, rewriteLog]
@echo
def write_secip_log_for_vm (vmName, secIps, vmId):
vm_name = vmName
logfilename = "/var/run/cloud/"+vm_name+".ip"
util.SMlog("Writing log to " + logfilename)
logf = open(logfilename, 'w')
output = ','.join([vmName, secIps, vmId])
result = True
try:
logf.write(output)
logf.write('\n')
except:
util.SMlog("Failed to write to rule log file " + logfilename)
result = False
logf.close()
return result
@echo
def remove_secip_log_for_vm(vmName):
vm_name = vmName
logfilename = "/var/run/cloud/"+vm_name+".ip"
result = True
try:
os.remove(logfilename)
except:
util.SMlog("Failed to delete rule log file " + logfilename)
result = False
return result
@echo
def write_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno, vmMac='ff:ff:ff:ff:ff:ff'):
@ -1289,6 +1478,7 @@ def network_rules(session, args):
vm_mac = args.get('vmMAC')
signature = args.pop('signature')
seqno = args.pop('seqno')
sec_ips = args.pop("secIps")
deflated = 'false'
if 'deflated' in args:
deflated = args.pop('deflated')
@ -1469,6 +1659,7 @@ if __name__ == "__main__":
"can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
"destroy_network_rules_for_vm":destroy_network_rules_for_vm,
"default_network_rules_systemvm":default_network_rules_systemvm,
"network_rules_vmSecondaryIp":network_rules_vmSecondaryIp,
"get_rule_logs_for_vms":get_rule_logs_for_vms,
"setLinkLocalIP":setLinkLocalIP,
"cleanup_rules":cleanup_rules,

View File

@ -321,25 +321,24 @@ def umount(localDir):
util.SMlog("Successfully unmounted " + localDir)
return
def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, instanceId):
def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, instanceId, secHostId):
# The aim is to mount secondaryStorageMountPath on
# And create <accountId>/<instanceId> dir on it, if it doesn't exist already.
# Assuming that secondaryStorageMountPath exists remotely
# Alex's suggestion and currently implemented:
# Just mount secondaryStorageMountPath/<relativeDir> everytime
# Just mount secondaryStorageMountPath/<relativeDir>/SecondaryStorageHost/ everytime
# Never unmount.
snapshotsDir = os.path.join(secondaryStorageMountPath, relativeDir)
# Mkdir local mount point dir, if it doesn't exist.
localMountPointPath = os.path.join(CLOUD_DIR, dcId)
localMountPointPath = os.path.join(localMountPointPath, relativeDir)
localMountPointPath = os.path.join(localMountPointPath, relativeDir, secHostId)
makedirs(localMountPointPath)
# if something is not mounted already on localMountPointPath,
# if something is not mounted already on localMountPointPath,
# mount secondaryStorageMountPath on localMountPath
if os.path.ismount(localMountPointPath):
# There is only one secondary storage per zone.
# There is more than one secondary storage per zone.
# And we are mounting each sec storage under a zone-specific directory
# So two secondary storage snapshot dirs will never get mounted on the same point on the same XenServer.
util.SMlog("The remote snapshots directory has already been mounted on " + localMountPointPath)
@ -352,11 +351,22 @@ def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, i
makedirs(backupsDir)
return backupsDir
def unmountAll(path):
try:
for dir in os.listdir(path):
if dir.isdigit():
util.SMlog("Unmounting Sub-Directory: " + dir)
localMountPointPath = os.path.join(path, dir)
umount(localMountPointPath)
except:
util.SMlog("Ignoring the error while trying to unmount the snapshots dir")
@echo
def unmountSnapshotsDir(session, args):
dcId = args['dcId']
localMountPointPath = os.path.join(CLOUD_DIR, dcId)
localMountPointPath = os.path.join(localMountPointPath, "snapshots")
unmountAll(localMountPointPath)
try:
umount(localMountPointPath)
except:
@ -482,7 +492,8 @@ def backupSnapshot(session, args):
snapshotUuid = args['snapshotUuid']
prevBackupUuid = args['prevBackupUuid']
backupUuid = args['backupUuid']
isISCSI = getIsTrueString(args['isISCSI'])
isISCSI = getIsTrueString(args['isISCSI'])
secHostId = args['secHostId']
primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI)
util.SMlog("primarySRPath: " + primarySRPath)
@ -496,10 +507,10 @@ def backupSnapshot(session, args):
# Mount secondary storage mount path on XenServer along the path
# /var/run/sr-mount/<dcId>/snapshots/ and create <accountId>/<volumeId> dir
# on it.
backupsDir = mountSnapshotsDir(secondaryStorageMountPath, "snapshots", dcId, accountId, volumeId)
backupsDir = mountSnapshotsDir(secondaryStorageMountPath, "snapshots", dcId, accountId, volumeId, secHostId)
util.SMlog("Backups dir " + backupsDir)
# Check existence of snapshot on primary storage
# Check existence of snapshot on primary storage
isfile(baseCopyPath, isISCSI)
if prevBackupUuid:
# Check existence of prevBackupFile

View File

@ -321,25 +321,24 @@ def umount(localDir):
util.SMlog("Successfully unmounted " + localDir)
return
def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, instanceId):
def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, instanceId, secHostId):
# The aim is to mount secondaryStorageMountPath on
# And create <accountId>/<instanceId> dir on it, if it doesn't exist already.
# Assuming that secondaryStorageMountPath exists remotely
# Alex's suggestion and currently implemented:
# Just mount secondaryStorageMountPath/<relativeDir> everytime
# Just mount secondaryStorageMountPath/<relativeDir>/SecondaryStorageHost/ everytime
# Never unmount.
snapshotsDir = os.path.join(secondaryStorageMountPath, relativeDir)
# Mkdir local mount point dir, if it doesn't exist.
localMountPointPath = os.path.join(CLOUD_DIR, dcId)
localMountPointPath = os.path.join(localMountPointPath, relativeDir)
localMountPointPath = os.path.join(localMountPointPath, relativeDir, secHostId)
makedirs(localMountPointPath)
# if something is not mounted already on localMountPointPath,
# mount secondaryStorageMountPath on localMountPath
if os.path.ismount(localMountPointPath):
# There is only one secondary storage per zone.
# There can be more than one secondary storage per zone.
# And we are mounting each sec storage under a zone-specific directory
# So two secondary storage snapshot dirs will never get mounted on the same point on the same XenServer.
util.SMlog("The remote snapshots directory has already been mounted on " + localMountPointPath)
@ -352,11 +351,22 @@ def mountSnapshotsDir(secondaryStorageMountPath, relativeDir, dcId, accountId, i
makedirs(backupsDir)
return backupsDir
def unmountAll(path):
try:
for dir in os.listdir(path):
if dir.isdigit():
util.SMlog("Unmounting Sub-Directory: " + dir)
localMountPointPath = os.path.join(path, dir)
umount(localMountPointPath)
except:
util.SMlog("Ignoring the error while trying to unmount the snapshots dir")
@echo
def unmountSnapshotsDir(session, args):
dcId = args['dcId']
localMountPointPath = os.path.join(CLOUD_DIR, dcId)
localMountPointPath = os.path.join(localMountPointPath, "snapshots")
unmountAll(localMountPointPath)
try:
umount(localMountPointPath)
except:
@ -490,7 +500,8 @@ def backupSnapshot(session, args):
snapshotUuid = args['snapshotUuid']
prevBackupUuid = args['prevBackupUuid']
backupUuid = args['backupUuid']
isISCSI = getIsTrueString(args['isISCSI'])
isISCSI = getIsTrueString(args['isISCSI'])
secHostId = args['secHostId']
primarySRPath = getPrimarySRPath(session, primaryStorageSRUuid, isISCSI)
util.SMlog("primarySRPath: " + primarySRPath)
@ -504,10 +515,10 @@ def backupSnapshot(session, args):
# Mount secondary storage mount path on XenServer along the path
# /var/run/sr-mount/<dcId>/snapshots/ and create <accountId>/<volumeId> dir
# on it.
backupsDir = mountSnapshotsDir(secondaryStorageMountPath, "snapshots", dcId, accountId, volumeId)
backupsDir = mountSnapshotsDir(secondaryStorageMountPath, "snapshots", dcId, accountId, volumeId, secHostId)
util.SMlog("Backups dir " + backupsDir)
# Check existence of snapshot on primary storage
# Check existence of snapshot on primary storage
isfile(baseCopyPath, isISCSI)
if prevBackupUuid:
# Check existence of prevBackupFile

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