mirror of https://github.com/apache/cloudstack.git
=More changes and marvin test
This commit is contained in:
parent
d1642a489c
commit
242f5f9cf7
|
|
@ -19,9 +19,7 @@ package com.cloud.network;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
|
|
@ -165,4 +163,11 @@ public interface NetworkService {
|
|||
|
||||
/* lists the nic informaton */
|
||||
List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
|
||||
|
||||
void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd);
|
||||
|
||||
void addNicDetail(AddNicDetailCmd cmd);
|
||||
|
||||
void updateNicDetail(UpdateNicDetailCmd cmd);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@
|
|||
<bean id="networkRuleConfigDaoImpl" class="com.cloud.network.dao.NetworkRuleConfigDaoImpl" />
|
||||
<bean id="networkServiceMapDaoImpl" class="com.cloud.network.dao.NetworkServiceMapDaoImpl" />
|
||||
<bean id="nicDaoImpl" class="com.cloud.vm.dao.NicDaoImpl" />
|
||||
<bean id="nicDetailDaoImpl" class="com.cloud.vm.dao.NicDetailDaoImpl" />
|
||||
<bean id="nicSecondaryIpDaoImpl" class="com.cloud.vm.dao.NicSecondaryIpDaoImpl" />
|
||||
<bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
|
||||
<bean id="ovsTunnelInterfaceDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" />
|
||||
|
|
@ -355,6 +356,7 @@
|
|||
<bean id="vmRulesetLogDaoImpl" class="com.cloud.network.security.dao.VmRulesetLogDaoImpl" />
|
||||
<bean id="volumeDao2Impl" class="org.apache.cloudstack.storage.volume.db.VolumeDao2Impl" />
|
||||
<bean id="volumeDaoImpl" class="com.cloud.storage.dao.VolumeDaoImpl" />
|
||||
<bean id="volumeDetailsDaoImpl" class="com.cloud.storage.dao.VolumeDetailsDaoImpl" />
|
||||
<bean id="volumeHostDaoImpl" class="com.cloud.storage.dao.VolumeHostDaoImpl" />
|
||||
<bean id="volumeJoinDaoImpl" class="com.cloud.api.query.dao.VolumeJoinDaoImpl" />
|
||||
<bean id="volumeReservationDaoImpl" class="org.apache.cloudstack.engine.cloud.entity.api.db.dao.VolumeReservationDaoImpl" />
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.*;
|
|||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
|
|
@ -1510,7 +1511,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
List<VolumeDetailResponse> volumeDetailResponseList = new ArrayList<VolumeDetailResponse>();
|
||||
for (VolumeDetailVO volumeDetail : volumeDetailList ){
|
||||
VolumeDetailResponse volumeDetailResponse = new VolumeDetailResponse();
|
||||
volumeDetailResponse.setId(id.toString());
|
||||
String uuid = ApiDBUtils.findVolumeById(id).getUuid();
|
||||
volumeDetailResponse.setId(uuid);
|
||||
volumeDetailResponse.setName(volumeDetail.getName());
|
||||
volumeDetailResponse.setValue(volumeDetail.getValue());
|
||||
volumeDetailResponse.setObjectName("volumedetail");
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public interface NetworkManager {
|
|||
throws ConcurrentOperationException;
|
||||
|
||||
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) throws ConcurrentOperationException;
|
||||
ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException;
|
||||
|
||||
void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
|
|
@ -127,8 +127,8 @@ public interface NetworkManager {
|
|||
boolean destroyNetwork(long networkId, ReservationContext context);
|
||||
|
||||
Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr,
|
||||
String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork physicalNetwork,
|
||||
long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr)
|
||||
String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork physicalNetwork,
|
||||
long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr, Boolean displayNetworkEnabled)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1091,14 +1091,14 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
public List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name,
|
||||
String displayText, boolean isDefault)
|
||||
throws ConcurrentOperationException {
|
||||
return setupNetwork(owner, offering, null, plan, name, displayText, false, null, null, null, null);
|
||||
return setupNetwork(owner, offering, null, plan, name, displayText, false, null, null, null, null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public 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) throws ConcurrentOperationException {
|
||||
ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException {
|
||||
|
||||
Account locked = _accountDao.acquireInLockTable(owner.getId());
|
||||
if (locked == null) {
|
||||
|
|
@ -1173,6 +1173,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(),
|
||||
related, name, displayText, predefined.getNetworkDomain(), offering.getGuestType(),
|
||||
plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.getSpecifyIpRanges(), vpcId);
|
||||
vo.setDisplayNetwork(isDisplayNetworkEnabled);
|
||||
networks.add(_networksDao.persist(vo, vo.getGuestType() == Network.GuestType.Isolated,
|
||||
finalizeServicesAndProvidersForNetwork(offering, plan.getPhysicalNetworkId())));
|
||||
|
||||
|
|
@ -1862,9 +1863,9 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
|
||||
@Override
|
||||
@DB
|
||||
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway,
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr)
|
||||
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway,
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr, Boolean isDisplayNetworkEnabled)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
|
||||
NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId);
|
||||
|
|
@ -2094,7 +2095,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
}
|
||||
|
||||
List<NetworkVO> networks = setupNetwork(owner, ntwkOff, userNetwork, plan, name, displayText, true, domainId,
|
||||
aclType, subdomainAccess, vpcId);
|
||||
aclType, subdomainAccess, vpcId, isDisplayNetworkEnabled);
|
||||
|
||||
Network network = null;
|
||||
if (networks == null || networks.isEmpty()) {
|
||||
|
|
@ -2687,7 +2688,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
guestNetwork = createGuestNetwork(requiredOfferings.get(0).getId(), owner.getAccountName() + "-network"
|
||||
, owner.getAccountName() + "-network", null, null, null, null, owner, null, physicalNetwork,
|
||||
zoneId, ACLType.Account,
|
||||
null, null, null, null);
|
||||
null, null, null, null, true);
|
||||
if (guestNetwork == null) {
|
||||
s_logger.warn("Failed to create default Virtual network for the account " + accountId + "in zone " + zoneId);
|
||||
throw new CloudRuntimeException("Failed to create a Guest Isolated Networks with SourceNAT " +
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
|||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -203,6 +201,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
HostPodDao _hostPodDao;
|
||||
@Inject
|
||||
DataCenterVnetDao _datacneter_vnet;
|
||||
@Inject
|
||||
NicDetailDao _nicDetailDao = null;
|
||||
|
||||
int _cidrLimit;
|
||||
boolean _allowSubdomainNetworkAccess;
|
||||
|
|
@ -817,6 +817,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
String endIPv6 = cmd.getEndIpv6();
|
||||
String ip6Gateway = cmd.getIp6Gateway();
|
||||
String ip6Cidr = cmd.getIp6Cidr();
|
||||
Boolean isDisplayNetworkEnabled = cmd.getDisplayNetwork();
|
||||
|
||||
// Validate network offering
|
||||
NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId);
|
||||
|
|
@ -1098,13 +1099,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
|
||||
}
|
||||
network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
|
||||
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller);
|
||||
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller, isDisplayNetworkEnabled);
|
||||
} else {
|
||||
if (_configMgr.isOfferingForVpc(ntwkOff)){
|
||||
throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
|
||||
}
|
||||
network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
|
||||
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr);
|
||||
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, isDisplayNetworkEnabled);
|
||||
}
|
||||
|
||||
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && createVlan) {
|
||||
|
|
@ -3347,7 +3348,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
if (privateNetwork == null) {
|
||||
//create Guest network
|
||||
privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan,
|
||||
null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null);
|
||||
null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null, true);
|
||||
s_logger.debug("Created private network " + privateNetwork);
|
||||
} else {
|
||||
s_logger.debug("Private network already exists: " + privateNetwork);
|
||||
|
|
@ -3407,4 +3408,57 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
_accountMgr.checkAccess(caller, null, true, userVm);
|
||||
return _networkMgr.listVmNics(vmId, nicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNicDetail(AddNicDetailCmd cmd){
|
||||
UserContext.current().setEventDetails("Nic Id: " + cmd.getId());
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long nicId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
|
||||
NicVO nic = _nicDao.findById(nicId);
|
||||
|
||||
//_accountMgr.checkAccess(caller, null, true, nic);
|
||||
NicDetailVO nicDetail = new NicDetailVO(nicId, name, value);
|
||||
_nicDetailDao.persist(nicDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNicDetail(UpdateNicDetailCmd cmd){
|
||||
UserContext.current().setEventDetails("Nic Id: " + cmd.getId());
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long nicId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
|
||||
NicVO nic = _nicDao.findById(nicId);
|
||||
// _accountMgr.checkAccess(caller, null, true, nic);
|
||||
NicDetailVO nicDetail = _nicDetailDao.findDetail(nicId, name);
|
||||
if(nicDetail != null){
|
||||
nicDetail.setValue(value);
|
||||
_nicDetailDao.update(nicDetail.getId(), nicDetail);
|
||||
}else{
|
||||
throw new InvalidParameterValueException("This detail doesnt exist for the nic");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNicDetail(RemoveNicDetailCmd cmd){
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Long nicId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
|
||||
NicVO nic = _nicDao.findById(nicId);
|
||||
//_accountMgr.checkAccess(caller, null, true, nic);
|
||||
NicDetailVO nicDetail = _nicDetailDao.findDetail(nicId, name);
|
||||
if(nicDetail != null){
|
||||
_nicDetailDao.remove(nicDetail.getId());
|
||||
}else{
|
||||
throw new InvalidParameterValueException("This detail doesnt exist for the nic ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public interface VpcManager extends VpcService{
|
|||
/**
|
||||
* Creates guest network in the VPC
|
||||
*
|
||||
*
|
||||
* @param ntwkOffId
|
||||
* @param name
|
||||
* @param displayText
|
||||
|
|
@ -97,14 +98,15 @@ public interface VpcManager extends VpcService{
|
|||
* @param subdomainAccess
|
||||
* @param vpcId
|
||||
* @param caller
|
||||
* @param displayNetworkEnabled
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws InsufficientCapacityException
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway, String cidr,
|
||||
String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork pNtwk, long zoneId,
|
||||
ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller)
|
||||
Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway, String cidr,
|
||||
String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork pNtwk, long zoneId,
|
||||
ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller, Boolean displayNetworkEnabled)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1938,9 +1938,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
|
||||
@DB
|
||||
@Override
|
||||
public Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway,
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller)
|
||||
public Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway,
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller, Boolean isDisplayNetworkEnabled)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
|
||||
Vpc vpc = getActiveVpc(vpcId);
|
||||
|
|
@ -1965,7 +1965,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
|
||||
//2) Create network
|
||||
Network guestNetwork = _ntwkMgr.createGuestNetwork(ntwkOffId, name, displayText, gateway, cidr, vlanId,
|
||||
networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, null, null);
|
||||
networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, null, null, isDisplayNetworkEnabled);
|
||||
|
||||
return guestNetwork;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
package com.cloud.vm;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: nitinmehta
|
||||
* Date: 15/04/13
|
||||
* Time: 5:03 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class NicDetailsVO {
|
||||
}
|
||||
|
|
@ -16,6 +16,8 @@
|
|||
// under the License.
|
||||
package com.cloud.vm.dao;
|
||||
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
|
@ -29,7 +31,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Local(value = { NicDetailDao.class })
|
||||
@Local (value={NicDetailDao.class})
|
||||
public class NicDetailDaoImpl extends GenericDaoBase<NicDetailVO, Long> implements NicDetailDao {
|
||||
protected final SearchBuilder<NicDetailVO> NicSearch;
|
||||
protected final SearchBuilder<NicDetailVO> DetailSearch;
|
||||
|
|
|
|||
|
|
@ -45,19 +45,16 @@ import com.cloud.utils.Pair;
|
|||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
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;
|
||||
import com.cloud.vm.VirtualMachineProfileImpl;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -178,7 +175,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
|
||||
@Override
|
||||
public 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) throws ConcurrentOperationException {
|
||||
ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -249,7 +246,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
|
||||
@Override
|
||||
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6, Boolean displayNetworkEnabled) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -862,6 +859,21 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNicDetail(AddNicDetailCmd addNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNicDetail(UpdateNicDetailCmd updateNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String allocatePublicIpForGuestNic(Long networkId, DataCenter dc,
|
||||
Pod pod, Account caller, String requestedIp)
|
||||
|
|
|
|||
|
|
@ -49,19 +49,15 @@ import com.cloud.utils.Pair;
|
|||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
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;
|
||||
import com.cloud.vm.VirtualMachineProfileImpl;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.*;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -666,7 +662,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
@Override
|
||||
public 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) throws ConcurrentOperationException {
|
||||
ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isNetworkDisplayEnabled) throws ConcurrentOperationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
@ -830,8 +826,8 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
*/
|
||||
@Override
|
||||
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway,
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6)
|
||||
String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
|
||||
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6, Boolean displayNetworkEnabled)
|
||||
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
@ -1370,8 +1366,20 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNicDetail(AddNicDetailCmd addNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNicDetail(UpdateNicDetailCmd updateNicDetailCmd) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
|
|||
*/
|
||||
@Override
|
||||
public Network createVpcGuestNetwork(long ntwkOffId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork pNtwk,
|
||||
long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Account caller, Boolean displayNetworkEnabled) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1387,6 +1387,7 @@ CREATE VIEW `cloud`.`volume_view` AS
|
|||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.networktype data_center_type,
|
||||
vm_instance.id vm_id,
|
||||
vm_instance.uuid vm_uuid,
|
||||
vm_instance.name vm_name,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,239 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
""" P1 tests for Scaling up Vm
|
||||
"""
|
||||
#Import Local Modules
|
||||
import marvin
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
from marvin.integration.lib.utils import *
|
||||
from marvin.integration.lib.base import *
|
||||
from marvin.integration.lib.common import *
|
||||
from nose.plugins.attrib import attr
|
||||
#Import System modules
|
||||
import time
|
||||
|
||||
_multiprocess_shared_ = True
|
||||
class Services:
|
||||
"""Test VM Life Cycle Services
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.services = {
|
||||
|
||||
"account": {
|
||||
"email": "test@test.com",
|
||||
"firstname": "Test",
|
||||
"lastname": "User",
|
||||
"username": "test",
|
||||
# Random characters are appended in create account to
|
||||
# ensure unique username generated each time
|
||||
"password": "password",
|
||||
},
|
||||
"small":
|
||||
# Create a small virtual machine instance with disk offering
|
||||
{
|
||||
"displayname": "testserver",
|
||||
"username": "root", # VM creds for SSH
|
||||
"password": "password",
|
||||
"ssh_port": 22,
|
||||
"hypervisor": 'XenServer',
|
||||
"privateport": 22,
|
||||
"publicport": 22,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
"name": "Small",
|
||||
"storagetype": "shared",
|
||||
"disksize": 1
|
||||
},
|
||||
"service_offerings":
|
||||
{
|
||||
"small":
|
||||
{
|
||||
# Small service offering ID to for change VM
|
||||
# service offering from medium to small
|
||||
"name": "SmallInstance",
|
||||
"displaytext": "SmallInstance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100,
|
||||
"memory": 256,
|
||||
},
|
||||
"big":
|
||||
{
|
||||
# Big service offering ID to for change VM
|
||||
"name": "BigInstance",
|
||||
"displaytext": "BigInstance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100,
|
||||
"memory": 512,
|
||||
}
|
||||
},
|
||||
#Change this
|
||||
"template": {
|
||||
"displaytext": "xs",
|
||||
"name": "xs",
|
||||
"passwordenabled": False,
|
||||
},
|
||||
"diskdevice": '/dev/xvdd',
|
||||
# Disk device where ISO is attached to instance
|
||||
"mount_dir": "/mnt/tmp",
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
#Migrate VM to hostid
|
||||
"ostype": 'CentOS 5.6 (64-bit)',
|
||||
# CentOS 5.3 (64-bit)
|
||||
}
|
||||
|
||||
class TestVolumeDetail(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(TestVolumeDetail, cls).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
|
||||
# Get Zone, Domain and templates
|
||||
domain = get_domain(cls.api_client, cls.services)
|
||||
zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Set Zones and disk offerings ??
|
||||
|
||||
# Create account, service offerings, vm.
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
domainid=domain.id
|
||||
)
|
||||
|
||||
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
)
|
||||
|
||||
#create a volume
|
||||
cls.volume = Volume.create(
|
||||
cls.api_client,
|
||||
{ "diskname" : "ndm"},
|
||||
zoneid=zone.id,
|
||||
account=cls.account.name,
|
||||
domainid=cls.account.domainid,
|
||||
diskofferingid=cls.disk_offering.id
|
||||
)
|
||||
#how does it work ??
|
||||
cls._cleanup = [
|
||||
cls.volume,
|
||||
cls.account
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.api_client = super(TestVolumeDetail, cls).getClsTestClient().getApiClient()
|
||||
cleanup_resources(cls.api_client, cls._cleanup)
|
||||
return
|
||||
|
||||
def setUp(self):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.cleanup = []
|
||||
|
||||
def tearDown(self):
|
||||
#Clean up, terminate the created ISOs
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
return
|
||||
|
||||
@attr(tags = ["advanced", "xenserver"])
|
||||
def test_01_updatevolumedetail(self):
|
||||
"""Test volume detail
|
||||
"""
|
||||
# Validate the following
|
||||
# Scale up the vm and see if it scales to the new svc offering and is finally in running state
|
||||
|
||||
self.debug("Testing ADD volume detail Volume-ID: %s " % (
|
||||
self.volume.id
|
||||
))
|
||||
|
||||
cmd = addVolumeDetail.addVolumeDetailCmd()
|
||||
cmd.name = self.volume.id
|
||||
cmd.value = self.volume.id
|
||||
cmd.id = self.volume.id
|
||||
self.apiclient.addVolumeDetail(cmd)
|
||||
|
||||
listVolumeDetailCmd = listVolumeDetails.listVolumeDetailsCmd()
|
||||
listVolumeDetailCmd.id = self.volume.id
|
||||
listVolumeDetailResponse = self.api_client.listVirtualMachines(listVolumeDetailCmd)
|
||||
|
||||
self.assertNotEqual(len(listVolumeDetailResponse), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
volumedetail = listVolumeDetailResponse[0]
|
||||
|
||||
#self.assertEqual(volumedetail.id, self.volume.id, "Check if the Volume returned is the same as the one we asked for")
|
||||
|
||||
|
||||
self.assertEqual(volumedetail.name, self.volume.id, "Check if Volume has right name")
|
||||
|
||||
self.assertEqual(volumedetail.value, self.volume.id, "Check if Volume has right value")
|
||||
|
||||
#updatevolumedetail
|
||||
self.debug("Testing UPDATE volume detail Volume-ID: %s " % (
|
||||
self.volume.id
|
||||
))
|
||||
cmd = updateVolumeDetail.updateVolumeDetailCmd()
|
||||
cmd.name = self.volume.id
|
||||
cmd.value = self.disk_offering.id
|
||||
cmd.id = self.volume.id
|
||||
self.apiclient.addVolumeDetail(cmd)
|
||||
|
||||
listVolumeDetailCmd = listVolumeDetails.listVolumeDetailsCmd()
|
||||
listVolumeDetailCmd.id = self.volume.id
|
||||
listVolumeDetailResponse = self.api_client.listVirtualMachines(listVolumeDetailCmd)
|
||||
|
||||
self.assertNotEqual(len(listVolumeDetailResponse), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
volumedetail = listVolumeDetailResponse[0]
|
||||
|
||||
#self.assertEqual(volumedetail.id, self.volume.id, "Check if the Volume returned is the same as the one we asked for")
|
||||
|
||||
|
||||
self.assertEqual(volumedetail.name, self.volume.id, "Check if Volume has right name")
|
||||
|
||||
self.assertEqual(volumedetail.value, self.disk_offering.id, "Check if Volume has right value")
|
||||
|
||||
|
||||
#remove detail
|
||||
self.debug("Testing REMOVE volume detail Volume-ID: %s " % (
|
||||
self.volume.id
|
||||
))
|
||||
cmd = removeVolumeDetail.removeVolumeDetailCmd()
|
||||
cmd.name = self.volume.id
|
||||
cmd.id = self.volume.id
|
||||
self.apiclient.removeVolumeDetail(cmd)
|
||||
|
||||
listVolumeDetailCmd = listVolumeDetails.listVolumeDetailsCmd()
|
||||
listVolumeDetailCmd.id = self.volume.id
|
||||
listVolumeDetailResponse = self.api_client.listVirtualMachines(listVolumeDetailCmd)
|
||||
|
||||
self.assertEqual(listVolumeDetailResponse, None, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
|
||||
return
|
||||
Loading…
Reference in New Issue