bug 8119: don't boot from iso, if iso is dettached

status 8119: resolved fixed
This commit is contained in:
Edison Su 2011-01-20 13:40:45 -05:00
parent 4b355ca301
commit d45f5cd5bf
2 changed files with 6 additions and 3 deletions

View File

@ -1071,7 +1071,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
if (!_enabled) {
return true;
}
if (groups != null || !groups.isEmpty()) {
if (groups != null && !groups.isEmpty()) {
final Transaction txn = Transaction.currentTxn();
txn.start();

View File

@ -2064,6 +2064,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (sshPublicKey != null) {
vm.setDetail("SSH.PublicKey", sshPublicKey);
}
if (isIso) {
vm.setIsoId(template.getId());
}
if (_itMgr.allocate(vm, template, offering, rootDiskOffering, dataDiskOfferings, networks, null, plan, cmd.getHypervisor(), owner) == null) {
return null;
@ -2148,7 +2152,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (vo.getIsoId() != null) {
template = _templateDao.findById(vo.getIsoId());
}
if (template != null && template.getFormat() == ImageFormat.ISO) {
if (template != null && template.getFormat() == ImageFormat.ISO && vo.getIsoId() != null) {
String isoPath = null;
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vo.getDataCenterId());
if (isoPathPair == null) {
@ -2169,7 +2173,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
iso.setDeviceId(3);
profile.addDisk(iso);
vo.setIsoId(template.getId());
} else {
/*create a iso placeholder*/
VolumeTO iso = new VolumeTO(profile.getId(), Volume.VolumeType.ISO, StorageResourceType.STORAGE_POOL, StoragePoolType.ISO, null, template.getName(), null, null,