mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	step1
This commit is contained in:
		
							parent
							
								
									211b4c5da2
								
							
						
					
					
						commit
						3aef9f408e
					
				| @ -45,6 +45,10 @@ public class ClusterVO implements Cluster { | ||||
|     @Column(name="pod_id") | ||||
|     long podId; | ||||
|      | ||||
|     @Column(name="hypervisor_type") | ||||
|     String hypervisorType; | ||||
|      | ||||
|      | ||||
|     public ClusterVO() { | ||||
|     } | ||||
|      | ||||
| @ -70,6 +74,14 @@ public class ClusterVO implements Cluster { | ||||
|         return podId; | ||||
|     } | ||||
|      | ||||
|     public String getHypervisorType() { | ||||
|     	return hypervisorType; | ||||
|     } | ||||
|      | ||||
|     public void setHypervisorType(String hy) { | ||||
|     	hypervisorType = hy; | ||||
|     } | ||||
|      | ||||
|     public ClusterVO(long clusterId) { | ||||
|         this.id = clusterId; | ||||
|     } | ||||
|  | ||||
| @ -244,14 +244,14 @@ public class UserConcentratedAllocator implements PodAllocator { | ||||
|         		so = _offeringDao.findById(userVm.getServiceOfferingId()); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) { | ||||
|         		so = new ServiceOfferingVO("Fake Offering For DomP", 1, | ||||
|     				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|     				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) { | ||||
|         		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|         		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.DomainRouter) { | ||||
|                 so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|                 so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else { | ||||
|         		assert(false) : "Unsupported system vm type"; | ||||
|                 so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|                 so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} | ||||
|              | ||||
|             if(capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) { | ||||
|  | ||||
| @ -2303,7 +2303,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach | ||||
|         _networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr)); | ||||
|         _multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr)); | ||||
|         _serviceOffering = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, | ||||
|                 useLocalStorage, true, null); | ||||
|                 useLocalStorage, true, null, null); | ||||
|         _serviceOffering.setUniqueName("Cloud.com-ConsoleProxy"); | ||||
|         _serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering); | ||||
|         _template = _templateDao.findConsoleProxyTemplate(); | ||||
|  | ||||
| @ -21,11 +21,14 @@ import com.cloud.agent.api.Answer; | ||||
| import com.cloud.agent.api.Command; | ||||
| import com.cloud.agent.api.StartupCommand; | ||||
| import com.cloud.configuration.dao.ConfigurationDao; | ||||
| import com.cloud.dc.ClusterVO; | ||||
| import com.cloud.dc.dao.ClusterDao; | ||||
| import com.cloud.exception.DiscoveryException; | ||||
| import com.cloud.host.HostVO; | ||||
| import com.cloud.host.Status; | ||||
| import com.cloud.host.Status.Event; | ||||
| import com.cloud.host.dao.HostDao; | ||||
| import com.cloud.hypervisor.Hypervisor; | ||||
| import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase; | ||||
| import com.cloud.hypervisor.xen.resource.CitrixResourceBase; | ||||
| import com.cloud.resource.Discoverer; | ||||
| @ -47,6 +50,7 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer, | ||||
| 	 private String _hostIp; | ||||
| 	 private int _waitTime = 3; /*wait for 3 minutes*/ | ||||
| 	 @Inject HostDao _hostDao = null; | ||||
| 	 @Inject ClusterDao _clusterDao; | ||||
| 	  | ||||
| 	@Override | ||||
| 	public boolean processAnswer(long agentId, long seq, Answer[] answers) { | ||||
| @ -224,6 +228,11 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer, | ||||
| 			kvmResource.configure("kvm agent", params); | ||||
| 			kvmResource.setRemoteAgent(true); | ||||
| 			resources.put(kvmResource, details); | ||||
| 			 | ||||
| 			 /*set cluster hypervisor type to xenserver*/ | ||||
|             ClusterVO clu = _clusterDao.findById(clusterId); | ||||
|             clu.setHypervisorType(Hypervisor.Type.KVM.toString()); | ||||
|             _clusterDao.update(clusterId, clu); | ||||
| 			return resources; | ||||
| 		} catch (Exception e) { | ||||
| 			String msg = " can't setup agent, due to " + e.toString() + " - " + e.getMessage(); | ||||
|  | ||||
| @ -50,6 +50,7 @@ import com.cloud.host.HostInfo; | ||||
| import com.cloud.host.HostVO; | ||||
| import com.cloud.host.Status; | ||||
| import com.cloud.host.dao.HostDao; | ||||
| import com.cloud.hypervisor.Hypervisor; | ||||
| import com.cloud.hypervisor.xen.resource.CitrixResourceBase; | ||||
| import com.cloud.hypervisor.xen.resource.XcpServerResource; | ||||
| import com.cloud.hypervisor.xen.resource.XenServerResource; | ||||
| @ -245,6 +246,12 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L | ||||
|             if (!addHostsToPool(url, conn, dcId, podId, clusterId, resources)) { | ||||
|                 return null; | ||||
|             } | ||||
|              | ||||
|             /*set cluster hypervisor type to xenserver*/ | ||||
|             ClusterVO clu = _clusterDao.findById(clusterId); | ||||
|             clu.setHypervisorType(Hypervisor.Type.XenServer.toString()); | ||||
|             _clusterDao.update(clusterId, clu); | ||||
|              | ||||
|         } catch (SessionAuthenticationFailed e) { | ||||
|             s_logger.warn("Authentication error", e); | ||||
|             return null; | ||||
|  | ||||
| @ -1873,7 +1873,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | ||||
|         String multicastRateStr = _configDao.getValue("multicast.throttling.rate"); | ||||
|         _networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr)); | ||||
|         _multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr)); | ||||
|         _offering = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null); | ||||
|         _offering = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null, null); | ||||
|         _offering.setUniqueName("Cloud.Com-SoftwareRouter"); | ||||
|         _offering = _serviceOfferingDao.persistSystemServiceOffering(_offering); | ||||
|         _template = _templateDao.findRoutingTemplate(); | ||||
|  | ||||
| @ -119,14 +119,14 @@ public class ConfigurationServerImpl implements ConfigurationServer { | ||||
| 				_configDao.update("hypervisor.type", "xenserver"); | ||||
| 				s_logger.debug("ConfigurationServer changed the hypervisor type to \"xenserver\"."); | ||||
| 				 | ||||
| 				_configDao.update("secondary.storage.vm", "true"); | ||||
| 				s_logger.debug("ConfigurationServer made secondary storage vm required."); | ||||
| 				//_configDao.update("secondary.storage.vm", "true"); | ||||
| 				//s_logger.debug("ConfigurationServer made secondary storage vm required."); | ||||
| 				 | ||||
| 				_configDao.update("secstorage.encrypt.copy", "true"); | ||||
| 				s_logger.debug("ConfigurationServer made secondary storage copy encrypted."); | ||||
| 				//_configDao.update("secstorage.encrypt.copy", "true"); | ||||
| 				//s_logger.debug("ConfigurationServer made secondary storage copy encrypted."); | ||||
| 				 | ||||
| 				_configDao.update("secstorage.secure.copy.cert", "realhostip"); | ||||
| 				s_logger.debug("ConfigurationServer made secondary storage copy use realhostip.");					          	          | ||||
| 				//_configDao.update("secstorage.secure.copy.cert", "realhostip"); | ||||
| 				//s_logger.debug("ConfigurationServer made secondary storage copy use realhostip.");					          	          | ||||
| 			} | ||||
| 			 | ||||
| 			boolean externalIpAlloator = Boolean.parseBoolean(_configDao.getValue("direct.attach.network.externalIpAllocator.enabled")); | ||||
|  | ||||
| @ -4433,7 +4433,7 @@ public class ManagementServerImpl implements ManagementServer { | ||||
| 
 | ||||
|     @Override | ||||
|     public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) { | ||||
|         return _configMgr.createServiceOffering(userId, name, cpu, ramSize, speed, displayText, localStorageRequired, offerHA, useVirtualNetwork, tags); | ||||
|         return _configMgr.createServiceOffering(userId, name, cpu, ramSize, speed, displayText, localStorageRequired, offerHA, useVirtualNetwork, tags, null); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|  | ||||
| @ -146,14 +146,14 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator { | ||||
|     			so = _offeringDao.findById(userVm.getServiceOfferingId()); | ||||
|     	} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) { | ||||
|     		so = new ServiceOfferingVO("Fake Offering For DomP", 1, | ||||
| 				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
| 				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|     	} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) { | ||||
|     		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|     		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|     	} else if(vm.getType() == VirtualMachine.Type.DomainRouter) { | ||||
|             so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|             so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|     	} else { | ||||
|     		assert(false) : "Unsupported system vm type"; | ||||
|             so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|             so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|     	} | ||||
|     	 | ||||
|     	long usedMemory = calcHostAllocatedCpuMemoryCapacity(vmOnHost, CapacityVO.CAPACITY_TYPE_MEMORY); | ||||
| @ -243,14 +243,14 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator { | ||||
|         		so = _offeringDao.findById(userVm.getServiceOfferingId()); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.ConsoleProxy) { | ||||
|         		so = new ServiceOfferingVO("Fake Offering For DomP", 1, | ||||
|     				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|     				_proxyRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.SecondaryStorageVm) { | ||||
|         		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|         		so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else if(vm.getType() == VirtualMachine.Type.DomainRouter) { | ||||
|                 so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|                 so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} else { | ||||
|         		assert(false) : "Unsupported system vm type"; | ||||
|                 so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null); | ||||
|                 so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, false, true, null, null); | ||||
|         	} | ||||
|              | ||||
|             if(capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) { | ||||
|  | ||||
| @ -1390,7 +1390,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V | ||||
|         String multicastRateStr = _configDao.getValue("multicast.throttling.rate"); | ||||
|         _networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr)); | ||||
|         _multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr)); | ||||
| 		_serviceOffering = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null); | ||||
| 		_serviceOffering = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, false, null, NetworkOffering.GuestIpType.Virtualized, useLocalStorage, true, null, null); | ||||
| 		_serviceOffering.setUniqueName("Cloud.com-SecondaryStorage"); | ||||
| 		_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering); | ||||
|         _template = _templateDao.findConsoleProxyTemplate(); | ||||
|  | ||||
| @ -741,7 +741,7 @@ public class DatabaseConfig { | ||||
|         	useLocalStorage = false; | ||||
|         } | ||||
|          | ||||
|         ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, nwRate, mcRate, ha, displayText, type, useLocalStorage, false, null); | ||||
|         ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, nwRate, mcRate, ha, displayText, type, useLocalStorage, false, null, null); | ||||
|         ServiceOfferingDaoImpl dao = ComponentLocator.inject(ServiceOfferingDaoImpl.class); | ||||
|         try { | ||||
|             dao.persist(serviceOffering); | ||||
|  | ||||
| @ -162,6 +162,7 @@ CREATE TABLE `cloud`.`cluster` ( | ||||
|   `name` varchar(255) NOT NULL COMMENT 'name for the cluster', | ||||
|   `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', | ||||
|   `data_center_id` bigint unsigned NOT NULL COMMENT 'data center id', | ||||
|   `hypervisor_type` varchar(255) NOT NULL, | ||||
|   PRIMARY KEY (`id`) | ||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user