This commit is contained in:
ilya musayev 2013-07-23 14:42:02 -04:00
commit cfad7975f6
220 changed files with 4555 additions and 3902 deletions

View File

@ -18,6 +18,8 @@ package com.cloud.agent.api.to;
import java.util.Date;
import com.cloud.agent.api.LogLevel;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.storage.DataStoreRole;
import com.cloud.utils.S3Utils;
@ -25,7 +27,9 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
private Long id;
private String uuid;
@LogLevel(Log4jLevel.Off)
private String accessKey;
@LogLevel(Log4jLevel.Off)
private String secretKey;
private String endPoint;
private String bucketName;
@ -68,10 +72,12 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject)
if (this == thatObject) {
return true;
if (thatObject == null || getClass() != thatObject.getClass())
}
if (thatObject == null || getClass() != thatObject.getClass()) {
return false;
}
final S3TO thatS3TO = (S3TO) thatObject;

View File

@ -47,7 +47,7 @@ public interface HostAllocator extends Adapter {
* @return List<Host> List of hosts that are suitable for VM allocation
**/
public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
/**
* Determines which physical hosts are suitable to
@ -62,7 +62,7 @@ public interface HostAllocator extends Adapter {
* @return List<Host> List of hosts that are suitable for VM allocation
**/
public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
/**
* Determines which physical hosts are suitable to
@ -77,7 +77,7 @@ public interface HostAllocator extends Adapter {
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
* @return List<Host> List of hosts that are suitable for VM allocation
**/
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
int returnUpTo, boolean considerReservedCapacity);
public static int RETURN_UPTO_ALL = -1;

View File

@ -18,9 +18,7 @@ package com.cloud.deploy;
import java.util.List;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
@ -38,10 +36,10 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
* avoid these data centers, pods, clusters, or hosts.
* @return DeployDestination for that virtual machine.
*/
List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
throws InsufficientServerCapacityException;
PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
}

View File

@ -29,7 +29,6 @@ import com.cloud.host.Host;
import com.cloud.org.Cluster;
import com.cloud.storage.StoragePool;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
@ -48,7 +47,7 @@ public interface DeploymentPlanner extends Adapter {
* @return DeployDestination for that virtual machine.
*/
@Deprecated
DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
/**
* check() is called right before the virtual machine starts to make sure
@ -65,7 +64,7 @@ public interface DeploymentPlanner extends Adapter {
* @return true if it's okay to start; false if not. If false, the exclude list will include what should be
* excluded.
*/
boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
boolean check(VirtualMachineProfile vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
/**
* canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so
@ -80,7 +79,7 @@ public interface DeploymentPlanner extends Adapter {
* avoid these data centers, pods, clusters, or hosts.
* @return true if it's okay to allocate; false or not
*/
boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
public enum AllocationAlgorithm {
random,

View File

@ -16,9 +16,9 @@
// under the License.
package com.cloud.ha;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
public interface FenceBuilder extends Adapter {
/**
@ -27,5 +27,5 @@ public interface FenceBuilder extends Adapter {
* @param vm vm
* @param host host where the vm was running on.
*/
public Boolean fenceOff(VMInstanceVO vm, HostVO host);
public Boolean fenceOff(VirtualMachine vm, Host host);
}

View File

@ -16,10 +16,10 @@
// under the License.
package com.cloud.ha;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
public interface Investigator extends Adapter {
/**
@ -27,7 +27,7 @@ public interface Investigator extends Adapter {
*
* @param vm to work on.
*/
public Boolean isVmAlive(VMInstanceVO vm, HostVO host);
public Boolean isVmAlive(VirtualMachine vm, Host host);
public Status isAgentAlive(HostVO agent);
public Status isAgentAlive(Host agent);
}

View File

@ -36,7 +36,7 @@ public interface HypervisorGuru extends Adapter {
* @param vm
* @return
*/
<T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm);
VirtualMachineTO implement(VirtualMachineProfile vm);
/**
* Give hypervisor guru opportunity to decide if certain command needs to be delegated to other host, mainly to secondary storage VM host

View File

@ -38,7 +38,7 @@ public interface NetworkMigrationResponder {
* @param context
* @return true when operation was successful.
*/
public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context);
public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context);
/**
* Cancel for migration preparation.
@ -52,7 +52,7 @@ public interface NetworkMigrationResponder {
* @param src The context nic migrates from.
* @param dst The context nic migrates to.
*/
public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
/**
* Commit the migration resource.
@ -66,5 +66,5 @@ public interface NetworkMigrationResponder {
* @param src the context nic migrates from.
* @param dst the context nic migrates to.
*/
public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
}

View File

