Now we have multiple routing template and buitin templates now, refactor template download code, that can handle it.

Basically, change the meaning of type field in template table: SYSTEM means sytem vm template, BUILIIN means buildin templates.
This commit is contained in:
edison 2010-09-28 19:38:52 -07:00
parent fb9f43d807
commit ad1ef80459
19 changed files with 274 additions and 120 deletions

View File

@ -0,0 +1,115 @@
package com.cloud.agent.resource.computing;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
public class KVMGuestOsMapper {
private static final Logger s_logger = Logger.getLogger(KVMGuestOsMapper.class);
private static Map<String, String> s_mapper = new HashMap<String, String>();
static {
s_mapper.put("CentOS 4.5 (32-bit)", "CentOS 4.5");
s_mapper.put("CentOS 4.6 (32-bit)", "CentOS 4.6");
s_mapper.put("CentOS 4.7 (32-bit)", "CentOS 4.7");
s_mapper.put("CentOS 4.8 (32-bit)", "CentOS 4.8");
s_mapper.put("CentOS 5.0 (32-bit)", "CentOS 5.0");
s_mapper.put("CentOS 5.0 (64-bit)", "CentOS 5.0");
s_mapper.put("CentOS 5.1 (32-bit)", "CentOS 5.1");
s_mapper.put("CentOS 5.1 (64-bit)", "CentOS 5.1");
s_mapper.put("CentOS 5.2 (32-bit)", "CentOS 5.2");
s_mapper.put("CentOS 5.2 (64-bit)", "CentOS 5.2");
s_mapper.put("CentOS 5.3 (32-bit)", "CentOS 5.3");
s_mapper.put("CentOS 5.3 (64-bit)", "CentOS 5.3");
s_mapper.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
s_mapper.put("CentOS 5.4 (64-bit)", "CentOS 5.4");
s_mapper.put("CentOS 5.5 (32-bit)", "CentOS 5.5");
s_mapper.put("CentOS 5.5 (64-bit)", "CentOS 5.5");
s_mapper.put("Red Hat Enterprise Linux 2", "Red Hat Enterprise Linux 2");
s_mapper.put("Red Hat Enterprise Linux 3 (32-bit)", "Red Hat Enterprise Linux 3");
s_mapper.put("Red Hat Enterprise Linux 3 (64-bit)", "Red Hat Enterprise Linux 3");
s_mapper.put("Red Hat Enterprise Linux 4(64-bit)", "Red Hat Enterprise Linux 4");
s_mapper.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5");
s_mapper.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6");
s_mapper.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7");
s_mapper.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8");
s_mapper.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0");
s_mapper.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0");
s_mapper.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
s_mapper.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
s_mapper.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2");
s_mapper.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2");
s_mapper.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3");
s_mapper.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3");
s_mapper.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4");
s_mapper.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4");
s_mapper.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5.5");
s_mapper.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5.5");
s_mapper.put("Fedora 13", "Fedora 13");
s_mapper.put("Fedora 12", "Fedora 12");
s_mapper.put("Fedora 11", "Fedora 11");
s_mapper.put("Fedora 10", "Fedora 10");
s_mapper.put("Fedora 9", "Fedora 9");
s_mapper.put("Fedora 8", "Fedora 8");
s_mapper.put("Ubuntu 10.04 (32-bit)", "Ubuntu 10.04");
s_mapper.put("Ubuntu 10.04 (64-bit)", "Ubuntu 10.04");
s_mapper.put("Ubuntu 9.10 (32-bit)", "Ubuntu 9.10");
s_mapper.put("Ubuntu 9.10 (64-bit)", "Ubuntu 9.10");
s_mapper.put("Ubuntu 9.04 (32-bit)", "Ubuntu 9.04");
s_mapper.put("Ubuntu 9.04 (64-bit)", "Ubuntu 9.04");
s_mapper.put("Ubuntu 8.10 (32-bit)", "Ubuntu 8.10");
s_mapper.put("Ubuntu 8.10 (64-bit)", "Ubuntu 8.10");
s_mapper.put("Ubuntu 8.04 (32-bit)", "Ubuntu 8.04");
s_mapper.put("Ubuntu 8.04 (64-bit)", "Ubuntu 8.04");
s_mapper.put("Debian GNU/Linux 5.0 (32-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 5.0 (64-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 4.0 (32-bit)", "Debian GNU/Linux 4");
s_mapper.put("Debian GNU/Linux 4.0 (64-bit)", "Debian GNU/Linux 4");
s_mapper.put("Other 2.6x Linux (32-bit)", "Other 2.6x Linux");
s_mapper.put("Other 2.6x Linux (64-bit)", "Other 2.6x Linux");
s_mapper.put("Other Linux (32-bit)", "Other Linux");
s_mapper.put("Other Linux (64-bit)", "Other Linux");
s_mapper.put("Other Ubuntu (32-bit)", "Other Linux");
s_mapper.put("Other Ubuntu (64-bit)", "Other Linux");
s_mapper.put("Asianux 3(32-bit)", "Other Linux");
s_mapper.put("Asianux 3(64-bit)", "Other Linux");
s_mapper.put("Windows 7 (32-bit)", "Windows 7");
s_mapper.put("Windows 7 (64-bit)", "Windows 7");
s_mapper.put("Windows Server 2003 Enterprise Edition(32-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 Enterprise Edition(64-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 DataCenter Edition(32-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 DataCenter Edition(64-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 Standard Edition(32-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 Standard Edition(64-bit)", "Windows Server 2003");
s_mapper.put("Windows Server 2003 Web Edition", "Windows Server 2003");
s_mapper.put("Microsoft Small Bussiness Server 2003", "Windows Server 2003");
s_mapper.put("Windows Server 2008 (32-bit)", "Windows Server 2008");
s_mapper.put("Windows Server 2008 (64-bit)", "Windows Server 2008");
s_mapper.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008");
s_mapper.put("Windows 2000 Server SP4 (32-bit)", "Windows 2000");
s_mapper.put("Windows 2000 Server", "Windows 2000");
s_mapper.put("Windows 2000 Advanced Server", "Windows 2000");
s_mapper.put("Windows 2000 Professional", "Windows 2000");
s_mapper.put("Windows Vista (32-bit)", "Windows Vista");
s_mapper.put("Windows Vista (64-bit)", "Windows Vista");
s_mapper.put("Windows XP SP2 (32-bit)", "Windows XP");
s_mapper.put("Windows XP SP3 (32-bit)", "Windows XP");
s_mapper.put("Windows XP (32-bit)", "Windows XP");
s_mapper.put("Windows XP (64-bit)", "Windows XP");
s_mapper.put("Windows 98", "Windows 98");
s_mapper.put("Windows 95", "Windows 95");
s_mapper.put("Windows NT 4", "Windows NT");
s_mapper.put("Windows 3.1", "Windows 3.1");
}
public static String getGuestOsName(String guestOsName) {
String guestOS = s_mapper.get(guestOsName);
if (guestOS == null) {
s_logger.debug("Can't find the mapping of guest os: " + guestOsName);
return "Other";
} else {
return guestOS;
}
}
}

