diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 978335a79b2..6693bb39a41 100644 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -23,6 +23,7 @@ import java.util.List; import com.cloud.agent.AgentManager; import com.cloud.ha.HighAvailabilityManager; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.NetworkManager; import com.cloud.server.ManagementServer; import com.cloud.storage.StorageManager; @@ -133,7 +134,8 @@ public enum Config { CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null), NetworkType("Advanced", ManagementServer.class, String.class, "network.type", "vlan", "The type of network that this deployment will use.", "vlan,direct"), LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null), - HypervisorType("Advanced", ManagementServer.class, String.class, "hypervisor.type", "kvm", "The type of hypervisor that this deployment will use.", "kvm,xenserver"), + HypervisorDefaultType("Advanced", ManagementServer.class, String.class, "hypervisor.type", HypervisorType.KVM.toString(), "The type of hypervisor that this deployment will use.", "kvm|xenserver"), + HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VmWare, "The type of hypervisor that this deployment will use.", "kvm,xenserver,vmware"), ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null), UseSecondaryStorageVm("Advanced", ManagementServer.class, Boolean.class, "secondary.storage.vm", "false", "Deploys a VM per zone to manage secondary storage if true, otherwise secondary storage is mounted on management server", null), EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "0", "Events older than specified number days will be purged", null), diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java index 16c47094675..e78c1e55e0d 100755 --- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java +++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java @@ -51,6 +51,7 @@ import com.cloud.exception.StorageUnavailableException; import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.StoragePoolHostVO; import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateStoragePoolVO; @@ -82,7 +83,6 @@ public class DownloadMonitorImpl implements DownloadMonitor { static final Logger s_logger = Logger.getLogger(DownloadMonitorImpl.class); private static final String DEFAULT_HTTP_COPY_PORT = "80"; - private String _hyperVisorType; @Inject VMTemplateHostDao _vmTemplateHostDao; @Inject @@ -143,11 +143,8 @@ public class DownloadMonitorImpl implements DownloadMonitor { s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs"); } - _hyperVisorType = _configDao.getValue("hypervisor.type"); - _copyAuthPasswd = configs.get("secstorage.copy.password"); - _agentMgr.registerForHostEvents(new DownloadListener(this), true, false, false); return true; } @@ -253,8 +250,11 @@ public class DownloadMonitorImpl implements DownloadMonitor { } return generateCopyUrl(ssVm.getPublicIpAddress(), srcTmpltHost.getInstallPath()); } + + VMTemplateVO tmplt = _templateDao.findById(srcTmpltHost.getTemplateId()); + HypervisorType hyperType = tmplt.getHypervisorType(); /*No secondary storage vm yet*/ - if (_hyperVisorType.equalsIgnoreCase("KVM")) { + if (hyperType != null && hyperType == HypervisorType.KVM) { return "file://" + sourceServer.getParent() + "/" + srcTmpltHost.getInstallPath(); } return null; diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index f8c9dafb76e..54f6631b40d 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -132,7 +132,6 @@ public class SnapshotManagerImpl implements SnapshotManager { protected SearchBuilder PolicySnapshotSearch; protected SearchBuilder PoliciesForSnapSearch; - private String _hypervisorType; private final boolean _shouldBeSnapshotCapable = true; // all methods here should be snapshot capable. @Override @DB @@ -997,8 +996,6 @@ public class SnapshotManagerImpl implements SnapshotManager { throw new ConfigurationException("Unable to get the configuration dao."); } - _hypervisorType = configDao.getValue("hypervisor.type"); - DateUtil.IntervalType.HOURLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.hourly"), HOURLYMAX)); DateUtil.IntervalType.DAILY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.daily"), DAILYMAX)); DateUtil.IntervalType.WEEKLY.setMax(NumbersUtil.parseInt(configDao.getValue("snapshot.max.weekly"), WEEKLYMAX));