bug 8048: preventing returning of volumes attached to destroyed vms, when list vols is executed by normal user

status 8048: resolved fixed
This commit is contained in:
abhishek 2011-01-20 11:41:04 -08:00
parent a4cfe20db8
commit b30b75cd18
1 changed files with 16 additions and 1 deletions

View File

@ -2405,7 +2405,22 @@ public class ManagementServerImpl implements ManagementServer {
}
else
{
returnableVolumes.add(v);
//do not add to returnable list if vol belongs to a user vm that is destoyed and cmd called by user
if(v.getInstanceId() == null) {
returnableVolumes.add(v);
}else {
if (account.getType() == Account.ACCOUNT_TYPE_NORMAL){
VMInstanceVO owningVm = _vmInstanceDao.findById(v.getInstanceId());
if(owningVm != null && owningVm.getType().equals(VirtualMachine.Type.User) && owningVm.getState().equals(VirtualMachine.State.Destroyed)){
// do not show volumes
// do nothing
}else {
returnableVolumes.add(v);
}
}else {
returnableVolumes.add(v);
}
}
}
}