View File

@ -3092,23 +3092,23 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private boolean isGuestPVEnabled(String guestOS) { private boolean isGuestPVEnabled(String guestOS) {
if (guestOS == null) if (guestOS == null)
return false; return false;
if (guestOS.startsWith("Ubuntu 10.04") || String guestOSName = KVMGuestOsMapper.getGuestOsName(guestOS);
guestOS.startsWith("Ubuntu 9") || if (guestOSName.startsWith("Ubuntu 10.04") ||
guestOS.startsWith("Ubuntu 8.10") || guestOSName.startsWith("Ubuntu 9") ||
guestOS.startsWith("Fedora 13") || guestOSName.startsWith("Ubuntu 8.10") ||
guestOS.startsWith("Fedora 12") || guestOSName.startsWith("Fedora 13") ||
guestOS.startsWith("Fedora 11") || guestOSName.startsWith("Fedora 12") ||
guestOS.startsWith("Fedora 10") || guestOSName.startsWith("Fedora 11") ||
guestOS.startsWith("Fedora 9") || guestOSName.startsWith("Fedora 10") ||
guestOS.startsWith("CentOS 5.3") || guestOSName.startsWith("Fedora 9") ||
guestOS.startsWith("CentOS 5.4") || guestOSName.startsWith("CentOS 5.3") ||
guestOS.startsWith("CentOS 5.5") || guestOSName.startsWith("CentOS 5.4") ||
guestOS.startsWith("Red Hat Enterprise Linux 5.3") || guestOSName.startsWith("CentOS 5.5") ||
guestOS.startsWith("Red Hat Enterprise Linux 5.4") || guestOSName.startsWith("Red Hat Enterprise Linux 5.3") ||
guestOS.startsWith("Red Hat Enterprise Linux 5.5") || guestOSName.startsWith("Red Hat Enterprise Linux 5.4") ||
guestOS.startsWith("Red Hat Enterprise Linux 6") || guestOSName.startsWith("Red Hat Enterprise Linux 5.5") ||
guestOS.startsWith("Debain Lenney") || guestOSName.startsWith("Red Hat Enterprise Linux 6") ||
guestOS.startsWith("Debain Squeeze") guestOSName.startsWith("Debian GNU/Linux")
) )
return true; return true;
else else

View File

@ -79,6 +79,11 @@ public class Storage {
hfsp hfsp
} }
public static enum TemplateType {
SYSTEM,
BUILTIN
}
public static enum StoragePoolType { public static enum StoragePoolType {
Filesystem(false), //local directory Filesystem(false), //local directory
NetworkFilesystem(true), //NFS or CIFS NetworkFilesystem(true), //NFS or CIFS

View File

@ -38,9 +38,4 @@ public interface VirtualMachineTemplate {
*/ */
String getName(); String getName();
/**
* @return the file system for this template.
*/
FileSystem getFileSystem();
} }

View File

@ -35,6 +35,7 @@ import com.cloud.async.AsyncInstanceCreateStatus;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.FileSystem;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.GenericDao;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.cloud.storage.Storage; import com.cloud.storage.Storage;
@ -64,7 +65,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
private boolean featured; private boolean featured;
@Column(name="type") @Column(name="type")
private FileSystem fileSystem = null; private Storage.TemplateType templateType;
@Column(name="url") @Column(name="url")
private String url = null; private String url = null;
@ -125,16 +126,16 @@ public class VMTemplateVO implements VirtualMachineTemplate {
/** /**
* Proper constructor for a new vm template. * Proper constructor for a new vm template.
*/ */
public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, FileSystem fs, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, fs, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType);
} }
public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, FileSystem fs, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.publicTemplate = isPublic; this.publicTemplate = isPublic;
this.featured = featured; this.featured = featured;
this.fileSystem = fs; this.templateType = type;
this.url = url; this.url = url;
this.requiresHvm = requiresHvm; this.requiresHvm = requiresHvm;
this.bits = bits; this.bits = bits;
@ -181,13 +182,12 @@ public class VMTemplateVO implements VirtualMachineTemplate {
return id; return id;
} }
@Override public TemplateType getTemplateType() {
public FileSystem getFileSystem() { return templateType;
return fileSystem;
} }
public void setFileSystem(FileSystem fs) { public void setTemplateType(TemplateType type) {
this.fileSystem = fs; this.templateType = type;
} }
public boolean requiresHvm() { public boolean requiresHvm() {
@ -300,8 +300,8 @@ public class VMTemplateVO implements VirtualMachineTemplate {
return HypervisorType.getType(hypervisorType); return HypervisorType.getType(hypervisorType);
} }
public void setHypervisorType(HypervisorType hyper) { public void setHypervisorType(HypervisorType hyperType) {
hypervisorType = hyper.toString(); hypervisorType = hyperType.toString();
} }
@Override @Override
@ -313,8 +313,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
} }
VMTemplateVO other = (VMTemplateVO)that; VMTemplateVO other = (VMTemplateVO)that;
return (this.getUniqueName().equals(other.getUniqueName())); return ((this.getUniqueName().equals(other.getUniqueName())));
} }
@Override @Override

