Added zone check for attach iso (#3755)

This commit is contained in:
Spaceman1984 2019-12-23 17:48:51 +02:00 committed by dahn
parent 2712decf50
commit 100308536c
1 changed files with 6 additions and 0 deletions

View File

@ -1187,6 +1187,12 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
throw new InvalidParameterValueException("Unable to find an ISO with id " + isoId);
}
long dcId = vm.getDataCenterId();
VMTemplateZoneVO exists = _tmpltZoneDao.findByZoneTemplate(dcId, isoId);
if (null == exists) {
throw new InvalidParameterValueException("ISO is not available in the zone the VM is in.");
}
// check permissions
// check if caller has access to VM and ISO
// and also check if the VM's owner has access to the ISO.