diff --git a/server/src/com/cloud/api/commands/ListSnapshotsCmd.java b/server/src/com/cloud/api/commands/ListSnapshotsCmd.java index a71e5b7b36c..c3b5b2a21e4 100644 --- a/server/src/com/cloud/api/commands/ListSnapshotsCmd.java +++ b/server/src/com/cloud/api/commands/ListSnapshotsCmd.java @@ -87,16 +87,13 @@ public class ListSnapshotsCmd extends BaseCmd { } Long accountId = null; - if ((account == null) || isAdmin(account.getType())) { - if(account != null && account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) - accountId = account.getId(); + if (account == null) { if (domainId != null && accountName != null) { - Account userAccount = getManagementServer().findAccountByName(accountName, domainId); - if (userAccount != null) { - accountId = userAccount.getId(); - } + account = getManagementServer().findAccountByName(accountName, domainId); } - } else { + } + + if( account != null && !isAdmin(account.getType())) { accountId = account.getId(); } @@ -118,8 +115,8 @@ public class ListSnapshotsCmd extends BaseCmd { c.addCriteria(Criteria.NAME, name); c.addCriteria(Criteria.ID, id); c.addCriteria(Criteria.KEYWORD, keyword); - c.addCriteria(Criteria.ACCOUNTID, accountId); - + c.addCriteria(Criteria.ACCOUNTID, accountId); + List snapshots = null; try { snapshots = getManagementServer().listSnapshots(c, interval);