clean up hypervisor.type, actually hypevisor.type may only make sense on the UI in multi-hypervisor.

In our java code, we should not write code based on hypervisor.type.
This commit is contained in:
edison 2010-09-28 09:53:25 -07:00
parent d478bb9d95
commit fb9f43d807
3 changed files with 8 additions and 9 deletions

View File

@ -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),

View File

@ -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;

View File

@ -132,7 +132,6 @@ public class SnapshotManagerImpl implements SnapshotManager {
protected SearchBuilder<SnapshotVO> PolicySnapshotSearch;
protected SearchBuilder<SnapshotPolicyVO> 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));