View File

@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import com.cloud.storage.LaunchPermissionVO; import com.cloud.storage.LaunchPermissionVO;
import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
import com.cloud.utils.DateUtil; import com.cloud.utils.DateUtil;
import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericDaoBase;
@ -120,7 +120,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
boolean isPublic = rs.getBoolean(4); boolean isPublic = rs.getBoolean(4);
String value = rs.getString(5); String value = rs.getString(5);
ImageFormat format = ImageFormat.valueOf(value); ImageFormat format = ImageFormat.valueOf(value);
String filesystem = rs.getString(6); String tmpltType = rs.getString(6);
boolean requiresHVM = rs.getBoolean(7); boolean requiresHVM = rs.getBoolean(7);
int bits = rs.getInt(8); int bits = rs.getInt(8);
String url = rs.getString(9); String url = rs.getString(9);
@ -140,7 +140,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
if (isPublic) { if (isPublic) {
continue; // if it's public already, skip adding it to permitted templates as this for private templates only continue; // if it's public already, skip adding it to permitted templates as this for private templates only
} }
VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, FileSystem.valueOf(filesystem), url, createdDate, requiresHVM, bits, templateAccountId, checksum, displayText, enablePassword, guestOSId, true, null); VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, TemplateType.valueOf(tmpltType), url, createdDate, requiresHVM, bits, templateAccountId, checksum, displayText, enablePassword, guestOSId, true, null);
permittedTemplates.add(template); permittedTemplates.add(template);
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -49,8 +49,9 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
public VMTemplateVO findByTemplateName(String templateName); public VMTemplateVO findByTemplateName(String templateName);
//public void update(VMTemplateVO template); //public void update(VMTemplateVO template);
public VMTemplateVO findRoutingTemplate(); public VMTemplateVO findRoutingTemplate();
public List<VMTemplateVO> listAllRoutingTemplates();
public VMTemplateVO findConsoleProxyTemplate(); public VMTemplateVO findConsoleProxyTemplate();
public VMTemplateVO findDefaultBuiltinTemplate(); public List<VMTemplateVO> listDefaultBuiltinTemplates();
public String getRoutingTemplateUniqueName(); public String getRoutingTemplateUniqueName();
public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path); public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path);
public List<VMTemplateVO> listReadyTemplates(); public List<VMTemplateVO> listReadyTemplates();

