diff --git a/agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java b/agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java new file mode 100644 index 00000000000..ce6ae1b8a81 --- /dev/null +++ b/agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java @@ -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 s_mapper = new HashMap(); + 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; + } + } +} + diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index 6baaf9ee9da..82dbcf7cd22 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -3092,24 +3092,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv private boolean isGuestPVEnabled(String guestOS) { if (guestOS == null) return false; - if (guestOS.startsWith("Ubuntu 10.04") || - guestOS.startsWith("Ubuntu 9") || - guestOS.startsWith("Ubuntu 8.10") || - guestOS.startsWith("Fedora 13") || - guestOS.startsWith("Fedora 12") || - guestOS.startsWith("Fedora 11") || - guestOS.startsWith("Fedora 10") || - guestOS.startsWith("Fedora 9") || - guestOS.startsWith("CentOS 5.3") || - guestOS.startsWith("CentOS 5.4") || - guestOS.startsWith("CentOS 5.5") || - guestOS.startsWith("Red Hat Enterprise Linux 5.3") || - guestOS.startsWith("Red Hat Enterprise Linux 5.4") || - guestOS.startsWith("Red Hat Enterprise Linux 5.5") || - guestOS.startsWith("Red Hat Enterprise Linux 6") || - guestOS.startsWith("Debain Lenney") || - guestOS.startsWith("Debain Squeeze") - ) + String guestOSName = KVMGuestOsMapper.getGuestOsName(guestOS); + if (guestOSName.startsWith("Ubuntu 10.04") || + guestOSName.startsWith("Ubuntu 9") || + guestOSName.startsWith("Ubuntu 8.10") || + guestOSName.startsWith("Fedora 13") || + guestOSName.startsWith("Fedora 12") || + guestOSName.startsWith("Fedora 11") || + guestOSName.startsWith("Fedora 10") || + guestOSName.startsWith("Fedora 9") || + guestOSName.startsWith("CentOS 5.3") || + guestOSName.startsWith("CentOS 5.4") || + guestOSName.startsWith("CentOS 5.5") || + guestOSName.startsWith("Red Hat Enterprise Linux 5.3") || + guestOSName.startsWith("Red Hat Enterprise Linux 5.4") || + guestOSName.startsWith("Red Hat Enterprise Linux 5.5") || + guestOSName.startsWith("Red Hat Enterprise Linux 6") || + guestOSName.startsWith("Debian GNU/Linux") + ) return true; else return false; diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/com/cloud/storage/Storage.java index 6905255e678..6eb07ec51ed 100644 --- a/api/src/com/cloud/storage/Storage.java +++ b/api/src/com/cloud/storage/Storage.java @@ -79,6 +79,11 @@ public class Storage { hfsp } + public static enum TemplateType { + SYSTEM, + BUILTIN + } + public static enum StoragePoolType { Filesystem(false), //local directory NetworkFilesystem(true), //NFS or CIFS diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/com/cloud/template/VirtualMachineTemplate.java index 0cdffe856d8..1697c1f5a3b 100755 --- a/api/src/com/cloud/template/VirtualMachineTemplate.java +++ b/api/src/com/cloud/template/VirtualMachineTemplate.java @@ -37,10 +37,5 @@ public interface VirtualMachineTemplate { * @return name */ String getName(); - - /** - * @return the file system for this template. - */ - FileSystem getFileSystem(); } diff --git a/core/src/com/cloud/storage/VMTemplateVO.java b/core/src/com/cloud/storage/VMTemplateVO.java index 00d79d9c793..f21e28a1b85 100644 --- a/core/src/com/cloud/storage/VMTemplateVO.java +++ b/core/src/com/cloud/storage/VMTemplateVO.java @@ -35,6 +35,7 @@ import com.cloud.async.AsyncInstanceCreateStatus; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.FileSystem; import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Storage.TemplateType; import com.cloud.utils.db.GenericDao; import com.google.gson.annotations.Expose; import com.cloud.storage.Storage; @@ -64,7 +65,7 @@ public class VMTemplateVO implements VirtualMachineTemplate { private boolean featured; @Column(name="type") - private FileSystem fileSystem = null; + private Storage.TemplateType templateType; @Column(name="url") private String url = null; @@ -125,16 +126,16 @@ public class VMTemplateVO implements VirtualMachineTemplate { /** * 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) { - this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, fs, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, 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, 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.name = name; this.publicTemplate = isPublic; this.featured = featured; - this.fileSystem = fs; + this.templateType = type; this.url = url; this.requiresHvm = requiresHvm; this.bits = bits; @@ -181,13 +182,12 @@ public class VMTemplateVO implements VirtualMachineTemplate { return id; } - @Override - public FileSystem getFileSystem() { - return fileSystem; + public TemplateType getTemplateType() { + return templateType; } - public void setFileSystem(FileSystem fs) { - this.fileSystem = fs; + public void setTemplateType(TemplateType type) { + this.templateType = type; } public boolean requiresHvm() { @@ -300,8 +300,8 @@ public class VMTemplateVO implements VirtualMachineTemplate { return HypervisorType.getType(hypervisorType); } - public void setHypervisorType(HypervisorType hyper) { - hypervisorType = hyper.toString(); + public void setHypervisorType(HypervisorType hyperType) { + hypervisorType = hyperType.toString(); } @Override @@ -313,8 +313,7 @@ public class VMTemplateVO implements VirtualMachineTemplate { } VMTemplateVO other = (VMTemplateVO)that; - return (this.getUniqueName().equals(other.getUniqueName())); - + return ((this.getUniqueName().equals(other.getUniqueName()))); } @Override diff --git a/core/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java b/core/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java index fd6eda64a99..d2a2aba925c 100644 --- a/core/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java +++ b/core/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java @@ -30,7 +30,7 @@ import org.apache.log4j.Logger; import com.cloud.storage.LaunchPermissionVO; 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.utils.DateUtil; import com.cloud.utils.db.GenericDaoBase; @@ -120,7 +120,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase { //finds by the column "name" public VMTemplateVO findByTemplateName(String templateName); //public void update(VMTemplateVO template); - public VMTemplateVO findRoutingTemplate(); + public VMTemplateVO findRoutingTemplate(); + public List listAllRoutingTemplates(); public VMTemplateVO findConsoleProxyTemplate(); - public VMTemplateVO findDefaultBuiltinTemplate(); + public List listDefaultBuiltinTemplates(); public String getRoutingTemplateUniqueName(); public List findIsosByIdAndPath(Long domainId, Long accountId, String path); public List listReadyTemplates(); diff --git a/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java index fe63f235d74..e178e2704f1 100644 --- a/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java +++ b/core/src/com/cloud/storage/dao/VMTemplateDaoImpl.java @@ -31,8 +31,10 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.domain.DomainVO; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.SnapshotPolicyVO; import com.cloud.storage.Storage; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateZoneVO; @@ -49,21 +51,23 @@ import com.cloud.utils.exception.CloudRuntimeException; @Local(value={VMTemplateDao.class}) public class VMTemplateDaoImpl extends GenericDaoBase implements VMTemplateDao { private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class); + private HypervisorType _defaultHyperType; @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, " + - "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones 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=? "; + "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 SearchBuilder TemplateNameSearch; - protected SearchBuilder UniqueNameSearch; + protected SearchBuilder UniqueNameSearch; + protected SearchBuilder tmpltTypeSearch; + protected SearchBuilder tmpltTypeHyperSearch; protected SearchBuilder AccountIdSearch; - protected SearchBuilder NameSearch; + protected SearchBuilder NameSearch; + protected SearchBuilder TmpltsInZoneSearch; protected SearchBuilder PublicSearch; private String routerTmpltName; @@ -91,19 +95,22 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem sc.setParameters("name", templateName); return findOneIncludingRemovedBy(sc); } + + @Override + public List listAllRoutingTemplates() { + SearchCriteria sc = tmpltTypeSearch.create(); + sc.setParameters("templateType", Storage.TemplateType.SYSTEM); + return listBy(sc); + } @Override public VMTemplateVO findRoutingTemplate() { - SearchCriteria sc = UniqueNameSearch.create(); - sc.setParameters("uniqueName", routerTmpltName); - return findOneIncludingRemovedBy(sc); + return findSystemVMTemplate(); } @Override public VMTemplateVO findConsoleProxyTemplate() { - SearchCriteria sc = UniqueNameSearch.create(); - sc.setParameters("uniqueName", consoleProxyTmpltName); - return findOneIncludingRemovedBy(sc); + return findSystemVMTemplate(); } @Override @@ -166,13 +173,31 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem UniqueNameSearch = createSearchBuilder(); UniqueNameSearch.and("uniqueName", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ); 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.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ); AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ); - AccountIdSearch.done(); - + AccountIdSearch.done(); + + SearchBuilder 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; } @@ -330,29 +355,41 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem @Override @DB public List listAllInZone(long dataCenterId) { - Transaction txn = Transaction.currentTxn(); - txn.start(); - PreparedStatement pstmt = null; - List result = new ArrayList(); - 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; + SearchCriteria sc = TmpltsInZoneSearch.create(); + sc.setJoinParameters("tmpltzone", "zoneId", dataCenterId); + return listBy(sc); } @Override - public VMTemplateVO findDefaultBuiltinTemplate() { - return findById(TemplateConstants.DEFAULT_BUILTIN_VM_DB_ID); + public List listDefaultBuiltinTemplates() { + SearchCriteria sc = tmpltTypeSearch.create(); + sc.setParameters("templateType", Storage.TemplateType.BUILTIN); + return listBy(sc); + } + + private VMTemplateVO findSystemVMTemplate() { + SearchCriteria 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; } } diff --git a/server/src/com/cloud/api/BaseCmd.java b/server/src/com/cloud/api/BaseCmd.java index c0c0970bd42..807bc7a1acb 100755 --- a/server/src/com/cloud/api/BaseCmd.java +++ b/server/src/com/cloud/api/BaseCmd.java @@ -358,6 +358,7 @@ public abstract class BaseCmd { TEMPLATE_NAME("templatename", BaseCmd.TYPE_STRING, "templateName"), TEMPLATE_DISPLAY_TEXT("templatedisplaytext", BaseCmd.TYPE_STRING, "templateDisplayText"), TEMPLATE_STATUS("templatestatus", BaseCmd.TYPE_STRING, "templateStatus"), + TEMPLATE_Type("templatetype", BaseCmd.TYPE_STRING, "templateType"), TEMPLATE_TOTAL("templatetotal", BaseCmd.TYPE_INT, "templatetotal"), TIMEZONE("timezone", BaseCmd.TYPE_STRING, "timezone"), TIMEZONE_OFFSET("timezoneoffset", BaseCmd.TYPE_FLOAT, "timezoneOffset"), diff --git a/server/src/com/cloud/api/commands/ListTemplatesCmd.java b/server/src/com/cloud/api/commands/ListTemplatesCmd.java index deeea51f129..7c0b5988568 100644 --- a/server/src/com/cloud/api/commands/ListTemplatesCmd.java +++ b/server/src/com/cloud/api/commands/ListTemplatesCmd.java @@ -172,6 +172,7 @@ public class ListTemplatesCmd extends BaseCmd { templateData.add(new Pair(BaseCmd.Properties.PASSWORD_ENABLED.getName(), Boolean.valueOf(template.getEnablePassword()).toString())); templateData.add(new Pair(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(template.isCrossZones()).toString())); templateData.add(new Pair(BaseCmd.Properties.FORMAT.getName(), template.getFormat())); + templateData.add(new Pair(BaseCmd.Properties.TEMPLATE_Type.getName(), template.getTemplateType())); GuestOS os = getManagementServer().findGuestOSById(template.getGuestOSId()); if (os != null) { diff --git a/server/src/com/cloud/api/commands/RegisterIsoCmd.java b/server/src/com/cloud/api/commands/RegisterIsoCmd.java index 89d5a830384..d4024adcafe 100755 --- a/server/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/server/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -149,7 +149,7 @@ public class RegisterIsoCmd extends BaseCmd { Long templateId; 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) { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } diff --git a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java index 100468d7a04..64b4b78bb3c 100755 --- a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -165,7 +165,7 @@ public class RegisterTemplateCmd extends BaseCmd { Long templateId; 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) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + ipve.getMessage()); } catch (IllegalArgumentException iae) { diff --git a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index ca77f49a552..31068a1f050 100644 --- a/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -487,14 +487,14 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L if ((tmplts != null) && !tmplts.isEmpty()) { TemplateInfo xenPVISO = tmplts.get("xs-tools"); if (xenPVISO != null) { - VMTemplateVO tmplt = _tmpltDao.findByName(xenPVISO.getTemplateName()); + VMTemplateVO tmplt = _tmpltDao.findByTemplateName(xenPVISO.getTemplateName()); Long id; if (tmplt == null) { 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); } else { - id = _tmpltDao.findByName(xenPVISO.getTemplateName()).getId(); + id = _tmpltDao.findByTemplateName(xenPVISO.getTemplateName()).getId(); } VMTemplateHostVO tmpltHost = _vmTemplateHostDao.findByHostTemplate(Hostid, id); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 7682655daba..8b861dd2914 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -5010,12 +5010,7 @@ public class ManagementServerImpl implements ManagementServer { ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase()); if (imgfmt == null) { 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); if ((uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("http") && !uri.getScheme().equalsIgnoreCase("https") && !uri.getScheme().equalsIgnoreCase("file"))) { @@ -5060,7 +5055,7 @@ public class ManagementServerImpl implements ManagementServer { 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) { throw new IllegalArgumentException("Invalid URL " + url); } diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java index e78c1e55e0d..74a78a78027 100755 --- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java +++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java @@ -420,16 +420,24 @@ public class DownloadMonitorImpl implements DownloadMonitor { Set toBeDownloaded = new HashSet(); List allTemplates = _templateDao.listAllInZone(storageHost.getDataCenterId()); - VMTemplateVO rtngTmplt = _templateDao.findRoutingTemplate(); - VMTemplateVO defaultBuiltin = _templateDao.findDefaultBuiltinTemplate(); + List rtngTmplts = _templateDao.listAllRoutingTemplates(); + List defaultBuiltin = _templateDao.listDefaultBuiltinTemplates(); - if (rtngTmplt != null && !allTemplates.contains(rtngTmplt)) - allTemplates.add(rtngTmplt); - - if (defaultBuiltin != null && !allTemplates.contains(defaultBuiltin)) { - allTemplates.add(defaultBuiltin); + if (rtngTmplts != null) { + for (VMTemplateVO rtngTmplt : rtngTmplts) { + if (!allTemplates.contains(rtngTmplt)) + allTemplates.add(rtngTmplt); + } } + if (defaultBuiltin != null) { + for (VMTemplateVO builtinTmplt : defaultBuiltin) { + if (!allTemplates.contains(builtinTmplt)) { + allTemplates.add(builtinTmplt); + } + } + } + for (Iterator i = allTemplates.iterator();i.hasNext();) { if (i.next().getName().startsWith("xs-tools")) { i.remove(); diff --git a/server/src/com/cloud/template/TemplateManager.java b/server/src/com/cloud/template/TemplateManager.java index 1bf24a1ec16..7ffeb2f1040 100755 --- a/server/src/com/cloud/template/TemplateManager.java +++ b/server/src/com/cloud/template/TemplateManager.java @@ -29,7 +29,7 @@ import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateStoragePoolVO; 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.dao.VMTemplateDao.TemplateFilter; 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 * @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 @@ -84,7 +84,7 @@ public interface TemplateManager extends Manager { * @param bootable true if this template will represent a bootable ISO * @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. diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index 259d97d9087..2b14b9b77b5 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -56,7 +56,7 @@ import com.cloud.storage.VMTemplateStoragePoolVO; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateZoneVO; 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.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.dao.SnapshotDao; @@ -118,7 +118,7 @@ public class TemplateManagerImpl implements TemplateManager { @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"); 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"); } - 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) { List dcs = _dcDao.listAllIncludingRemoved(); @@ -597,14 +597,14 @@ public class TemplateManagerImpl implements TemplateManager { @Override public Long createInZone(long zoneId, long userId, String displayText, 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) { Long id = _tmpltDao.getNextInSequence(Long.class, "id"); UserVO user = _userDao.findById(userId); 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); UserAccount userAccount = _userAccountDao.findById(userId); diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index db9119d6774..b100de6869d 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2510,15 +2510,9 @@ public class UserVmManagerImpl implements UserVmManager { } 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.setBits(origTemplate.getBits()); } 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.setBits(64); } diff --git a/setup/db/templates.sql b/setup/db/templates.sql index 8c0506f488f..8d00c5a1074 100644 --- a/setup/db/templates.sql +++ b/setup/db/templates.sql @@ -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) - 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) - 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) - 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) - 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) - 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) - 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');