bug 8474: fix attaching ISO to xenserver vm

status 8474: resolved fixed
This commit is contained in:
Edison Su 2011-02-08 10:04:20 -05:00
parent 3d493f2083
commit 4fe6219754

View File

@ -1170,11 +1170,9 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
String errMsg = "Unable to attach ISO" + isoId + "to virtual machine " + vmId;
userId = accountAndUserValidation(account, userId, vmInstanceCheck, iso, errMsg);
VMInstanceVO vm = ApiDBUtils.findVMInstanceById(vmId);
VMTemplateVO vmTemplate = ApiDBUtils.findTemplateById(vm.getTemplateId());
if ("xen-pv-drv-iso".equals(iso.getDisplayText()) && vmTemplate.getHypervisorType() != Hypervisor.HypervisorType.XenServer){
throw new InvalidParameterValueException("Cannot attach Xenserver PV drivers to incompatible hypervisor " +vmTemplate.getHypervisorType());
if ("xen-pv-drv-iso".equals(iso.getDisplayText()) && vmInstanceCheck.getHypervisorType() != Hypervisor.HypervisorType.XenServer){
throw new InvalidParameterValueException("Cannot attach Xenserver PV drivers to incompatible hypervisor " + vmInstanceCheck.getHypervisorType());
}
return attachISOToVM(vmId, userId, isoId, true);