View File

@ -31,8 +31,10 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.domain.DomainVO; import com.cloud.domain.DomainVO;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.SnapshotPolicyVO;
import com.cloud.storage.Storage; import com.cloud.storage.Storage;
import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VMTemplateZoneVO; import com.cloud.storage.VMTemplateZoneVO;
@ -49,21 +51,23 @@ import com.cloud.utils.exception.CloudRuntimeException;
@Local(value={VMTemplateDao.class}) @Local(value={VMTemplateDao.class})
public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implements VMTemplateDao { public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implements VMTemplateDao {
private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class); private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class);
private HypervisorType _defaultHyperType;
@Inject @Inject
VMTemplateZoneDao _templateZoneDao; VMTemplateZoneDao _templateZoneDao;
@Inject
ConfigurationDao _configDao;
private final String SELECT_ALL = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " + private final String SELECT_ALL = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " +
"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones FROM vm_template t"; "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t";
protected static final String SELECT_ALL_IN_ZONE =
"SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.removed, t.account_id, " +
"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones FROM vm_template t, template_zone_ref tz where t.removed is null and tz.removed is null and t.id = tz.template_id and tz.zone_id=? ";
protected SearchBuilder<VMTemplateVO> TemplateNameSearch; protected SearchBuilder<VMTemplateVO> TemplateNameSearch;
protected SearchBuilder<VMTemplateVO> UniqueNameSearch; protected SearchBuilder<VMTemplateVO> UniqueNameSearch;
protected SearchBuilder<VMTemplateVO> tmpltTypeSearch;
protected SearchBuilder<VMTemplateVO> tmpltTypeHyperSearch;
protected SearchBuilder<VMTemplateVO> AccountIdSearch; protected SearchBuilder<VMTemplateVO> AccountIdSearch;
protected SearchBuilder<VMTemplateVO> NameSearch; protected SearchBuilder<VMTemplateVO> NameSearch;
protected SearchBuilder<VMTemplateVO> TmpltsInZoneSearch;
protected SearchBuilder<VMTemplateVO> PublicSearch; protected SearchBuilder<VMTemplateVO> PublicSearch;
private String routerTmpltName; private String routerTmpltName;
@ -92,18 +96,21 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
return findOneIncludingRemovedBy(sc); return findOneIncludingRemovedBy(sc);
} }
@Override
public List<VMTemplateVO> listAllRoutingTemplates() {
SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
return listBy(sc);
}
@Override @Override
public VMTemplateVO findRoutingTemplate() { public VMTemplateVO findRoutingTemplate() {
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create(); return findSystemVMTemplate();
sc.setParameters("uniqueName", routerTmpltName);
return findOneIncludingRemovedBy(sc);
} }
@Override @Override
public VMTemplateVO findConsoleProxyTemplate() { public VMTemplateVO findConsoleProxyTemplate() {
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create(); return findSystemVMTemplate();
sc.setParameters("uniqueName", consoleProxyTmpltName);
return findOneIncludingRemovedBy(sc);
} }
@Override @Override
@ -168,11 +175,29 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
NameSearch = createSearchBuilder(); NameSearch = createSearchBuilder();
NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ); NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
tmpltTypeHyperSearch = createSearchBuilder();
tmpltTypeHyperSearch.and("templateType", tmpltTypeHyperSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
tmpltTypeHyperSearch.and("hypervisor_type", tmpltTypeHyperSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
tmpltTypeSearch = createSearchBuilder();
tmpltTypeSearch.and("templateType", tmpltTypeSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
AccountIdSearch = createSearchBuilder(); AccountIdSearch = createSearchBuilder();
AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ); AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ); AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
AccountIdSearch.done(); AccountIdSearch.done();
SearchBuilder<VMTemplateZoneVO> tmpltZoneSearch = _templateZoneDao.createSearchBuilder();
tmpltZoneSearch.and("removed", tmpltZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
tmpltZoneSearch.and("zoneId", tmpltZoneSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
TmpltsInZoneSearch = createSearchBuilder();
TmpltsInZoneSearch.and("removed", TmpltsInZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
TmpltsInZoneSearch.join("tmpltzone", tmpltZoneSearch, tmpltZoneSearch.entity().getTemplateId(), TmpltsInZoneSearch.entity().getId());
tmpltZoneSearch.done();
TmpltsInZoneSearch.done();
_defaultHyperType = HypervisorType.getType(_configDao.getValue("hypervisor.type"));
return result; return result;
} }
@ -330,29 +355,41 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
@Override @Override
@DB @DB
public List<VMTemplateVO> listAllInZone(long dataCenterId) { public List<VMTemplateVO> listAllInZone(long dataCenterId) {
Transaction txn = Transaction.currentTxn(); SearchCriteria<VMTemplateVO> sc = TmpltsInZoneSearch.create();
txn.start(); sc.setJoinParameters("tmpltzone", "zoneId", dataCenterId);
PreparedStatement pstmt = null; return listBy(sc);
List<VMTemplateVO> result = new ArrayList<VMTemplateVO>();
try {
String sql = SELECT_ALL_IN_ZONE;
pstmt = txn.prepareAutoCloseStatement(sql);
pstmt.setLong(1, dataCenterId);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
result.add(toEntityBean(rs, false));
}
txn.commit();
} catch (SQLException sqle) {
s_logger.warn("Exception: ",sqle);
throw new CloudRuntimeException("Unable to list templates in zone", sqle);
}
return result;
} }
@Override @Override
public VMTemplateVO findDefaultBuiltinTemplate() { public List<VMTemplateVO> listDefaultBuiltinTemplates() {
return findById(TemplateConstants.DEFAULT_BUILTIN_VM_DB_ID); SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
sc.setParameters("templateType", Storage.TemplateType.BUILTIN);
return listBy(sc);
}
private VMTemplateVO findSystemVMTemplate() {
SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch.create();
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
sc.setParameters("hypervisor_type", _defaultHyperType.toString());
VMTemplateVO tmplt = findOneBy(sc);
if (tmplt == null) {
/*Can't find it? We'd like to prefer xenserver */
if (_defaultHyperType != HypervisorType.XenServer) {
sc = tmpltTypeHyperSearch.create();
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
sc.setParameters("hypervisor_type", HypervisorType.XenServer);
tmplt = findOneBy(sc);
/*Still can't find it? return a random one*/
if (tmplt == null) {
sc = tmpltTypeSearch.create();
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
tmplt = findOneBy(sc);
}
}
}
return tmplt;
} }
} }

