Skip to content

Commit 439118e

Browse files
committed
Added zone check
1 parent 29e1bbc commit 439118e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

server/src/main/java/com/cloud/template/TemplateManagerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,12 @@ public boolean attachIso(long isoId, long vmId) {
11871187
throw new InvalidParameterValueException("Unable to find an ISO with id " + isoId);
11881188
}
11891189

1190+
long dcId = vm.getDataCenterId();
1191+
VMTemplateZoneVO exists = _tmpltZoneDao.findByZoneTemplate(dcId, isoId);
1192+
if (null == exists) {
1193+
throw new InvalidParameterValueException("ISO is not available in the zone the VM is in.");
1194+
}
1195+
11901196
// check permissions
11911197
// check if caller has access to VM and ISO
11921198
// and also check if the VM's owner has access to the ISO.

0 commit comments

Comments
 (0)