mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.10'
This commit is contained in:
commit
61208b5db2
@ -3584,7 +3584,17 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
final Long domainId = cmd.getDomainId();
|
final Long domainId = cmd.getDomainId();
|
||||||
final Long projectId = cmd.getProjectId();
|
final Long projectId = cmd.getProjectId();
|
||||||
|
|
||||||
final Account owner = _accountMgr.finalizeOwner(caller, accountName, domainId, projectId);
|
Account owner = null;
|
||||||
|
try {
|
||||||
|
owner = _accountMgr.finalizeOwner(caller, accountName, domainId, projectId);
|
||||||
|
} catch (InvalidParameterValueException ex) {
|
||||||
|
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && accountName != null && domainId != null) {
|
||||||
|
owner = _accountDao.findAccountIncludingRemoved(accountName, domainId);
|
||||||
|
}
|
||||||
|
if (owner == null) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final SSHKeyPairVO s = _sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), cmd.getName());
|
final SSHKeyPairVO s = _sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), cmd.getName());
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
|
|||||||
@ -991,7 +991,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||||||
_capacityDao.persist(capacity);
|
_capacityDao.persist(capacity);
|
||||||
} else {
|
} else {
|
||||||
CapacityVO capacity = capacities.get(0);
|
CapacityVO capacity = capacities.get(0);
|
||||||
if (capacity.getTotalCapacity() != totalOverProvCapacity || allocated != 0L || capacity.getCapacityState() != capacityState) {
|
if (capacity.getTotalCapacity() != totalOverProvCapacity || allocated != capacity.getUsedCapacity() || capacity.getCapacityState() != capacityState) {
|
||||||
capacity.setTotalCapacity(totalOverProvCapacity);
|
capacity.setTotalCapacity(totalOverProvCapacity);
|
||||||
capacity.setUsedCapacity(allocated);
|
capacity.setUsedCapacity(allocated);
|
||||||
capacity.setCapacityState(capacityState);
|
capacity.setCapacityState(capacityState);
|
||||||
|
|||||||
@ -87,6 +87,7 @@ import com.cloud.template.TemplateManager;
|
|||||||
import com.cloud.template.VirtualMachineTemplate;
|
import com.cloud.template.VirtualMachineTemplate;
|
||||||
import com.cloud.user.Account.State;
|
import com.cloud.user.Account.State;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
|
import com.cloud.user.dao.SSHKeyPairDao;
|
||||||
import com.cloud.user.dao.UserAccountDao;
|
import com.cloud.user.dao.UserAccountDao;
|
||||||
import com.cloud.user.dao.UserDao;
|
import com.cloud.user.dao.UserDao;
|
||||||
import com.cloud.utils.ConstantTimeComparator;
|
import com.cloud.utils.ConstantTimeComparator;
|
||||||
@ -263,6 +264,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
private DedicatedResourceDao _dedicatedDao;
|
private DedicatedResourceDao _dedicatedDao;
|
||||||
@Inject
|
@Inject
|
||||||
private GlobalLoadBalancerRuleDao _gslbRuleDao;
|
private GlobalLoadBalancerRuleDao _gslbRuleDao;
|
||||||
|
@Inject
|
||||||
|
private SSHKeyPairDao _sshKeyPairDao;
|
||||||
|
|
||||||
List<QuerySelector> _querySelectors;
|
List<QuerySelector> _querySelectors;
|
||||||
|
|
||||||
@ -924,6 +927,12 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
// Delete resource count and resource limits entries set for this account (if there are any).
|
// Delete resource count and resource limits entries set for this account (if there are any).
|
||||||
_resourceCountDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
|
_resourceCountDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
|
||||||
_resourceLimitDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
|
_resourceLimitDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
|
||||||
|
|
||||||
|
// Delete ssh keypairs
|
||||||
|
List<SSHKeyPairVO> sshkeypairs = _sshKeyPairDao.listKeyPairs(accountId, account.getDomainId());
|
||||||
|
for (SSHKeyPairVO keypair: sshkeypairs) {
|
||||||
|
_sshKeyPairDao.remove(keypair.getId());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
s_logger.warn("Failed to cleanup account " + account + " due to ", ex);
|
s_logger.warn("Failed to cleanup account " + account + " due to ", ex);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import java.net.InetAddress;
|
|||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.cloud.acl.DomainChecker;
|
import com.cloud.acl.DomainChecker;
|
||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
@ -105,6 +106,13 @@ public class AccountManagerImplTest extends AccountManagetImplTestBase {
|
|||||||
.thenReturn(true);
|
.thenReturn(true);
|
||||||
Mockito.when(_vmSnapshotDao.listByAccountId(Mockito.anyLong())).thenReturn(new ArrayList<VMSnapshotVO>());
|
Mockito.when(_vmSnapshotDao.listByAccountId(Mockito.anyLong())).thenReturn(new ArrayList<VMSnapshotVO>());
|
||||||
|
|
||||||
|
List<SSHKeyPairVO> sshkeyList = new ArrayList<SSHKeyPairVO>();
|
||||||
|
SSHKeyPairVO sshkey = new SSHKeyPairVO();
|
||||||
|
sshkey.setId(1l);
|
||||||
|
sshkeyList.add(sshkey);
|
||||||
|
Mockito.when(_sshKeyPairDao.listKeyPairs(Mockito.anyLong(), Mockito.anyLong())).thenReturn(sshkeyList);
|
||||||
|
Mockito.when(_sshKeyPairDao.remove(Mockito.anyLong())).thenReturn(true);
|
||||||
|
|
||||||
Assert.assertTrue(accountManager.deleteUserAccount(42));
|
Assert.assertTrue(accountManager.deleteUserAccount(42));
|
||||||
// assert that this was a clean delete
|
// assert that this was a clean delete
|
||||||
Mockito.verify(_accountDao, Mockito.never()).markForCleanup(
|
Mockito.verify(_accountDao, Mockito.never()).markForCleanup(
|
||||||
|
|||||||
@ -69,6 +69,7 @@ import com.cloud.storage.dao.VolumeDao;
|
|||||||
import com.cloud.storage.snapshot.SnapshotManager;
|
import com.cloud.storage.snapshot.SnapshotManager;
|
||||||
import com.cloud.template.TemplateManager;
|
import com.cloud.template.TemplateManager;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
|
import com.cloud.user.dao.SSHKeyPairDao;
|
||||||
import com.cloud.user.dao.UserAccountDao;
|
import com.cloud.user.dao.UserAccountDao;
|
||||||
import com.cloud.user.dao.UserDao;
|
import com.cloud.user.dao.UserDao;
|
||||||
import com.cloud.vm.VirtualMachineManager;
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
@ -189,7 +190,8 @@ public class AccountManagetImplTestBase {
|
|||||||
ServiceOfferingDao _offeringDao;
|
ServiceOfferingDao _offeringDao;
|
||||||
@Mock
|
@Mock
|
||||||
OrchestrationService _orchSrvc;
|
OrchestrationService _orchSrvc;
|
||||||
|
@Mock
|
||||||
|
SSHKeyPairDao _sshKeyPairDao;
|
||||||
|
|
||||||
AccountManagerImpl accountManager;
|
AccountManagerImpl accountManager;
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,6 @@ for i in $*
|
|||||||
do
|
do
|
||||||
info=`/opt/cloud/bin/checks2svpn.sh $i`
|
info=`/opt/cloud/bin/checks2svpn.sh $i`
|
||||||
ret=$?
|
ret=$?
|
||||||
echo -n "$i:$ret:$info&"
|
batchInfo+="$i:$ret:$info&"
|
||||||
done
|
done
|
||||||
|
echo -n $batchInfo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user