return TemplateAdapterType.BareMetal.getName();
}
@Override
public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
TemplateProfile profile = super.prepare(cmd);
if (profile.getZoneId() == null || profile.getZoneId() == -1) {
List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved();
for (DataCenterVO dc : dcs) {
List<HostVO> pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, dc.getId());
if (pxeServers.size() == 0) {
throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + dc.getName());
}
}
} else {
List<HostVO> pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, profile.getZoneId());
if (pxeServers.size() == 0) {
throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + profile.getZoneId());
}
}
return profile;
}