CLOUDSTACK-2673: Failed to deploy guest vm using ISO with S3 being the

storage provider.
This commit is contained in:
Min Chen 2013-05-29 15:47:39 -07:00
parent bc91e7692d
commit e51adc3b7d
3 changed files with 498 additions and 464 deletions

View File

@ -19,6 +19,7 @@ package com.cloud.template;
import java.util.List;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
@ -108,6 +109,8 @@ public interface TemplateManager extends TemplateApiService{
List<DataStore> getImageStoreByTemplate(long templateId, Long zoneId);
TemplateInfo prepareIso(long isoId, long dcId);

File diff suppressed because it is too large Load Diff

View File

@ -2770,24 +2770,21 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
vm.setDetails(details);
if (vm.getIsoId() != null) {
TemplateInfo template = templateFactory.getTemplate(vm.getIsoId(), DataStoreRole.Image, vm.getDataCenterId());
if (template == null || template.getFormat() != ImageFormat.ISO) {
throw new CloudRuntimeException(
"Can not find ISO in vm_template table for id "
+ vm.getIsoId());
TemplateInfo template = this.templateMgr.prepareIso(vm.getIsoId(), vm.getDataCenterId());
if (template == null){
s_logger.error("Failed to prepare ISO on secondary or cache storage");
throw new CloudRuntimeException("Failed to prepare ISO on secondary or cache storage");
}
if (template.isBootable()) {
profile.setBootLoaderType(BootloaderType.CD);
}
GuestOSVO guestOS = _guestOSDao.findById(template.getGuestOSId());
String displayName = null;
if (guestOS != null) {
displayName = guestOS.getDisplayName();
}
TemplateObjectTO iso = (TemplateObjectTO)template.getTO();
iso.setGuestOsType(displayName);
DiskTO disk = new DiskTO(iso, 3L, Volume.Type.ISO);