mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Changed VirtualMachineProfile to be non-generic. From here on VirtualMachineManager will only manage vm instance. It doesn't understand the difference between different types of VMs. This makes the vmsync code to be generic across all vms.
This commit is contained in:
parent
7928963d16
commit
1325014a03
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -129,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());
|
||||
|
||||
@ -147,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());
|
||||
@ -256,8 +256,6 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
||||
|
||||
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
|
||||
return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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>();
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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>();
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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 {
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
@ -783,8 +782,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
||||
}
|
||||
|
||||
@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;
|
||||
@ -864,8 +862,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) {
|
||||
@ -885,7 +883,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());
|
||||
@ -896,8 +894,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;
|
||||
@ -950,10 +948,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);
|
||||
}
|
||||
}
|
||||
@ -969,7 +966,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
public void prepareStop(VirtualMachineProfile profile) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
|
||||
}
|
||||
|
||||
@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 +231,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 +249,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 +298,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,7 +335,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
||||
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -342,7 +343,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
public void prepareStop(VirtualMachineProfile profile) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -391,7 +392,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 +401,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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -97,8 +97,8 @@ public class MidoNetElementTest extends TestCase {
|
||||
|
||||
//mockVm
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<? extends VirtualMachine> mockVm =
|
||||
(VirtualMachineProfile<? extends VirtualMachine>)mock(VirtualMachineProfile.class);
|
||||
VirtualMachineProfile mockVm =
|
||||
(VirtualMachineProfile)mock(VirtualMachineProfile.class);
|
||||
when(mockVm.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
|
||||
MidoNetElement elem = new MidoNetElement();
|
||||
|
||||
@ -200,13 +200,13 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException {
|
||||
@ -373,7 +373,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
|
||||
|
||||
@Override
|
||||
public boolean release(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
@ -222,7 +222,7 @@ public class NiciraNvpGuestNetworkGuru 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);
|
||||
|
||||
@ -72,7 +72,7 @@ public class OvsElement extends AdapterBase implements NetworkElement {
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException {
|
||||
@ -92,7 +92,7 @@ public class OvsElement extends AdapterBase implements NetworkElement {
|
||||
|
||||
@Override
|
||||
public boolean release(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
|
||||
|
||||
@ -26,7 +26,7 @@ public interface OvsTunnelManager extends Manager {
|
||||
|
||||
boolean isOvsTunnelEnabled();
|
||||
|
||||
public void VmCheckAndCreateTunnel(VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
public void VmCheckAndCreateTunnel(VirtualMachineProfile vm,
|
||||
Network nw, DeployDestination dest);
|
||||
|
||||
public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw);
|
||||
|
||||
@ -383,7 +383,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
|
||||
|
||||
@Override
|
||||
public void VmCheckAndCreateTunnel(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
Network nw, DeployDestination dest) {
|
||||
CheckAndCreateTunnel(vm.getVirtualMachine(), nw, dest);
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
|
||||
*/
|
||||
@Override
|
||||
public boolean prepare(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException {
|
||||
@ -526,7 +526,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
|
||||
*/
|
||||
@Override
|
||||
public boolean release(Network network, NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
s_logger.trace("release");
|
||||
@ -569,7 +569,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
|
||||
|
||||
@Override
|
||||
public boolean prepareMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context) {
|
||||
try {
|
||||
prepare(network, nic, vm, dest, context);
|
||||
@ -588,7 +588,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
|
||||
|
||||
@Override
|
||||
public void rollbackMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
try {
|
||||
release(network, nic, vm, dst);
|
||||
@ -601,7 +601,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
|
||||
|
||||
@Override
|
||||
public void commitMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
try {
|
||||
release(network, nic, vm, src);
|
||||
|
||||
@ -119,7 +119,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
@ -129,7 +129,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
String reservationId) {
|
||||
Network network = _networkDao.findById(nic.getNetworkId());
|
||||
_sspMgr.deleteNicEnv(network, nic, new ReservationContextImpl(reservationId, null, null));
|
||||
@ -143,7 +143,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
||||
|
||||
@Override
|
||||
public boolean prepareMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context) {
|
||||
try {
|
||||
reserve(nic, network, vm, dest, context);
|
||||
@ -159,14 +159,14 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
||||
|
||||
@Override
|
||||
public void rollbackMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
release(nic, vm, dst.getReservationId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
release(nic, vm, src.getReservationId());
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator {
|
||||
private static final Logger s_logger = Logger.getLogger(RandomStoragePoolAllocator.class);
|
||||
|
||||
@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) {
|
||||
|
||||
List<StoragePool> suitablePools = new ArrayList<StoragePool>();
|
||||
|
||||
@ -105,13 +105,13 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
|
||||
CapacityManager _capacityMgr;
|
||||
|
||||
@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, ExcludeList avoid, int returnUpTo,
|
||||
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo,
|
||||
boolean considerReservedCapacity) {
|
||||
|
||||
long dcId = plan.getDataCenterId();
|
||||
@ -195,7 +195,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
|
||||
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();
|
||||
|
||||
@ -32,7 +32,7 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
@Local(value={HostAllocator.class})
|
||||
public class FirstFitRoutingAllocator extends FirstFitAllocator {
|
||||
@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) {
|
||||
try {
|
||||
NDC.push("FirstFitRoutingAllocator");
|
||||
|
||||
@ -69,7 +69,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
||||
@Inject ResourceManager _resourceMgr;
|
||||
|
||||
@Override
|
||||
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vm,DeploymentPlan plan, Type type,
|
||||
public List<Host> allocateTo(VirtualMachineProfile vm,DeploymentPlan plan, Type type,
|
||||
ExcludeList avoid, int returnUpTo) {
|
||||
|
||||
List<Host> hosts = super.allocateTo(vm, plan, type, avoid, returnUpTo);
|
||||
|
||||
@ -42,19 +42,19 @@ public class TestingAllocator extends AdapterBase implements HostAllocator {
|
||||
Long _routingHost;
|
||||
|
||||
@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) {
|
||||
return allocateTo(vmProfile, plan, type, avoid, returnUpTo, considerReservedCapacity);
|
||||
}
|
||||
|
||||
@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) {
|
||||
List<Host> availableHosts = new ArrayList<Host>();
|
||||
Host host = null;
|
||||
|
||||
@ -1310,9 +1310,9 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<ConsoleProxyVO> profile, DeployDestination dest, ReservationContext context) {
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
|
||||
|
||||
ConsoleProxyVO vm = profile.getVirtualMachine();
|
||||
ConsoleProxyVO vm = _consoleProxyDao.findById(profile.getId());
|
||||
Map<String, String> details = _vmDetailsDao.findDetails(vm.getId());
|
||||
vm.setDetails(details);
|
||||
|
||||
@ -1388,11 +1388,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<ConsoleProxyVO> profile, DeployDestination dest, ReservationContext context) {
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
|
||||
|
||||
finalizeCommandsOnStart(cmds, profile);
|
||||
|
||||
ConsoleProxyVO proxy = profile.getVirtualMachine();
|
||||
ConsoleProxyVO proxy = _consoleProxyDao.findById(profile.getId());
|
||||
DataCenter dc = dest.getDataCenter();
|
||||
List<NicProfile> nics = profile.getNics();
|
||||
for (NicProfile nic : nics) {
|
||||
@ -1411,7 +1411,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<ConsoleProxyVO> profile) {
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
|
||||
|
||||
NicProfile managementNic = null;
|
||||
NicProfile controlNic = null;
|
||||
@ -1438,7 +1438,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeStart(VirtualMachineProfile<ConsoleProxyVO> 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()) {
|
||||
if (answer != null) {
|
||||
@ -1454,7 +1454,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
_rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false);
|
||||
IPAddressVO ipaddr = _ipAddressDao.findByAssociatedVmId(profile.getVirtualMachine().getId());
|
||||
if (ipaddr != null && ipaddr.getSystem()) {
|
||||
ConsoleProxyVO consoleVm = profile.getVirtualMachine();
|
||||
ConsoleProxyVO consoleVm = _consoleProxyDao.findById(profile.getId());
|
||||
// override CPVM guest IP with EIP, so that console url's will be prepared with EIP
|
||||
consoleVm.setPublicIpAddress(ipaddr.getAddress().addr());
|
||||
_consoleProxyDao.update(consoleVm.getId(), consoleVm);
|
||||
@ -1483,7 +1483,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<ConsoleProxyVO> profile, StopAnswer answer) {
|
||||
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
|
||||
//release elastic IP here if assigned
|
||||
IPAddressVO ip = _ipAddressDao.findByAssociatedVmId(profile.getId());
|
||||
if (ip != null && ip.getSystem()) {
|
||||
@ -1685,7 +1685,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {
|
||||
public void prepareStop(VirtualMachineProfile profile) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.exception.AffinityConflictException;
|
||||
import com.cloud.exception.InsufficientServerCapacityException;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface DeploymentPlanningManager extends Manager {
|
||||
@ -40,11 +39,11 @@ public interface DeploymentPlanningManager extends Manager {
|
||||
*
|
||||
*
|
||||
*/
|
||||
DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
|
||||
DeployDestination planDeployment(VirtualMachineProfile vmProfile, DeploymentPlan plan,
|
||||
ExcludeList avoids) throws InsufficientServerCapacityException, AffinityConflictException;
|
||||
|
||||
String finalizeReservation(DeployDestination plannedDestination,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids)
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids)
|
||||
throws InsufficientServerCapacityException, AffinityConflictException;
|
||||
|
||||
void cleanupVMReservations();
|
||||
|
||||
@ -207,7 +207,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
|
||||
public DeployDestination planDeployment(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException,
|
||||
AffinityConflictException {
|
||||
|
||||
@ -449,7 +449,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
return dest;
|
||||
}
|
||||
|
||||
private void checkForNonDedicatedResources(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DataCenter dc, ExcludeList avoids) {
|
||||
private void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) {
|
||||
boolean isExplicit = false;
|
||||
VirtualMachine vm = vmProfile.getVirtualMachine();
|
||||
// check affinity group of type Explicit dedication exists
|
||||
@ -534,7 +534,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
}
|
||||
}
|
||||
|
||||
private PlannerResourceUsage getPlannerUsage(DeploymentPlanner planner, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException {
|
||||
private PlannerResourceUsage getPlannerUsage(DeploymentPlanner planner, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException {
|
||||
if (planner != null && planner instanceof DeploymentClusterPlanner) {
|
||||
return ((DeploymentClusterPlanner) planner).getResourceUsage(vmProfile, plan, avoids);
|
||||
} else {
|
||||
@ -843,7 +843,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
|
||||
// /refactoring planner methods
|
||||
private DeployDestination checkClustersforDestination(List<Long> clusterList,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
|
||||
DataCenter dc, DeploymentPlanner.PlannerResourceUsage resourceUsageRequired, ExcludeList PlannerAvoidOutput) {
|
||||
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
@ -1035,7 +1035,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
return hostCanAccessSPool;
|
||||
}
|
||||
|
||||
protected List<Host> findSuitableHosts(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
|
||||
protected List<Host> findSuitableHosts(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
|
||||
List<Host> suitableHosts = new ArrayList<Host>();
|
||||
for (HostAllocator allocator : _hostAllocators) {
|
||||
@ -1052,7 +1052,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
}
|
||||
|
||||
protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsForVolumes(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
|
||||
int returnUpTo) {
|
||||
List<VolumeVO> volumesTobeCreated = _volsDao.findUsableVolumesForInstance(vmProfile.getId());
|
||||
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<Volume, List<StoragePool>>();
|
||||
@ -1219,7 +1219,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
||||
@DB
|
||||
@Override
|
||||
public String finalizeReservation(DeployDestination plannedDestination,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids)
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids)
|
||||
throws InsufficientServerCapacityException, AffinityConflictException {
|
||||
|
||||
VirtualMachine vm = vmProfile.getVirtualMachine();
|
||||
|
||||
@ -110,7 +110,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
|
||||
|
||||
@Override
|
||||
public List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
|
||||
public List<Long> orderClusters(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoid)
|
||||
throws InsufficientServerCapacityException {
|
||||
VirtualMachine vm = vmProfile.getVirtualMachine();
|
||||
@ -178,7 +178,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
|
||||
}
|
||||
|
||||
private List<Long> scanPodsForDestination(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid){
|
||||
private List<Long> scanPodsForDestination(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid){
|
||||
|
||||
ServiceOffering offering = vmProfile.getServiceOffering();
|
||||
int requiredCpu = offering.getCpu() * offering.getSpeed();
|
||||
@ -264,7 +264,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
}
|
||||
|
||||
private void removeClustersCrossingThreshold(List<Long> clusterListForVmAllocation, ExcludeList avoid,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan) {
|
||||
|
||||
List<Short> capacityList = getCapacitiesForCheckingThreshold();
|
||||
List<Long> clustersCrossingThreshold = new ArrayList<Long>();
|
||||
@ -302,7 +302,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
}
|
||||
|
||||
private List<Long> scanClustersForDestinationInZoneOrPod(long id, boolean isZone,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) {
|
||||
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) {
|
||||
|
||||
VirtualMachine vm = vmProfile.getVirtualMachine();
|
||||
ServiceOffering offering = vmProfile.getServiceOffering();
|
||||
@ -362,7 +362,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
* other than the capacity based ordering which is done by default.
|
||||
* @return List<Long> ordered list of Cluster Ids
|
||||
*/
|
||||
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> reordersClusterIds = clusterCapacityInfo.first();
|
||||
return reordersClusterIds;
|
||||
}
|
||||
@ -374,7 +374,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
* other than the capacity based ordering which is done by default.
|
||||
* @return List<Long> ordered list of Pod Ids
|
||||
*/
|
||||
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();
|
||||
return podIdsByCapacity;
|
||||
}
|
||||
@ -476,14 +476,14 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan,
|
||||
public boolean check(VirtualMachineProfile vm, DeploymentPlan plan,
|
||||
DeployDestination dest, ExcludeList exclude) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
|
||||
public boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) {
|
||||
// check what the ServiceOffering says. If null, check the global config
|
||||
ServiceOffering offering = vm.getServiceOffering();
|
||||
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
|
||||
@ -510,14 +510,14 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
||||
|
||||
|
||||
@Override
|
||||
public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan,
|
||||
public DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan,
|
||||
ExcludeList avoid) throws InsufficientServerCapacityException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
|
||||
public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
|
||||
DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
|
||||
return PlannerResourceUsage.Shared;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
||||
}
|
||||
|
||||
|
||||
protected <T extends VirtualMachine> VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile<T> vmProfile) {
|
||||
protected VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile vmProfile) {
|
||||
|
||||
ServiceOffering offering = vmProfile.getServiceOffering();
|
||||
VirtualMachine vm = vmProfile.getVirtualMachine();
|
||||
|
||||
@ -23,7 +23,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
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)
|
||||
@ -40,8 +39,7 @@ public class KVMGuru 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
|
||||
|
||||
@ -23,7 +23,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
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)
|
||||
@ -40,8 +39,7 @@ public class LXCGuru 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
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// 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,
|
||||
@ -55,7 +55,6 @@ import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicVO;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
@ -82,7 +81,7 @@ public interface NetworkManager {
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
|
||||
PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp,
|
||||
PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp,
|
||||
boolean isSystem) throws InsufficientAddressCapacityException;
|
||||
|
||||
|
||||
@ -103,17 +102,17 @@ public interface NetworkManager {
|
||||
List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean errorIfAlreadySetup, Long domainId,
|
||||
ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException;
|
||||
|
||||
void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
|
||||
void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceUnavailableException;
|
||||
|
||||
void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws
|
||||
void release(VirtualMachineProfile vmProfile, boolean forced) throws
|
||||
ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm);
|
||||
void cleanupNics(VirtualMachineProfile vm);
|
||||
|
||||
void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm);
|
||||
void expungeNics(VirtualMachineProfile vm);
|
||||
|
||||
List<NicProfile> getNicProfiles(VirtualMachine vm);
|
||||
|
||||
@ -129,27 +128,27 @@ public interface NetworkManager {
|
||||
* @param vm
|
||||
* @param dest
|
||||
*/
|
||||
void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest);
|
||||
void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest);
|
||||
|
||||
/**
|
||||
* commit vm nic change for migration
|
||||
*
|
||||
* This method will be called in migration transaction after the successful
|
||||
* This method will be called in migration transaction after the successful
|
||||
* vm migration.
|
||||
* @param src
|
||||
* @param dst
|
||||
*/
|
||||
void commitNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
|
||||
void commitNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
|
||||
|
||||
/**
|
||||
* rollback vm nic change for migration
|
||||
*
|
||||
* This method will be called in migaration transaction after vm migration
|
||||
* This method will be called in migaration transaction after vm migration
|
||||
* failure.
|
||||
* @param src
|
||||
* @param dst
|
||||
*/
|
||||
void rollbackNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
|
||||
void rollbackNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
|
||||
|
||||
boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements);
|
||||
|
||||
@ -193,8 +192,7 @@ public interface NetworkManager {
|
||||
|
||||
boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException;
|
||||
|
||||
boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm,
|
||||
DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException;
|
||||
boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
IpAddress assignSystemIp(long networkId, Account owner,
|
||||
boolean forElasticLb, boolean forElasticIp)
|
||||
@ -203,7 +201,7 @@ public interface NetworkManager {
|
||||
boolean handleSystemIpRelease(IpAddress ip);
|
||||
|
||||
void allocateDirectIp(NicProfile nic, DataCenter dc,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
Network network, String requestedIpv4, String requestedIpv6)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException;
|
||||
@ -212,8 +210,8 @@ public interface NetworkManager {
|
||||
* @param owner
|
||||
* @param guestNetwork
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws InsufficientAddressCapacityException
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws InsufficientAddressCapacityException
|
||||
*/
|
||||
PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork) throws InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
|
||||
@ -229,8 +227,8 @@ public interface NetworkManager {
|
||||
* @throws InsufficientAddressCapacityException
|
||||
* @throws ConcurrentOperationException
|
||||
*/
|
||||
Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId,
|
||||
VirtualMachineProfile<? extends VMInstanceVO> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId,
|
||||
VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
|
||||
|
||||
@ -247,7 +245,7 @@ public interface NetworkManager {
|
||||
* @throws InsufficientCapacityException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest,
|
||||
NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest,
|
||||
ReservationContext context, long nicId, NetworkVO network) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
@ -256,7 +254,7 @@ public interface NetworkManager {
|
||||
* @param vm
|
||||
* @param nic TODO
|
||||
*/
|
||||
void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic);
|
||||
void removeNic(VirtualMachineProfile vm, Nic nic);
|
||||
|
||||
|
||||
/**
|
||||
@ -264,7 +262,7 @@ public interface NetworkManager {
|
||||
* @param networkId
|
||||
* @param releaseOnFailure TODO
|
||||
*/
|
||||
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
|
||||
IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
|
||||
@ -297,7 +295,7 @@ public interface NetworkManager {
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic)
|
||||
void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
|
||||
@ -314,7 +312,8 @@ public interface NetworkManager {
|
||||
* @throws InsufficientCapacityException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare) throws InsufficientVirtualNetworkCapcityException,
|
||||
NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
|
||||
|
||||
@ -1615,7 +1615,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks)
|
||||
public void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
@ -1690,7 +1690,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
@DB
|
||||
@Override
|
||||
public Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic,
|
||||
int deviceId, VirtualMachineProfile<? extends VMInstanceVO> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
int deviceId, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException{
|
||||
|
||||
NetworkVO ntwkVO = _networksDao.findById(network.getId());
|
||||
@ -1997,7 +1997,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
protected boolean prepareElement(NetworkElement element, NetworkVO network,
|
||||
NicProfile profile, VirtualMachineProfile<? extends VMInstanceVO> vmProfile,
|
||||
NicProfile profile, VirtualMachineProfile vmProfile,
|
||||
DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
element.prepare(network, profile, vmProfile, dest, context);
|
||||
@ -2044,7 +2044,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
|
||||
public void prepare(VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
|
||||
|
||||
@ -2072,7 +2072,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination
|
||||
public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination
|
||||
dest, ReservationContext context, long nicId, NetworkVO network)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
|
||||
ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
@ -2136,7 +2136,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest) {
|
||||
public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) {
|
||||
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
|
||||
ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
|
||||
for (NicVO nic : nics) {
|
||||
@ -2163,7 +2163,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
}
|
||||
|
||||
private NicProfile findNicProfileById(VirtualMachineProfile<? extends VMInstanceVO> vm, long id){
|
||||
private NicProfile findNicProfileById(VirtualMachineProfile vm, long id){
|
||||
for(NicProfile nic: vm.getNics()){
|
||||
if(nic.getId() == id){
|
||||
return nic;
|
||||
@ -2174,8 +2174,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
public void commitNicForMigration(
|
||||
VirtualMachineProfile<? extends VMInstanceVO> src,
|
||||
VirtualMachineProfile<? extends VMInstanceVO> dst) {
|
||||
VirtualMachineProfile src,
|
||||
VirtualMachineProfile dst) {
|
||||
for(NicProfile nicSrc: src.getNics()){
|
||||
NetworkVO network = _networksDao.findById(nicSrc.getNetworkId());
|
||||
NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
|
||||
@ -2200,8 +2200,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
public void rollbackNicForMigration(
|
||||
VirtualMachineProfile<? extends VMInstanceVO> src,
|
||||
VirtualMachineProfile<? extends VMInstanceVO> dst) {
|
||||
VirtualMachineProfile src,
|
||||
VirtualMachineProfile dst) {
|
||||
for(NicProfile nicDst: dst.getNics()){
|
||||
NetworkVO network = _networksDao.findById(nicDst.getNetworkId());
|
||||
NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
|
||||
@ -2222,7 +2222,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws
|
||||
public void release(VirtualMachineProfile vmProfile, boolean forced) throws
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
|
||||
for (NicVO nic : nics) {
|
||||
@ -2233,14 +2233,14 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic)
|
||||
public void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
NicVO nicVO = _nicDao.findById(nic.getId());
|
||||
releaseNic(vmProfile, nicVO);
|
||||
}
|
||||
|
||||
@DB
|
||||
protected void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, NicVO nicVO)
|
||||
protected void releaseNic(VirtualMachineProfile vmProfile, NicVO nicVO)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
//lock the nic
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
@ -2292,7 +2292,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
|
||||
public void cleanupNics(VirtualMachineProfile vm) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Cleaning network for vm: " + vm.getId());
|
||||
}
|
||||
@ -2305,12 +2305,12 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
|
||||
@Override
|
||||
public void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic) {
|
||||
public void removeNic(VirtualMachineProfile vm, Nic nic) {
|
||||
removeNic(vm, _nicDao.findById(nic.getId()));
|
||||
}
|
||||
|
||||
|
||||
protected void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, NicVO nic) {
|
||||
protected void removeNic(VirtualMachineProfile vm, NicVO nic) {
|
||||
nic.setState(Nic.State.Deallocating);
|
||||
_nicDao.update(nic.getId(), nic);
|
||||
NetworkVO network = _networksDao.findById(nic.getNetworkId());
|
||||
@ -2347,7 +2347,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
|
||||
public void expungeNics(VirtualMachineProfile vm) {
|
||||
List<NicVO> nics = _nicDao.listByVmIdIncludingRemoved(vm.getId());
|
||||
for (NicVO nic : nics) {
|
||||
_nicDao.expunge(nic.getId());
|
||||
@ -3704,7 +3704,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@DB
|
||||
@Override
|
||||
public boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException {
|
||||
public boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException {
|
||||
VMInstanceVO vmInstance = _vmDao.findById(vm.getId());
|
||||
DataCenterVO dc = _dcDao.findById(vmInstance.getDataCenterId());
|
||||
if (dc.getNetworkType() == NetworkType.Basic) {
|
||||
@ -4198,7 +4198,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network,
|
||||
public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network,
|
||||
String requestedIpv4, String requestedIpv6) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
//This method allocates direct ip for the Shared network in Advance zones
|
||||
@ -4300,7 +4300,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare)
|
||||
public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
|
||||
ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.PasswordGenerator;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.vm.NicProfile;
|
||||
@ -112,13 +111,13 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
|
||||
InsufficientCapacityException, ResourceUnavailableException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@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) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -200,7 +199,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
|
||||
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
if (canHandle(dest, network.getTrafficType())) {
|
||||
|
||||
@ -208,16 +207,16 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
_userVmDao.loadDetails((UserVmVO) uservm.getVirtualMachine());
|
||||
String password = (String) uservm.getParameter(VirtualMachineProfile.Param.VmPassword);
|
||||
String userData = uservm.getVirtualMachine().getUserData();
|
||||
String sshPublicKey = uservm.getVirtualMachine().getDetail("SSH.PublicKey");
|
||||
UserVmVO uservm = _userVmDao.findById(vm.getId());
|
||||
_userVmDao.loadDetails(uservm);
|
||||
String password = (String)vm.getParameter(VirtualMachineProfile.Param.VmPassword);
|
||||
String userData = uservm.getUserData();
|
||||
String sshPublicKey = uservm.getDetail("SSH.PublicKey");
|
||||
|
||||
Commands cmds = new Commands(OnError.Continue);
|
||||
if (password != null && nic.isDefaultNic()) {
|
||||
final String encodedPassword = PasswordGenerator.rot13(password);
|
||||
SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
|
||||
SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(), uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
|
||||
cmds.addCommand("password", cmd);
|
||||
}
|
||||
String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(uservm.getServiceOfferingId()).getDisplayText();
|
||||
@ -225,7 +224,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
|
||||
cmds.addCommand(
|
||||
"vmdata",
|
||||
generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(),
|
||||
generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getHostName(),
|
||||
uservm.getInstanceName(), uservm.getId(), uservm.getUuid(), sshPublicKey));
|
||||
try {
|
||||
_agentManager.send(dest.getHost().getId(), cmds);
|
||||
@ -235,29 +234,29 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
|
||||
}
|
||||
Answer dataAnswer = cmds.getAnswer("vmdata");
|
||||
if (dataAnswer != null && dataAnswer.getResult()) {
|
||||
s_logger.info("Sent vm data successfully to vm " + uservm.getVirtualMachine().getInstanceName());
|
||||
s_logger.info("Sent vm data successfully to vm " + uservm.getInstanceName());
|
||||
return true;
|
||||
}
|
||||
s_logger.info("Failed to send vm data to vm " + uservm.getVirtualMachine().getInstanceName());
|
||||
s_logger.info("Failed to send vm data to vm " + uservm.getInstanceName());
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException {
|
||||
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -68,13 +68,13 @@ public class SecurityGroupElement 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 {
|
||||
return true;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@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, InsufficientCapacityException, ResourceUnavailableException {
|
||||
if (vm.getType() != VirtualMachine.Type.User || vm.getHypervisorType() == HypervisorType.BareMetal) {
|
||||
@ -232,7 +232,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
List<DomainRouterVO> routers = _routerMgr.deployVirtualRouterInGuestNetwork(network, dest,
|
||||
_accountMgr.getAccount(network.getAccountId()),
|
||||
uservm.getParameters(), offering.getRedundantRouter());
|
||||
@ -685,7 +685,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
|
||||
public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm)
|
||||
throws ResourceUnavailableException {
|
||||
if (!canHandle(network, null)) {
|
||||
return false;
|
||||
@ -697,13 +697,13 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
return _routerMgr.savePasswordToRouter(network, nic, uservm, routers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey)
|
||||
public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey)
|
||||
throws ResourceUnavailableException {
|
||||
if (!canHandle(network, null)) {
|
||||
return false;
|
||||
@ -715,13 +715,13 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
return _routerMgr.saveSSHPublicKeyToRouter(network, nic, uservm, routers, SSHPublicKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
|
||||
public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm)
|
||||
throws ResourceUnavailableException {
|
||||
if (!canHandle(network, null)) {
|
||||
return false;
|
||||
@ -733,7 +733,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
return _routerMgr.saveUserDataToRouter(network, nic, uservm, routers);
|
||||
}
|
||||
@ -848,21 +848,21 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@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 {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
if (canHandle(network, Service.Dhcp)) {
|
||||
if (vm.getType() != VirtualMachine.Type.User) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
List<DomainRouterVO> routers = getRouters(network, dest);
|
||||
|
||||
@ -893,7 +893,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@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 {
|
||||
if (canHandle(network, Service.Dhcp)) {
|
||||
@ -902,7 +902,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
List<DomainRouterVO> routers = getRouters(network, dest);
|
||||
|
||||
@ -916,7 +916,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
|
||||
if (canHandle(network, Service.UserData)) {
|
||||
@ -930,7 +930,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
|
||||
VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
|
||||
|
||||
List<DomainRouterVO> routers = getRouters(network, dest);
|
||||
|
||||
@ -1049,7 +1049,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
|
||||
@Override
|
||||
public boolean prepareMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context) {
|
||||
if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
|
||||
return true;
|
||||
@ -1068,7 +1068,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
|
||||
@Override
|
||||
public void rollbackMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
|
||||
return;
|
||||
@ -1086,7 +1086,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
|
||||
@Override
|
||||
public void commitMigration(NicProfile nic, Network network,
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
VirtualMachineProfile vm,
|
||||
ReservationContext src, ReservationContext dst) {
|
||||
if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
|
||||
return;
|
||||
|
||||
@ -185,7 +185,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
||||
}
|
||||
|
||||
@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, InsufficientCapacityException, ResourceUnavailableException {
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
|
||||
if(vm.getHypervisorType() == HypervisorType.VMware && vm.getType() != VirtualMachine.Type.DomainRouter) {
|
||||
@ -124,11 +124,11 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
assert nic.getTrafficType() == TrafficType.Control;
|
||||
|
||||
@ -163,7 +163,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
assert nic.getTrafficType() == TrafficType.Control;
|
||||
|
||||
if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) {
|
||||
|
||||
@ -188,7 +188,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
@ -208,7 +208,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@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 (nic.getIp4Address() == null && nic.getIp6Address() == null) {
|
||||
allocateDirectIp(nic, network, vm, dest.getDataCenter(), null, null);
|
||||
@ -217,7 +217,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@DB
|
||||
protected void allocateDirectIp(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DataCenter dc, String requestedIp4Addr, String requestedIp6Addr)
|
||||
protected void allocateDirectIp(NicProfile nic, Network network, VirtualMachineProfile vm, DataCenter dc, String requestedIp4Addr, String requestedIp6Addr)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
|
||||
@ -236,7 +236,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
|
||||
DataCenterVO dc = _dcDao.findById(network.getDataCenterId());
|
||||
@ -119,7 +119,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
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 {
|
||||
|
||||
String oldIp = nic.getIp4Address();
|
||||
@ -159,7 +159,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
|
||||
}
|
||||
|
||||
@DB
|
||||
protected void getIp(NicProfile nic, Pod pod, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException,
|
||||
protected void getIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
DataCenter dc = _dcDao.findById(pod.getDataCenterId());
|
||||
if (nic.getIp4Address() == null) {
|
||||
|
||||
@ -198,7 +198,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
|
||||
if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIpv4() != null) {
|
||||
@ -224,7 +224,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
|
||||
super.deallocate(config, nic, vm);
|
||||
|
||||
if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
|
||||
@ -241,7 +241,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
|
||||
assert (nic.getReservationStrategy() == ReservationStrategy.Start) : "What can I do for nics that are not allocated at start? ";
|
||||
boolean _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
|
||||
@ -278,7 +278,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
|
||||
if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
|
||||
return true;
|
||||
|
||||
@ -216,7 +216,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
if (network.getSpecifyIpRanges()) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
|
||||
@ -316,7 +316,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
|
||||
throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
|
||||
@ -393,7 +393,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
|
||||
assert (nic.getReservationStrategy() == ReservationStrategy.Start) : "What can I do for nics that are not allocated at start? ";
|
||||
@ -403,7 +403,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
nic.setBroadcastUri(null);
|
||||
nic.setIsolationUri(null);
|
||||
return true;
|
||||
|
||||
@ -90,11 +90,11 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
TrafficType trafficType = config.getTrafficType();
|
||||
assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage: "Well, I can't take care of this config now can I? " + config;
|
||||
@ -112,7 +112,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
|
||||
public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException {
|
||||
Pod pod = dest.getPod();
|
||||
|
||||
@ -144,7 +144,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
_dcDao.releasePrivateIpAddress(nic.getId(), nic.getReservationId());
|
||||
|
||||
nic.deallocate();
|
||||
|
||||
@ -132,7 +132,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
|
||||
DataCenter dc = _configMgr.getZone(network.getDataCenterId());
|
||||
NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
|
||||
@ -212,7 +212,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm,
|
||||
DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
|
||||
if (nic.getIp4Address() == null) {
|
||||
@ -222,7 +222,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
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(), VlanType.VirtualNetwork, null, null, false);
|
||||
@ -136,7 +136,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
@ -164,7 +164,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@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 (nic.getIp4Address() == null) {
|
||||
getIp(nic, dest.getDataCenter(), vm, network);
|
||||
@ -172,7 +172,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
|
||||
assert network.getTrafficType() == TrafficType.Storage : "Well, I can't take care of this config now can I? " + network;
|
||||
if (!_sNwMgr.isStorageIpRangeAvailable(network.getDataCenterId())) {
|
||||
@ -114,7 +114,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@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 {
|
||||
if (!_sNwMgr.isStorageIpRangeAvailable(dest.getDataCenter().getId())) {
|
||||
super.reserve(nic, network, vm, dest, context);
|
||||
@ -146,7 +146,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
Network nw = _nwDao.findById(nic.getNetworkId());
|
||||
if (!_sNwMgr.isStorageIpRangeAvailable(nw.getDataCenterId())) {
|
||||
return super.release(nic, vm, reservationId);
|
||||
@ -159,7 +159,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@ -61,13 +61,13 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
||||
* @param routers TODO
|
||||
*
|
||||
*/
|
||||
boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
|
||||
boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
|
||||
List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
|
||||
boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
|
||||
List<? extends VirtualRouter> routers, String SSHPublicKey) throws ResourceUnavailableException;
|
||||
|
||||
boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
|
||||
boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
|
||||
List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
List<DomainRouterVO> deployVirtualRouterInGuestNetwork(Network guestNetwork, DeployDestination dest, Account owner,
|
||||
@ -99,16 +99,16 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
||||
boolean applyStaticNats(Network network, final List<? extends StaticNat> rules, List<? extends VirtualRouter> routers)
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest,
|
||||
boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
|
||||
List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest,
|
||||
boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
|
||||
List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyLoadBalancingRules(Network network, List<? extends LoadBalancingRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
|
||||
boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile<UserVm> uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException ;
|
||||
boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException ;
|
||||
|
||||
boolean removeDhcpSupportForSubnet(Network network, List<DomainRouterVO> routers) throws ResourceUnavailableException;
|
||||
|
||||
|
||||
@ -485,10 +485,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean savePasswordToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
public boolean savePasswordToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
final VirtualMachineProfile updatedProfile = profile;
|
||||
|
||||
return applyRules(network, routers, "save password entry", false, null, false, new RuleApplier() {
|
||||
@Override
|
||||
@ -503,10 +503,11 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveSSHPublicKeyToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers, final String SSHPublicKey) throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
public boolean saveSSHPublicKeyToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers, final String SSHPublicKey) throws ResourceUnavailableException {
|
||||
final UserVmVO vm = _userVmDao.findById(profile.getVirtualMachine().getId());
|
||||
_userVmDao.loadDetails(vm);
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
final VirtualMachineProfile updatedProfile = profile;
|
||||
|
||||
return applyRules(network, routers, "save SSHkey entry", false, null, false, new RuleApplier() {
|
||||
@Override
|
||||
@ -518,17 +519,16 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
if(template != null && template.getEnablePassword()) {
|
||||
createPasswordCommand(router, updatedProfile, nicVo, cmds);
|
||||
}
|
||||
createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, SSHPublicKey, cmds);
|
||||
createVmDataCommand(router, vm, nicVo, SSHPublicKey, cmds);
|
||||
return sendCommandsToRouter(router, cmds);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveUserDataToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
public boolean saveUserDataToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
|
||||
final UserVmVO vm = _userVmDao.findById(profile.getVirtualMachine().getId());
|
||||
_userVmDao.loadDetails(vm);
|
||||
|
||||
return applyRules(network, routers, "save userdata entry", false, null, false, new RuleApplier() {
|
||||
@Override
|
||||
@ -536,7 +536,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
// for basic zone, send vm data/password information only to the router in the same pod
|
||||
Commands cmds = new Commands(OnError.Stop);
|
||||
NicVO nicVo = _nicDao.findById(nic.getId());
|
||||
createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, null, cmds);
|
||||
createVmDataCommand(router, vm, nicVo, null, cmds);
|
||||
return sendCommandsToRouter(router, cmds);
|
||||
}
|
||||
});
|
||||
@ -1979,7 +1979,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest,
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest,
|
||||
ReservationContext context) {
|
||||
|
||||
boolean dnsProvided = true;
|
||||
@ -1989,7 +1989,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
_dcDao.loadDetails(dc);
|
||||
|
||||
//1) Set router details
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId());
|
||||
Map<String, String> details = _vmDetailsDao.findDetails(router.getId());
|
||||
router.setDetails(details);
|
||||
|
||||
@ -2262,9 +2262,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile,
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile,
|
||||
DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
|
||||
List<NicProfile> nics = profile.getNics();
|
||||
for (NicProfile nic : nics) {
|
||||
@ -2284,8 +2284,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
NicProfile controlNic = getControlNic(profile);
|
||||
|
||||
if (controlNic == null) {
|
||||
@ -2324,8 +2324,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
return true;
|
||||
}
|
||||
|
||||
protected NicProfile getControlNic(VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
protected NicProfile getControlNic(VirtualMachineProfile profile) {
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
|
||||
NicProfile controlNic = null;
|
||||
if (profile.getHypervisorType() == HypervisorType.VMware && dcVo.getNetworkType() == NetworkType.Basic) {
|
||||
@ -2346,7 +2346,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
return controlNic;
|
||||
}
|
||||
|
||||
protected void finalizeSshAndVersionAndNetworkUsageOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DomainRouterVO router, NicProfile controlNic) {
|
||||
protected void finalizeSshAndVersionAndNetworkUsageOnStart(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, NicProfile controlNic) {
|
||||
DomainRouterVO vr = _routerDao.findById(profile.getId());
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
|
||||
|
||||
// Update router template/scripts version
|
||||
@ -2356,7 +2357,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
cmds.addCommand("getDomRVersion", command);
|
||||
|
||||
// Network usage command to create iptables rules
|
||||
boolean forVpc = profile.getVirtualMachine().getVpcId() != null;
|
||||
boolean forVpc = vr.getVpcId() != null;
|
||||
if (!forVpc)
|
||||
cmds.addCommand("networkUsage", new NetworkUsageCommand(controlNic.getIp4Address(), router.getHostName(), "create", forVpc));
|
||||
}
|
||||
@ -2561,9 +2562,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds,
|
||||
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds,
|
||||
ReservationContext context) {
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
|
||||
boolean result = true;
|
||||
|
||||
@ -2620,9 +2621,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
||||
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
|
||||
if (answer != null) {
|
||||
VMInstanceVO vm = profile.getVirtualMachine();
|
||||
VirtualMachine vm = profile.getVirtualMachine();
|
||||
DomainRouterVO domR = _routerDao.findById(vm.getId());
|
||||
processStopOrRebootAnswer(domR, answer);
|
||||
List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
|
||||
@ -2765,10 +2766,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configDhcpForSubnet(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
public boolean configDhcpForSubnet(Network network, final NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
|
||||
UserVmVO vm = _userVmDao.findById(profile.getId());
|
||||
_userVmDao.loadDetails(vm);
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
|
||||
final Long podId = isZoneBasic ? dest.getPod().getId() : null;
|
||||
|
||||
@ -2780,7 +2781,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
router.getState(), DataCenter.class, network.getDataCenterId());
|
||||
}
|
||||
//check if this is not the primary subnet.
|
||||
UserVm vm = updatedProfile.getVirtualMachine();
|
||||
NicVO domr_guest_nic = _nicDao.findByInstanceIdAndIpAddressAndVmtype(router.getId(), _nicDao.getIpAddress(nic.getNetworkId(), router.getId()), VirtualMachine.Type.DomainRouter);
|
||||
//check if the router ip address and the vm ip address belong to same subnet.
|
||||
//if they do not belong to same netwoek check for the alias ips. if not create one.
|
||||
@ -2895,12 +2895,16 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applyDhcpEntry(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile,
|
||||
public boolean applyDhcpEntry(Network network, final NicProfile nic, VirtualMachineProfile profile,
|
||||
DeployDestination dest, List<DomainRouterVO> routers)
|
||||
throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
if(s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("applyDhcpEntry(" + network.getCidr() + ", " + nic.getMacAddress() + ", " + profile.getUuid() + ", " + dest.getHost() + ", " + routers + ")");
|
||||
}
|
||||
final UserVmVO vm = _userVmDao.findById(profile.getId());
|
||||
_userVmDao.loadDetails(vm);
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
final VirtualMachineProfile updatedProfile = profile;
|
||||
final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
|
||||
final Long podId = isZoneBasic ? dest.getPod().getId() : null;
|
||||
|
||||
@ -2918,7 +2922,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
Commands cmds = new Commands(OnError.Stop);
|
||||
if (!(isZoneBasic && router.getPodIdToDeployIn().longValue() != podId.longValue() && _dnsBasicZoneUpdates.equalsIgnoreCase("pod"))) {
|
||||
NicVO nicVo = _nicDao.findById(nic.getId());
|
||||
createDhcpEntryCommand(router, updatedProfile.getVirtualMachine(), nicVo, cmds);
|
||||
createDhcpEntryCommand(router, vm, nicVo, cmds);
|
||||
return sendCommandsToRouter(router, cmds);
|
||||
}
|
||||
return true;
|
||||
@ -2970,11 +2974,12 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, DeployDestination dest, List<DomainRouterVO> routers)
|
||||
public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, List<DomainRouterVO> routers)
|
||||
throws ResourceUnavailableException {
|
||||
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
|
||||
final UserVmVO vm = _userVmDao.findById(profile.getId());
|
||||
_userVmDao.loadDetails(vm);
|
||||
|
||||
final VirtualMachineProfile<UserVm> updatedProfile = profile;
|
||||
final VirtualMachineProfile updatedProfile = profile;
|
||||
final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
|
||||
final Long podId = isZoneBasic ? dest.getPod().getId() : null;
|
||||
|
||||
@ -2993,7 +2998,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
if (!(isZoneBasic && router.getPodIdToDeployIn().longValue() != podId.longValue())) {
|
||||
NicVO nicVo = _nicDao.findById(nic.getId());
|
||||
createPasswordCommand(router, updatedProfile, nicVo, cmds);
|
||||
createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, updatedProfile.getVirtualMachine().getDetail("SSH.PublicKey"), cmds);
|
||||
createVmDataCommand(router, vm, nicVo, vm.getDetail("SSH.PublicKey"), cmds);
|
||||
return sendCommandsToRouter(router, cmds);
|
||||
}
|
||||
return true;
|
||||
@ -3352,7 +3357,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
cmds.addCommand("startVpn", startVpnCmd);
|
||||
}
|
||||
|
||||
private void createPasswordCommand(VirtualRouter router, VirtualMachineProfile<UserVm> profile, NicVO nic, Commands cmds) {
|
||||
private void createPasswordCommand(VirtualRouter router, VirtualMachineProfile profile, NicVO nic, Commands cmds) {
|
||||
String password = (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword);
|
||||
DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
|
||||
|
||||
@ -3960,11 +3965,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
|
||||
|
||||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile){
|
||||
public void prepareStop(VirtualMachineProfile profile){
|
||||
//Collect network usage before stopping Vm
|
||||
VMInstanceVO vm = profile.getVirtualMachine();
|
||||
|
||||
DomainRouterVO router = _routerDao.findById(vm.getId());
|
||||
DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId());
|
||||
if(router == null){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ import java.util.TreeSet;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.configuration.ZoneConfig;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -38,14 +37,12 @@ import com.cloud.agent.api.PlugNicCommand;
|
||||
import com.cloud.agent.api.SetupGuestNetworkAnswer;
|
||||
import com.cloud.agent.api.SetupGuestNetworkCommand;
|
||||
import com.cloud.agent.api.StopAnswer;
|
||||
import com.cloud.agent.api.routing.DnsMasqConfigCommand;
|
||||
import com.cloud.agent.api.routing.IpAssocVpcCommand;
|
||||
import com.cloud.agent.api.routing.NetworkElementCommand;
|
||||
import com.cloud.agent.api.routing.SetNetworkACLCommand;
|
||||
import com.cloud.agent.api.routing.SetSourceNatCommand;
|
||||
import com.cloud.agent.api.routing.SetStaticRouteCommand;
|
||||
import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand;
|
||||
import com.cloud.agent.api.to.DhcpTO;
|
||||
import com.cloud.agent.api.to.IpAddressTO;
|
||||
import com.cloud.agent.api.to.NetworkACLTO;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
@ -599,10 +596,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
|
||||
|
||||
@Override
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest,
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest,
|
||||
ReservationContext context) {
|
||||
DomainRouterVO vr = _routerDao.findById(profile.getId());
|
||||
|
||||
if (profile.getVirtualMachine().getVpcId() != null) {
|
||||
if (vr.getVpcId() != null) {
|
||||
String defaultDns1 = null;
|
||||
String defaultDns2 = null;
|
||||
//remove public and guest nics as we will plug them later
|
||||
@ -623,7 +621,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
|
||||
//add vpc cidr/dns/networkdomain to the boot load args
|
||||
StringBuilder buf = profile.getBootArgsBuilder();
|
||||
Vpc vpc = _vpcMgr.getVpc(profile.getVirtualMachine().getVpcId());
|
||||
Vpc vpc = _vpcMgr.getVpc(vr.getVpcId());
|
||||
buf.append(" vpccidr=" + vpc.getCidr() + " domain=" + vpc.getNetworkDomain());
|
||||
|
||||
buf.append(" dns1=").append(defaultDns1);
|
||||
@ -695,8 +693,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
|
||||
boolean isVpc = (router.getVpcId() != null);
|
||||
if (!isVpc) {
|
||||
@ -1319,10 +1317,10 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
||||
public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
|
||||
super.finalizeStop(profile, answer);
|
||||
//Mark VPN connections as Disconnected
|
||||
DomainRouterVO router = profile.getVirtualMachine();
|
||||
DomainRouterVO router = _routerDao.findById(profile.getId());
|
||||
Long vpcId = router.getVpcId();
|
||||
if (vpcId != null) {
|
||||
_s2sVpnMgr.markDisconnectVpnConnByVpc(vpcId);
|
||||
|
||||
@ -1060,7 +1060,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
}
|
||||
|
||||
// Check if the vm is using any disks on local storage.
|
||||
VirtualMachineProfile<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
|
||||
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vm);
|
||||
List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());
|
||||
boolean usesLocal = false;
|
||||
for (VolumeVO volume : volumes) {
|
||||
@ -1156,7 +1156,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
suitableHosts, requiresStorageMotion);
|
||||
}
|
||||
|
||||
private Map<Volume, List<StoragePool>> findSuitablePoolsForVolumes(VirtualMachineProfile<VMInstanceVO> vmProfile,
|
||||
private Map<Volume, List<StoragePool>> findSuitablePoolsForVolumes(VirtualMachineProfile vmProfile,
|
||||
Host host) {
|
||||
List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());
|
||||
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<Volume, List<StoragePool>>();
|
||||
@ -1284,7 +1284,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
// Volume stays in the same cluster after migration.
|
||||
DataCenterDeployment plan = new DataCenterDeployment(volume.getDataCenterId(), srcVolumePool.getPodId(),
|
||||
srcVolumePool.getClusterId(), null, null, null);
|
||||
VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
|
||||
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
|
||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
|
||||
DiskProfile diskProfile = new DiskProfile(volume, diskOffering, profile.getHypervisorType());
|
||||
|
||||
@ -403,7 +403,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
||||
public StoragePool findStoragePool(DiskProfile dskCh, final DataCenterVO dc, Pod pod, Long clusterId, Long hostId, VMInstanceVO vm,
|
||||
final Set<StoragePool> avoid) {
|
||||
|
||||
VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
|
||||
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
for (StoragePoolAllocator allocator : _storagePoolAllocators) {
|
||||
|
||||
ExcludeList avoidList = new ExcludeList();
|
||||
|
||||
@ -41,7 +41,6 @@ import com.cloud.storage.Volume.Type;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface VolumeManager extends VolumeApiService {
|
||||
@ -85,7 +84,7 @@ public interface VolumeManager extends VolumeApiService {
|
||||
@Override
|
||||
Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
|
||||
|
||||
void release(VirtualMachineProfile<? extends VMInstanceVO> profile);
|
||||
void release(VirtualMachineProfile profile);
|
||||
|
||||
void cleanupVolumes(long vmId) throws ConcurrentOperationException;
|
||||
|
||||
@ -95,15 +94,11 @@ public interface VolumeManager extends VolumeApiService {
|
||||
<T extends VMInstanceVO> void migrateVolumes(T vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
Map<VolumeVO, StoragePoolVO> volumeToPool);
|
||||
|
||||
boolean storageMigration(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
StoragePool destPool);
|
||||
boolean storageMigration(VirtualMachineProfile vm, StoragePool destPool);
|
||||
|
||||
void prepareForMigration(
|
||||
VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
DeployDestination dest);
|
||||
void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest);
|
||||
|
||||
void prepare(VirtualMachineProfile<? extends VirtualMachine> vm,
|
||||
void prepare(VirtualMachineProfile vm,
|
||||
DeployDestination dest) throws StorageUnavailableException,
|
||||
InsufficientStorageCapacityException, ConcurrentOperationException;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user