use of com.cloud.user.AccountVO in project cloudstack by apache.
the class VpcApiUnitTest method validateNtwkOffForVpcInvalidNoRVRSupport.
//5) Invalid offering - no redundant router support
@Test(expected = InvalidParameterValueException.class)
public void validateNtwkOffForVpcInvalidNoRVRSupport() {
boolean result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 5, "0.0.0.0", "111-", _vo, "10.1.1.1", new AccountVO(), null);
result = true;
} finally {
assertFalse("TEST FAILED, can't use network offering with guest type = Shared", result);
}
}
use of com.cloud.user.AccountVO in project cloudstack by apache.
the class VpcApiUnitTest method validateNtwkOffForVpcInvalidNoConserveMode.
//3) invalid offering - conserve mode is off
@Test(expected = InvalidParameterValueException.class)
public void validateNtwkOffForVpcInvalidNoConserveMode() {
boolean result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 3, "0.0.0.0", "111-", _vo, "10.1.1.1", new AccountVO(), null);
result = true;
} finally {
assertFalse("Validate network offering: TEST FAILED, can't use network offering without conserve mode = true", result);
}
}
use of com.cloud.user.AccountVO in project cloudstack by apache.
the class DedicatedResourceManagerImpl method createDedicateZoneResponse.
@Override
public DedicateZoneResponse createDedicateZoneResponse(DedicatedResources resource) {
DedicateZoneResponse dedicateZoneResponse = new DedicateZoneResponse();
DataCenterVO dc = _zoneDao.findById(resource.getDataCenterId());
DomainVO domain = _domainDao.findById(resource.getDomainId());
AccountVO account = _accountDao.findById(resource.getAccountId());
AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
dedicateZoneResponse.setId(resource.getUuid());
dedicateZoneResponse.setZoneId(dc.getUuid());
dedicateZoneResponse.setZoneName(dc.getName());
dedicateZoneResponse.setDomainId(domain.getUuid());
dedicateZoneResponse.setAffinityGroupId(group.getUuid());
if (account != null) {
dedicateZoneResponse.setAccountId(account.getUuid());
}
dedicateZoneResponse.setObjectName("dedicatedzone");
return dedicateZoneResponse;
}
use of com.cloud.user.AccountVO in project cloudstack by apache.
the class DedicatedResourceManagerImpl method findOrCreateDedicatedAffinityGroup.
private AffinityGroup findOrCreateDedicatedAffinityGroup(Long domainId, Long accountId) {
if (domainId == null) {
return null;
}
AffinityGroup group = null;
String accountName = null;
String affinityGroupName = null;
if (accountId != null) {
AccountVO account = _accountDao.findById(accountId);
accountName = account.getAccountName();
group = _affinityGroupDao.findByAccountAndType(accountId, "ExplicitDedication");
if (group != null) {
return group;
}
// default to a groupname with account/domain information
affinityGroupName = "DedicatedGrp-" + accountName;
} else {
// domain level group
group = _affinityGroupDao.findDomainLevelGroupByType(domainId, "ExplicitDedication");
if (group != null) {
return group;
}
// default to a groupname with account/domain information
String domainName = _domainDao.findById(domainId).getName();
affinityGroupName = "DedicatedGrp-domain-" + domainName;
}
group = _affinityGroupService.createAffinityGroup(accountName, null, domainId, affinityGroupName, "ExplicitDedication", "dedicated resources group");
return group;
}
use of com.cloud.user.AccountVO in project cloudstack by apache.
the class DedicatedResourceManagerImpl method createDedicatePodResponse.
@Override
public DedicatePodResponse createDedicatePodResponse(DedicatedResources resource) {
DedicatePodResponse dedicatePodResponse = new DedicatePodResponse();
HostPodVO pod = _podDao.findById(resource.getPodId());
DomainVO domain = _domainDao.findById(resource.getDomainId());
AccountVO account = _accountDao.findById(resource.getAccountId());
AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
dedicatePodResponse.setId(resource.getUuid());
dedicatePodResponse.setPodId(pod.getUuid());
dedicatePodResponse.setPodName(pod.getName());
dedicatePodResponse.setDomainId(domain.getUuid());
dedicatePodResponse.setAffinityGroupId(group.getUuid());
if (account != null) {
dedicatePodResponse.setAccountId(account.getUuid());
}
dedicatePodResponse.setObjectName("dedicatedpod");
return dedicatePodResponse;
}
Aggregations