View File

@ -358,6 +358,7 @@ public abstract class BaseCmd {
TEMPLATE_NAME("templatename", BaseCmd.TYPE_STRING, "templateName"), TEMPLATE_NAME("templatename", BaseCmd.TYPE_STRING, "templateName"),
TEMPLATE_DISPLAY_TEXT("templatedisplaytext", BaseCmd.TYPE_STRING, "templateDisplayText"), TEMPLATE_DISPLAY_TEXT("templatedisplaytext", BaseCmd.TYPE_STRING, "templateDisplayText"),
TEMPLATE_STATUS("templatestatus", BaseCmd.TYPE_STRING, "templateStatus"), TEMPLATE_STATUS("templatestatus", BaseCmd.TYPE_STRING, "templateStatus"),
TEMPLATE_Type("templatetype", BaseCmd.TYPE_STRING, "templateType"),
TEMPLATE_TOTAL("templatetotal", BaseCmd.TYPE_INT, "templatetotal"), TEMPLATE_TOTAL("templatetotal", BaseCmd.TYPE_INT, "templatetotal"),
TIMEZONE("timezone", BaseCmd.TYPE_STRING, "timezone"), TIMEZONE("timezone", BaseCmd.TYPE_STRING, "timezone"),
TIMEZONE_OFFSET("timezoneoffset", BaseCmd.TYPE_FLOAT, "timezoneOffset"), TIMEZONE_OFFSET("timezoneoffset", BaseCmd.TYPE_FLOAT, "timezoneOffset"),

View File

@ -172,6 +172,7 @@ public class ListTemplatesCmd extends BaseCmd {
templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString())); templateData.add(new Pair<String, Object>(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString()));
templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString())); templateData.add(new Pair<String, Object>(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString()));
templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), template.getFormat())); templateData.add(new Pair<String, Object>(BaseCmd.Properties.FORMAT.getName(), template.getFormat()));
templateData.add(new Pair<String, Object>(BaseCmd.Properties.TEMPLATE_Type.getName(), template.getTemplateType()));
GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId()); GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId());
if (os != null) { if (os != null) {

View File

@ -149,7 +149,7 @@ public class RegisterIsoCmd extends BaseCmd {
Long templateId; Long templateId;
try { try {
templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic.booleanValue(), featured.booleanValue(), ImageFormat.ISO.toString(), FileSystem.cdfs.toString(), url, null, true, 64 /*bits*/, false, guestOSId, bootable, HypervisorType.None); templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic.booleanValue(), featured.booleanValue(), ImageFormat.ISO.toString(), null, url, null, true, 64 /*bits*/, false, guestOSId, bootable, HypervisorType.None);
} catch (Exception ex) { } catch (Exception ex) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
} }