@ -23,7 +23,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
/**
* Network includes all of the enums used within networking.
*
*
*/
public class Networks {
@ -66,8 +66,8 @@ public class Networks {
Pvlan("pvlan", String.class),
UnDecided(null, null);
private String scheme;
private Class<?> type;
private final String scheme;
private final Class<?> type;
private BroadcastDomainType(String scheme, Class<?> type) {
this.scheme = scheme;
@ -75,14 +75,16 @@ public class Networks {
}
/**
* @return scheme to be used in broadcast uri. Null indicates that this type does not have broadcast tags.
* @return scheme to be used in broadcast uri. Null indicates that this
* type does not have broadcast tags.
*/
public String scheme() {
return scheme;
}
/**
* @return type of the value in the broadcast uri. Null indicates that this type does not have broadcast tags.
* @return type of the value in the broadcast uri. Null indicates that
* this type does not have broadcast tags.
*/
public Class<?> type() {
return type;
@ -90,9 +92,56 @@ public class Networks {
public <T> URI toUri(T value) {
try {
return new URI(scheme + "://" + value);
// do we need to check that value does not contain a scheme
// part?
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI(scheme, value.toString(), null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
public static BroadcastDomainType getTypeOf(URI uri) {
return getType(uri.getScheme());
}
public static BroadcastDomainType getTypeOf(String str)
throws URISyntaxException {
return getTypeOf(new URI(str));
}
public static BroadcastDomainType getType(String scheme) {
if (scheme == null) {
return UnDecided;
}
for (BroadcastDomainType type : values()) {
if (scheme.equalsIgnoreCase(type.scheme())) {
return type;
}
}
return UnDecided;
}
public static String getValue(String uriString)
throws URISyntaxException {
return getValue(new URI(uriString));
}
public static String getValue(URI uri) {
BroadcastDomainType type = getTypeOf(uri);
if (type == Vlan) {
// do complicated stuff for backward compatibility
try {
Long.parseLong(uri.getSchemeSpecificPart());
return uri.getSchemeSpecificPart();
} catch (NumberFormatException e) {
return uri.getHost();
}
} else {
return uri.getSchemeSpecificPart();
}
}
};
@ -110,8 +159,7 @@ public class Networks {
Vpn;
public static boolean isSystemNetwork(TrafficType trafficType) {
if (Storage.equals(trafficType)
|| Management.equals(trafficType)
if (Storage.equals(trafficType) || Management.equals(trafficType)
|| Control.equals(trafficType)) {
return true;
}
@ -163,11 +211,18 @@ public class Networks {
public <T> URI toUri(T value) {
try {
// assert(this!=Vlan || value.getClass().isAssignableFrom(Integer.class)) :
// assert(this!=Vlan ||
// value.getClass().isAssignableFrom(Integer.class)) :
// do we need to check that value does not contain a scheme
// part?
// "Why are you putting non integer into vlan url";
return new URI(scheme + "://" + value.toString());
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI(scheme, value.toString(), null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to isolation type URI: " + value);
throw new CloudRuntimeException(
"Unable to convert to isolation type URI: " + value);
}
}
}
@ -176,7 +231,7 @@ public class Networks {
Vlan("vlan"),
VSwitch("vswitch");
private String scheme;
private final String scheme;
private BroadcastScheme(String scheme) {
this.scheme = scheme;

View File

@ -27,7 +27,7 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException;
}

View File

@ -71,7 +71,7 @@ public interface NetworkElement extends Adapter {
* @throws ResourceUnavailableException
* @throws InsufficientNetworkCapacityException
*/
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;
@ -85,7 +85,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**

View File

@ -27,8 +27,8 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface UserDataServiceProvider extends NetworkElement {
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException;
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException;
}

View File

@ -127,7 +127,7 @@ public interface NetworkGuru extends Adapter {
* @throws InsufficientAddressCapacityException if there are not addresses
* to be assigned.
*/
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* Once a guest network is implemented, then the virtual machine must
@ -147,7 +147,7 @@ public interface NetworkGuru extends Adapter {
* @throws ConcurrentOperationException if there are multiple operations
* happening on this guest network or vm.
*/
void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* When a virtual machine is stopped, the NetworkGuru is informed via the
@ -158,7 +158,7 @@ public interface NetworkGuru extends Adapter {
* @param reservationId reservation id passed to it in the ReservationContext
* @return true if release is successful or false if unsuccessful.
*/
boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId);
boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId);
/**
* When a virtual machine is destroyed, the NetworkGuru is informed via
@ -169,7 +169,7 @@ public interface NetworkGuru extends Adapter {
* @param nic nic that the vm was using to access the guest network.
* @param vm virtual machine being destroyed.
*/
void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm);
void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm);
/**
* @deprecated This method should not be here in the first place. What does this really mean? Is it always persisted

View File

@ -158,7 +158,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
}
}
public static final String IsDynamicScalingEnabled = "enable.dynamic.scaling";
static final String IsDynamicScalingEnabled = "enable.dynamic.scaling";
public enum Event {
CreateRequested,
@ -182,27 +182,28 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
};
public enum Type {
User,
DomainRouter,
ConsoleProxy,
SecondaryStorageVm,
ElasticIpVm,
ElasticLoadBalancerVm,
InternalLoadBalancerVm,
User(false),
DomainRouter(true),
ConsoleProxy(true),
SecondaryStorageVm(true),
ElasticIpVm(true),
ElasticLoadBalancerVm(true),
InternalLoadBalancerVm(true),
/*
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
* VM with this type. UserBareMetal should treat exactly as User.
*/
UserBareMetal;
UserBareMetal(false);
public static boolean isSystemVM(VirtualMachine.Type vmtype) {
if (DomainRouter.equals(vmtype)
|| ConsoleProxy.equals(vmtype)
|| SecondaryStorageVm.equals(vmtype) || InternalLoadBalancerVm.equals(vmtype)) {
return true;
}
return false;
boolean _isUsedBySystem;
private Type(boolean isUsedBySystem) {
_isUsedBySystem = isUsedBySystem;
}
public boolean isUsedBySystem() {
return _isUsedBySystem;
}
}
@ -211,39 +212,39 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
* reference this VM. You can build names that starts with this name and it
* guarantees uniqueness for things related to the VM.
*/
public String getInstanceName();
String getInstanceName();
/**
* @return the host name of the virtual machine. If the user did not
* specify the host name when creating the virtual machine then it is
* defaults to the instance name.
*/
public String getHostName();
String getHostName();
/**
* @return the ip address of the virtual machine.
*/
public String getPrivateIpAddress();
String getPrivateIpAddress();
/**
* @return mac address.
*/
public String getPrivateMacAddress();
String getPrivateMacAddress();
/**
* @return password of the host for vnc purposes.
*/
public String getVncPassword();
String getVncPassword();
/**
* @return the state of the virtual machine
*/
// public State getState();
// State getState();
/**
* @return template id.
*/
public long getTemplateId();
long getTemplateId();
@ -252,49 +253,51 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
*
* @return guestOSId
*/
public long getGuestOSId();
long getGuestOSId();
/**
* @return pod id.
*/
public Long getPodIdToDeployIn();
Long getPodIdToDeployIn();
/**
* @return data center id.
*/
public long getDataCenterId();
long getDataCenterId();
/**
* @return id of the host it was assigned last time.
*/
public Long getLastHostId();
Long getLastHostId();
@Override
public Long getHostId();
Long getHostId();
/**
* @return should HA be enabled for this machine?
*/
public boolean isHaEnabled();
boolean isHaEnabled();
/**
* @return should limit CPU usage to the service offering?
*/
public boolean limitCpuUse();
boolean limitCpuUse();
/**
* @return date when machine was created
*/
public Date getCreated();
Date getCreated();
public long getServiceOfferingId();
long getServiceOfferingId();
public Long getDiskOfferingId();
Long getDiskOfferingId();
Type getType();
HypervisorType getHypervisorType();
public Map<String, String> getDetails();
Map<String, String> getDetails();
long getUpdated();
}

View File

@ -19,9 +19,7 @@ package com.cloud.vm;
import java.util.List;
import java.util.Map;
import com.cloud.agent.api.to.DataTO;
import com.cloud.agent.api.to.DiskTO;
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
import com.cloud.template.VirtualMachineTemplate;
@ -33,10 +31,8 @@ import com.cloud.user.Account;
* on what the virtual machine profile should look like before it is
* actually started on the hypervisor.
*
* @param <T>
* a VirtualMachine
*/
public interface VirtualMachineProfile<T extends VirtualMachine> {
public interface VirtualMachineProfile {
public static class Param {
@ -69,7 +65,7 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
/**
* @return the virtual machine that backs up this profile.
*/
T getVirtualMachine();
VirtualMachine getVirtualMachine();
/**
* @return service offering for this virtual machine.

View File

@ -21,7 +21,6 @@ import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface AffinityGroupProcessor extends Adapter {
@ -37,7 +36,7 @@ public interface AffinityGroupProcessor extends Adapter {
* @param avoid
* avoid these data centers, pods, clusters, or hosts.
*/
void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
throws AffinityConflictException;
/**
@ -57,6 +56,6 @@ public interface AffinityGroupProcessor extends Adapter {
* @param plannedDestination
* deployment destination where VM is planned to be deployed
*/
boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
throws AffinityConflictException;
}

View File

@ -21,7 +21,6 @@ import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
@ -29,7 +28,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
protected String _type;
@Override
public void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
public void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
throws AffinityConflictException {
}
@ -44,7 +43,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
}
@Override
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
public boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
throws AffinityConflictException {
return true;
}

View File

@ -28,6 +28,7 @@ import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.log4j.Logger;
import com.cloud.configuration.ResourceLimit;
import com.cloud.configuration.Resource.ResourceOwnerType;
@APICommand(name = "listResourceLimits", description="Lists resource limits.", responseObject=ResourceLimitResponse.class)
public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd {
@ -42,11 +43,19 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists resource limits by ID.")
private Long id;
@Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description="Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. " +
"1 - IP. Number of public IP addresses a user can own. " +
"2 - Volume. Number of disk volumes a user can create." +
"3 - Snapshot. Number of snapshots a user can create." +
"4 - Template. Number of templates that a user can register/create.")
@Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description="Type of resource to update. Values are 0, 1, 2, 3, and 4." +
"0 - Instance. Number of instances a user can create. " +
"1 - IP. Number of public IP addresses an account can own. " +
"2 - Volume. Number of disk volumes an account can own." +
"3 - Snapshot. Number of snapshots an account can own." +
"4 - Template. Number of templates an account can register/create." +
"5 - Project. Number of projects an account can own." +
"6 - Network. Number of networks an account can own." +
"7 - VPC. Number of VPC an account can own." +
"8 - CPU. Number of CPU an account can allocate for his resources." +
"9 - Memory. Amount of RAM an account can allocate for his resources." +
"10 - Primary Storage. Amount of Primary storage an account can allocate for his resoruces." +
"11 - Secondary Storage. Amount of Secondary storage an account can allocate for his resources.")
private Integer resourceType;
/////////////////////////////////////////////////////

View File

@ -110,7 +110,9 @@ public class CallContext {
CallContext callingContext = new CallContext(callingUser, callingAccount, contextId);
s_currentContext.set(callingContext);
NDC.push("ctx-" + UuidUtils.first(contextId));
s_logger.debug("Setting calling context: " + callingContext);
if (s_logger.isTraceEnabled()) {
s_logger.trace("Registered: " + callingContext);
}
return callingContext;
}
@ -161,11 +163,13 @@ public class CallContext {
public static CallContext unregister() {
CallContext context = s_currentContext.get();
if (context == null) {
s_logger.trace("No context to remove");
s_logger.debug("No context to remove");
return null;
}
s_currentContext.remove();
s_logger.debug("Context removed " + context);
if (s_logger.isTraceEnabled()) {
s_logger.trace("Unregistered: " + context);
}
String contextId = context.getContextId();
String sessionIdOnStack = null;
String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId);
@ -210,9 +214,9 @@ public class CallContext {
@Override
public String toString() {
return new StringBuffer("CallContext[acct=").append(account.getId())
return new StringBuffer("CCtxt[acct=").append(account.getId())
.append("; user=").append(user.getId())
.append("; session=").append(contextId)
.append("; id=").append(contextId)
.append("]").toString();
}
}

View File

@ -0,0 +1,76 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;
import java.net.URISyntaxException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.cloud.network.Networks.BroadcastDomainType;
/**
* @author dhoogland
*
*/
public class NetworksTest {
@Before
public void setUp() {
}
@Test
public void emptyBroadcastDomainTypeTest() throws URISyntaxException {
BroadcastDomainType type = BroadcastDomainType.getTypeOf("");
Assert.assertEquals(
"an empty uri should mean a broadcasttype of undecided",
BroadcastDomainType.UnDecided, type);
}
@Test
public void vlanBroadcastDomainTypeTest() throws URISyntaxException {
String uri1 = "vlan://1";
String uri2 = "vlan:2";
BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(uri1);
BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2);
String id1 = BroadcastDomainType.getValue(uri1);
String id2 = BroadcastDomainType.getValue(uri2);
Assert.assertEquals("uri1 should be of broadcasttype vlan",
BroadcastDomainType.Vlan, type1);
Assert.assertEquals("uri2 should be of broadcasttype vlan",
BroadcastDomainType.Vlan, type2);
Assert.assertEquals("id1 should be \"1\"", "1", id1);
Assert.assertEquals("id1 should be \"2\"", "2", id2);
}
@Test
public void otherTypesTest() throws URISyntaxException {
String bogeyUri = "lswitch://1";
String uri2 = "mido:2";
BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(bogeyUri);
BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2);
String id1 = BroadcastDomainType.getValue(bogeyUri);
String id2 = BroadcastDomainType.getValue(uri2);
Assert.assertEquals("uri1 should be of broadcasttype vlan",
BroadcastDomainType.Lswitch, type1);
Assert.assertEquals("uri2 should be of broadcasttype vlan",
BroadcastDomainType.Mido, type2);
Assert.assertEquals("id1 should be \"//1\"", "//1", id1);
Assert.assertEquals("id1 should be \"2\"", "2", id2);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,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
@ -23,6 +23,317 @@
-->
<section id="gsoc-midsummer-ian">
<title>Mid-Summer Progress Updates</title>
<para>This section describes ...</para>
<title>Mid-Summer Progress Updates for Ian Duffy - "Ldap User Provisioning"</title>
<para>This section describes my progress with the project titled "LDAP User Provisioning".</para>
<section id="introduction">
<title>Introduction</title>
<para>
Progress on my project is moving along smoothly. The Cloudstack community along with my mentor Abhi have been very accomodating. Since the community bonding period communication has been consistent and the expectations have been clear. Sebastien, head mentor has given us great guidance. I have enjoyed their teaching style. I found it was a nice gradual build up starting with creating a simple document update patch to eventually submitting a new Cloudstack Plugin.
</para>
<para>
I am pleased with my progress on the project to date. I feel as if the goals set out in my proposal are very doable and that they should be achieved.
</para>
</section>
<section id="jenkins">
<title>Continuous Integration with Jenkins</title>
<para>
In order to try deliver working solutions of good quality I felt it would be a good idea to implement a continuous integration environment using Jenkins. The idea of this would be to automatically build and test my code. This was welcomed and aided by community members greatly.
</para>
<para>
The pipeline for this is as follows:
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/jenkins-pipeline.png"/>
</imageobject>
<textobject>
<phrase>jenkins-pipeline.png: Screenshot of the build pipeline.</phrase>
</textobject>
</mediaobject>
<itemizedlist>
<listitem>
<para>
Acquire Code Base - This pulls down the latest Cloudstack codebase and builds it executing all unit tests.
</para>
</listitem>
<listitem>
<para>
Static Analysis - This runs tests on my code to ensure quality and good practice. This is being achieved with sonar source.
</para>
</listitem>
<listitem>
<para>
Integration Tests - This deploys the Cloudstack database. Brings up the Cloudstack Manager with jetty and their simulator. All checkin/integration tests are ran and then the jetty server is shutdown.
</para>
</listitem>
<listitem>
<para>
Package(Only exists on my local Jenkins) - The codebase is packaged up into an RPM and placed onto a local yum repo. If the time allows this will be used for future automated acceptance testing.
</para>
</listitem>
</itemizedlist>
<para>
If your are interested in this I have created a screencast on youtube which walks through it: <ulink url="http://www.youtube.com/watch?v=8k9IS3wMRok"><citetitle>Continuous testing environment</citetitle></ulink>
</para>
</section>
<section id="ldap-plugin-implementation">
<title>Ldap Plugin implementation</title>
<para>
At the start of the coding stage I began to review the current LDAP implementation. This includes:
</para>
<itemizedlist>
<listitem>
<para>
The user authenticator - This enables LDAP users to login to Cloudstack once the user exists within the internal Cloudstack database.
</para>
</listitem>
<listitem>
<para>
LDAPConfig -This allows for adding LDAP configuration. This is detailed over here: <ulink url="https://cloudstack.apache.org/docs/api/apidocs-4.1/root_admin/ldapConfig.html"><citetitle>ldapConfig API reference</citetitle></ulink> This did not allow multiple configurations.
</para>
</listitem>
<listitem>
<para>
LDAPRemove - This allows for removing the LDAP configuration
</para>
</listitem>
<listitem>
<para>
UI features. Global settings -> LDAP configuration allowed for the addition of a single LDAP server using the LDAPConfig command and the removal of an LDAP server using the LDAPRemove command.
</para>
</listitem>
</itemizedlist>
<para>
After reviewing this code and implementation for some time I realised that it wasn't the most maintainable code. I realised I could extend it if required. But it would involve creating more unmaintainable code and it would be messy. This goes against my own principles of developing quality. This made me make the steep but justified decision to completely redo the LDAP implementation within Cloudstack. By doing this I did expanded the scope of the project.
</para>
<para>
I began to research the most appropriate way of structuring this. I started of by redoing the implementation. This meant creating the following classes(Excluding DAOs):
</para>
<itemizedlist>
<listitem>
<para>
LdapManager: Manages all LDAP connections.
</para>
</listitem>
<listitem>
<para>
LdapConfiguration: Supplies all configuration from within the Cloudstack database or defaults where required.
</para>
</listitem>
<listitem>
<para>
LdapUserManager: Handles any interaction with LDAP user information.
</para>
</listitem>
<listitem>
<para>
LdapUtils: Supplies static helpers, e.g. escape search queries, get attributes from search queries.
</para>
</listitem>
<listitem>
<para>
LdapContextFactory: Manages the creation of contexts.
</para>
</listitem>
<listitem>
<para>
LdapAuthenticator: Supplies an authenticator to Cloudstack using the LdapManager.
</para>
</listitem>
</itemizedlist>
<para>
From this I had a solid foundation for creating API commands to allow the user to interact with an LDAP server. I went on to create the following commands:
</para>
<itemizedlist>
<listitem>
<para>
LdapAddConfiguration - This allows for adding multiple LDAP configurations. Each configuration is just seen as a hostname and port.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/add-ldap-configuration.png"/>
</imageobject>
<textobject>
<phrase>add-ldap-configuration.png: Screenshot of API response.</phrase>
</textobject>
</mediaobject>
<mediaobject>
<imageobject>
<imagedata fileref="./images/add-ldap-configuration-failure.png"/>
</imageobject>
<textobject>
<phrase>add-ldap-configuration-failure.png: Screenshot of API response.</phrase>
</textobject>
</mediaobject>
</listitem>
<listitem>
<para>
LdapDeleteConfiguration - This allows for the deletion of an LDAP configuration based on its hostname.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/delete-ldap-configuration.png"/>
</imageobject>
<textobject>
<phrase>delete-ldap-configuration.png: Screenshot of API response.</phrase>
</textobject>
</mediaobject>
<mediaobject>
<imageobject>
<imagedata fileref="./images/delete-ldap-configuration-failure.png"/>
</imageobject>
<textobject>
<phrase>delete-ldap-configuration-failure.png: Screenshot of API response.</phrase>
</textobject>
</mediaobject>
</listitem>
<listitem>
<para>
LdapListConfiguration - This lists all of the LDAP configurations that exist within the database.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/list-ldap-configuration.png"/>
</imageobject>
<textobject>
<phrase>list-ldap-configuration.png: Screenshot of the build pipeline.</phrase>
</textobject>
</mediaobject>
</listitem>
<listitem>
<para>
LdapListAllUsers - This lists all the users within LDAP.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/ldap-list-users.png"/>
</imageobject>
<textobject>
<phrase>ldap-list-users.png: Screenshot of the build pipeline.</phrase>
</textobject>
</mediaobject>
</listitem>
</itemizedlist>
<para>
Along with this global configuration options were added, this includes:
</para>
<itemizedlist>
<listitem>
<para>
LDAP basedn: This allows the user to set the basedn for their LDAP configuration
</para>
</listitem>
<listitem>
<para>
LDAP bind password: This allows the user to set the password to use for binding to LDAP for creating the system context. If this is left blank along with bind principal then anonymous binding is used.
</para>
</listitem>
<listitem>
<para>
LDAP bind principal: This allows the user to set the principle to use for binding with LDAP for creating the system context. If this is left blank along with the bind password then anonymous binding is used.
</para>
</listitem>
<listitem>
<para>
LDAP email attribute: This sets out the attribute to use for getting the users email address. Within both OpenLDAP and ActiveDirectory this is mail. For this reason this is set to mail by default.
</para>
</listitem>
<listitem>
<para>
LDAP realname attribute: This sets out the attribute to use for getting the users realname. Within both OpenLDAP and ActiveDiretory this is cn. For this reason this is set to cn by default.
</para>
</listitem>
<listitem>
<para>
LDAP username attribute: This sets out the attribute to use for getting the users username. Within OpenLDAP this is uid and within ActiveDirectory this is samAccountName. In order to comply with posix standards this is set as uid by default.
</para>
</listitem>
<listitem>
<para>
LDAP user object: This sets out the object type of user accounts within LDAP. Within OpenLDAP this is inetOrgPerson and within ActiveDirectory this is user. Again, in order to comply with posix standards this is set as inetOrgperson by default.
</para>
</listitem>
</itemizedlist>
<para>
With this implementation I believe it allows for a much more extendable and flexible approach. The whole implementation is abstracted from the Cloudstack codebase using the "plugin" model. This allows all of the LDAP features to be contained within one place. Along with this the implementation supplies a good foundation. A side affect of redoing the implementation allowed me to add support for multiple LDAP servers. This means failover is support, so for example, if you have a standard ActiveDirectory with primary and secondary domain controller. Both can be added to Cloudstack which will allow it to failover to either one assume one of them is down.
</para>
<para>
The API changes required me to update the UI interface within Cloudstack. With the improved API implementation this was easier. The Global Settings -> Ldap Configuration page has support for multiple LDAP servers however it only requires a hostname and port. All "global" ldap settings are set within the global settings page.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/ldap-global-settings.png"/>
</imageobject>
<textobject>
<phrase>ldap-global-settings.png: Screenshot the LDAP related settings within global settings.</phrase>
</textobject>
</mediaobject>
<mediaobject>
<imageobject>
<imagedata fileref="./images/ldap-configuration.png"/>
</imageobject>
<textobject>
<phrase>ldap-configuration.png: Screenshot of the LDAP configuration page.</phrase>
</textobject>
</mediaobject>
</section>
<section id="accounts-ui">
<title>Add accounts UI</title>
<para>
Extending the UI to allow for easy provisioning of LDAP users is currently a work in progress. At the moment I have a 'working' implementation, see below screenshot. I am in need of assistance with it and am waiting on a review to be looked at.
</para>
<mediaobject>
<imageobject>
<imagedata fileref="./images/ldap-account-addition.png"/>
</imageobject>
<textobject>
<phrase>ldap-account-addition.png: Screenshot of add user screen when LDAP is enabled.</phrase>
</textobject>
</mediaobject>
</section>
<section id="testing">
<title>Testing</title>
<para>
Unit tests have 92% code coverage within the LDAP Plugin. The unit tests were wrote in groovy using the spock framework. This allowed for a BDD style of of testing.
</para>
<para>
Integration tests have been wrote in python using the marvin test framework for Cloudstack. This test configures a LDAP server and attempts to login as an LDAP user. The plugin comes with an embedded LDAP server for testing purposes.
</para>
<para>Execute integration tests:</para>
<programlisting>nosetests --with-marvin --marvin-config=setup/dev/local.cfg test/integration/component/test_ldap.py --loa</programlisting>
<para>Start embedded LDAP server:</para>
<programlisting>mvn -pl :cloud-plugin-user-authenticator-ldap ldap:run</programlisting>
</section>
<section id="conclusion">
<title>Conclusion</title>
<para>
I am very pleased with the learning outcomes of this project so far. I have been exposed to many things that my college's computer science curriculum does not cover. This includes:
</para>
<itemizedlist>
<listitem>
<para>Usage of source control management tools(git) and dealing with code collaboration</para>
</listitem>
<listitem>
<para>Usage of a dependency manager and build tool(maven)</para>
</listitem>
<listitem>
<para>Usage of continous testing environments(jenkins)</para>
</listitem>
<listitem>
<para>Usage of an IDE(eclipse)</para>
</listitem>
<listitem>
<para>Exposure to testing, both unit and integration tests</para>
</listitem>
<listitem>
<para>Exposure to a functional programming language(groovy)</para>
</listitem>
<listitem>
<para>Exposure to web development libraries(jQuery)</para>
</listitem>
</itemizedlist>
<para>
The experience gained from this project is invalueable and it is great that the Google Summer Of Code program exist.
</para>
</section>
</section>

View File

@ -11,9 +11,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

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,144 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
%BOOK_ENTITIES;
]>
<!-- Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<section id="removed-api-4.2">
<title>Removed APIs</title>
<itemizedlist>
<listitem>
<para>deleteCiscoNexusVSM (Deletes a Cisco Nexus VSM device) </para>
</listitem>
<listitem>
<para>enableCiscoNexusVSM (Enables a Cisco Nexus VSM device) </para>
</listitem>
<listitem>
<para>disableCiscoNexusVSM (Disables a Cisco Nexus VSM device) </para>
</listitem>
<listitem>
<para>listCiscoNexusVSMs (Retrieves a Cisco Nexus 1000v Virtual Switch Manager device
associated with a Cluster) </para>
</listitem>
<listitem>
<para>addBaremetalHost (Adds a new host.) </para>
</listitem>
<listitem>
<para>addExternalFirewall (Adds an external firewall appliance) </para>
</listitem>
<listitem>
<para>deleteExternalFirewall (Deletes an external firewall appliance.) </para>
</listitem>
<listitem>
<para>listExternalFirewalls (Lists external firewall appliances.) </para>
</listitem>
<listitem>
<para>addExternalLoadBalancer (Adds F5 external load balancer appliance.) </para>
</listitem>
<listitem>
<para>deleteExternalLoadBalancer (Deletes a F5 external load balancer appliance added in a
zone.) </para>
</listitem>
<listitem>
<para>listExternalLoadBalancers (Lists F5 external load balancer appliances added in a
zone.) </para>
</listitem>
<listitem>
<para>createVolumeOnFiler (Creates a volume.) </para>
</listitem>
<listitem>
<para>destroyVolumeOnFiler (Destroys a volume.) </para>
</listitem>
<listitem>
<para>listVolumesOnFiler (Lists volumes.) </para>
</listitem>
<listitem>
<para>createLunOnFiler (Creates a LUN from a pool.) </para>
</listitem>
<listitem>
<para>destroyLunOnFiler (Destroys a LUN.) </para>
</listitem>
<listitem>
<para>listLunsOnFiler (Lists LUN.) </para>
</listitem>
<listitem>
<para>associateLun (Associates a LUN with a guest IQN.) </para>
</listitem>
<listitem>
<para>dissociateLun (Dissociates a LUN.) </para>
</listitem>
<listitem>
<para>createPool (Creates a pool.) </para>
</listitem>
<listitem>
<para>deletePool (Deletes a pool.) </para>
</listitem>
<listitem>
<para>modifyPool (Modifies pool.) </para>
</listitem>
<listitem>
<para>listPools (Lists pool.) </para>
</listitem>
<listitem>
<para>addF5LoadBalancer (Adds a F5 BigIP load balancer device.) </para>
</listitem>
<listitem>
<para>configureF5LoadBalancer (Configures a F5 load balancer device.) </para>
</listitem>
<listitem>
<para>deleteF5LoadBalancer (Deletes a F5 load balancer device.) </para>
</listitem>
<listitem>
<para>listF5LoadBalancers (Lists F5 load balancer devices.) </para>
</listitem>
<listitem>
<para>listF5LoadBalancerNetworks (Lists network that are using a F5 load balancer device.)
</para>
</listitem>
<listitem>
<para>addSrxFirewall (Adds a SRX firewall device.) </para>
</listitem>
<listitem>
<para>deleteSrxFirewall (Deletes a SRX firewall device.) </para>
</listitem>
<listitem>
<para>configureSrxFirewall (Configures a SRX firewall device) </para>
</listitem>
<listitem>
<para>listSrxFirewalls (Lists SRX firewall devices in a physical network) </para>
</listitem>
<listitem>
<para>listSrxFirewallNetworks (Lists network that are using SRX firewall device) </para>
</listitem>
<listitem>
<para>addNetscalerLoadBalancer (Adds a netscaler load balancer device) </para>
</listitem>
<listitem>
<para>deleteNetscalerLoadBalancer (Deletes a netscaler load balancer device) </para>
</listitem>
<listitem>
<para>configureNetscalerLoadBalancer (Configures a netscaler load balancer device) </para>
</listitem>
<listitem>
<para>listNetscalerLoadBalancers (Lists netscaler load balancer devices) </para>
</listitem>
<listitem>
<para>listNetscalerLoadBalancerNetworks (Lists network that are using a netscaler load
balancer device) </para>
</listitem>
</itemizedlist>
</section>

View File

@ -25,6 +25,8 @@
<section id="whats-new-in-api-4.2">
<title>What's New in the API for 4.2</title>
<xi:include href="added-API-commands-4.2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="changed-API-commands-4.2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="removed-api-4.2.xml.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</section>
<section id="whats-new-in-api-4.1">
<title>What's New in the API for 4.1</title>

View File

@ -23,7 +23,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.storage.StoragePool;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
@ -44,7 +43,7 @@ public interface StoragePoolAllocator extends Adapter {
* @return List<StoragePool> List of storage pools that are suitable for the
* VM
**/
List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo);
static int RETURN_UPTO_ALL = -1;

View File

@ -22,6 +22,9 @@ import java.util.UUID;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
@ -29,16 +32,14 @@ import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.dc.DataCenter;
import com.cloud.deploy.DataCenterDeployment;
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanningManager;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.deploy.DeploymentPlanningManager;
import com.cloud.exception.AffinityConflictException;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.ConcurrentOperationException;
@ -128,7 +129,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
}
protected boolean areAffinityGroupsAssociated(VirtualMachineProfile<? extends VirtualMachine> vmProfile) {
protected boolean areAffinityGroupsAssociated(VirtualMachineProfile vmProfile) {
VirtualMachine vm = vmProfile.getVirtualMachine();
long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
@ -146,7 +147,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
//load vm instance and offerings and call virtualMachineManagerImpl
//FIXME: profile should work on VirtualMachineEntity
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm);
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vm.getPodIdToDeployIn(), null, null, null, null);
if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId());
@ -156,7 +157,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
if(!vols.isEmpty()){
VolumeVO vol = vols.get(0);
StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
StoragePool pool = (StoragePool)dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
if (!pool.isInMaintenance()) {
long rootVolDcId = pool.getDataCenterId();
@ -224,8 +225,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
DataCenterDeployment reservedPlan = new DataCenterDeployment(vm.getDataCenterId(),
vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), null, null);
try {
VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)),
_accountDao.findById(vm.getAccountId()), reservedPlan);
_itMgr.start(vm.getUuid(), params, reservedPlan);
} catch (Exception ex) {
// Retry the deployment without using the reservation plan
DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
@ -234,31 +234,27 @@ public class VMEntityManagerImpl implements VMEntityManager {
plan.setAvoids(reservedPlan.getAvoids());
}
_itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()),
plan);
_itMgr.start(vm.getUuid(), params, plan);
}
} else {
// no reservation found. Let VirtualMachineManager retry
_itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), null);
_itMgr.start(vm.getUuid(), params, null);
}
}
@Override
public boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException {
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
return _itMgr.stop(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
_itMgr.stop(vmEntityVO.getUuid());
return true;
}
@Override
public boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException{
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
_itMgr.destroy(vm.getUuid());
return true;
}
}

View File

@ -436,4 +436,8 @@ public class NetworkOfferingVO implements NetworkOffering {
public void setConcurrentConnections(Integer concurrent_connections) {
this.concurrent_connections = concurrent_connections;
}
public void setPublicLb(boolean publicLb) {
this.publicLb = publicLb;
}
}

View File

@ -90,6 +90,7 @@ public class Upgrade410to420 implements DbUpgrade {
correctExternalNetworkDevicesSetup(conn);
removeFirewallServiceFromSharedNetworkOfferingWithSGService(conn);
fix22xKVMSnapshots(conn);
setKVMSnapshotFlag(conn);
addIndexForAlert(conn);
fixBaremetalForeignKeys(conn);
// storage refactor related migration
@ -297,9 +298,46 @@ public class Upgrade410to420 implements DbUpgrade {
*/
}
private void updatePrimaryStore(Connection conn) {
PreparedStatement sql = null;
PreparedStatement sql2 = null;
//KVM snapshot flag: only turn on if Customers is using snapshot;
private void setKVMSnapshotFlag(Connection conn) {
s_logger.debug("Verify and set the KVM snapshot flag if snapshot was used. ");
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
int numRows = 0;
pstmt = conn.prepareStatement("select count(*) from `cloud`.`snapshots` where hypervisor_type = 'KVM'");
rs = pstmt.executeQuery();
if(rs.next()){
numRows = rs.getInt(1);
}
rs.close();
pstmt.close();
if (numRows > 0){
//Add the configuration flag
pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = 'KVM.snapshot.enabled'");
pstmt.setString(1, "true");
pstmt.executeUpdate();
}
} catch (SQLException e) {
throw new CloudRuntimeException("Failed to read the snapshot table for KVM upgrade. ", e);
} finally {
try {
if (rs != null) {
rs.close();
}
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
}
}
s_logger.debug("Done set KVM snapshot flag. ");
}
private void updatePrimaryStore(Connection conn) {
PreparedStatement sql = null;
PreparedStatement sql2 = null;
try {
sql = conn.prepareStatement("update storage_pool set storage_provider_name = ? , scope = ? where pool_type = 'Filesystem' or pool_type = 'LVM'");
sql.setString(1, DataStoreProvider.DEFAULT_PRIMARY);

View File

@ -398,6 +398,10 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
Long oldHostId = vmi.getHostId();
Long oldUpdated = vmi.getUpdated();
Date oldUpdateDate = vmi.getUpdateTime();
if ( newState.equals(oldState) && newHostId != null && newHostId.equals(oldHostId) ) {
// state is same, don't need to update
return true;
}
SearchCriteria<VMInstanceVO> sc = StateChangeSearch.create();
sc.setParameters("id", vmi.getId());

View File

@ -49,6 +49,8 @@ import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.storage.MigrateVolumeAnswer;
import com.cloud.agent.api.storage.MigrateVolumeCommand;
import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.agent.api.to.DataTO;
@ -64,6 +66,7 @@ import com.cloud.storage.DataStoreRole;
import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeManager;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.dao.VMTemplateDao;
@ -330,6 +333,30 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
}
protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) {
VolumeInfo volume = (VolumeInfo)srcData;
StoragePool destPool = (StoragePool)this.dataStoreMgr.getDataStore(destData.getDataStore().getId(), DataStoreRole.Primary);
MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool);
EndPoint ep = selector.select(volume.getDataStore());
MigrateVolumeAnswer answer = (MigrateVolumeAnswer) ep.sendMessage(command);
if (answer == null || !answer.getResult()) {
throw new CloudRuntimeException("Failed to migrate volume " + volume + " to storage pool " + destPool);
} else {
// Update the volume details after migration.
VolumeVO volumeVo = this.volDao.findById(volume.getId());
Long oldPoolId = volume.getPoolId();
volumeVo.setPath(answer.getVolumePath());
volumeVo.setFolder(destPool.getPath());
volumeVo.setPodId(destPool.getPodId());
volumeVo.setPoolId(destPool.getId());
volumeVo.setLastPoolId(oldPoolId);
this.volDao.update(volume.getId(), volumeVo);
}
return answer;
}
@Override
public Void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) {
Answer answer = null;
@ -347,7 +374,12 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
} else if (destData.getType() == DataObjectType.VOLUME && srcData.getType() == DataObjectType.VOLUME
&& srcData.getDataStore().getRole() == DataStoreRole.Primary
&& destData.getDataStore().getRole() == DataStoreRole.Primary) {
answer = copyVolumeBetweenPools(srcData, destData);
if (srcData.getId() == destData.getId()) {
// The volume has to be migrated across storage pools.
answer = migrateVolumeToPool(srcData, destData);
} else {
answer = copyVolumeBetweenPools(srcData, destData);
}
} else if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.SNAPSHOT) {
answer = copySnapshot(srcData, destData);
} else {

View File

@ -100,6 +100,13 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
@Override
public TemplateInfo getTemplate(DataObject obj, DataStore store) {
return this.getTemplate(obj.getId(), store);
TemplateObject tmpObj = (TemplateObject) this.getTemplate(obj.getId(), store);
// carry over url set in passed in data object, for copyTemplate case
// where url is generated on demand and not persisted in DB.
// need to think of a more generic way to pass these runtime information
// carried through DataObject post 4.2
TemplateObject origTmpl = (TemplateObject) obj;
tmpObj.setUrl(origTmpl.getUrl());
return tmpObj;
}
}

View File

@ -27,10 +27,11 @@ import java.util.Random;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterVO;
@ -49,7 +50,6 @@ import com.cloud.user.Account;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public abstract class AbstractStoragePoolAllocator extends AdapterBase implements StoragePoolAllocator {
@ -99,12 +99,12 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
}
protected abstract List<StoragePool> select(DiskProfile dskCh,
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
int returnUpTo);
@Override
public List<StoragePool> allocateToPool(DiskProfile dskCh,
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
int returnUpTo) {
List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo);
return reOrder(pools, vmProfile, plan);
@ -144,7 +144,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
}
protected List<StoragePool> reOrder(List<StoragePool> pools,
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
VirtualMachineProfile vmProfile, DeploymentPlan plan) {
if (pools == null) {
return null;
}

View File

@ -25,18 +25,18 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.StoragePool;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@Component
@ -49,7 +49,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
DiskOfferingDao _diskOfferingDao;
@Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
s_logger.debug("ClusterScopeStoragePoolAllocator looking for storage pool");
@ -91,7 +91,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
if (suitablePools.size() == returnUpTo) {
break;
}
StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
StoragePool pol = (StoragePool) dataStoreMgr.getPrimaryDataStore(pool.getId());
if (filter(avoid, pol, dskCh, plan)) {
suitablePools.add(pol);
} else {

View File

@ -49,7 +49,7 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
boolean _storagePoolCleanupEnabled;
@Override
public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
s_logger.debug("GarbageCollectingStoragePoolAllocator looking for storage pool");
if (!_storagePoolCleanupEnabled) {

View File

@ -65,7 +65,7 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
ConfigurationDao _configDao;
@Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
List<StoragePool> suitablePools = new ArrayList<StoragePool>();

View File

@ -42,7 +42,7 @@ public class UseLocalForRootAllocator extends LocalStoragePoolAllocator implemen
@Override
public List<StoragePool> allocateToPool(DiskProfile dskCh,
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
int returnUpTo) {
DataCenterVO dc = _dcDao.findById(plan.getDataCenterId());
if (!dc.isLocalStorageEnabled()) {

View File

@ -56,7 +56,7 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
@Override
protected List<StoragePool> select(DiskProfile dskCh,
VirtualMachineProfile<? extends VirtualMachine> vmProfile,
VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
List<StoragePool> suitablePools = new ArrayList<StoragePool>();

View File

@ -191,8 +191,9 @@ public class DefaultEndPointSelector implements EndPointSelector {
// we can arbitrarily pick one ssvm to do that task
List<HostVO> ssAHosts = listUpAndConnectingSecondaryStorageVmHost(dcId);
if (ssAHosts == null || ssAHosts.isEmpty()) {
s_logger.info("No running ssvm is found, so command will be sent to LocalHostEndPoint");
return LocalHostEndpoint.getEndpoint(); // use local host as endpoint in
// case of no ssvm existing
// case of no ssvm existing
}
Collections.shuffle(ssAHosts);
HostVO host = ssAHosts.get(0);

View File

@ -639,7 +639,7 @@ public class VolumeServiceImpl implements VolumeService {
srcVolume.processEvent(Event.OperationSuccessed);
destVolume.processEvent(Event.OperationSuccessed, result.getAnswer());
srcVolume.getDataStore().delete(srcVolume);
// srcVolume.getDataStore().delete(srcVolume);
future.complete(res);
} catch (Exception e) {
res.setResult(e.toString());
@ -1045,6 +1045,13 @@ public class VolumeServiceImpl implements VolumeService {
List<VolumeDataStoreVO> toBeDownloaded = new ArrayList<VolumeDataStoreVO>(dbVolumes);
for (VolumeDataStoreVO volumeStore : dbVolumes) {
VolumeVO volume = _volumeDao.findById(volumeStore.getVolumeId());
if (volume == null ){
s_logger.warn("Volume_store_ref shows that volume " + volumeStore.getVolumeId() + " is on image store " + storeId
+ ", but the volume is not found in volumes table, potentially some bugs in deleteVolume, so we just treat this volume to be deleted and mark it as destroyed");
volumeStore.setDestroyed(true);
_volumeStoreDao.update(volumeStore.getId(), volumeStore);
continue;
}
// Exists then don't download
if (volumeInfos.containsKey(volume.getId())) {
TemplateProp volInfo = volumeInfos.remove(volume.getId());

View File

@ -76,8 +76,9 @@ add_an_ip () {
if [ $old_state -eq 0 ]
then
sudo ip link set $ethDev up
sudo arping -c 3 -I $ethDev -A -U -s $pubIp $pubIp
fi
sudo arping -c 1 -I $ethDev -A -U -s $pubIp $pubIp
sudo arping -c 1 -I $ethDev -A -U -s $pubIp $pubIp
local tableNo=${ethDev:3}
sudo iptables-save -t mangle | grep "PREROUTING -i $ethDev -m state --state NEW -j CONNMARK --set-xmark" 2>/dev/null
if [ $? -gt 0 ]

View File

@ -23,9 +23,10 @@ import java.util.Set;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.log4j.Logger;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenter;
@ -82,7 +83,7 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement
* This IncludeList is then used to update the avoid list for a given data center.
*/
@Override
public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
public void process(VirtualMachineProfile vmProfile, DeploymentPlan plan,
ExcludeList avoid) throws AffinityConflictException {
VirtualMachine vm = vmProfile.getVirtualMachine();
List<AffinityGroupVMMapVO> vmGroupMappings = _affinityGroupVMMapDao.findByVmIdType(vm.getId(), getType());

View File

@ -66,7 +66,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
protected VMReservationDao _reservationDao;
@Override
public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
public void process(VirtualMachineProfile vmProfile, DeploymentPlan plan,
ExcludeList avoid)
throws AffinityConflictException {
VirtualMachine vm = vmProfile.getVirtualMachine();
@ -118,7 +118,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
}
@Override
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination plannedDestination)
public boolean check(VirtualMachineProfile vmProfile, DeployDestination plannedDestination)
throws AffinityConflictException {
if (plannedDestination.getHost() == null) {

View File

@ -67,7 +67,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy
}
@Override
public List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
public List<Long> orderClusters(VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
List<Long> clusterList = super.orderClusters(vmProfile, plan, avoid);
Set<Long> hostsToAvoid = avoid.getHostsToAvoid();
@ -251,7 +251,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy
}
@Override
public PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
// Check if strict or preferred mode should be used.
boolean preferred = isServiceOfferingUsingPlannerInPreferredMode(vmProfile.getServiceOfferingId());

View File

@ -176,8 +176,7 @@ public class ImplicitPlannerTest {
public void checkWhenDcInAvoidList() throws InsufficientServerCapacityException {
DataCenterVO mockDc = mock(DataCenterVO.class);
ExcludeList avoids = mock(ExcludeList.class);
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
VMInstanceVO vm = mock(VMInstanceVO.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
@ -193,8 +192,7 @@ public class ImplicitPlannerTest {
@Test
public void checkStrictModeWithCurrentAccountVmsPresent() throws InsufficientServerCapacityException {
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
ExcludeList avoids = new ExcludeList();
@ -230,7 +228,7 @@ public class ImplicitPlannerTest {
@Test
public void checkStrictModeHostWithCurrentAccountVmsFull() throws InsufficientServerCapacityException {
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
ExcludeList avoids = new ExcludeList();
@ -268,7 +266,7 @@ public class ImplicitPlannerTest {
@Test
public void checkStrictModeNoHostsAvailable() throws InsufficientServerCapacityException {
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
ExcludeList avoids = new ExcludeList();
@ -289,7 +287,7 @@ public class ImplicitPlannerTest {
@Test
public void checkPreferredModePreferredHostAvailable() throws InsufficientServerCapacityException {
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
ExcludeList avoids = new ExcludeList();
@ -328,7 +326,7 @@ public class ImplicitPlannerTest {
@Test
public void checkPreferredModeNoHostsAvailable() throws InsufficientServerCapacityException {
@SuppressWarnings("unchecked")
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
DataCenterDeployment plan = mock(DataCenterDeployment.class);
ExcludeList avoids = new ExcludeList();
@ -347,7 +345,7 @@ public class ImplicitPlannerTest {
assertTrue("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
}
private void initializeForTest(VirtualMachineProfileImpl<VMInstanceVO> vmProfile, DataCenterDeployment plan) {
private void initializeForTest(VirtualMachineProfileImpl vmProfile, DataCenterDeployment plan) {
DataCenterVO mockDc = mock(DataCenterVO.class);
VMInstanceVO vm = mock(VMInstanceVO.class);
UserVmVO userVm = mock(UserVmVO.class);

View File

@ -41,7 +41,7 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo
* @return List<Long> ordered list of Cluster Ids
*/
@Override
protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
if(vmProfile.getOwner() == null || !isZone){
return clusterIdsByCapacity;
@ -118,7 +118,7 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo
* @return List<Long> ordered list of Pod Ids
*/
@Override
protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
List<Long> podIdsByCapacity = podCapacityInfo.first();
if(vmProfile.getOwner() == null){
return podIdsByCapacity;

View File

@ -46,7 +46,7 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment
* @return List<Long> ordered list of Cluster Ids
*/
@Override
protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
if(vmProfile.getOwner() == null){
return clusterIdsByCapacity;
@ -76,7 +76,7 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment
* @return List<Long> ordered list of Pod Ids
*/
@Override
protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
List<Long> podIdsByCapacity = podCapacityInfo.first();
if(vmProfile.getOwner() == null){
return podIdsByCapacity;

View File

@ -47,13 +47,13 @@ public class RandomAllocator extends AdapterBase implements HostAllocator {
@Inject private ResourceManager _resourceMgr;
@Override
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
ExcludeList avoid, int returnUpTo) {
return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true);
}
@Override
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
ExcludeList avoid, List<? extends Host> hosts, int returnUpTo, boolean considerReservedCapacity) {
long dcId = plan.getDataCenterId();
Long podId = plan.getPodId();
@ -109,7 +109,7 @@ public class RandomAllocator extends AdapterBase implements HostAllocator {
}
@Override
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) {
long dcId = plan.getDataCenterId();

View File

@ -5,20 +5,20 @@
// 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.
//
//
// Automatically generated by addcopyright.py at 01/29/2013
// Apache License, Version 2.0 (the "License"); you may not use this
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.baremetal.manager;
@ -38,7 +38,6 @@ import com.cloud.hypervisor.HypervisorGuruBase;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.VMInstanceDao;
@ -59,7 +58,7 @@ public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru
}
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
public VirtualMachineTO implement(VirtualMachineProfile vm) {
VirtualMachineTO to = toVirtualMachineTO(vm);
VMInstanceVO vo = _vmDao.findById(vm.getId());

View File

@ -23,20 +23,21 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.dc.*;
import com.cloud.dc.ClusterDetailsDao;
import org.apache.log4j.Logger;
import com.cloud.capacity.CapacityManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterDetailsVO;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.HostPodDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
@ -45,7 +46,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.resource.ResourceManager;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@ -63,7 +63,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
@Inject protected ClusterDetailsDao _clusterDetailsDao;
@Override
public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
public DeployDestination plan(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
VirtualMachine vm = vmProfile.getVirtualMachine();
ServiceOffering offering = vmProfile.getServiceOffering();
String hostTag = null;
@ -143,7 +143,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
}
@Override
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
public boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) {
return vm.getHypervisorType() == HypervisorType.BareMetal;
}
@ -163,7 +163,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
}
@Override
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude) {
public boolean check(VirtualMachineProfile vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude) {
// TODO Auto-generated method stub
return false;
}

View File

@ -5,20 +5,20 @@
// 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.
//
//
// Automatically generated by addcopyright.py at 01/29/2013
// Apache License, Version 2.0 (the "License"); you may not use this
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.baremetal.networkservice;
@ -31,10 +31,11 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@ -68,7 +69,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.NicProfile;
import com.cloud.vm.NicVO;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
@Local(value=BaremetalPxeService.class)
@ -82,7 +82,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
@Override
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) {
public boolean prepare(VirtualMachineProfile profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) {
SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString());
sc.addAnd(sc.getEntity().getPodId(), Op.EQ, dest.getPod().getId());
@ -127,7 +127,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
@Override
public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) {
public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) {
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
if (nics.size() != 1) {
throw new CloudRuntimeException("Wrong nic number " + nics.size() + " of vm " + vm.getId());
@ -168,7 +168,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) {
throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null");
}
}
pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId());
if (pNetwork == null) {
@ -188,7 +188,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
HostPodVO pod = _podDao.findById(cmd.getPodId());
if (pod == null) {
throw new IllegalArgumentException("Could not find pod with ID: " + cmd.getPodId());
}
}
List<HostVO> pxes = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalPxe, null, cmd.getPodId(), zoneId);
if (pxes.size() != 0) {

View File

@ -76,7 +76,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
PodVlanMapDao _podVlanDao;
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
if (dest.getHost().getHypervisorType() != HypervisorType.BareMetal) {
super.reserve(nic, network, vm, dest, context);
@ -149,7 +149,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
s_logger.debug("Allocated a nic " + nic + " for " + vm);
}
private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile<? extends VirtualMachine> vm, Network network, String requiredIp)
private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp)
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
DataCenter dc = _dcDao.findById(pod.getDataCenterId());
if (nic.getIp4Address() == null) {

View File

@ -103,7 +103,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
@Override
@DB
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
Host host = dest.getHost();
if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) {
@ -122,7 +122,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException {
return true;
}
@ -158,7 +158,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
return true;
}
public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
if (vm.getHypervisorType() != HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getGuestType())) {
return false;
@ -167,7 +167,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
}
@Override
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
//TODO Add support for baremetal
return true;
}

View File

@ -47,7 +47,7 @@ public interface BaremetalDhcpManager extends Manager, PluggableService {
DHCPD,
}
boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
BaremetalDhcpVO addDchpServer(AddBaremetalDhcpCmd cmd);

View File

@ -133,7 +133,7 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
}
@Override
public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> profile,
public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile,
DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
Long zoneId = profile.getVirtualMachine().getDataCenterId();
Long podId = profile.getVirtualMachine().getPodIdToDeployIn();

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
@ -27,10 +27,11 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@ -62,7 +63,6 @@ import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
@Local(value = BaremetalPxeService.class)
@ -84,7 +84,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
VMTemplateDao _tmpDao;
@Override
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile nic, DeployDestination dest, ReservationContext context) {
public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context) {
NetworkVO nwVO = _nwDao.findById(nic.getNetworkId());
SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString());

View File

@ -111,7 +111,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
@Override
@DB
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) {
return false;
@ -138,7 +138,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException {
return true;
}

View File

@ -5,20 +5,20 @@
// 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.
//
//
// Automatically generated by addcopyright.py at 01/29/2013
// Apache License, Version 2.0 (the "License"); you may not use this
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.baremetal.networkservice;
@ -37,7 +37,6 @@ import com.cloud.utils.component.Manager;
import com.cloud.utils.component.PluggableService;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
public interface BaremetalPxeManager extends Manager, PluggableService {
@ -58,7 +57,7 @@ public interface BaremetalPxeManager extends Manager, PluggableService {
List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd cmd);
boolean addUserData(NicProfile nic, VirtualMachineProfile<UserVm> vm);
boolean addUserData(NicProfile nic, VirtualMachineProfile vm);
public static final Network.Service BAREMETAL_PXE_SERVICE = new Network.Service("BaremetalPxeService");
public static final String BAREMETAL_PXE_CAPABILITY = "BaremetalPxe";

View File

@ -5,20 +5,20 @@
// 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.
//
//
// Automatically generated by addcopyright.py at 01/29/2013
// Apache License, Version 2.0 (the "License"); you may not use this
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.baremetal.networkservice;
@ -31,11 +31,12 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
@ -183,7 +184,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
}
@Override
public boolean addUserData(NicProfile nic, VirtualMachineProfile<UserVm> profile) {
public boolean addUserData(NicProfile nic, VirtualMachineProfile profile) {
UserVmVO vm = (UserVmVO) profile.getVirtualMachine();
_vmDao.loadDetails(vm);

View File

@ -5,20 +5,20 @@
// 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.
//
//
// Automatically generated by addcopyright.py at 01/29/2013
// Apache License, Version 2.0 (the "License"); you may not use this
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.baremetal.networkservice;
@ -29,17 +29,15 @@ import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
import com.cloud.baremetal.database.BaremetalPxeVO;
import com.cloud.deploy.DeployDestination;
import com.cloud.host.Host;
import com.cloud.uservm.UserVm;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
public interface BaremetalPxeService extends Adapter {
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile nic, DeployDestination dest, ReservationContext context);
public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context);
public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl);
@ -62,5 +60,5 @@ public interface BaremetalPxeService extends Adapter {
public static final String PXE_PARAM_PING_STORAGE_SERVER_IP = "pingStorageServerIp";
public static final String PXE_PARAM_PING_ROOT_DIR = "pingDir";
public static final String PXE_PARAM_PING_STORAGE_SERVER_USERNAME = "pingStorageServerUserName";
public static final String PXE_PARAM_PING_STORAGE_SERVER_PASSWORD = "pingStorageServerPassword";
public static final String PXE_PARAM_PING_STORAGE_SERVER_PASSWORD = "pingStorageServerPassword";
}

View File

@ -72,7 +72,7 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
}
@Override
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
if (!canHandle(dest)) {
return false;
@ -82,17 +82,17 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
return false;
}
return pxeMgr.addUserData(nic, (VirtualMachineProfile<UserVm>) vm);
return pxeMgr.addUserData(nic, (VirtualMachineProfile) vm);
}
@Override
public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException {
public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException {
public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@ -115,14 +115,14 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
}
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
@ -154,7 +154,7 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
@Override
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm)
throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;

View File

@ -31,12 +31,13 @@ import com.cloud.agent.api.FenceCommand;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.ha.FenceBuilder;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VMInstanceVO;
import com.cloud.resource.ResourceManager;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VirtualMachine;
@Local(value=FenceBuilder.class)
public class OvmFencer extends AdapterBase implements FenceBuilder {
@ -66,7 +67,7 @@ public class OvmFencer extends AdapterBase implements FenceBuilder {
}
@Override
public Boolean fenceOff(VMInstanceVO vm, HostVO host) {
public Boolean fenceOff(VirtualMachine vm, Host host) {
if (host.getHypervisorType() != HypervisorType.Ovm) {
s_logger.debug("Don't know how to fence non Ovm hosts " + host.getHypervisorType());
return null;

View File

@ -20,12 +20,11 @@ import javax.ejb.Local;
import javax.inject.Inject;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorGuru;
import com.cloud.hypervisor.HypervisorGuruBase;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@Local(value=HypervisorGuru.class)
@ -41,8 +40,7 @@ public class OvmGuru extends HypervisorGuruBase implements HypervisorGuru {
}
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(
VirtualMachineProfile<T> vm) {
public VirtualMachineTO implement(VirtualMachineProfile vm) {
VirtualMachineTO to = toVirtualMachineTO(vm);
to.setBootloader(vm.getBootLoaderType());

View File

@ -16,18 +16,17 @@
// under the License.
package com.cloud.simulator;
import javax.ejb.Local;
import javax.inject.Inject;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorGuru;
import com.cloud.hypervisor.HypervisorGuruBase;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import javax.ejb.Local;
import javax.inject.Inject;
@Local(value=HypervisorGuru.class)
public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru {
@ -43,7 +42,7 @@ public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru
}
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
public VirtualMachineTO implement(VirtualMachineProfile vm) {
VirtualMachineTO to = toVirtualMachineTO(vm);
// Determine the VM's OS description

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
@ -27,6 +27,8 @@ import javax.persistence.Table;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.utils.db.Encrypt;
@Entity
@Table(name="ucs_manager")
public class UcsManagerVO implements InternalIdentity, Identity {
@ -50,16 +52,19 @@ public class UcsManagerVO implements InternalIdentity, Identity {
@Column(name="username")
private String username;
@Encrypt
@Column(name="password")
private String password;
public long getId() {
@Override
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getUuid() {
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {

View File

@ -22,14 +22,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.AddUcsManagerCmd;
import org.apache.cloudstack.api.AssociateUcsProfileToBladeCmd;
import org.apache.cloudstack.api.ListUcsBladeCmd;
@ -39,7 +39,10 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UcsBladeResponse;
import org.apache.cloudstack.api.response.UcsManagerResponse;
import org.apache.cloudstack.api.response.UcsProfileResponse;
import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
@ -54,6 +57,7 @@ import com.cloud.ucs.database.UcsManagerVO;
import com.cloud.ucs.structure.ComputeBlade;
import com.cloud.ucs.structure.UcsCookie;
import com.cloud.ucs.structure.UcsProfile;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.SearchCriteria2;
@ -83,11 +87,86 @@ public class UcsManagerImpl implements UcsManager {
private HostDao hostDao;
@Inject
private DataCenterDao dcDao;
@Inject
private ConfigurationDao configDao;
private final Map<Long, UcsCookie> cookies = new HashMap<Long, UcsCookie>();
private String name;
private int runLevel;
private Map<String, Object> params;
private ScheduledExecutorService syncBladesExecutor;
private int syncBladeInterval;
private class SyncBladesThread implements Runnable {
private void discoverNewBlades(Map<String, UcsBladeVO> previous,
Map<String, ComputeBlade> now, UcsManagerVO mgr) {
for (Map.Entry<String, ComputeBlade> e : now.entrySet()) {
String dn = e.getKey();
if (previous.keySet().contains(dn)) {
continue;
}
ComputeBlade nc = e.getValue();
UcsBladeVO vo = new UcsBladeVO();
vo.setDn(nc.getDn());
vo.setUcsManagerId(mgr.getId());
vo.setUuid(UUID.randomUUID().toString());
bladeDao.persist(vo);
s_logger.debug(String.format("discovered a new UCS blade[dn:%s] during sync", nc.getDn()));
}
}
private void decommissionFadedBlade(Map<String, UcsBladeVO> previous, Map<String, ComputeBlade> now) {
for (Map.Entry<String, UcsBladeVO> e : previous.entrySet()) {
String dn = e.getKey();
if (now.keySet().contains(dn)) {
continue;
}
UcsBladeVO vo = e.getValue();
bladeDao.remove(vo.getId());
s_logger.debug(String.format("decommission faded blade[dn:%s] during sync", vo.getDn()));
}
}
private void syncBlades(UcsManagerVO mgr) {
SearchCriteriaService<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class);
q.addAnd(q.getEntity().getUcsManagerId(), Op.EQ, mgr.getId());
List<UcsBladeVO> pblades = q.list();
if (pblades.isEmpty()) {
return;
}
Map<String, UcsBladeVO> previousBlades = new HashMap<String, UcsBladeVO>(pblades.size());
for (UcsBladeVO b : pblades) {
previousBlades.put(b.getDn(), b);
}
List<ComputeBlade> cblades = listBlades(mgr.getId());
Map<String, ComputeBlade> currentBlades = new HashMap<String, ComputeBlade>(cblades.size());
for (ComputeBlade c : cblades) {
currentBlades.put(c.getDn(), c);
}
discoverNewBlades(previousBlades, currentBlades, mgr);
decommissionFadedBlade(previousBlades, currentBlades);
}
@Override
public void run() {
try {
List<UcsManagerVO> mgrs = ucsDao.listAll();
for (UcsManagerVO mgr : mgrs) {
syncBlades(mgr);
}
} catch (Throwable t) {
s_logger.warn(t.getMessage(), t);
}
}
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@ -96,6 +175,9 @@ public class UcsManagerImpl implements UcsManager {
@Override
public boolean start() {
syncBladeInterval = Integer.valueOf(configDao.getValue(Config.UCSSyncBladeInterval.key()));
syncBladesExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("UCS-SyncBlades"));
syncBladesExecutor.scheduleAtFixedRate(new SyncBladesThread(), syncBladeInterval, syncBladeInterval, TimeUnit.SECONDS);
return true;
}

View File

@ -36,6 +36,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UcsManagerResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.ConcurrentOperationException;
@ -50,7 +51,7 @@ import com.cloud.user.Account;
public class ListUcsManagerCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class);
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the zone id", required=true)
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, description="the zone id", entityType=ZoneResponse.class, required=true)
private Long zoneId;
@Inject

View File

@ -11,25 +11,22 @@
// 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.ha;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
@Local(value=FenceBuilder.class)
public class VmwareFencer extends AdapterBase implements FenceBuilder {
@Override
public Boolean fenceOff(VMInstanceVO vm, HostVO host) {
public Boolean fenceOff(VirtualMachine vm, Host host) {
return null;
}

View File

@ -11,18 +11,18 @@
// 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.ha;
import javax.ejb.Local;
import com.cloud.host.HostVO;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
@Local(value=Investigator.class)
public class VmwareInvestigator extends AdapterBase implements Investigator {
@ -30,7 +30,7 @@ public class VmwareInvestigator extends AdapterBase implements Investigator {
}
@Override
public Status isAgentAlive(HostVO agent) {
public Status isAgentAlive(Host agent) {
if(agent.getHypervisorType() == HypervisorType.VMware)
return Status.Disconnected;
@ -38,7 +38,7 @@ public class VmwareInvestigator extends AdapterBase implements Investigator {
}
@Override
public Boolean isVmAlive(VMInstanceVO vm, HostVO host) {
public Boolean isVmAlive(VirtualMachine vm, Host host) {
if(vm.getHypervisorType() == HypervisorType.VMware)
return true;

View File

@ -122,7 +122,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
}
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
public VirtualMachineTO implement(VirtualMachineProfile vm) {
VirtualMachineTO to = toVirtualMachineTO(vm);
to.setBootloader(BootloaderType.HVM);

View File

@ -28,6 +28,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.concurrent.*;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
@ -4073,33 +4074,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
return str.replace('/', '-');
}
// This methd can be used to determine if the datastore is active yet.
// When an iSCSI target is created on a host and that target already contains
// the metadata that represents a datastore, the datastore shows up within
// vCenter as existent, but not necessarily active.
// Call this method and pass in the datastore's name to wait, if necessary,
// for the datastore to become active.
private boolean datastoreFileExists(DatastoreMO dsMo, String volumeDatastorePath) {
for (int i = 0; i < 10; i++) {
try {
return dsMo.fileExists(volumeDatastorePath);
}
catch (Exception e) {
if (!e.getMessage().contains("is not accessible")) {
break;
}
}
try {
Thread.sleep(5000);
}
catch (Exception e) {
}
}
return false;
}
@Override
public ManagedObjectReference handleDatastoreAndVmdkAttach(Command cmd, String iqn, String storageHost, int storagePort,
String initiatorUsername, String initiatorPassword, String targetUsername, String targetPassword) throws Exception {
@ -4115,7 +4089,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), dsMo.getName());
if (!datastoreFileExists(dsMo, volumeDatastorePath)) {
if (!dsMo.fileExists(volumeDatastorePath)) {
String dummyVmName = getWorkerName(context, cmd, 0);
VirtualMachineMO vmMo = prepareVolumeHostDummyVm(hyperHost, dsMo, dummyVmName);
@ -4209,6 +4183,126 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
}
}
private void addRemoveInternetScsiTargetsToAllHosts(final boolean add, final List<HostInternetScsiHbaStaticTarget> lstTargets,
final List<Pair<ManagedObjectReference, String>> lstHosts) throws Exception {
VmwareContext context = getServiceContext();
ExecutorService executorService = Executors.newFixedThreadPool(lstHosts.size());
final List<Exception> exceptions = new ArrayList<Exception>();
for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
HostMO host = new HostMO(context, hostPair.first());
HostStorageSystemMO hostStorageSystem = host.getHostStorageSystemMO();
boolean iScsiHbaConfigured = false;
for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
if (hba instanceof HostInternetScsiHba) {
// just finding an instance of HostInternetScsiHba means that we have found at least one configured iSCSI HBA
// at least one iSCSI HBA must be configured before a CloudStack user can use this host for iSCSI storage
iScsiHbaConfigured = true;
final String iScsiHbaDevice = hba.getDevice();
final HostStorageSystemMO hss = hostStorageSystem;
executorService.submit(new Thread() {
@Override
public void run() {
try {
if (add) {
hss.addInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
}
else {
hss.removeInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
}
hss.rescanHba(iScsiHbaDevice);
hss.rescanVmfs();
}
catch (Exception ex) {
synchronized (exceptions) {
exceptions.add(ex);
}
}
}
});
}
}
if (!iScsiHbaConfigured) {
throw new Exception("An iSCSI HBA must be configured before a host can use iSCSI storage.");
}
}
executorService.shutdown();
if (!executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.MINUTES)) {
throw new Exception("The system timed out before completing the task 'rescanAllHosts'.");
}
if (exceptions.size() > 0) {
throw new Exception(exceptions.get(0).getMessage());
}
}
private void rescanAllHosts(final List<Pair<ManagedObjectReference, String>> lstHosts) throws Exception {
VmwareContext context = getServiceContext();
ExecutorService executorService = Executors.newFixedThreadPool(lstHosts.size());
final List<Exception> exceptions = new ArrayList<Exception>();
for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
HostMO host = new HostMO(context, hostPair.first());
HostStorageSystemMO hostStorageSystem = host.getHostStorageSystemMO();
boolean iScsiHbaConfigured = false;
for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
if (hba instanceof HostInternetScsiHba) {
// just finding an instance of HostInternetScsiHba means that we have found at least one configured iSCSI HBA
// at least one iSCSI HBA must be configured before a CloudStack user can use this host for iSCSI storage
iScsiHbaConfigured = true;
final String iScsiHbaDevice = hba.getDevice();
final HostStorageSystemMO hss = hostStorageSystem;
executorService.submit(new Thread() {
@Override
public void run() {
try {
hss.rescanHba(iScsiHbaDevice);
hss.rescanVmfs();
}
catch (Exception ex) {
synchronized (exceptions) {
exceptions.add(ex);
}
}
}
});
}
}
if (!iScsiHbaConfigured) {
throw new Exception("An iSCSI HBA must be configured before a host can use iSCSI storage.");
}
}
executorService.shutdown();
if (!executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.MINUTES)) {
throw new Exception("The system timed out before completing the task 'rescanAllHosts'.");
}
if (exceptions.size() > 0) {
throw new Exception(exceptions.get(0).getMessage());
}
}
private ManagedObjectReference createVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress,
int storagePortNumber, String iqn, String chapName, String chapSecret, String mutualChapName, String mutualChapSecret) throws Exception {
VmwareContext context = getServiceContext();
@ -4242,80 +4336,46 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
lstTargets.add(target);
HostDatastoreSystemMO hostDatastoreSystem = null;
HostStorageSystemMO hostStorageSystem = null;
addRemoveInternetScsiTargetsToAllHosts(true, lstTargets, lstHosts);
final List<Thread> threads = new ArrayList<Thread>();
final List<Exception> exceptions = new ArrayList<Exception>();
rescanAllHosts(lstHosts);
for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
HostMO host = new HostMO(context, hostPair.first());
hostDatastoreSystem = host.getHostDatastoreSystemMO();
hostStorageSystem = host.getHostStorageSystemMO();
HostMO host = new HostMO(context, lstHosts.get(0).first());
HostDatastoreSystemMO hostDatastoreSystem = host.getHostDatastoreSystemMO();
boolean iScsiHbaConfigured = false;
for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
if (hba instanceof HostInternetScsiHba) {
// just finding an instance of HostInternetScsiHba means that we have found at least one configured iSCSI HBA
// at least one iSCSI HBA must be configured before a CloudStack user can use this host for iSCSI storage
iScsiHbaConfigured = true;
final String iScsiHbaDevice = hba.getDevice();
final HostStorageSystemMO hss = hostStorageSystem;
threads.add(new Thread() {
@Override
public void run() {
try {
hss.addInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
hss.rescanHba(iScsiHbaDevice);
hss.rescanVmfs();
}
catch (Exception ex) {
synchronized (exceptions) {
exceptions.add(ex);
}
}
}
});
}
}
if (!iScsiHbaConfigured) {
throw new Exception("An iSCSI HBA must be configured before a host can use iSCSI storage.");
}
}
for (Thread thread : threads) {
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
if (exceptions.size() > 0) {
throw new Exception(exceptions.get(0).getMessage());
}
ManagedObjectReference morDs = hostDatastoreSystem.findDatastoreByName(iqn);
ManagedObjectReference morDs = hostDatastoreSystem.findDatastoreByName(datastoreName);
if (morDs != null) {
return morDs;
}
rescanAllHosts(lstHosts);
HostStorageSystemMO hostStorageSystem = host.getHostStorageSystemMO();
List<HostScsiDisk> lstHostScsiDisks = hostDatastoreSystem.queryAvailableDisksForVmfs();
HostScsiDisk hostScsiDisk = getHostScsiDisk(hostStorageSystem.getStorageDeviceInfo().getScsiTopology(), lstHostScsiDisks, iqn);
if (hostScsiDisk == null) {
// check to see if the datastore actually does exist already
morDs = hostDatastoreSystem.findDatastoreByName(datastoreName);
if (morDs != null) {
return morDs;
}
throw new Exception("A relevant SCSI disk could not be located to use to create a datastore.");
}
return hostDatastoreSystem.createVmfsDatastore(datastoreName, hostScsiDisk);
morDs = hostDatastoreSystem.createVmfsDatastore(datastoreName, hostScsiDisk);
if (morDs != null) {
rescanAllHosts(lstHosts);
return morDs;
}
throw new Exception("Unable to create a datastore");
}
// the purpose of this method is to find the HostScsiDisk in the passed-in array that exists (if any) because
@ -4363,46 +4423,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
lstTargets.add(target);
final List<Thread> threads = new ArrayList<Thread>();
final List<Exception> exceptions = new ArrayList<Exception>();
addRemoveInternetScsiTargetsToAllHosts(false, lstTargets, lstHosts);
for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
final HostMO host = new HostMO(context, hostPair.first());
final HostStorageSystemMO hostStorageSystem = host.getHostStorageSystemMO();
for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
if (hba instanceof HostInternetScsiHba) {
final String iScsiHbaDevice = hba.getDevice();
Thread thread = new Thread() {
@Override
public void run() {
try {
hostStorageSystem.removeInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
hostStorageSystem.rescanHba(iScsiHbaDevice);
hostStorageSystem.rescanVmfs();
}
catch (Exception ex) {
exceptions.add(ex);
}
}
};
threads.add(thread);
thread.start();
}
}
}
for (Thread thread : threads) {
thread.join();
}
if (exceptions.size() > 0) {
throw new Exception(exceptions.get(0).getMessage());
}
rescanAllHosts(lstHosts);
}
protected Answer execute(AttachIsoCommand cmd) {

View File

@ -100,7 +100,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
@Override
public boolean prepare(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException {
@ -109,7 +109,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
@Override
public boolean release(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException {
return true;

View File

@ -11,7 +11,7 @@
// 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.ha;
@ -31,13 +31,14 @@ import com.cloud.agent.api.FenceAnswer;
import com.cloud.agent.api.FenceCommand;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.resource.ResourceManager;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
@Local(value=FenceBuilder.class)
public class XenServerFencer extends AdapterBase implements FenceBuilder {
@ -49,7 +50,7 @@ public class XenServerFencer extends AdapterBase implements FenceBuilder {
@Inject ResourceManager _resourceMgr;
@Override
public Boolean fenceOff(VMInstanceVO vm, HostVO host) {
public Boolean fenceOff(VirtualMachine vm, Host host) {
if (host.getHypervisorType() != HypervisorType.XenServer) {
s_logger.debug("Don't know how to fence non XenServer hosts " + host.getHypervisorType());
return null;

View File

@ -11,7 +11,7 @@
// 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.hypervisor;
@ -24,9 +24,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.GuestOSVO;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VirtualMachineProfileImpl;
@Local(value=HypervisorGuru.class)
public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru {
@ -42,7 +40,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
}
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
public VirtualMachineTO implement(VirtualMachineProfile vm) {
BootloaderType bt = BootloaderType.PyGrub;
if (vm.getBootLoaderType() == BootloaderType.CD) {
bt = vm.getBootLoaderType();

View File

@ -579,7 +579,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
cluster.setGuid(startup.getPool());
_clusterDao.update(cluster.getId(), cluster);
} else if (! cluster.getGuid().equals(startup.getPool()) ) {
String msg = "pool uuid for cluster " + cluster.getId() + " changed from " + cluster.getGuid() + " to " + cmd.getPod();
String msg = "pool uuid for cluster " + cluster.getId() + " changed from " + cluster.getGuid() + " to " + startup.getPool();
s_logger.warn(msg);
throw new CloudRuntimeException(msg);
}

View File

@ -139,8 +139,6 @@ import com.cloud.agent.api.GetHostStatsAnswer;
import com.cloud.agent.api.GetHostStatsCommand;
import com.cloud.agent.api.GetStorageStatsAnswer;
import com.cloud.agent.api.GetStorageStatsCommand;
import com.cloud.agent.api.GetVmDiskStatsAnswer;
import com.cloud.agent.api.GetVmDiskStatsCommand;
import com.cloud.agent.api.GetVmStatsAnswer;
import com.cloud.agent.api.GetVmStatsCommand;
import com.cloud.agent.api.GetVncPortAnswer;
@ -195,7 +193,6 @@ import com.cloud.agent.api.UnPlugNicAnswer;
import com.cloud.agent.api.UnPlugNicCommand;
import com.cloud.agent.api.UpdateHostPasswordCommand;
import com.cloud.agent.api.UpgradeSnapshotCommand;
import com.cloud.agent.api.VmDiskStatsEntry;
import com.cloud.agent.api.VmStatsEntry;
import com.cloud.agent.api.check.CheckSshAnswer;
import com.cloud.agent.api.check.CheckSshCommand;
@ -498,8 +495,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return execute((GetHostStatsCommand) cmd);
} else if (clazz == GetVmStatsCommand.class) {
return execute((GetVmStatsCommand) cmd);
} else if (cmd instanceof GetVmDiskStatsCommand) {
return execute((GetVmDiskStatsCommand) cmd);
} else if (clazz == CheckHealthCommand.class) {
return execute((CheckHealthCommand) cmd);
} else if (clazz == StopCommand.class) {
@ -2636,80 +2631,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return hostStats;
}
protected GetVmDiskStatsAnswer execute( GetVmDiskStatsCommand cmd) {
Connection conn = getConnection();
List<String> vmNames = cmd.getVmNames();
HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsNameMap = new HashMap<String, List<VmDiskStatsEntry>>();
if( vmNames.size() == 0 ) {
return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
}
try {
// Determine the UUIDs of the requested VMs
List<String> vmUUIDs = new ArrayList<String>();
for (String vmName : vmNames) {
VM vm = getVM(conn, vmName);
vmUUIDs.add(vm.getUuid(conn));
}
HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsUUIDMap = getVmDiskStats(conn, cmd, vmUUIDs, cmd.getHostGuid());
if( vmDiskStatsUUIDMap == null ) {
return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(), vmDiskStatsNameMap);
}
for (String vmUUID : vmDiskStatsUUIDMap.keySet()) {
List<VmDiskStatsEntry> vmDiskStatsUUID = vmDiskStatsUUIDMap.get(vmUUID);
String vmName = vmNames.get(vmUUIDs.indexOf(vmUUID));
for (VmDiskStatsEntry vmDiskStat : vmDiskStatsUUID) {
vmDiskStat.setVmName(vmName);
}
vmDiskStatsNameMap.put(vmName, vmDiskStatsUUID);
}
return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
} catch (XenAPIException e) {
String msg = "Unable to get VM disk stats" + e.toString();
s_logger.warn(msg, e);
return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
} catch (XmlRpcException e) {
String msg = "Unable to get VM disk stats" + e.getMessage();
s_logger.warn(msg, e);
return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
}
}
private HashMap<String, List<VmDiskStatsEntry>> getVmDiskStats(Connection conn, GetVmDiskStatsCommand cmd, List<String> vmUUIDs, String hostGuid) {
HashMap<String, List<VmDiskStatsEntry>> vmResponseMap = new HashMap<String, List<VmDiskStatsEntry>>();
for (String vmUUID : vmUUIDs) {
vmResponseMap.put(vmUUID, new ArrayList<VmDiskStatsEntry>());
}
try {
for (String vmUUID : vmUUIDs) {
VM vm = VM.getByUuid(conn, vmUUID);
List<VmDiskStatsEntry> vmDiskStats = new ArrayList<VmDiskStatsEntry>();
for (VBD vbd : vm.getVBDs(conn)) {
if (!vbd.getType(conn).equals(Types.VbdType.CD)) {
VmDiskStatsEntry stats = new VmDiskStatsEntry();
VBDMetrics record = vbd.getMetrics(conn);
stats.setPath(vbd.getVDI(conn).getUuid(conn));
stats.setBytesRead((long)(record.getIoReadKbs(conn) * 1024));
stats.setBytesWrite((long)(record.getIoWriteKbs(conn) * 1024));
vmDiskStats.add(stats);
}
}
vmResponseMap.put(vmUUID, vmDiskStats);
}
} catch (Exception e) {
s_logger.warn("Error while collecting disk stats from : ", e);
return null;
}
return vmResponseMap;
}
protected GetVmStatsAnswer execute( GetVmStatsCommand cmd) {
Connection conn = getConnection();
List<String> vmNames = cmd.getVmNames();

View File

@ -182,7 +182,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
@Override
public boolean prepare(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException {
@ -228,7 +228,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
@Override
public boolean release(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException {

View File

@ -211,7 +211,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
@Override
public void reserve(NicProfile nic, Network network,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException {
@ -221,7 +221,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
@Override
public boolean release(NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
String reservationId) {
// TODO Auto-generated method stub
return super.release(nic, vm, reservationId);

View File

@ -422,7 +422,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
@Override
public boolean prepare(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException {
@ -441,7 +441,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
@Override
public boolean release(Network network, NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException {
return true;

View File

@ -71,7 +71,7 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
}
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
// signal to the dns server that this vm is up and running and set the ip address to hostname mapping.
vm.getHostName();
@ -81,7 +81,7 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
vm.getHostName();
nic.getIp4Address();
nic.getIp6Address();

View File

@ -123,14 +123,14 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan
}
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
return true;
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException,
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException {
return true;

View File

@ -127,7 +127,6 @@ import com.cloud.utils.net.Ip;
import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.VirtualMachineGuru;
@ -140,10 +139,8 @@ import com.cloud.vm.dao.NicDao;
@Component
@Local(value = { ElasticLoadBalancerManager.class })
public class ElasticLoadBalancerManagerImpl extends ManagerBase implements
ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
private static final Logger s_logger = Logger
.getLogger(ElasticLoadBalancerManagerImpl.class);
public class ElasticLoadBalancerManagerImpl extends ManagerBase implements ElasticLoadBalancerManager, VirtualMachineGuru {
private static final Logger s_logger = Logger.getLogger(ElasticLoadBalancerManagerImpl.class);
@Inject
IPAddressDao _ipAddressDao;
@ -538,21 +535,15 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
private DomainRouterVO start(DomainRouterVO elbVm, User user, Account caller, Map<Param, Object> params) throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Starting ELB VM " + elbVm);
if (_itMgr.start(elbVm, params, user, caller) != null) {
return _routerDao.findById(elbVm.getId());
} else {
return null;
}
_itMgr.start(elbVm.getUuid(), params);
return _routerDao.findById(elbVm.getId());
}
private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Stopping ELB vm " + elbVm);
try {
if (_itMgr.advanceStop( elbVm, forced, user, caller)) {
return _routerDao.findById(elbVm.getId());
} else {
return null;
}
_itMgr.advanceStop(elbVm.getUuid(), forced);
return _routerDao.findById(elbVm.getId());
} catch (OperationTimedoutException e) {
throw new CloudRuntimeException("Unable to stop " + elbVm, e);
}
@ -781,13 +772,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public DomainRouterVO findById(long id) {
return _routerDao.findById(id);
}
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) {
DomainRouterVO elbVm = profile.getVirtualMachine();
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
List<NicProfile> elbNics = profile.getNics();
Long guestNtwkId = null;
@ -867,8 +852,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
DomainRouterVO elbVm = profile.getVirtualMachine();
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
List<NicProfile> nics = profile.getNics();
for (NicProfile nic : nics) {
@ -888,7 +873,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
if (answer == null || !answer.getResult()) {
s_logger.warn("Unable to ssh to the ELB VM: " + answer.getDetails());
@ -899,8 +884,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
DomainRouterVO elbVm = profile.getVirtualMachine();
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
DataCenterVO dcVo = _dcDao.findById(elbVm.getDataCenterId());
NicProfile controlNic = null;
@ -953,10 +938,9 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
if (answer != null) {
VMInstanceVO vm = profile.getVirtualMachine();
DomainRouterVO elbVm = _routerDao.findById(vm.getId());
DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
processStopOrRebootAnswer(elbVm, answer);
}
}
@ -966,13 +950,13 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
}
@Override
public void finalizeExpunge(DomainRouterVO vm) {
public void finalizeExpunge(VirtualMachine vm) {
// no-op
}
@Override
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
public void prepareStop(VirtualMachineProfile profile) {
}
}

View File

@ -159,13 +159,13 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
}
@Override
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
InsufficientNetworkCapacityException, ResourceUnavailableException {
return true;
}
@Override
public boolean release(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
public boolean release(Network config, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
return true;
}

View File

@ -170,7 +170,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
if (!canHandle(network, null)) {
@ -218,7 +218,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
return true;
}

View File

@ -120,7 +120,7 @@ import com.cloud.vm.dao.NicDao;
@Component
@Local(value = { InternalLoadBalancerVMManager.class, InternalLoadBalancerVMService.class})
public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
InternalLoadBalancerVMManager, VirtualMachineGuru<DomainRouterVO> {
InternalLoadBalancerVMManager, VirtualMachineGuru {
private static final Logger s_logger = Logger
.getLogger(InternalLoadBalancerVMManagerImpl.class);
static final private String _internalLbVmNamePrefix = "b";
@ -151,12 +151,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
@Inject ConfigurationServer _configServer;
@Override
public DomainRouterVO findById(long id) {
return _internalLbVmDao.findById(id);
}
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile,
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile,
DeployDestination dest, ReservationContext context) {
//Internal LB vm starts up with 2 Nics
@ -231,8 +226,9 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
}
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
DomainRouterVO internalLbVm = profile.getVirtualMachine();
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
List<NicProfile> nics = profile.getNics();
for (NicProfile nic : nics) {
@ -248,8 +244,8 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
}
@Override
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
DomainRouterVO internalLbVm = profile.getVirtualMachine();
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
boolean result = true;
@ -297,8 +293,8 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
}
@Override
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
DomainRouterVO internalLbVm = profile.getVirtualMachine();
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
NicProfile controlNic = getNicProfileByTrafficType(profile, TrafficType.Control);
if (controlNic == null) {
@ -334,15 +330,15 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
}
@Override
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
}
@Override
public void finalizeExpunge(DomainRouterVO vm) {
public void finalizeExpunge(VirtualMachine vm) {
}
@Override
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
public void prepareStop(VirtualMachineProfile profile) {
}
@Override
@ -391,7 +387,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
return _name;
}
protected NicProfile getNicProfileByTrafficType(VirtualMachineProfile<DomainRouterVO> profile, TrafficType trafficType) {
protected NicProfile getNicProfileByTrafficType(VirtualMachineProfile profile, TrafficType trafficType) {
for (NicProfile nic : profile.getNics()) {
if (nic.getTrafficType() == trafficType && nic.getIp4Address() != null) {
return nic;
@ -400,7 +396,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
return null;
}
protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DomainRouterVO router, NicProfile controlNic) {
protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, NicProfile controlNic) {
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
// Update internal lb vm template/scripts version
@ -467,7 +463,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
maxconn = offering.getConcurrentConnections().toString();
}
LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, guestNic.getIp4Address(),
guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(),
guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(),
_itMgr.toNicTO(guestNicProfile, internalLbVm.getHypervisorType()), internalLbVm.getVpcId(), maxconn);
cmd.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
@ -538,11 +534,8 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
protected VirtualRouter stopInternalLbVm(DomainRouterVO internalLbVm, boolean forced, Account caller, long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException {
s_logger.debug("Stopping internal lb vm " + internalLbVm);
try {
if (_itMgr.advanceStop(internalLbVm, forced, _accountMgr.getActiveUser(callerUserId), caller)) {
return _internalLbVmDao.findById(internalLbVm.getId());
} else {
return null;
}
_itMgr.advanceStop(internalLbVm.getUuid(), forced);
return _internalLbVmDao.findById(internalLbVm.getId());
} catch (OperationTimedoutException e) {
throw new CloudRuntimeException("Unable to stop " + internalLbVm, e);
}
@ -815,16 +808,13 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Starting Internal LB VM " + internalLbVm);
if (_itMgr.start(internalLbVm, params, _accountMgr.getUserIncludingRemoved(callerUserId), caller, null) != null) {
if (internalLbVm.isStopPending()) {
s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!");
internalLbVm.setStopPending(false);
internalLbVm = _internalLbVmDao.persist(internalLbVm);
}
return _internalLbVmDao.findById(internalLbVm.getId());
} else {
return null;
_itMgr.start(internalLbVm.getUuid(), params, null);
if (internalLbVm.isStopPending()) {
s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!");
internalLbVm.setStopPending(false);
internalLbVm = _internalLbVmDao.persist(internalLbVm);
}
return _internalLbVmDao.findById(internalLbVm.getId());
}

View File

@ -17,7 +17,6 @@
package org.apache.cloudstack.internallbvmmgr;
import java.lang.reflect.Field;
import java.util.Map;
import javax.inject.Inject;
@ -34,11 +33,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@ -46,10 +43,8 @@ import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.AccountVO;
import com.cloud.user.User;
import com.cloud.user.UserVO;
import com.cloud.user.dao.AccountDao;
import com.cloud.utils.component.ComponentContext;
@ -112,31 +107,6 @@ public class InternalLBVMServiceTest extends TestCase {
Mockito.when(_domainRouterDao.findById(validVmId)).thenReturn(validVm);
Mockito.when(_domainRouterDao.findById(nonExistingVmId)).thenReturn(null);
Mockito.when(_domainRouterDao.findById(nonInternalLbVmId)).thenReturn(nonInternalLbVm);
try {
Mockito.when(_itMgr.start(Mockito.any(DomainRouterVO.class),
Mockito.any(Map.class), Mockito.any(User.class), Mockito.any(Account.class), Mockito.any(DeploymentPlan.class))).thenReturn(validVm);
} catch (InsufficientCapacityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ResourceUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Mockito.when(_itMgr.advanceStop(Mockito.any(DomainRouterVO.class), Mockito.any(Boolean.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
} catch (ResourceUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperationTimedoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ConcurrentOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override

View File

@ -145,13 +145,13 @@ PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, Junip
}
@Override
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
InsufficientNetworkCapacityException, ResourceUnavailableException {
return true;
}
@Override
public boolean release(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
public boolean release(Network config, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
return true;
}

View File

@ -391,7 +391,7 @@ public class MidoNetElement extends AdapterBase implements
* From interface DHCPServiceProvider
*/
@Override
public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
@ -455,7 +455,7 @@ public class MidoNetElement extends AdapterBase implements
}
@Override
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
@ -768,7 +768,7 @@ public class MidoNetElement extends AdapterBase implements
}
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
s_logger.debug("prepare called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
@ -832,7 +832,7 @@ public class MidoNetElement extends AdapterBase implements
}
@Override
public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("release called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());

View File

@ -145,7 +145,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
@Override
public void reserve(NicProfile nic, Network network,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException {
@ -156,7 +156,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
@Override
public boolean release(NicProfile nic,
VirtualMachineProfile<? extends VirtualMachine> vm,
VirtualMachineProfile vm,
String reservationId) {
s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
return super.release(nic, vm, reservationId);

View File

@ -78,7 +78,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
super();
}
protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException,
protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException, ConcurrentOperationException {
if (nic.getIp4Address() == null) {
PublicIp ip = _networkMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), Vlan.VlanType.VirtualNetwork, null, null, false);
@ -117,7 +117,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
}
@Override
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException, ConcurrentOperationException {
@ -148,7 +148,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
}
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
s_logger.debug("reserve called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
if (nic.getIp4Address() == null) {
@ -157,7 +157,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
}
@Override
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
return true;
}
@ -189,7 +189,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
}
@Override @DB
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
s_logger.debug("deallocate called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
if (s_logger.isDebugEnabled()) {
s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());

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