From 4696b16d100cbf7ec8ad89800985ae060a720c1b Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 28 Jan 2011 11:07:39 -0800 Subject: [PATCH] Normalize name convention for vmware hypervisor --- api/src/com/cloud/hypervisor/Hypervisor.java | 6 +++--- server/src/com/cloud/agent/manager/AgentManagerImpl.java | 8 +++----- server/src/com/cloud/configuration/Config.java | 2 +- server/src/com/cloud/deploy/FirstFitPlanner.java | 1 + server/src/com/cloud/hypervisor/VMwareGuru.java | 2 +- server/src/com/cloud/network/guru/ControlNetworkGuru.java | 6 +++--- .../router/VirtualNetworkApplianceManagerImpl.java | 2 +- server/src/com/cloud/storage/StorageManagerImpl.java | 2 +- .../com/cloud/storage/listener/StoragePoolMonitor.java | 2 +- server/src/com/cloud/vm/UserVmManagerImpl.java | 2 +- 10 files changed, 16 insertions(+), 17 deletions(-) diff --git a/api/src/com/cloud/hypervisor/Hypervisor.java b/api/src/com/cloud/hypervisor/Hypervisor.java index cc063cd00dd..8e3805ea93b 100644 --- a/api/src/com/cloud/hypervisor/Hypervisor.java +++ b/api/src/com/cloud/hypervisor/Hypervisor.java @@ -24,7 +24,7 @@ public class Hypervisor { Xen, XenServer, KVM, - VmWare, + VMware, VirtualBox, Parralels, Any; /*If you don't care about the hypervisor type*/ @@ -40,8 +40,8 @@ public class Hypervisor { return HypervisorType.XenServer; } else if (hypervisor.equalsIgnoreCase("KVM")) { return HypervisorType.KVM; - } else if (hypervisor.equalsIgnoreCase("VmWare")) { - return HypervisorType.VmWare; + } else if (hypervisor.equalsIgnoreCase("VMware")) { + return HypervisorType.VMware; } else if (hypervisor.equalsIgnoreCase("VirtualBox")) { return HypervisorType.VirtualBox; } else if (hypervisor.equalsIgnoreCase("Parralels")) { diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 437e4c4bf76..7cd8e11979b 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -610,11 +610,9 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, "Please specify a hypervisor"); } - Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType - .valueOf(cmd.getHypervisor()); + Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.getType(cmd.getHypervisor()); if (hypervisorType == null) { - throw new InvalidParameterValueException( - "Please specify a valid hypervisor name"); + throw new InvalidParameterValueException("Please specify a valid hypervisor name"); } Cluster.ClusterType clusterType = null; @@ -2625,7 +2623,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, // If this command is from a KVM agent, or from an agent that has a // null hypervisor type, don't do the CIDR check if (hypervisorType == null || hypervisorType == HypervisorType.KVM - || hypervisorType == HypervisorType.VmWare) { + || hypervisorType == HypervisorType.VMware) { doCidrCheck = false; } diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index b04df36d541..5df4963fb75 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -138,7 +138,7 @@ 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), LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null), HypervisorDefaultType("Advanced", ManagementServer.class, String.class, "hypervisor.type", HypervisorType.KVM.toString(), "The type of hypervisor that this deployment will use.", "kvm,xenserver,vmware"), - HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VmWare, "The list of hypervisors that this deployment will use.", "hypervisorList"), + HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware, "The list of hypervisors that this deployment will use.", "hypervisorList"), ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null), EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "0", "Events older than specified number days will be purged", null), UseLocalStorage("Premium", ManagementServer.class, Boolean.class, "use.local.storage", "false", "Should we use the local storage if it's available?", null), diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java index 770b6fad6b2..8493f633bd9 100644 --- a/server/src/com/cloud/deploy/FirstFitPlanner.java +++ b/server/src/com/cloud/deploy/FirstFitPlanner.java @@ -63,6 +63,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner { s_logger.debug("try to allocate a host from dc:" + plan.getDataCenterId() + ", pod:" + plan.getPodId() + ",cluster:" + plan.getClusterId() + ", requested cpu: " + cpu_requested + ", requested ram: " + ram_requested); if (vm.getLastHostId() != null) { + HostVO host = _hostDao.findById(vm.getLastHostId()); if (host != null && host.getStatus() == Status.Up) { diff --git a/server/src/com/cloud/hypervisor/VMwareGuru.java b/server/src/com/cloud/hypervisor/VMwareGuru.java index fb7f90d189a..fa5e97b2971 100644 --- a/server/src/com/cloud/hypervisor/VMwareGuru.java +++ b/server/src/com/cloud/hypervisor/VMwareGuru.java @@ -38,7 +38,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { @Override public HypervisorType getHypervisorType() { - return HypervisorType.VmWare; + return HypervisorType.VMware; } @Override diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java index 3467d76e977..f81713ca443 100644 --- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java +++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java @@ -94,7 +94,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu return null; } - if(vm.getHypervisorType() == HypervisorType.VmWare && vm.getType() != VirtualMachine.Type.DomainRouter) { + if(vm.getHypervisorType() == HypervisorType.VMware && vm.getType() != VirtualMachine.Type.DomainRouter) { NicProfile nicProf = new NicProfile(Nic.ReservationStrategy.Create, null, null, null, null); String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId()); nicProf.setMacAddress(mac); @@ -117,7 +117,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu InsufficientAddressCapacityException { assert nic.getTrafficType() == TrafficType.Control; - if (dest.getHost().getHypervisorType() == HypervisorType.VmWare && vm.getType() == VirtualMachine.Type.DomainRouter) { + if (dest.getHost().getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) { super.reserve(nic, config, vm, dest, context); String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId()); @@ -137,7 +137,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) { assert nic.getTrafficType() == TrafficType.Control; - if (vm.getHypervisorType() == HypervisorType.VmWare && vm.getType() == VirtualMachine.Type.DomainRouter) { + if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) { super.release(nic, vm, reservationId); return true; } diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index d2534f912b0..02f209d2df0 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1049,7 +1049,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian } else if (nic.getTrafficType() == TrafficType.Control) { // DOMR control command is sent over management server in VMware - if (dest.getHost().getHypervisorType() == HypervisorType.VmWare) { + if (dest.getHost().getHypervisorType() == HypervisorType.VMware) { if(s_logger.isInfoEnabled()) { s_logger.info("Check if we need to add management server explicit route to DomR. pod cidr: " + dest.getPod().getCidrAddress() + "/" + dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + _mgmt_host); diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 1de507adab3..992415351ed 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2209,7 +2209,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag private boolean sendToVmResidesOn(StoragePoolVO storagePool, Command cmd) { ClusterVO cluster = _clusterDao.findById(storagePool.getClusterId()); - if ((cluster.getHypervisorType() == HypervisorType.KVM || cluster.getHypervisorType() == HypervisorType.VmWare) && + if ((cluster.getHypervisorType() == HypervisorType.KVM || cluster.getHypervisorType() == HypervisorType.VMware) && ((cmd instanceof ManageSnapshotCommand) || (cmd instanceof BackupSnapshotCommand))) { return true; diff --git a/server/src/com/cloud/storage/listener/StoragePoolMonitor.java b/server/src/com/cloud/storage/listener/StoragePoolMonitor.java index c9158cea010..f31a0b5cfac 100755 --- a/server/src/com/cloud/storage/listener/StoragePoolMonitor.java +++ b/server/src/com/cloud/storage/listener/StoragePoolMonitor.java @@ -70,7 +70,7 @@ public class StoragePoolMonitor implements Listener { if (cmd instanceof StartupRoutingCommand) { StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd; if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType() == HypervisorType.KVM || - scCmd.getHypervisorType() == HypervisorType.VmWare) { + scCmd.getHypervisorType() == HypervisorType.VMware) { List pools = _poolDao.listBy(host.getDataCenterId(), host.getPodId(), host.getClusterId()); for (StoragePoolVO pool : pools) { Long hostId = host.getId(); diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 98e10d01b7d..65e8109bc79 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -598,7 +598,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager if(hostId == null) { hostId = vm.getLastHostId(); HostVO host = _hostDao.findById(hostId); - if(host != null && host.getHypervisorType() == HypervisorType.VmWare) { + if(host != null && host.getHypervisorType() == HypervisorType.VMware) { sendCommand = true; } }