View File

@ -165,7 +165,7 @@ public class RegisterTemplateCmd extends BaseCmd {
Long templateId; Long templateId;
try { try {
templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic, featured, format, "ext3", url, null, requiresHVM, bits, passwordEnabled, guestOSId, true, hyperType); templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic, featured, format, null, url, null, requiresHVM, bits, passwordEnabled, guestOSId, true, hyperType);
} catch (InvalidParameterValueException ipve) { } catch (InvalidParameterValueException ipve) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + ipve.getMessage()); throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + ipve.getMessage());
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {

View File

@ -487,14 +487,14 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
if ((tmplts != null) && !tmplts.isEmpty()) { if ((tmplts != null) && !tmplts.isEmpty()) {
TemplateInfo xenPVISO = tmplts.get("xs-tools"); TemplateInfo xenPVISO = tmplts.get("xs-tools");
if (xenPVISO != null) { if (xenPVISO != null) {
VMTemplateVO tmplt = _tmpltDao.findByName(xenPVISO.getTemplateName()); VMTemplateVO tmplt = _tmpltDao.findByTemplateName(xenPVISO.getTemplateName());
Long id; Long id;
if (tmplt == null) { if (tmplt == null) {
id = _tmpltDao.getNextInSequence(Long.class, "id"); id = _tmpltDao.getNextInSequence(Long.class, "id");
VMTemplateVO template = new VMTemplateVO(id, xenPVISO.getTemplateName(), xenPVISO.getTemplateName(), ImageFormat.ISO , true, true, FileSystem.cdfs, "/opt/xensource/packages/iso/xs-tools-5.5.0.iso", null, true, 64, Account.ACCOUNT_ID_SYSTEM, null, "xen-pv-drv-iso", false, 1, false, HypervisorType.None); VMTemplateVO template = new VMTemplateVO(id, xenPVISO.getTemplateName(), xenPVISO.getTemplateName(), ImageFormat.ISO , true, true, null, "/opt/xensource/packages/iso/xs-tools-5.5.0.iso", null, true, 64, Account.ACCOUNT_ID_SYSTEM, null, "xen-pv-drv-iso", false, 1, false, HypervisorType.None);
_tmpltDao.persist(template); _tmpltDao.persist(template);
} else { } else {
id = _tmpltDao.findByName(xenPVISO.getTemplateName()).getId(); id = _tmpltDao.findByTemplateName(xenPVISO.getTemplateName()).getId();
} }
VMTemplateHostVO tmpltHost = _vmTemplateHostDao.findByHostTemplate(Hostid, id); VMTemplateHostVO tmpltHost = _vmTemplateHostDao.findByHostTemplate(Hostid, id);

View File

@ -5012,11 +5012,6 @@ public class ManagementServerImpl implements ManagementServer {
throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values())); throw new IllegalArgumentException("Image format is incorrect " + format + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
} }
FileSystem fileSystem = FileSystem.valueOf(diskType);
if (fileSystem == null) {
throw new IllegalArgumentException("File system is incorrect " + diskType + ". Supported file systems are " + EnumUtils.listValues(FileSystem.values()));
}
URI uri = new URI(url); URI uri = new URI(url);
if ((uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("http") && !uri.getScheme().equalsIgnoreCase("https") && !uri.getScheme().equalsIgnoreCase("file"))) { if ((uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("http") && !uri.getScheme().equalsIgnoreCase("https") && !uri.getScheme().equalsIgnoreCase("file"))) {
throw new IllegalArgumentException("Unsupported scheme for url: " + url); throw new IllegalArgumentException("Unsupported scheme for url: " + url);
@ -5060,7 +5055,7 @@ public class ManagementServerImpl implements ManagementServer {
throw new IllegalArgumentException("Cannot use reserved names for templates"); throw new IllegalArgumentException("Cannot use reserved names for templates");
} }
return _tmpltMgr.create(userId, accountId, zoneId, name, displayText, isPublic, featured, imgfmt, fileSystem, uri, chksum, requiresHvm, bits, enablePassword, guestOSId, bootable, hyperType); return _tmpltMgr.create(userId, accountId, zoneId, name, displayText, isPublic, featured, imgfmt, null, uri, chksum, requiresHvm, bits, enablePassword, guestOSId, bootable, hyperType);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URL " + url); throw new IllegalArgumentException("Invalid URL " + url);
} }

View File

@ -420,14 +420,22 @@ public class DownloadMonitorImpl implements DownloadMonitor {
Set<VMTemplateVO> toBeDownloaded = new HashSet<VMTemplateVO>(); Set<VMTemplateVO> toBeDownloaded = new HashSet<VMTemplateVO>();
List<VMTemplateVO> allTemplates = _templateDao.listAllInZone(storageHost.getDataCenterId()); List<VMTemplateVO> allTemplates = _templateDao.listAllInZone(storageHost.getDataCenterId());
VMTemplateVO rtngTmplt = _templateDao.findRoutingTemplate(); List<VMTemplateVO> rtngTmplts = _templateDao.listAllRoutingTemplates();
VMTemplateVO defaultBuiltin = _templateDao.findDefaultBuiltinTemplate(); List<VMTemplateVO> defaultBuiltin = _templateDao.listDefaultBuiltinTemplates();
if (rtngTmplt != null && !allTemplates.contains(rtngTmplt)) if (rtngTmplts != null) {
for (VMTemplateVO rtngTmplt : rtngTmplts) {
if (!allTemplates.contains(rtngTmplt))
allTemplates.add(rtngTmplt); allTemplates.add(rtngTmplt);
}
}
if (defaultBuiltin != null && !allTemplates.contains(defaultBuiltin)) { if (defaultBuiltin != null) {
allTemplates.add(defaultBuiltin); for (VMTemplateVO builtinTmplt : defaultBuiltin) {
if (!allTemplates.contains(builtinTmplt)) {
allTemplates.add(builtinTmplt);
}
}
} }
for (Iterator<VMTemplateVO> i = allTemplates.iterator();i.hasNext();) { for (Iterator<VMTemplateVO> i = allTemplates.iterator();i.hasNext();) {

View File

@ -29,7 +29,7 @@ import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateHostVO;
import com.cloud.storage.VMTemplateStoragePoolVO; import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.dao.VMTemplateDao.TemplateFilter; import com.cloud.storage.dao.VMTemplateDao.TemplateFilter;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -64,7 +64,7 @@ public interface TemplateManager extends Manager {
* @param bootable true if this template will represent a bootable ISO * @param bootable true if this template will represent a bootable ISO
* @return id of the template created. * @return id of the template created.
*/ */
Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType); Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, TemplateType type, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType);
/** /**
* Creates a Template * Creates a Template
@ -84,7 +84,7 @@ public interface TemplateManager extends Manager {
* @param bootable true if this template will represent a bootable ISO * @param bootable true if this template will represent a bootable ISO
* @return id of the template created. * @return id of the template created.
*/ */
Long createInZone(long zoneId, long userId, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable); Long createInZone(long zoneId, long userId, String displayText, boolean isPublic, boolean featured, ImageFormat format, TemplateType type, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable);
/** /**
* Prepares a template for vm creation for a certain storage pool. * Prepares a template for vm creation for a certain storage pool.

View File

@ -56,7 +56,7 @@ import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VMTemplateZoneVO; import com.cloud.storage.VMTemplateZoneVO;
import com.cloud.storage.VolumeVO; import com.cloud.storage.VolumeVO;
import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.dao.SnapshotDao; import com.cloud.storage.dao.SnapshotDao;
@ -118,7 +118,7 @@ public class TemplateManagerImpl implements TemplateManager {
@Override @Override
public Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { public Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, TemplateType type, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
Long id = _tmpltDao.getNextInSequence(Long.class, "id"); Long id = _tmpltDao.getNextInSequence(Long.class, "id");
AccountVO account = _accountDao.findById(accountId); AccountVO account = _accountDao.findById(accountId);
@ -126,7 +126,7 @@ public class TemplateManagerImpl implements TemplateManager {
throw new IllegalArgumentException("Only admins can create templates in all zones"); throw new IllegalArgumentException("Only admins can create templates in all zones");
} }
VMTemplateVO template = new VMTemplateVO(id, name, format, isPublic, featured, fs, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable, hyperType); VMTemplateVO template = new VMTemplateVO(id, name, format, isPublic, featured, type, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable, hyperType);
if (zoneId == null) { if (zoneId == null) {
List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved(); List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved();
@ -597,14 +597,14 @@ public class TemplateManagerImpl implements TemplateManager {
@Override @Override
public Long createInZone(long zoneId, long userId, String displayText, public Long createInZone(long zoneId, long userId, String displayText,
boolean isPublic, boolean featured, ImageFormat format, boolean isPublic, boolean featured, ImageFormat format,
FileSystem fs, URI url, String chksum, boolean requiresHvm, TemplateType type, URI url, String chksum, boolean requiresHvm,
int bits, boolean enablePassword, long guestOSId, boolean bootable) { int bits, boolean enablePassword, long guestOSId, boolean bootable) {
Long id = _tmpltDao.getNextInSequence(Long.class, "id"); Long id = _tmpltDao.getNextInSequence(Long.class, "id");
UserVO user = _userDao.findById(userId); UserVO user = _userDao.findById(userId);
long accountId = user.getAccountId(); long accountId = user.getAccountId();
VMTemplateVO template = new VMTemplateVO(id, displayText, format, isPublic, featured, fs, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable, null); VMTemplateVO template = new VMTemplateVO(id, displayText, format, isPublic, featured, type, url.toString(), requiresHvm, bits, accountId, chksum, displayText, enablePassword, guestOSId, bootable, null);
Long templateId = _tmpltDao.addTemplateToZone(template, zoneId); Long templateId = _tmpltDao.addTemplateToZone(template, zoneId);
UserAccount userAccount = _userAccountDao.findById(userId); UserAccount userAccount = _userAccountDao.findById(userId);

View File

@ -2510,15 +2510,9 @@ public class UserVmManagerImpl implements UserVmManager {
} }
if ((origTemplate != null) && !Storage.ImageFormat.ISO.equals(origTemplate.getFormat())) { if ((origTemplate != null) && !Storage.ImageFormat.ISO.equals(origTemplate.getFormat())) {
// We made a template from a root volume that was cloned from a
// template
privateTemplate.setFileSystem(origTemplate.getFileSystem());
privateTemplate.setRequiresHvm(origTemplate.requiresHvm()); privateTemplate.setRequiresHvm(origTemplate.requiresHvm());
privateTemplate.setBits(origTemplate.getBits()); privateTemplate.setBits(origTemplate.getBits());
} else { } else {
// We made a template from a root volume that was not cloned
// from a template, or a data volume
privateTemplate.setFileSystem(Storage.FileSystem.Unknown);
privateTemplate.setRequiresHvm(true); privateTemplate.setRequiresHvm(true);
privateTemplate.setBits(64); privateTemplate.setBits(64);
} }

View File

@ -1,19 +1,22 @@
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.0.0RC5/systemvm.vhd.bz2', '31cd7ce94fe68c973d5dc37c3349d02e', 0, 'SystemVM Template', 'VHD', 15, 0, 1, 'Xenserver'); VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'system', 0, 64, 1, 'http://download.cloud.com/releases/2.0.0RC5/systemvm.vhd.bz2', '31cd7ce94fe68c973d5dc37c3349d02e', 0, 'SystemVM Template', 'VHD', 15, 0, 1, 'Xenserver');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 11, 1, 1, 'Xenserver'); VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI', 1, now(), 'builtin', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 11, 1, 1, 'Xenserver');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (3, 'routing_kvm', 'SystemVM Template (KVM)', 0, now(), 'system', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/systemvm.qcow2.bz2', '78c91a8d2b3441fc5d5129399fca2bb9', 0, 'SystemVM Template KVM', 'QCOW2', 15, 0, 1, 'KVM');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (4, 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 112, 1, 1, 'KVM'); VALUES (4, 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI', 1, now(), 'builtin', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 112, 1, 1, 'KVM');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (5, 'blank', 'BlankVM', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/Blank.ova.bz2', '', 0, 'BlankVM', 'OVA', 47, 1, 1, 'VMware'); VALUES (5, 'blank', 'BlankVM', 1, now(), 'builtin', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/Blank.ova.bz2', '', 0, 'BlankVM', 'OVA', 47, 1, 1, 'VMware');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (6, 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'ntfs', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/WinXPSP3.ova.bz2', '', 0, 'WindowsXP-SP3', 'OVA', 58, 1, 1, 'VMware'); VALUES (6, 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'builtin', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/WinXPSP3.ova.bz2', '', 0, 'WindowsXP-SP3', 'OVA', 58, 1, 1, 'VMware');
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (7, 'centos53-x64', 'centos53-x64', 1, now(), 'ext3', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/CentOS5.3-x86_64.ova.bz2', '', 0, 'centos53-x64', 'OVA', 112, 1, 1, 'VMware'); VALUES (7, 'centos53-x64', 'centos53-x64', 1, now(), 'builtin', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/CentOS5.3-x86_64.ova.bz2', '', 0, 'centos53-x64', 'OVA', 112, 1, 1, 'VMware');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS');