mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	more file changes
This commit is contained in:
		
							parent
							
								
									b0acdbcf8b
								
							
						
					
					
						commit
						6134f7dfd2
					
				| @ -19,7 +19,9 @@ package com.cloud.host; | |||||||
| 
 | 
 | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.host.Status; | ||||||
| import com.cloud.hypervisor.Hypervisor; | import com.cloud.hypervisor.Hypervisor; | ||||||
|  | import com.cloud.hypervisor.Hypervisor.Type; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -8,9 +8,16 @@ import com.cloud.network.Network.Mode; | |||||||
| import com.cloud.network.Network.TrafficType; | import com.cloud.network.Network.TrafficType; | ||||||
| import com.cloud.user.OwnedBy; | import com.cloud.user.OwnedBy; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * A NetworkProfile defines the specifics of a network | ||||||
|  |  * owned by an account.  | ||||||
|  |  */ | ||||||
| public interface NetworkProfile extends OwnedBy { | public interface NetworkProfile extends OwnedBy { | ||||||
|      |      | ||||||
|     long getId(); |     /** | ||||||
|  |      * @return id of the network profile.  Null means the network profile is not from the database. | ||||||
|  |      */ | ||||||
|  |     Long getId(); | ||||||
| 
 | 
 | ||||||
|     Mode getMode(); |     Mode getMode(); | ||||||
| 
 | 
 | ||||||
| @ -23,4 +30,6 @@ public interface NetworkProfile extends OwnedBy { | |||||||
|     String getCidr(); |     String getCidr(); | ||||||
| 
 | 
 | ||||||
|     void setCidr(String cidr); |     void setCidr(String cidr); | ||||||
|  |      | ||||||
|  |     long getNetworkOfferingId(); | ||||||
| } | } | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ package com.cloud.network; | |||||||
| 
 | 
 | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import com.cloud.exception.ConflictingNetworkSettingsException; | import com.cloud.exception.ConflictingNetworkSettingsException; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| @ -20,6 +21,8 @@ import com.cloud.vm.VirtualMachine; | |||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| public interface NetworkProfiler extends Adapter { | public interface NetworkProfiler extends Adapter { | ||||||
|  |     NetworkProfile convert(NetworkOffering offering, Map<String, String> params, Account owner); | ||||||
|  |      | ||||||
|     List<? extends NetworkProfile>  convert(Collection<? extends NetworkOffering> networkOfferings, Account owner); |     List<? extends NetworkProfile>  convert(Collection<? extends NetworkOffering> networkOfferings, Account owner); | ||||||
|     boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkProfile> networkProfiles) throws ConflictingNetworkSettingsException; |     boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkProfile> networkProfiles) throws ConflictingNetworkSettingsException; | ||||||
| } | } | ||||||
|  | |||||||
| @ -3,7 +3,9 @@ | |||||||
|  */ |  */ | ||||||
| package com.cloud.vm; | package com.cloud.vm; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.exception.InsufficientAddressCapacityException; | ||||||
| import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | import com.cloud.exception.InsufficientVirtualNetworkCapcityException; | ||||||
|  | import com.cloud.network.NetworkProfile; | ||||||
| import com.cloud.utils.Pair; | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.component.Adapter; | import com.cloud.utils.component.Adapter; | ||||||
| 
 | 
 | ||||||
| @ -16,8 +18,10 @@ import com.cloud.utils.component.Adapter; | |||||||
|  */ |  */ | ||||||
| public interface NetworkConcierge extends Adapter { | public interface NetworkConcierge extends Adapter { | ||||||
|     String getUniqueName(); |     String getUniqueName(); | ||||||
|  | 
 | ||||||
|  |     Nic allocate(VirtualMachine vm, NetworkProfile profile, Nic nic); | ||||||
|      |      | ||||||
|     Pair<String, String> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException; |     Pair<String, String> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException; | ||||||
|      |      | ||||||
|     boolean release(String uniqueName, String uniqueId); |     boolean release(String uniqueName, String uniqueId); | ||||||
| } | } | ||||||
|  | |||||||
| @ -17,6 +17,8 @@ | |||||||
|  */ |  */ | ||||||
| package com.cloud.vm; | package com.cloud.vm; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.network.Network.Mode; | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Nic represents one nic on the VM. |  * Nic represents one nic on the VM. | ||||||
| @ -50,4 +52,6 @@ public interface Nic { | |||||||
|     long getInstanceId(); |     long getInstanceId(); | ||||||
|      |      | ||||||
|     long getDeviceId(); |     long getDeviceId(); | ||||||
|  |      | ||||||
|  |     Mode getMode(); | ||||||
| } | } | ||||||
|  | |||||||
| @ -29,6 +29,7 @@ public class VmCharacteristics { | |||||||
|     Hypervisor.Type hypervisorType; |     Hypervisor.Type hypervisorType; | ||||||
|     VirtualMachine.Type type; |     VirtualMachine.Type type; | ||||||
|     Map<String, String> params; |     Map<String, String> params; | ||||||
|  |     Long templateId; | ||||||
|      |      | ||||||
|     public VmCharacteristics(VirtualMachine.Type type) { |     public VmCharacteristics(VirtualMachine.Type type) { | ||||||
|         this.type = type; |         this.type = type; | ||||||
| @ -38,6 +39,9 @@ public class VmCharacteristics { | |||||||
|         return type; |         return type; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     public Long getTemplateId() { | ||||||
|  |         return templateId; | ||||||
|  |     } | ||||||
|      |      | ||||||
|     public int getCores() { |     public int getCores() { | ||||||
|         return core; |         return core; | ||||||
| @ -55,15 +59,21 @@ public class VmCharacteristics { | |||||||
|         return hypervisorType; |         return hypervisorType; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public VmCharacteristics(long id, int core, int speed, long ram, Hypervisor.Type type, Map<String, String> params) { |     public VmCharacteristics(long id, int core, int speed, long ram, Long templateId, Hypervisor.Type type, Map<String, String> params) { | ||||||
|         this.core = core; |         this.core = core; | ||||||
|         this.speed = speed; |         this.speed = speed; | ||||||
|         this.ram = ram; |         this.ram = ram; | ||||||
|         this.hypervisorType = type; |         this.hypervisorType = type; | ||||||
|         this.params = params; |         this.params = params; | ||||||
|         this.id = id; |         this.id = id; | ||||||
|  |         this.templateId = templateId; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     protected VmCharacteristics() { |     protected VmCharacteristics() { | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public String toString() { | ||||||
|  |         return "VM-" + type + "-" + id; | ||||||
|  |     } | ||||||
| } | } | ||||||
| @ -44,6 +44,7 @@ import com.cloud.uservm.UserVm; | |||||||
| import com.cloud.utils.Pair; | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.component.Manager; | import com.cloud.utils.component.Manager; | ||||||
| import com.cloud.vm.VMInstanceVO; | import com.cloud.vm.VMInstanceVO; | ||||||
|  | import com.cloud.vm.VmCharacteristics; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * AgentManager manages hosts.  It directly coordinates between the |  * AgentManager manages hosts.  It directly coordinates between the | ||||||
| @ -178,6 +179,8 @@ public interface AgentManager extends Manager { | |||||||
| 	 * @return | 	 * @return | ||||||
| 	 */ | 	 */ | ||||||
|     Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids); |     Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids); | ||||||
|  |      | ||||||
|  |     Host findHost(VmCharacteristics vm, Set<? extends Host> avoids); | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Put the agent in maintenance mode. |      * Put the agent in maintenance mode. | ||||||
|  | |||||||
| @ -24,11 +24,12 @@ import javax.persistence.GenerationType; | |||||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.org.Cluster; | ||||||
| import com.cloud.utils.NumbersUtil; | import com.cloud.utils.NumbersUtil; | ||||||
| 
 | 
 | ||||||
| @Entity | @Entity | ||||||
| @Table(name="cluster") | @Table(name="cluster") | ||||||
| public class ClusterVO { | public class ClusterVO implements Cluster { | ||||||
| 
 | 
 | ||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy = GenerationType.IDENTITY) |     @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||
|  | |||||||
| @ -28,12 +28,12 @@ import javax.persistence.TableGenerator; | |||||||
| 
 | 
 | ||||||
| @Entity | @Entity | ||||||
| @Table(name="data_center") | @Table(name="data_center") | ||||||
| public class DataCenterVO { | public class DataCenterVO implements DataCenter { | ||||||
|      |      | ||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy=GenerationType.IDENTITY) |     @GeneratedValue(strategy=GenerationType.IDENTITY) | ||||||
|     @Column(name="id") |     @Column(name="id") | ||||||
|     private Long id = null; |     private long id; | ||||||
|      |      | ||||||
| 	@Column(name="name") | 	@Column(name="name") | ||||||
| 	private String name = null; | 	private String name = null; | ||||||
| @ -66,20 +66,20 @@ public class DataCenterVO { | |||||||
|     @TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1) |     @TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1) | ||||||
|     private long macAddress = 1; |     private long macAddress = 1; | ||||||
|      |      | ||||||
|     public DataCenterVO(Long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr) { |     public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr) { | ||||||
|  |         this(name, description, dns1, dns2, dns3, dns4, vnet, guestCidr); | ||||||
|         this.id = id; |         this.id = id; | ||||||
| 		this.name = name; |  | ||||||
| 		this.description = description; |  | ||||||
| 		this.dns1 = dns1; |  | ||||||
| 		this.dns2 = dns2; |  | ||||||
| 		this.internalDns1 = dns3; |  | ||||||
| 		this.internalDns2 = dns4; |  | ||||||
| 		this.vnet = vnet; |  | ||||||
| 		this.guestNetworkCidr = guestCidr; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|     public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr) { |     public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr) { | ||||||
|         this(null, name, description, dns1, dns2, dns3, dns4, vnet, guestCidr); |         this.name = name; | ||||||
|  |         this.description = description; | ||||||
|  |         this.dns1 = dns1; | ||||||
|  |         this.dns2 = dns2; | ||||||
|  |         this.internalDns1 = dns3; | ||||||
|  |         this.internalDns2 = dns4; | ||||||
|  |         this.vnet = vnet; | ||||||
|  |         this.guestNetworkCidr = guestCidr; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public String getDescription() { |     public String getDescription() { | ||||||
| @ -117,7 +117,8 @@ public class DataCenterVO { | |||||||
| 	protected DataCenterVO() { | 	protected DataCenterVO() { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 	public Long getId() { | 	@Override | ||||||
|  |     public long getId() { | ||||||
| 		return id; | 		return id; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ import com.cloud.utils.NumbersUtil; | |||||||
| 
 | 
 | ||||||
| @Entity | @Entity | ||||||
| @Table(name = "host_pod_ref") | @Table(name = "host_pod_ref") | ||||||
| public class HostPodVO { | public class HostPodVO implements Pod { | ||||||
| 	@Id | 	@Id | ||||||
| 	@GeneratedValue(strategy = GenerationType.IDENTITY) | 	@GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||
| 	long id; | 	long id; | ||||||
| @ -67,7 +67,8 @@ public class HostPodVO { | |||||||
| 	protected HostPodVO() { | 	protected HostPodVO() { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public long getId() { | 	@Override | ||||||
|  |     public long getId() { | ||||||
| 		return id; | 		return id; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -37,8 +37,9 @@ import com.cloud.utils.db.GenericDao; | |||||||
| public class NetworkOfferingVO implements NetworkOffering { | public class NetworkOfferingVO implements NetworkOffering { | ||||||
|     public final static String SystemVmPublicNetwork = "System-Vm-Public-Network"; |     public final static String SystemVmPublicNetwork = "System-Vm-Public-Network"; | ||||||
|     public final static String SystemVmGuestNetwork = "System-Vm-Guest-Network"; |     public final static String SystemVmGuestNetwork = "System-Vm-Guest-Network"; | ||||||
|     public final static String SystemVmLinkLocalNetwork = "System-Vm-LinkLocal-Network"; |     public final static String SystemVmControlNetwork = "System-Vm-Control-Network"; | ||||||
|     public final static String SystemVmManagementNetwork = "System-Vm-Management-Network"; |     public final static String SystemVmManagementNetwork = "System-Vm-Management-Network"; | ||||||
|  |     public final static String SystemVmStorageNetwork = "System-Vm-Storage-Network"; | ||||||
|      |      | ||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy=GenerationType.IDENTITY) |     @GeneratedValue(strategy=GenerationType.IDENTITY) | ||||||
| @ -71,6 +72,9 @@ public class NetworkOfferingVO implements NetworkOffering { | |||||||
|     @Column(name="system_only") |     @Column(name="system_only") | ||||||
|     boolean systemOnly; |     boolean systemOnly; | ||||||
|      |      | ||||||
|  |     @Column(name="tags") | ||||||
|  |     String tags; | ||||||
|  |      | ||||||
|     @Column(name=GenericDao.REMOVED_COLUMN) |     @Column(name=GenericDao.REMOVED_COLUMN) | ||||||
|     Date removed; |     Date removed; | ||||||
|      |      | ||||||
| @ -129,6 +133,14 @@ public class NetworkOfferingVO implements NetworkOffering { | |||||||
|         return concurrentConnections; |         return concurrentConnections; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     public String getTags() { | ||||||
|  |         return tags; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public void setTags(String tags) { | ||||||
|  |         this.tags = tags; | ||||||
|  |     } | ||||||
|  |      | ||||||
|     public NetworkOfferingVO() { |     public NetworkOfferingVO() { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | |||||||
| @ -33,6 +33,7 @@ import com.cloud.exception.StorageUnavailableException; | |||||||
| import com.cloud.host.Host; | import com.cloud.host.Host; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
|  | import com.cloud.storage.Volume.VolumeType; | ||||||
| import com.cloud.user.Account; | import com.cloud.user.Account; | ||||||
| import com.cloud.user.AccountVO; | import com.cloud.user.AccountVO; | ||||||
| import com.cloud.utils.Pair; | import com.cloud.utils.Pair; | ||||||
| @ -314,4 +315,20 @@ public interface StorageManager extends Manager { | |||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public boolean cancelPrimaryStorageForMaintenance(long primaryStorageId, long userId); |     public boolean cancelPrimaryStorageForMaintenance(long primaryStorageId, long userId); | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * Allocates one volume. | ||||||
|  |      * @param <T> | ||||||
|  |      * @param type | ||||||
|  |      * @param offering | ||||||
|  |      * @param name | ||||||
|  |      * @param size | ||||||
|  |      * @param template | ||||||
|  |      * @param vm | ||||||
|  |      * @param account | ||||||
|  |      * @return VolumeVO a persisted volume. | ||||||
|  |      */ | ||||||
|  |     <T extends VMInstanceVO> VolumeVO allocate(VolumeType type, DiskOfferingVO offering, String name, Long size, VMTemplateVO template, T vm, AccountVO account); | ||||||
|  |      | ||||||
|  |     <T extends VMInstanceVO> void create(T vm); | ||||||
| } | } | ||||||
|  | |||||||
| @ -296,7 +296,8 @@ public class VolumeVO implements Volume { | |||||||
|         return size; |         return size; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| 	public void setSize(long size) { | 	@Override | ||||||
|  |     public void setSize(long size) { | ||||||
| 		this.size = size; | 		this.size = size; | ||||||
| 	} | 	} | ||||||
|      |      | ||||||
| @ -402,7 +403,8 @@ public class VolumeVO implements Volume { | |||||||
| 		this.diskOfferingId = diskOfferingId; | 		this.diskOfferingId = diskOfferingId; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public Long getTemplateId() { | 	@Override | ||||||
|  |     public Long getTemplateId() { | ||||||
| 		return templateId; | 		return templateId; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -435,7 +437,8 @@ public class VolumeVO implements Volume { | |||||||
| 		this.storageResourceType = storageResourceType2; | 		this.storageResourceType = storageResourceType2; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public Long getPoolId() { | 	@Override | ||||||
|  |     public Long getPoolId() { | ||||||
| 		return poolId; | 		return poolId; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| @ -455,7 +458,8 @@ public class VolumeVO implements Volume { | |||||||
|         return updated; |         return updated; | ||||||
|     } |     } | ||||||
| 	 | 	 | ||||||
| 	public State getState() { | 	@Override | ||||||
|  |     public State getState() { | ||||||
| 	    return state; | 	    return state; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -30,18 +30,18 @@ import org.apache.log4j.Logger; | |||||||
| 
 | 
 | ||||||
| import com.cloud.async.AsyncInstanceCreateStatus; | import com.cloud.async.AsyncInstanceCreateStatus; | ||||||
| import com.cloud.storage.Volume; | import com.cloud.storage.Volume; | ||||||
| import com.cloud.storage.VolumeVO; |  | ||||||
| import com.cloud.storage.Volume.MirrorState; | import com.cloud.storage.Volume.MirrorState; | ||||||
| import com.cloud.storage.Volume.VolumeType; | import com.cloud.storage.Volume.VolumeType; | ||||||
|  | import com.cloud.storage.VolumeVO; | ||||||
| import com.cloud.utils.Pair; | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.db.DB; | import com.cloud.utils.db.DB; | ||||||
| import com.cloud.utils.db.GenericDaoBase; | import com.cloud.utils.db.GenericDaoBase; | ||||||
| import com.cloud.utils.db.GenericSearchBuilder; | import com.cloud.utils.db.GenericSearchBuilder; | ||||||
| import com.cloud.utils.db.SearchBuilder; | import com.cloud.utils.db.SearchBuilder; | ||||||
| import com.cloud.utils.db.SearchCriteria; | import com.cloud.utils.db.SearchCriteria; | ||||||
| import com.cloud.utils.db.Transaction; |  | ||||||
| import com.cloud.utils.db.SearchCriteria.Func; | import com.cloud.utils.db.SearchCriteria.Func; | ||||||
| import com.cloud.utils.db.SearchCriteria.Op; | import com.cloud.utils.db.SearchCriteria.Op; | ||||||
|  | import com.cloud.utils.db.Transaction; | ||||||
| import com.cloud.utils.exception.CloudRuntimeException; | import com.cloud.utils.exception.CloudRuntimeException; | ||||||
| 
 | 
 | ||||||
| @Local(value=VolumeDao.class) @DB(txn=false) | @Local(value=VolumeDao.class) @DB(txn=false) | ||||||
|  | |||||||
| @ -63,20 +63,20 @@ import com.cloud.agent.api.StartupProxyCommand; | |||||||
| import com.cloud.agent.api.StartupRoutingCommand; | import com.cloud.agent.api.StartupRoutingCommand; | ||||||
| import com.cloud.agent.api.StartupStorageCommand; | import com.cloud.agent.api.StartupStorageCommand; | ||||||
| import com.cloud.agent.api.UnsupportedAnswer; | import com.cloud.agent.api.UnsupportedAnswer; | ||||||
| import com.cloud.agent.api.UpgradeCommand; |  | ||||||
| import com.cloud.agent.manager.allocator.HostAllocator; | import com.cloud.agent.manager.allocator.HostAllocator; | ||||||
| import com.cloud.agent.manager.allocator.PodAllocator; | import com.cloud.agent.manager.allocator.PodAllocator; | ||||||
| import com.cloud.agent.transport.Request; | import com.cloud.agent.transport.Request; | ||||||
| import com.cloud.agent.transport.Response; | import com.cloud.agent.transport.Response; | ||||||
| import com.cloud.agent.transport.UpgradeResponse; |  | ||||||
| import com.cloud.alert.AlertManager; | import com.cloud.alert.AlertManager; | ||||||
| import com.cloud.capacity.CapacityVO; | import com.cloud.capacity.CapacityVO; | ||||||
| import com.cloud.capacity.dao.CapacityDao; | import com.cloud.capacity.dao.CapacityDao; | ||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
| import com.cloud.dc.ClusterVO; | import com.cloud.dc.ClusterVO; | ||||||
|  | import com.cloud.dc.DataCenter; | ||||||
| import com.cloud.dc.DataCenterIpAddressVO; | import com.cloud.dc.DataCenterIpAddressVO; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.dc.HostPodVO; | import com.cloud.dc.HostPodVO; | ||||||
|  | import com.cloud.dc.Pod; | ||||||
| import com.cloud.dc.PodCluster; | import com.cloud.dc.PodCluster; | ||||||
| import com.cloud.dc.dao.ClusterDao; | import com.cloud.dc.dao.ClusterDao; | ||||||
| import com.cloud.dc.dao.DataCenterDao; | import com.cloud.dc.dao.DataCenterDao; | ||||||
| @ -92,10 +92,10 @@ import com.cloud.exception.UnsupportedVersionException; | |||||||
| import com.cloud.ha.HighAvailabilityManager; | import com.cloud.ha.HighAvailabilityManager; | ||||||
| import com.cloud.host.DetailVO; | import com.cloud.host.DetailVO; | ||||||
| import com.cloud.host.Host; | import com.cloud.host.Host; | ||||||
|  | import com.cloud.host.Host.Type; | ||||||
| import com.cloud.host.HostStats; | import com.cloud.host.HostStats; | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
| import com.cloud.host.Host.Type; |  | ||||||
| import com.cloud.host.Status.Event; | import com.cloud.host.Status.Event; | ||||||
| import com.cloud.host.dao.DetailsDao; | import com.cloud.host.dao.DetailsDao; | ||||||
| import com.cloud.host.dao.HostDao; | import com.cloud.host.dao.HostDao; | ||||||
| @ -112,7 +112,6 @@ import com.cloud.resource.ServerResource; | |||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.storage.GuestOSCategoryVO; | import com.cloud.storage.GuestOSCategoryVO; | ||||||
| import com.cloud.storage.Storage; | import com.cloud.storage.Storage; | ||||||
| import com.cloud.storage.Storage.StorageResourceType; |  | ||||||
| import com.cloud.storage.StoragePoolVO; | import com.cloud.storage.StoragePoolVO; | ||||||
| import com.cloud.storage.VMTemplateHostVO; | import com.cloud.storage.VMTemplateHostVO; | ||||||
| import com.cloud.storage.VMTemplateVO; | import com.cloud.storage.VMTemplateVO; | ||||||
| @ -508,6 +507,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|         throw new DiscoveryException("Unable to add the host"); |         throw new DiscoveryException("Unable to add the host"); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public boolean deleteHost(long hostId) { |     public boolean deleteHost(long hostId) { | ||||||
|         Transaction txn = Transaction.currentTxn(); |         Transaction txn = Transaction.currentTxn(); | ||||||
| @ -548,11 +548,9 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|             _dcDao.releasePrivateIpAddress(host.getPrivateIpAddress(), host.getDataCenterId(), null); |             _dcDao.releasePrivateIpAddress(host.getPrivateIpAddress(), host.getDataCenterId(), null); | ||||||
|             AgentAttache attache = _agents.get(hostId); |             AgentAttache attache = _agents.get(hostId); | ||||||
|             handleDisconnect(attache, Status.Event.Remove, false); |             handleDisconnect(attache, Status.Event.Remove, false); | ||||||
|             /* |  | ||||||
|             host.setGuid(null); |             host.setGuid(null); | ||||||
|             host.setClusterId(null); |             host.setClusterId(null); | ||||||
|             _hostDao.update(host.getId(), host); |             _hostDao.update(host.getId(), host); | ||||||
|             */ |  | ||||||
|             _hostDao.remove(hostId); |             _hostDao.remove(hostId); | ||||||
|              |              | ||||||
|             //delete the associated primary storage from db |             //delete the associated primary storage from db | ||||||
| @ -1062,6 +1060,19 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public Pod findPod(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids) { | ||||||
|  |         for (PodAllocator allocator : _podAllocators) { | ||||||
|  |             Pod pod = allocator.allocateTo(vm, dc, avoids); | ||||||
|  |             if (pod != null) { | ||||||
|  |                 s_logger.debug("Pod " + pod.getId() + " is found by " + allocator.getName()); | ||||||
|  |                 return pod; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         s_logger.debug("Unable to find any pod for " + vm); | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public HostStats getHostStatistics(long hostId) throws InternalErrorException |     public HostStats getHostStatistics(long hostId) throws InternalErrorException | ||||||
| @ -1088,6 +1099,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|     	return null; |     	return null; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public Long getGuestOSCategoryId(long hostId) { |     public Long getGuestOSCategoryId(long hostId) { | ||||||
|     	HostVO host = _hostDao.findById(hostId); |     	HostVO host = _hostDao.findById(hostId); | ||||||
|     	if (host == null) { |     	if (host == null) { | ||||||
| @ -1119,6 +1131,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|             _investigate = investigate; |             _investigate = investigate; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         @Override | ||||||
|         public void run() { |         public void run() { | ||||||
|             try { |             try { | ||||||
|                 handleDisconnect(_attache, _event, _investigate); |                 handleDisconnect(_attache, _event, _investigate); | ||||||
| @ -1589,6 +1602,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public void updateHost(long hostId, long guestOSCategoryId) { |     public void updateHost(long hostId, long guestOSCategoryId) { | ||||||
|     	GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); |     	GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); | ||||||
|     	Map<String, String> hostDetails = _hostDetailsDao.findDetails(hostId); |     	Map<String, String> hostDetails = _hostDetailsDao.findDetails(hostId); | ||||||
| @ -1749,6 +1763,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public Host findHost(VmCharacteristics vm, Set<? extends Host> avoids) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     // create capacity entries if none exist for this server |     // create capacity entries if none exist for this server | ||||||
|     private void createCapacityEntry(final StartupCommand startup, HostVO server) { |     private void createCapacityEntry(final StartupCommand startup, HostVO server) { | ||||||
| @ -1824,6 +1842,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory { | |||||||
|             this.actionDelegate = actionDelegate; |             this.actionDelegate = actionDelegate; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         @Override | ||||||
|         public void run() { |         public void run() { | ||||||
|             try { |             try { | ||||||
|                 if (s_logger.isDebugEnabled()) { |                 if (s_logger.isDebugEnabled()) { | ||||||
|  | |||||||
| @ -19,13 +19,18 @@ package com.cloud.agent.manager.allocator; | |||||||
| 
 | 
 | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.dc.DataCenter; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.dc.HostPodVO; | import com.cloud.dc.HostPodVO; | ||||||
|  | import com.cloud.dc.Pod; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.template.VirtualMachineTemplate; | import com.cloud.template.VirtualMachineTemplate; | ||||||
| import com.cloud.utils.Pair; | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.component.Adapter; | import com.cloud.utils.component.Adapter; | ||||||
|  | import com.cloud.vm.VmCharacteristics; | ||||||
| 
 | 
 | ||||||
| public interface PodAllocator extends Adapter { | public interface PodAllocator extends Adapter { | ||||||
|     Pair<HostPodVO, Long> allocateTo(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids); |     Pair<HostPodVO, Long> allocateTo(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids); | ||||||
|  |      | ||||||
|  |     Pod allocateTo(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids); | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,11 +33,12 @@ import com.cloud.agent.manager.allocator.PodAllocator; | |||||||
| import com.cloud.capacity.CapacityVO; | import com.cloud.capacity.CapacityVO; | ||||||
| import com.cloud.capacity.dao.CapacityDao; | import com.cloud.capacity.dao.CapacityDao; | ||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
|  | import com.cloud.dc.DataCenter; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.dc.HostPodVO; | import com.cloud.dc.HostPodVO; | ||||||
|  | import com.cloud.dc.Pod; | ||||||
| import com.cloud.dc.dao.HostPodDao; | import com.cloud.dc.dao.HostPodDao; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| import com.cloud.offering.NetworkOffering.GuestIpType; |  | ||||||
| import com.cloud.offering.ServiceOffering; | import com.cloud.offering.ServiceOffering; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.service.dao.ServiceOfferingDao; | import com.cloud.service.dao.ServiceOfferingDao; | ||||||
| @ -56,6 +57,7 @@ import com.cloud.vm.State; | |||||||
| import com.cloud.vm.UserVmVO; | import com.cloud.vm.UserVmVO; | ||||||
| import com.cloud.vm.VMInstanceVO; | import com.cloud.vm.VMInstanceVO; | ||||||
| import com.cloud.vm.VirtualMachine; | import com.cloud.vm.VirtualMachine; | ||||||
|  | import com.cloud.vm.VmCharacteristics; | ||||||
| import com.cloud.vm.dao.UserVmDao; | import com.cloud.vm.dao.UserVmDao; | ||||||
| import com.cloud.vm.dao.VMInstanceDao; | import com.cloud.vm.dao.VMInstanceDao; | ||||||
| 
 | 
 | ||||||
| @ -366,4 +368,9 @@ public class UserConcentratedAllocator implements PodAllocator { | |||||||
| */ | */ | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public Pod allocateTo(VmCharacteristics vm, DataCenter dc, Set<? extends Pod> avoids) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -79,9 +79,7 @@ public class ListZonesByCmd extends BaseCmd { | |||||||
|         int i = 0; |         int i = 0; | ||||||
|         for (DataCenterVO dataCenter : dataCenters) { |         for (DataCenterVO dataCenter : dataCenters) { | ||||||
|             List<Pair<String, Object>> dcData = new ArrayList<Pair<String, Object>>(); |             List<Pair<String, Object>> dcData = new ArrayList<Pair<String, Object>>(); | ||||||
|             if (dataCenter.getId() != null) { |             dcData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.toString(dataCenter.getId()))); | ||||||
|                 dcData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), dataCenter.getId().toString())); |  | ||||||
|             } |  | ||||||
|             dcData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), dataCenter.getName())); |             dcData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), dataCenter.getName())); | ||||||
|             if ((dataCenter.getDescription() != null) && !dataCenter.getDescription().equalsIgnoreCase("null")) { |             if ((dataCenter.getDescription() != null) && !dataCenter.getDescription().equalsIgnoreCase("null")) { | ||||||
|                 dcData.add(new Pair<String, Object>(BaseCmd.Properties.DESCRIPTION.getName(), dataCenter.getDescription())); |                 dcData.add(new Pair<String, Object>(BaseCmd.Properties.DESCRIPTION.getName(), dataCenter.getDescription())); | ||||||
|  | |||||||
| @ -22,7 +22,6 @@ import java.sql.PreparedStatement; | |||||||
| import java.sql.ResultSet; | import java.sql.ResultSet; | ||||||
| import java.sql.SQLException; | import java.sql.SQLException; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Date; |  | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @ -38,8 +37,8 @@ import com.cloud.dc.DataCenterVO; | |||||||
| import com.cloud.dc.HostPodVO; | import com.cloud.dc.HostPodVO; | ||||||
| import com.cloud.dc.PodVlanMapVO; | import com.cloud.dc.PodVlanMapVO; | ||||||
| import com.cloud.dc.Vlan; | import com.cloud.dc.Vlan; | ||||||
| import com.cloud.dc.VlanVO; |  | ||||||
| import com.cloud.dc.Vlan.VlanType; | import com.cloud.dc.Vlan.VlanType; | ||||||
|  | import com.cloud.dc.VlanVO; | ||||||
| import com.cloud.dc.dao.AccountVlanMapDao; | import com.cloud.dc.dao.AccountVlanMapDao; | ||||||
| import com.cloud.dc.dao.DataCenterDao; | import com.cloud.dc.dao.DataCenterDao; | ||||||
| import com.cloud.dc.dao.DataCenterIpAddressDaoImpl; | import com.cloud.dc.dao.DataCenterIpAddressDaoImpl; | ||||||
| @ -53,11 +52,9 @@ import com.cloud.exception.InternalErrorException; | |||||||
| import com.cloud.exception.InvalidParameterValueException; | import com.cloud.exception.InvalidParameterValueException; | ||||||
| import com.cloud.network.dao.IPAddressDao; | import com.cloud.network.dao.IPAddressDao; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| import com.cloud.offering.NetworkOffering.GuestIpType; |  | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.service.dao.ServiceOfferingDao; | import com.cloud.service.dao.ServiceOfferingDao; | ||||||
| import com.cloud.storage.DiskOfferingVO; | import com.cloud.storage.DiskOfferingVO; | ||||||
| import com.cloud.storage.SecondaryStorage; |  | ||||||
| import com.cloud.storage.dao.DiskOfferingDao; | import com.cloud.storage.dao.DiskOfferingDao; | ||||||
| import com.cloud.user.AccountVO; | import com.cloud.user.AccountVO; | ||||||
| import com.cloud.user.UserVO; | import com.cloud.user.UserVO; | ||||||
| @ -131,6 +128,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException { |     public void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	if (value != null && (value.trim().isEmpty() || value.equals("null"))) { |     	if (value != null && (value.trim().isEmpty() || value.equals("null"))) { | ||||||
|     		value = null; |     		value = null; | ||||||
| @ -347,6 +345,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		} | 		} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public void deletePod(long userId, long podId) throws InvalidParameterValueException, InternalErrorException { |     public void deletePod(long userId, long podId) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	// Make sure the pod exists |     	// Make sure the pod exists | ||||||
| @ -367,6 +366,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		saveConfigurationEvent(userId, null, EventTypes.EVENT_POD_DELETE, "Successfully deleted pod with name: " + pod.getName() + " in zone: " + zone.getName() + ".", "podId=" + podId, "dcId=" + zone.getId()); | 		saveConfigurationEvent(userId, null, EventTypes.EVENT_POD_DELETE, "Successfully deleted pod with name: " + pod.getName() + " in zone: " + zone.getName() + ".", "podId=" + podId, "dcId=" + zone.getId()); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public HostPodVO editPod(long userId, long podId, String newPodName, String gateway, String cidr, String startIp, String endIp) throws InvalidParameterValueException, InternalErrorException { |     public HostPodVO editPod(long userId, long podId, String newPodName, String gateway, String cidr, String startIp, String endIp) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	// Make sure the pod exists |     	// Make sure the pod exists | ||||||
| @ -451,6 +451,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		return pod; | 		return pod; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp) throws InvalidParameterValueException, InternalErrorException { |     public HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	checkPodAttributes(-1, podName, zoneId, gateway, cidr, startIp, endIp, true); |     	checkPodAttributes(-1, podName, zoneId, gateway, cidr, startIp, endIp, true); | ||||||
| @ -647,6 +648,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	 |     	 | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public void deleteZone(long userId, long zoneId) throws InvalidParameterValueException, InternalErrorException { |     public void deleteZone(long userId, long zoneId) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	// Make sure the zone exists |     	// Make sure the zone exists | ||||||
| @ -780,6 +782,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	return zone; |     	return zone; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException { |     public DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException { | ||||||
|     	 |     	 | ||||||
| @ -817,7 +820,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	checkZoneParameters(zoneName, dns1, dns2, internalDns1, internalDns2,true); |     	checkZoneParameters(zoneName, dns1, dns2, internalDns1, internalDns2,true); | ||||||
| 		 | 		 | ||||||
| 		// Create the new zone in the database | 		// Create the new zone in the database | ||||||
| 		DataCenterVO zone = new DataCenterVO(null, zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr); | 		DataCenterVO zone = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr); | ||||||
| 		zone = _zoneDao.persist(zone); | 		zone = _zoneDao.persist(zone); | ||||||
| 		 | 		 | ||||||
| 		// Add vnet entries for the new zone | 		// Add vnet entries for the new zone | ||||||
| @ -828,6 +831,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		return zone; | 		return zone; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) { |     public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) { | ||||||
|     	String networkRateStr = _configDao.getValue("network.throttling.rate"); |     	String networkRateStr = _configDao.getValue("network.throttling.rate"); | ||||||
|     	String multicastRateStr = _configDao.getValue("multicast.throttling.rate"); |     	String multicastRateStr = _configDao.getValue("multicast.throttling.rate"); | ||||||
| @ -846,6 +850,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	} |     	} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public ServiceOfferingVO updateServiceOffering(long userId, long serviceOfferingId, String name, String displayText, Boolean offerHA, Boolean useVirtualNetwork, String tags) { |     public ServiceOfferingVO updateServiceOffering(long userId, long serviceOfferingId, String name, String displayText, Boolean offerHA, Boolean useVirtualNetwork, String tags) { | ||||||
|     	boolean updateNeeded = (name != null || displayText != null || offerHA != null || useVirtualNetwork != null || tags != null); |     	boolean updateNeeded = (name != null || displayText != null || offerHA != null || useVirtualNetwork != null || tags != null); | ||||||
|     	if (!updateNeeded) { |     	if (!updateNeeded) { | ||||||
| @ -889,6 +894,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public DiskOfferingVO updateDiskOffering(long userId, long diskOfferingId, String name, String displayText, String tags) { |     public DiskOfferingVO updateDiskOffering(long userId, long diskOfferingId, String name, String displayText, String tags) { | ||||||
|     	boolean updateNeeded = (name != null || displayText != null || tags != null); |     	boolean updateNeeded = (name != null || displayText != null || tags != null); | ||||||
|     	if (!updateNeeded) { |     	if (!updateNeeded) { | ||||||
| @ -922,6 +928,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	} |     	} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean deleteServiceOffering(long userId, long serviceOfferingId) { |     public boolean deleteServiceOffering(long userId, long serviceOfferingId) { | ||||||
|     	ServiceOfferingVO offering = _serviceOfferingDao.findById(serviceOfferingId); |     	ServiceOfferingVO offering = _serviceOfferingDao.findById(serviceOfferingId); | ||||||
|     	 |     	 | ||||||
| @ -934,6 +941,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	} |     	} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public DiskOfferingVO createDiskOffering(long userId, long domainId, String name, String description, int numGibibytes, String tags) { |     public DiskOfferingVO createDiskOffering(long userId, long domainId, String name, String description, int numGibibytes, String tags) { | ||||||
|     	long diskSize = numGibibytes * 1024; |     	long diskSize = numGibibytes * 1024; | ||||||
|     	tags = cleanupTags(tags); |     	tags = cleanupTags(tags); | ||||||
| @ -949,6 +957,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		} | 		} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean deleteDiskOffering(long userId, long diskOfferingId) { |     public boolean deleteDiskOffering(long userId, long diskOfferingId) { | ||||||
|         DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId); |         DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId); | ||||||
|          |          | ||||||
| @ -962,6 +971,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public String changePrivateIPRange(boolean add, long podId, String startIP, String endIP) throws InvalidParameterValueException { |     public String changePrivateIPRange(boolean add, long podId, String startIP, String endIP) throws InvalidParameterValueException { | ||||||
|     	checkPrivateIpRangeErrors(podId, startIP, endIP); |     	checkPrivateIpRangeErrors(podId, startIP, endIP); | ||||||
|     	 |     	 | ||||||
| @ -980,6 +990,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		} | 		} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public VlanVO createVlanAndPublicIpRange(long userId, VlanType vlanType, Long zoneId, Long accountId, Long podId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) throws InvalidParameterValueException, InternalErrorException {    		 |     public VlanVO createVlanAndPublicIpRange(long userId, VlanType vlanType, Long zoneId, Long accountId, Long podId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) throws InvalidParameterValueException, InternalErrorException {    		 | ||||||
|     	 |     	 | ||||||
| 		//check for hypervisor type to be xenserver | 		//check for hypervisor type to be xenserver | ||||||
| @ -1048,7 +1059,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|         		List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAccountVlanMapsByAccount(accountId); |         		List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAccountVlanMapsByAccount(accountId); | ||||||
|         		for (AccountVlanMapVO accountVlanMap : accountVlanMaps) { |         		for (AccountVlanMapVO accountVlanMap : accountVlanMaps) { | ||||||
|         			VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId()); |         			VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId()); | ||||||
|         			if (vlan.getDataCenterId() == zone.getId().longValue()) { |         			if (vlan.getDataCenterId() == zone.getId()) { | ||||||
|         				throw new InvalidParameterValueException("The account " + account.getAccountName() + " is already assigned to an IP range in zone " + zone.getName() + "."); |         				throw new InvalidParameterValueException("The account " + account.getAccountName() + " is already assigned to an IP range in zone " + zone.getName() + "."); | ||||||
|         			} |         			} | ||||||
|         		} |         		} | ||||||
| @ -1068,7 +1079,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|         		List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAll(); |         		List<AccountVlanMapVO> accountVlanMaps = _accountVlanMapDao.listAll(); | ||||||
|         		for (AccountVlanMapVO accountVlanMap : accountVlanMaps) { |         		for (AccountVlanMapVO accountVlanMap : accountVlanMaps) { | ||||||
|         			VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId()); |         			VlanVO vlan = _vlanDao.findById(accountVlanMap.getVlanDbId()); | ||||||
|         			if (vlan.getDataCenterId() == zone.getId().longValue()) { |         			if (vlan.getDataCenterId() == zone.getId()) { | ||||||
|         				throw new InvalidParameterValueException("Zone " + zone.getName() + " already has account-wide IP ranges. A zone may contain either pod-wide IP ranges or account-wide IP ranges, but not both."); |         				throw new InvalidParameterValueException("Zone " + zone.getName() + " already has account-wide IP ranges. A zone may contain either pod-wide IP ranges or account-wide IP ranges, but not both."); | ||||||
|         			} |         			} | ||||||
|         		} |         		} | ||||||
| @ -1193,6 +1204,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		return vlan; | 		return vlan; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException { |     public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException { | ||||||
|     	VlanVO vlan = _vlanDao.findById(vlanDbId); |     	VlanVO vlan = _vlanDao.findById(vlanDbId); | ||||||
|     	if (vlan == null) { |     	if (vlan == null) { | ||||||
| @ -1249,6 +1261,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
| 		return success; | 		return success; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public List<String> csvTagsToList(String tags) { |     public List<String> csvTagsToList(String tags) { | ||||||
|     	List<String> tagsList = new ArrayList<String>(); |     	List<String> tagsList = new ArrayList<String>(); | ||||||
|     	 |     	 | ||||||
| @ -1262,6 +1275,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { | |||||||
|     	return tagsList; |     	return tagsList; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public String listToCsvTags(List<String> tagsList) { |     public String listToCsvTags(List<String> tagsList) { | ||||||
|     	String tags = ""; |     	String tags = ""; | ||||||
|     	if (tagsList.size() > 0) { |     	if (tagsList.size() > 0) { | ||||||
|  | |||||||
| @ -22,7 +22,6 @@ import java.io.IOException; | |||||||
| import java.net.InetSocketAddress; | import java.net.InetSocketAddress; | ||||||
| import java.nio.channels.SocketChannel; | import java.nio.channels.SocketChannel; | ||||||
| import java.nio.charset.Charset; | import java.nio.charset.Charset; | ||||||
| import java.util.ArrayList; |  | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| @ -84,8 +83,8 @@ import com.cloud.exception.OperationTimedoutException; | |||||||
| import com.cloud.exception.StorageUnavailableException; | import com.cloud.exception.StorageUnavailableException; | ||||||
| import com.cloud.ha.HighAvailabilityManager; | import com.cloud.ha.HighAvailabilityManager; | ||||||
| import com.cloud.host.Host; | import com.cloud.host.Host; | ||||||
| import com.cloud.host.Host.Type; |  | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
|  | import com.cloud.host.Host.Type; | ||||||
| import com.cloud.host.dao.HostDao; | import com.cloud.host.dao.HostDao; | ||||||
| import com.cloud.info.ConsoleProxyConnectionInfo; | import com.cloud.info.ConsoleProxyConnectionInfo; | ||||||
| import com.cloud.info.ConsoleProxyInfo; | import com.cloud.info.ConsoleProxyInfo; | ||||||
| @ -97,7 +96,8 @@ import com.cloud.info.RunningHostInfoAgregator.ZoneHostInfo; | |||||||
| import com.cloud.maid.StackMaid; | import com.cloud.maid.StackMaid; | ||||||
| import com.cloud.network.IpAddrAllocator; | import com.cloud.network.IpAddrAllocator; | ||||||
| import com.cloud.network.IpAddrAllocator.networkInfo; | import com.cloud.network.IpAddrAllocator.networkInfo; | ||||||
| import com.cloud.network.Network.TrafficType; | import com.cloud.network.NetworkManager; | ||||||
|  | import com.cloud.network.NetworkProfileVO; | ||||||
| import com.cloud.network.dao.IPAddressDao; | import com.cloud.network.dao.IPAddressDao; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
| import com.cloud.offerings.NetworkOfferingVO; | import com.cloud.offerings.NetworkOfferingVO; | ||||||
| @ -223,6 +223,8 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach | |||||||
|     private StorageManager _storageMgr; |     private StorageManager _storageMgr; | ||||||
|     @Inject |     @Inject | ||||||
|     private HighAvailabilityManager _haMgr; |     private HighAvailabilityManager _haMgr; | ||||||
|  |     @Inject NetworkManager _networkMgr; | ||||||
|  |      | ||||||
|     @Inject AccountManager _accountMgr; |     @Inject AccountManager _accountMgr; | ||||||
|     @Inject |     @Inject | ||||||
|     private EventDao _eventDao; |     private EventDao _eventDao; | ||||||
| @ -1010,17 +1012,25 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach | |||||||
|         long id = _consoleProxyDao.getNextInSequence(Long.class, "id"); |         long id = _consoleProxyDao.getNextInSequence(Long.class, "id"); | ||||||
|         String name = VirtualMachineName.getConsoleProxyName(id, _instance); |         String name = VirtualMachineName.getConsoleProxyName(id, _instance); | ||||||
|          |          | ||||||
|  |         DataCenterVO dc = _dcDao.findById(dataCenterId); | ||||||
|  |          | ||||||
|         ConsoleProxyVO proxy = new ConsoleProxyVO(id, name, _template.getId(), _template.getGuestOSId(), dataCenterId, 0); |         ConsoleProxyVO proxy = new ConsoleProxyVO(id, name, _template.getId(), _template.getGuestOSId(), dataCenterId, 0); | ||||||
|         proxy = _consoleProxyDao.persist(proxy); |         proxy = _consoleProxyDao.persist(proxy); | ||||||
|         ArrayList<NetworkOfferingVO> networkOfferings = new ArrayList<NetworkOfferingVO>(3); |         List<NetworkProfileVO> profiles = _networkMgr.getSystemAccountNetworkProfiles(NetworkOfferingVO.SystemVmControlNetwork, NetworkOfferingVO.SystemVmManagementNetwork, NetworkOfferingVO.SystemVmPublicNetwork); | ||||||
|         networkOfferings.add(_managementNetworkOffering); |         try { | ||||||
|         networkOfferings.add(_linkLocalNetworkOffering); |             proxy = _vmMgr.allocate(proxy, _template, _serviceOffering, profiles, dc, _accountMgr.getSystemAccount()); | ||||||
|         networkOfferings.add(_publicNetworkOffering); |             proxy = _vmMgr.create(proxy); | ||||||
|         _vmMgr.allocate(proxy, _serviceOffering, null, networkOfferings, null, null, null, _accountMgr.getSystemAccount()); |         } catch (InsufficientCapacityException e) { | ||||||
|         Map<String, Object> context = new HashMap<String, Object>(); |             s_logger.warn("InsufficientCapacity", e); | ||||||
|         String publicIpAddress = null; |             throw new CloudRuntimeException("Insufficient capcity exception", e); | ||||||
|  |         } catch (StorageUnavailableException e) { | ||||||
|  |             s_logger.warn("Unable to contact storage", e); | ||||||
|  |             throw new CloudRuntimeException("Unable to contact storage", e); | ||||||
|  |         } | ||||||
|  |          | ||||||
|         return null; |         return null; | ||||||
|          |          | ||||||
|  |          | ||||||
| /* | /* | ||||||
|         Transaction txn = Transaction.currentTxn(); |         Transaction txn = Transaction.currentTxn(); | ||||||
|         try { |         try { | ||||||
| @ -2353,13 +2363,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach | |||||||
|             throw new ConfigurationException("Unable to find the template for console proxy VMs"); |             throw new ConfigurationException("Unable to find the template for console proxy VMs"); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         _publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmPublicNetwork, TrafficType.Public, null); |  | ||||||
|         _publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering); |  | ||||||
|         _managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null); |  | ||||||
|         _managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering); |  | ||||||
|         _linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.Control, null); |  | ||||||
|         _linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering); |  | ||||||
|          |  | ||||||
|         _capacityScanScheduler.scheduleAtFixedRate(getCapacityScanTask(), STARTUP_DELAY, _capacityScanInterval, TimeUnit.MILLISECONDS); |         _capacityScanScheduler.scheduleAtFixedRate(getCapacityScanTask(), STARTUP_DELAY, _capacityScanInterval, TimeUnit.MILLISECONDS); | ||||||
| 
 | 
 | ||||||
|         if (s_logger.isInfoEnabled()) |         if (s_logger.isInfoEnabled()) | ||||||
|  | |||||||
| @ -24,8 +24,8 @@ import javax.ejb.Local; | |||||||
| import javax.naming.ConfigurationException; | import javax.naming.ConfigurationException; | ||||||
| 
 | 
 | ||||||
| import com.cloud.configuration.dao.ConfigurationDao; | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
| import com.cloud.host.Host.Type; |  | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
|  | import com.cloud.host.Host.Type; | ||||||
| import com.cloud.info.ConsoleProxyInfo; | import com.cloud.info.ConsoleProxyInfo; | ||||||
| import com.cloud.utils.component.ComponentLocator; | import com.cloud.utils.component.ComponentLocator; | ||||||
| import com.cloud.utils.component.Inject; | import com.cloud.utils.component.Inject; | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ package com.cloud.network; | |||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
|  | import com.cloud.agent.api.to.NicTO; | ||||||
| import com.cloud.async.executor.AssignToLoadBalancerExecutor; | import com.cloud.async.executor.AssignToLoadBalancerExecutor; | ||||||
| import com.cloud.async.executor.LoadBalancerParam; | import com.cloud.async.executor.LoadBalancerParam; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| @ -28,12 +29,16 @@ import com.cloud.dc.VlanVO; | |||||||
| import com.cloud.exception.ConcurrentOperationException; | import com.cloud.exception.ConcurrentOperationException; | ||||||
| import com.cloud.exception.InsufficientCapacityException; | import com.cloud.exception.InsufficientCapacityException; | ||||||
| import com.cloud.exception.ResourceAllocationException; | import com.cloud.exception.ResourceAllocationException; | ||||||
|  | import com.cloud.offerings.NetworkOfferingVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.user.AccountVO; | import com.cloud.user.AccountVO; | ||||||
|  | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.component.Manager; | import com.cloud.utils.component.Manager; | ||||||
| import com.cloud.vm.DomainRouter; | import com.cloud.vm.DomainRouter; | ||||||
| import com.cloud.vm.DomainRouterVO; | import com.cloud.vm.DomainRouterVO; | ||||||
|  | import com.cloud.vm.NicVO; | ||||||
| import com.cloud.vm.UserVmVO; | import com.cloud.vm.UserVmVO; | ||||||
|  | import com.cloud.vm.VMInstanceVO; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * NetworkManager manages the network for the different end users. |  * NetworkManager manages the network for the different end users. | ||||||
| @ -206,6 +211,17 @@ public interface NetworkManager extends Manager { | |||||||
|      * @param sourceNat - (optional) true if the IP address should be a source NAT address |      * @param sourceNat - (optional) true if the IP address should be a source NAT address | ||||||
|      * @return - list of IP addresses |      * @return - list of IP addresses | ||||||
|      */ |      */ | ||||||
|     List<IPAddressVO> listPublicIpAddressesInVirtualNetwork(long accountId, long dcId, Boolean sourceNat);	 |     List<IPAddressVO> listPublicIpAddressesInVirtualNetwork(long accountId, long dcId, Boolean sourceNat); | ||||||
| 	 |      | ||||||
|  |     NetworkProfileVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering); | ||||||
|  |     NetworkProfileVO setupNetworkProfile(AccountVO account, NetworkOfferingVO offering, Map<String, String> params); | ||||||
|  |     List<NetworkProfileVO> setupNetworkProfiles(AccountVO account, List<NetworkOfferingVO> offerings); | ||||||
|  |      | ||||||
|  |     List<NetworkProfileVO> getSystemAccountNetworkProfiles(String... offeringNames); | ||||||
|  |      | ||||||
|  |     <K extends VMInstanceVO> List<NicVO> allocate(K vm, List<Pair<NetworkProfileVO, NicVO>> networks) throws InsufficientCapacityException; | ||||||
|  | 
 | ||||||
|  |     <K extends VMInstanceVO> List<NicTO> prepare(K vm); | ||||||
|  |      | ||||||
|  |     <K extends VMInstanceVO> void create(K vm); | ||||||
| } | } | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ | |||||||
| package com.cloud.network; | package com.cloud.network; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
|  | import java.util.HashMap; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @ -54,6 +55,7 @@ import com.cloud.agent.api.routing.LoadBalancerCfgCommand; | |||||||
| import com.cloud.agent.api.routing.SavePasswordCommand; | import com.cloud.agent.api.routing.SavePasswordCommand; | ||||||
| import com.cloud.agent.api.routing.SetFirewallRuleCommand; | import com.cloud.agent.api.routing.SetFirewallRuleCommand; | ||||||
| import com.cloud.agent.api.routing.VmDataCommand; | import com.cloud.agent.api.routing.VmDataCommand; | ||||||
|  | import com.cloud.agent.api.to.NicTO; | ||||||
| import com.cloud.alert.AlertManager; | import com.cloud.alert.AlertManager; | ||||||
| import com.cloud.api.BaseCmd; | import com.cloud.api.BaseCmd; | ||||||
| import com.cloud.async.AsyncJobExecutor; | import com.cloud.async.AsyncJobExecutor; | ||||||
| @ -144,13 +146,18 @@ import com.cloud.utils.net.NetUtils; | |||||||
| import com.cloud.vm.DomainRouter; | import com.cloud.vm.DomainRouter; | ||||||
| import com.cloud.vm.DomainRouter.Role; | import com.cloud.vm.DomainRouter.Role; | ||||||
| import com.cloud.vm.DomainRouterVO; | import com.cloud.vm.DomainRouterVO; | ||||||
|  | import com.cloud.vm.NetworkConcierge; | ||||||
|  | import com.cloud.vm.Nic; | ||||||
|  | import com.cloud.vm.NicVO; | ||||||
| import com.cloud.vm.State; | import com.cloud.vm.State; | ||||||
| import com.cloud.vm.UserVmVO; | import com.cloud.vm.UserVmVO; | ||||||
|  | import com.cloud.vm.VMInstanceVO; | ||||||
| import com.cloud.vm.VirtualMachine; | import com.cloud.vm.VirtualMachine; | ||||||
| import com.cloud.vm.VirtualMachine.Event; | import com.cloud.vm.VirtualMachine.Event; | ||||||
| import com.cloud.vm.VirtualMachineManager; | import com.cloud.vm.VirtualMachineManager; | ||||||
| import com.cloud.vm.VirtualMachineName; | import com.cloud.vm.VirtualMachineName; | ||||||
| import com.cloud.vm.dao.DomainRouterDao; | import com.cloud.vm.dao.DomainRouterDao; | ||||||
|  | import com.cloud.vm.dao.NicDao; | ||||||
| import com.cloud.vm.dao.UserVmDao; | import com.cloud.vm.dao.UserVmDao; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -195,8 +202,10 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
|     @Inject UserStatisticsDao _statsDao = null; |     @Inject UserStatisticsDao _statsDao = null; | ||||||
|     @Inject NetworkOfferingDao _networkOfferingDao = null; |     @Inject NetworkOfferingDao _networkOfferingDao = null; | ||||||
|     @Inject NetworkProfileDao _networkProfileDao = null; |     @Inject NetworkProfileDao _networkProfileDao = null; | ||||||
|  |     @Inject NicDao _nicDao; | ||||||
|      |      | ||||||
|     Adapters<NetworkProfiler> _networkProfilers; |     Adapters<NetworkProfiler> _networkProfilers; | ||||||
|  |     Adapters<NetworkConcierge> _networkConcierges; | ||||||
| 
 | 
 | ||||||
|     long _routerTemplateId = -1; |     long _routerTemplateId = -1; | ||||||
|     int _routerRamSize; |     int _routerRamSize; | ||||||
| @ -207,10 +216,8 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
|     int _routerCleanupInterval = 3600; |     int _routerCleanupInterval = 3600; | ||||||
|     int _routerStatsInterval = 300; |     int _routerStatsInterval = 300; | ||||||
|     private ServiceOfferingVO _offering; |     private ServiceOfferingVO _offering; | ||||||
|     private NetworkOfferingVO _managementNetworkOffering; |     private HashMap<String, Pair<NetworkOfferingVO, NetworkProfileVO>> _systemNetworks = new HashMap<String, Pair<NetworkOfferingVO, NetworkProfileVO>>(5); | ||||||
|     private NetworkOfferingVO _publicNetworkOffering; |      | ||||||
|     private NetworkOfferingVO _linkLocalNetworkOffering; |  | ||||||
|     private NetworkOfferingVO _guestNetworkOffering; |  | ||||||
|     private VMTemplateVO _template; |     private VMTemplateVO _template; | ||||||
|      |      | ||||||
|     ScheduledExecutorService _executor; |     ScheduledExecutorService _executor; | ||||||
| @ -1782,6 +1789,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
| 
 | 
 | ||||||
|         final ComponentLocator locator = ComponentLocator.getCurrentLocator(); |         final ComponentLocator locator = ComponentLocator.getCurrentLocator(); | ||||||
|         _networkProfilers = locator.getAdapters(NetworkProfiler.class); |         _networkProfilers = locator.getAdapters(NetworkProfiler.class); | ||||||
|  |         _networkConcierges = locator.getAdapters(NetworkConcierge.class); | ||||||
|          |          | ||||||
|         final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params); |         final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params); | ||||||
| 
 | 
 | ||||||
| @ -1835,47 +1843,27 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
|             // throw new ConfigurationException("Unable to find the template for the router: " + _routerTemplateId); |             // throw new ConfigurationException("Unable to find the template for the router: " + _routerTemplateId); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         _publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmPublicNetwork, TrafficType.Public, null); |         NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmPublicNetwork, TrafficType.Public, null); | ||||||
|         _publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering); |         publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(publicNetworkOffering); | ||||||
|         _managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null); |         _systemNetworks.put(NetworkOfferingVO.SystemVmPublicNetwork, new Pair<NetworkOfferingVO, NetworkProfileVO>(publicNetworkOffering, null)); | ||||||
|         _managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering); |         NetworkOfferingVO managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null); | ||||||
|         _linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.Control, null); |         managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(managementNetworkOffering); | ||||||
|         _linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering); |         _systemNetworks.put(NetworkOfferingVO.SystemVmManagementNetwork, new Pair<NetworkOfferingVO, NetworkProfileVO>(managementNetworkOffering, null)); | ||||||
|         _guestNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmGuestNetwork, TrafficType.Guest, GuestIpType.Virtualized); |         NetworkOfferingVO controlNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmControlNetwork, TrafficType.Control, null); | ||||||
|         _guestNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_guestNetworkOffering); |         controlNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(controlNetworkOffering); | ||||||
|          |         _systemNetworks.put(NetworkOfferingVO.SystemVmControlNetwork, new Pair<NetworkOfferingVO, NetworkProfileVO>(controlNetworkOffering, null)); | ||||||
|         // FIXME: Obviously Virtualized is not the only guest network.  How do we determine which one to use? |         NetworkOfferingVO guestNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmGuestNetwork, TrafficType.Guest, GuestIpType.Virtualized); | ||||||
|          |         guestNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(guestNetworkOffering); | ||||||
|          |         _systemNetworks.put(NetworkOfferingVO.SystemVmGuestNetwork, new Pair<NetworkOfferingVO, NetworkProfileVO>(guestNetworkOffering, null)); | ||||||
|  |         NetworkOfferingVO storageNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmStorageNetwork, TrafficType.Storage, null); | ||||||
|  |         storageNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(storageNetworkOffering); | ||||||
|  |         _systemNetworks.put(NetworkOfferingVO.SystemVmGuestNetwork, new Pair<NetworkOfferingVO, NetworkProfileVO>(storageNetworkOffering, null)); | ||||||
|          |          | ||||||
|         s_logger.info("Network Manager is configured."); |         s_logger.info("Network Manager is configured."); | ||||||
| 
 | 
 | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public void setupNetworkProfiles(List<NetworkOfferingVO> offerings, AccountVO account) { |  | ||||||
|         List<? extends NetworkProfile> profiles = null; |  | ||||||
|         for (NetworkProfiler profiler : _networkProfilers) { |  | ||||||
|             if (s_logger.isDebugEnabled()) { |  | ||||||
|                 s_logger.debug("Sending network profiles to " + profiler.getName()); |  | ||||||
|             } |  | ||||||
|             profiles = profiler.convert(offerings, account); |  | ||||||
|             if (profiles != null) { |  | ||||||
|                 break; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (profiles == null) { |  | ||||||
|             s_logger.debug("Unable to resolve the network profiles"); |  | ||||||
|             throw new CloudRuntimeException("Uanble to convert network offerings to network profiles for that account"); |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         for (NetworkProfile profile : profiles) { |  | ||||||
|             NetworkProfileVO vo = new NetworkProfileVO(profile, account.getId()); |  | ||||||
|             vo = _networkProfileDao.persist(vo); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Override |     @Override | ||||||
|     public String getName() { |     public String getName() { | ||||||
|         return _name; |         return _name; | ||||||
| @ -1883,18 +1871,15 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean start() { |     public boolean start() { | ||||||
|         List<NetworkOfferingVO> offerings = new ArrayList<NetworkOfferingVO>(4); |         AccountVO systemAccount = _accountMgr.getSystemAccount(); | ||||||
|         offerings.add(_publicNetworkOffering); |         for (Pair<NetworkOfferingVO, NetworkProfileVO> network : _systemNetworks.values()) { | ||||||
|         offerings.add(_guestNetworkOffering); |             network.second(setupNetworkProfile(systemAccount, network.first())); | ||||||
|         offerings.add(_linkLocalNetworkOffering); |             if (network.second() == null) { | ||||||
|         offerings.add(_managementNetworkOffering); |                 s_logger.warn("Unable to setup system account's network profile for " + network.first().getName()); | ||||||
| 
 |                 return false; | ||||||
|        // try { |             } | ||||||
|         //    setupNetworkProfiles(offerings, _accountMgr.getSystemAccount()); |         } | ||||||
|         //} catch (Exception e) { |          | ||||||
|           //  s_logger.warn("Unable to setup the system network profiles"); |  | ||||||
|             //return false; |  | ||||||
|         //} |  | ||||||
|         _executor.scheduleAtFixedRate(new RouterCleanupTask(), _routerCleanupInterval, _routerCleanupInterval, TimeUnit.SECONDS); |         _executor.scheduleAtFixedRate(new RouterCleanupTask(), _routerCleanupInterval, _routerCleanupInterval, TimeUnit.SECONDS); | ||||||
|         _executor.scheduleAtFixedRate(new NetworkUsageTask(), _routerStatsInterval, _routerStatsInterval, TimeUnit.SECONDS); |         _executor.scheduleAtFixedRate(new NetworkUsageTask(), _routerStatsInterval, _routerStatsInterval, TimeUnit.SECONDS); | ||||||
|         return true; |         return true; | ||||||
| @ -2363,6 +2348,103 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager | |||||||
| 		return _ipAddressDao.search(ipAddressSC, null); | 		return _ipAddressDao.search(ipAddressSC, null); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|  |     public NetworkProfileVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering) { | ||||||
|  |         return setupNetworkProfile(owner, offering, new HashMap<String, String>()); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public NetworkProfileVO setupNetworkProfile(AccountVO owner, NetworkOfferingVO offering, Map<String, String> params) { | ||||||
|  |         for (NetworkProfiler profiler : _networkProfilers) { | ||||||
|  |             NetworkProfile profile = profiler.convert(offering, params, owner); | ||||||
|  |             if (profile == null) { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  |              | ||||||
|  |             if (profile.getId() != null) { | ||||||
|  |                 if (profile instanceof NetworkProfileVO) { | ||||||
|  |                     return (NetworkProfileVO)profile; | ||||||
|  |                 } else { | ||||||
|  |                     return _networkProfileDao.findById(profile.getId()); | ||||||
|  |                 } | ||||||
|  |             }  | ||||||
|  |              | ||||||
|  |             NetworkProfileVO vo = new NetworkProfileVO(profile, owner.getId(), offering.getId()); | ||||||
|  |             return _networkProfileDao.persist(vo); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         throw new CloudRuntimeException("Unable to convert network offering to network profile: " + offering.getId()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<NetworkProfileVO> setupNetworkProfiles(AccountVO owner, List<NetworkOfferingVO> offerings) { | ||||||
|  |         List<NetworkProfileVO> profiles = new ArrayList<NetworkProfileVO>(offerings.size()); | ||||||
|  |         for (NetworkOfferingVO offering : offerings) { | ||||||
|  |             profiles.add(setupNetworkProfile(owner, offering)); | ||||||
|  |         } | ||||||
|  |         return profiles; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public List<NetworkProfileVO> getSystemAccountNetworkProfiles(String... offeringNames) { | ||||||
|  |         List<NetworkProfileVO> profiles = new ArrayList<NetworkProfileVO>(offeringNames.length); | ||||||
|  |         for (String offeringName : offeringNames) { | ||||||
|  |             Pair<NetworkOfferingVO, NetworkProfileVO> network = _systemNetworks.get(offeringName); | ||||||
|  |             if (network == null) { | ||||||
|  |                 throw new CloudRuntimeException("Unable to find system network profile for " + offeringName); | ||||||
|  |             } | ||||||
|  |             profiles.add(network.second()); | ||||||
|  |         } | ||||||
|  |         return profiles; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     @Override @DB | ||||||
|  |     public <K extends VMInstanceVO> List<NicVO> allocate(K vm, List<Pair<NetworkProfileVO, NicVO>> networks) throws InsufficientCapacityException { | ||||||
|  |         List<NicVO> nics = new ArrayList<NicVO>(networks.size()); | ||||||
|  |          | ||||||
|  |         Transaction txn = Transaction.currentTxn(); | ||||||
|  |         txn.start(); | ||||||
|  |          | ||||||
|  |         for (Pair<NetworkProfileVO, NicVO> network : networks) { | ||||||
|  |             for (NetworkConcierge concierge : _networkConcierges) { | ||||||
|  |                 Nic nic = concierge.allocate(vm, network.first(), network.second()); | ||||||
|  |                 if (nic == null) { | ||||||
|  |                     continue; | ||||||
|  |                 } | ||||||
|  |                 NicVO vo = new NicVO(concierge.getUniqueName(), vm.getId(), network.first().getId()); | ||||||
|  |                  | ||||||
|  |                 if (nic.getIp4Address() != null) { | ||||||
|  |                     vo.setIp4Address(nic.getIp4Address()); | ||||||
|  |                     vo.setState(NicVO.State.IpAcquired); | ||||||
|  |                 } | ||||||
|  |                  | ||||||
|  |                 if (nic.getMacAddress() != null) { | ||||||
|  |                     vo.setMacAddress(nic.getMacAddress()); | ||||||
|  |                 } | ||||||
|  |                  | ||||||
|  |                 if (nic.getMode() != null) { | ||||||
|  |                     vo.setMode(nic.getMode()); | ||||||
|  |                 } | ||||||
|  |          | ||||||
|  |                 vo = _nicDao.persist(vo); | ||||||
|  |                 nics.add(vo); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         txn.commit(); | ||||||
|  |          | ||||||
|  |         return nics; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public <K extends VMInstanceVO> List<NicTO> prepare(K vm) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public <K extends VMInstanceVO> void create(K vm) { | ||||||
|  |     } | ||||||
|  |      | ||||||
|     protected class NetworkUsageTask implements Runnable { |     protected class NetworkUsageTask implements Runnable { | ||||||
| 
 | 
 | ||||||
|         public NetworkUsageTask() { |         public NetworkUsageTask() { | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ import javax.persistence.Table; | |||||||
| import com.cloud.network.Network.BroadcastDomainType; | import com.cloud.network.Network.BroadcastDomainType; | ||||||
| import com.cloud.network.Network.Mode; | import com.cloud.network.Network.Mode; | ||||||
| import com.cloud.network.Network.TrafficType; | import com.cloud.network.Network.TrafficType; | ||||||
| import com.cloud.user.OwnedBy; | import com.cloud.vm.NetworkCharacteristics; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * NetworkProfileVO contains information about a specific network. |  * NetworkProfileVO contains information about a specific network. | ||||||
| @ -37,10 +37,10 @@ import com.cloud.user.OwnedBy; | |||||||
|  */ |  */ | ||||||
| @Entity | @Entity | ||||||
| @Table(name="network_profiles") | @Table(name="network_profiles") | ||||||
| public class NetworkProfileVO implements OwnedBy { | public class NetworkProfileVO implements NetworkProfile { | ||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy=GenerationType.IDENTITY) |     @GeneratedValue(strategy=GenerationType.IDENTITY) | ||||||
|     long id; |     Long id; | ||||||
|      |      | ||||||
|     @Column(name="mode") |     @Column(name="mode") | ||||||
|     @Enumerated(value=EnumType.STRING) |     @Enumerated(value=EnumType.STRING) | ||||||
| @ -66,27 +66,38 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|     @Column(name="cidr") |     @Column(name="cidr") | ||||||
|     String cidr; |     String cidr; | ||||||
|      |      | ||||||
|  |     @Column(name="network_offering_id") | ||||||
|  |     long networkOfferingId; | ||||||
|  |      | ||||||
|     public NetworkProfileVO() { |     public NetworkProfileVO() { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public NetworkProfileVO(NetworkProfile that, long accountId) { |     public NetworkProfileVO(NetworkProfile that, long accountId, long offeringId) { | ||||||
|         this(accountId, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType()); |         this(accountId, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public NetworkProfileVO(long accountId, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType) { |     public NetworkProfileVO(long accountId, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId) { | ||||||
|         this.accountId = accountId; |         this.accountId = accountId; | ||||||
|         this.trafficType = trafficType; |         this.trafficType = trafficType; | ||||||
|         this.mode = mode; |         this.mode = mode; | ||||||
|         this.broadcastDomainType = broadcastDomainType; |         this.broadcastDomainType = broadcastDomainType; | ||||||
|  |         this.networkOfferingId = networkOfferingId; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public long getId() { |     @Override | ||||||
|  |     public Long getId() { | ||||||
|         return id; |         return id; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public Mode getMode() { |     public Mode getMode() { | ||||||
|         return mode; |         return mode; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public long getNetworkOfferingId() { | ||||||
|  |         return networkOfferingId; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     public void setMode(Mode mode) { |     public void setMode(Mode mode) { | ||||||
|         this.mode = mode; |         this.mode = mode; | ||||||
| @ -101,6 +112,7 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|         this.accountId = accountId; |         this.accountId = accountId; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public BroadcastDomainType getBroadcastDomainType() { |     public BroadcastDomainType getBroadcastDomainType() { | ||||||
|         return broadcastDomainType; |         return broadcastDomainType; | ||||||
|     } |     } | ||||||
| @ -109,6 +121,7 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|         this.broadcastDomainType = broadcastDomainType; |         this.broadcastDomainType = broadcastDomainType; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public TrafficType getTrafficType() { |     public TrafficType getTrafficType() { | ||||||
|         return trafficType; |         return trafficType; | ||||||
|     } |     } | ||||||
| @ -117,6 +130,7 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|         this.trafficType = trafficType; |         this.trafficType = trafficType; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public String getGateway() { |     public String getGateway() { | ||||||
|         return gateway; |         return gateway; | ||||||
|     } |     } | ||||||
| @ -125,10 +139,12 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|         this.gateway = gateway; |         this.gateway = gateway; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public String getCidr() { |     public String getCidr() { | ||||||
|         return cidr; |         return cidr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public void setCidr(String cidr) { |     public void setCidr(String cidr) { | ||||||
|         this.cidr = cidr; |         this.cidr = cidr; | ||||||
|     } |     } | ||||||
| @ -140,4 +156,8 @@ public class NetworkProfileVO implements OwnedBy { | |||||||
|     public void setVlanId(Long vlanId) { |     public void setVlanId(Long vlanId) { | ||||||
|         this.vlanId = vlanId; |         this.vlanId = vlanId; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public NetworkCharacteristics toCharacteristics() { | ||||||
|  |         return new NetworkCharacteristics(id, broadcastDomainType, cidr, mode, 0); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -5,16 +5,21 @@ package com.cloud.network; | |||||||
| 
 | 
 | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import javax.ejb.Local; | import javax.ejb.Local; | ||||||
| 
 | 
 | ||||||
| import com.cloud.exception.ConflictingNetworkSettingsException; | import com.cloud.exception.ConflictingNetworkSettingsException; | ||||||
|  | import com.cloud.network.Network.BroadcastDomainType; | ||||||
|  | import com.cloud.network.Network.Mode; | ||||||
| import com.cloud.network.dao.NetworkProfileDao; | import com.cloud.network.dao.NetworkProfileDao; | ||||||
| import com.cloud.offering.NetworkOffering; | import com.cloud.offering.NetworkOffering; | ||||||
|  | import com.cloud.offering.NetworkOffering.GuestIpType; | ||||||
| import com.cloud.offering.ServiceOffering; | import com.cloud.offering.ServiceOffering; | ||||||
| import com.cloud.user.Account; | import com.cloud.user.Account; | ||||||
| import com.cloud.utils.component.AdapterBase; | import com.cloud.utils.component.AdapterBase; | ||||||
| import com.cloud.utils.component.Inject; | import com.cloud.utils.component.Inject; | ||||||
|  | import com.cloud.utils.exception.CloudRuntimeException; | ||||||
| import com.cloud.vm.VirtualMachine; | import com.cloud.vm.VirtualMachine; | ||||||
| 
 | 
 | ||||||
| @Local(value=NetworkProfiler.class) | @Local(value=NetworkProfiler.class) | ||||||
| @ -24,6 +29,28 @@ public class NetworkProfilerImpl extends AdapterBase implements NetworkProfiler | |||||||
|     protected NetworkProfilerImpl() { |     protected NetworkProfilerImpl() { | ||||||
|         super(); |         super(); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public NetworkProfile convert(NetworkOffering offering, Map<String, String> params, Account owner) { | ||||||
|  |         List<NetworkProfileVO> profiles = _profileDao.listBy(owner.getId(), offering.getId()); | ||||||
|  |          | ||||||
|  |         for (NetworkProfileVO profile : profiles) { | ||||||
|  |             // FIXME: We should do more comparisons such as if the specific cidr matches. | ||||||
|  |             return profile; | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         GuestIpType ipType = offering.getGuestIpType(); | ||||||
|  |         BroadcastDomainType broadcastType = null; | ||||||
|  |         Mode mode = null; | ||||||
|  |         if (ipType == GuestIpType.Virtualized) { | ||||||
|  |             mode = Mode.Dhcp; | ||||||
|  |             broadcastType = BroadcastDomainType.Vlan; | ||||||
|  |         } else { | ||||||
|  |             throw new CloudRuntimeException("Unable to convert " + ipType); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         return new NetworkProfileVO(owner.getId(), offering.getTrafficType(), mode, broadcastType, offering.getId()); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public List<? extends NetworkProfile> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner) { |     public List<? extends NetworkProfile> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner) { | ||||||
| @ -35,7 +62,6 @@ public class NetworkProfilerImpl extends AdapterBase implements NetworkProfiler | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkProfile> networkProfiles) throws ConflictingNetworkSettingsException { |     public boolean check(VirtualMachine vm, ServiceOffering serviceOffering, Collection<? extends NetworkProfile> networkProfiles) throws ConflictingNetworkSettingsException { | ||||||
|         // TODO Auto-generated method stub |  | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,4 +24,5 @@ import com.cloud.utils.db.GenericDao; | |||||||
| 
 | 
 | ||||||
| public interface NetworkProfileDao extends GenericDao<NetworkProfileVO, Long> { | public interface NetworkProfileDao extends GenericDao<NetworkProfileVO, Long> { | ||||||
|     List<NetworkProfileVO> listBy(long accountId); |     List<NetworkProfileVO> listBy(long accountId); | ||||||
|  |     List<NetworkProfileVO> listBy(long accountId, long offeringId); | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,7 +46,10 @@ public class NetworkProfileDaoImpl extends GenericDaoBase<NetworkProfileVO, Long | |||||||
|          |          | ||||||
|         AccountSearch = createSearchBuilder(); |         AccountSearch = createSearchBuilder(); | ||||||
|         AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ); |         AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ); | ||||||
|  |         AccountSearch.and("offering", AccountSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ); | ||||||
|         AccountSearch.done(); |         AccountSearch.done(); | ||||||
|  |          | ||||||
|  |          | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public NetworkProfileVO findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType,  long accountId) { |     public NetworkProfileVO findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType,  long accountId) { | ||||||
| @ -66,4 +69,13 @@ public class NetworkProfileDaoImpl extends GenericDaoBase<NetworkProfileVO, Long | |||||||
|          |          | ||||||
|         return listActiveBy(sc); |         return listActiveBy(sc); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public List<NetworkProfileVO> listBy(long accountId, long offeringId) { | ||||||
|  |         SearchCriteria<NetworkProfileVO> sc = AccountSearch.create(); | ||||||
|  |         sc.setParameters("offering", offeringId); | ||||||
|  |         sc.setParameters("account", accountId); | ||||||
|  |          | ||||||
|  |         return listActiveBy(sc); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -89,9 +89,9 @@ import com.cloud.exception.ResourceAllocationException; | |||||||
| import com.cloud.exception.ResourceInUseException; | import com.cloud.exception.ResourceInUseException; | ||||||
| import com.cloud.exception.StorageUnavailableException; | import com.cloud.exception.StorageUnavailableException; | ||||||
| import com.cloud.host.Host; | import com.cloud.host.Host; | ||||||
| import com.cloud.host.Host.Type; |  | ||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.host.Status; | import com.cloud.host.Status; | ||||||
|  | import com.cloud.host.Host.Type; | ||||||
| import com.cloud.host.dao.DetailsDao; | import com.cloud.host.dao.DetailsDao; | ||||||
| import com.cloud.host.dao.HostDao; | import com.cloud.host.dao.HostDao; | ||||||
| import com.cloud.hypervisor.Hypervisor; | import com.cloud.hypervisor.Hypervisor; | ||||||
| @ -289,6 +289,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return vols.get(0); |         return vols.get(0); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public List<VolumeVO> prepare(VMInstanceVO vm, HostVO host) { |     public List<VolumeVO> prepare(VMInstanceVO vm, HostVO host) { | ||||||
|         List<VolumeVO> vols = _volsDao.findCreatedByInstance(vm.getId()); |         List<VolumeVO> vols = _volsDao.findCreatedByInstance(vm.getId()); | ||||||
|         List<VolumeVO> recreateVols = new ArrayList<VolumeVO>(vols.size()); |         List<VolumeVO> recreateVols = new ArrayList<VolumeVO>(vols.size()); | ||||||
| @ -986,6 +987,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public void destroy(VMInstanceVO vm, List<VolumeVO> vols) { |     public void destroy(VMInstanceVO vm, List<VolumeVO> vols) { | ||||||
|         if (s_logger.isDebugEnabled() && vm != null) { |         if (s_logger.isDebugEnabled() && vm != null) { | ||||||
|             s_logger.debug("Destroying volumes of " + vm.toString()); |             s_logger.debug("Destroying volumes of " + vm.toString()); | ||||||
| @ -1120,6 +1122,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return UUID.randomUUID().toString(); |         return UUID.randomUUID().toString(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public boolean volumeOnSharedStoragePool(VolumeVO volume) { |     public boolean volumeOnSharedStoragePool(VolumeVO volume) { | ||||||
|         Long poolId = volume.getPoolId(); |         Long poolId = volume.getPoolId(); | ||||||
|         if (poolId == null) { |         if (poolId == null) { | ||||||
| @ -1135,6 +1138,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public boolean volumeInactive(VolumeVO volume) { |     public boolean volumeInactive(VolumeVO volume) { | ||||||
|         Long vmId = volume.getInstanceId(); |         Long vmId = volume.getInstanceId(); | ||||||
|         if (vmId != null) { |         if (vmId != null) { | ||||||
| @ -1152,6 +1156,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public String getVmNameOnVolume(VolumeVO volume) { |     public String getVmNameOnVolume(VolumeVO volume) { | ||||||
|     	 Long vmId = volume.getInstanceId(); |     	 Long vmId = volume.getInstanceId(); | ||||||
|          if (vmId != null) { |          if (vmId != null) { | ||||||
| @ -1165,6 +1170,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|          return null; |          return null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public String getAbsoluteIsoPath(long templateId, long dataCenterId) { |     public String getAbsoluteIsoPath(long templateId, long dataCenterId) { | ||||||
|         String isoPath = null; |         String isoPath = null; | ||||||
| 
 | 
 | ||||||
| @ -1182,6 +1188,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return isoPath; |         return isoPath; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public String getSecondaryStorageURL(long zoneId) { |     public String getSecondaryStorageURL(long zoneId) { | ||||||
|         // Determine the secondary storage URL |         // Determine the secondary storage URL | ||||||
|         HostVO secondaryStorageHost = _hostDao.findSecondaryStorageHost(zoneId); |         HostVO secondaryStorageHost = _hostDao.findSecondaryStorageHost(zoneId); | ||||||
| @ -1193,6 +1200,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return secondaryStorageHost.getStorageUrl(); |         return secondaryStorageHost.getStorageUrl(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public HostVO getSecondaryStorageHost(long zoneId) { |     public HostVO getSecondaryStorageHost(long zoneId) { | ||||||
|         return _hostDao.findSecondaryStorageHost(zoneId); |         return _hostDao.findSecondaryStorageHost(zoneId); | ||||||
|     } |     } | ||||||
| @ -1404,6 +1412,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|     	return pool; |     	return pool; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     @DB |     @DB | ||||||
|     public boolean deletePool(long id) { |     public boolean deletePool(long id) { | ||||||
|         boolean deleteFlag = false; |         boolean deleteFlag = false; | ||||||
| @ -1512,6 +1521,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public VolumeVO moveVolume(VolumeVO volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId) throws InternalErrorException { |     public VolumeVO moveVolume(VolumeVO volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId) throws InternalErrorException { | ||||||
|     	// Find a destination storage pool with the specified criteria |     	// Find a destination storage pool with the specified criteria | ||||||
|     	DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId()); |     	DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId()); | ||||||
| @ -1810,6 +1820,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         public StorageGarbageCollector() { |         public StorageGarbageCollector() { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         @Override | ||||||
|         public void run() { |         public void run() { | ||||||
|             try { |             try { | ||||||
|                 s_logger.info("Storage Garbage Collection Thread is running."); |                 s_logger.info("Storage Garbage Collection Thread is running."); | ||||||
| @ -1833,6 +1844,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|     public void cleanupStorage(boolean recurring) { |     public void cleanupStorage(boolean recurring) { | ||||||
| 
 | 
 | ||||||
|         // Cleanup primary storage pools |         // Cleanup primary storage pools | ||||||
| @ -1919,6 +1931,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public List<StoragePoolVO> getStoragePoolsForVm(long vmId) { |     public List<StoragePoolVO> getStoragePoolsForVm(long vmId) { | ||||||
|         SearchCriteria<StoragePoolVO> sc = PoolsUsedByVmSearch.create(); |         SearchCriteria<StoragePoolVO> sc = PoolsUsedByVmSearch.create(); | ||||||
|         sc.setJoinParameters("volumes", "vm", vmId); |         sc.setJoinParameters("volumes", "vm", vmId); | ||||||
| @ -1926,6 +1939,7 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|         return _storagePoolDao.search(sc, null); |         return _storagePoolDao.search(sc, null); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     @Override | ||||||
|     public String getPrimaryStorageNameLabel(VolumeVO volume) { |     public String getPrimaryStorageNameLabel(VolumeVO volume) { | ||||||
|         Long poolId     = volume.getPoolId(); |         Long poolId     = volume.getPoolId(); | ||||||
|          |          | ||||||
| @ -2263,4 +2277,125 @@ public class StorageManagerImpl implements StorageManager { | |||||||
|     		return false; |     		return false; | ||||||
|     	} |     	} | ||||||
|     } |     } | ||||||
|  | 	 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> VolumeVO allocate(VolumeType type, DiskOfferingVO offering, String name, Long size, VMTemplateVO template, T vm, AccountVO account) { | ||||||
|  |         VolumeVO vol = new VolumeVO(VolumeType.ROOT, name, vm.getDataCenterId(), account.getDomainId(), account.getId(), offering.getId(), size); | ||||||
|  |         if (vm != null) { | ||||||
|  |             vol.setInstanceId(vm.getId()); | ||||||
|  |         } | ||||||
|  |         if (template != null && template.getFormat() != ImageFormat.ISO) { | ||||||
|  |             vol.setTemplateId(template.getId()); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         vol = _volsDao.persist(vol); | ||||||
|  |          | ||||||
|  |         return vol; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     final protected DiskCharacteristics createDiskCharacteristics(VolumeVO volume, DiskOfferingVO offering) { | ||||||
|  |         return new DiskCharacteristics(volume.getId(), volume.getVolumeType(), volume.getName(), offering.getId(), volume.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isRecreatable(), volume.getTemplateId()); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     final protected DiskCharacteristics createDiskCharacteristics(VolumeVO volume) { | ||||||
|  |         DiskOfferingVO offering = _diskOfferingDao.findById(volume.getDiskOfferingId()); | ||||||
|  |         return createDiskCharacteristics(volume, offering); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> void create(T vm) { | ||||||
|  |         List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); | ||||||
|  |         assert vols.size() >= 1 : "Come on, what's with the zero volumes for " + vm; | ||||||
|  |         for (VolumeVO vol : vols) { | ||||||
|  |             DiskCharacteristics dskCh = createDiskCharacteristics(vol); | ||||||
|  |             int retry = _retry; | ||||||
|  |             while (--retry >= 0) { | ||||||
|  |                  | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         /* | ||||||
|  | StoragePoolVO pool = null; | ||||||
|  | final HashSet<StoragePool> avoidPools = new HashSet<StoragePool>(avoids); | ||||||
|  | 
 | ||||||
|  | VolumeType volType = volume.getVolumeType(); | ||||||
|  | 
 | ||||||
|  | VolumeTO created = null; | ||||||
|  | int retry = _retry; | ||||||
|  | while (--retry >= 0) { | ||||||
|  | created = null; | ||||||
|  | 
 | ||||||
|  | txn.start(); | ||||||
|  | 
 | ||||||
|  | long podId = pod.getId(); | ||||||
|  | pod = _podDao.lock(podId, true); | ||||||
|  | if (pod == null) { | ||||||
|  | txn.rollback(); | ||||||
|  | volume.setStatus(AsyncInstanceCreateStatus.Failed); | ||||||
|  | volume.setDestroyed(true); | ||||||
|  | _volsDao.persist(volume); | ||||||
|  | throw new CloudRuntimeException("Unable to acquire lock on the pod " + podId); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | pool = findStoragePool(dskCh, dc, pod, clusterId, offering, vm, template, avoidPools); | ||||||
|  | if (pool == null) { | ||||||
|  | txn.rollback(); | ||||||
|  | break; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | avoidPools.add(pool); | ||||||
|  | if (s_logger.isDebugEnabled()) { | ||||||
|  | s_logger.debug("Trying to create " + volume + " on " + pool); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | volume.setPoolId(pool.getId()); | ||||||
|  | _volsDao.persist(volume); | ||||||
|  | 
 | ||||||
|  | txn.commit(); | ||||||
|  | 
 | ||||||
|  | CreateCommand cmd = null; | ||||||
|  | VMTemplateStoragePoolVO tmpltStoredOn = null; | ||||||
|  | if (volume.getVolumeType() == VolumeType.ROOT && Storage.ImageFormat.ISO != template.getFormat()) { | ||||||
|  | tmpltStoredOn = _tmpltMgr.prepareTemplateForCreate(template, pool); | ||||||
|  | if (tmpltStoredOn == null) { | ||||||
|  | continue; | ||||||
|  | } | ||||||
|  | cmd = new CreateCommand(volume, vm, dskCh, tmpltStoredOn.getLocalDownloadPath(), pool); | ||||||
|  | } else { | ||||||
|  | cmd = new CreateCommand(volume, vm, dskCh, pool, size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | Answer answer = sendToPool(pool, cmd); | ||||||
|  | if (answer != null && answer.getResult()) { | ||||||
|  | created = ((CreateAnswer)answer).getVolume(); | ||||||
|  | break; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | volume.setPoolId(null); | ||||||
|  | _volsDao.persist(volume); | ||||||
|  | 
 | ||||||
|  | s_logger.debug("Retrying the create because it failed on pool " + pool); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | if (created == null) { | ||||||
|  | if (s_logger.isDebugEnabled()) { | ||||||
|  | s_logger.debug("Unable to create a volume for " + volume); | ||||||
|  | } | ||||||
|  | volume.setStatus(AsyncInstanceCreateStatus.Failed); | ||||||
|  | volume.setDestroyed(true); | ||||||
|  | _volsDao.persist(volume); | ||||||
|  | 
 | ||||||
|  | return null; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | volume.setStatus(AsyncInstanceCreateStatus.Created); | ||||||
|  | volume.setFolder(pool.getPath()); | ||||||
|  | volume.setPath(created.getPath()); | ||||||
|  | volume.setSize(created.getSize()); | ||||||
|  | volume.setPoolType(pool.getPoolType()); | ||||||
|  | volume.setPodId(pod.getId()); | ||||||
|  | _volsDao.persist(volume); | ||||||
|  | return volume; | ||||||
|  |     */ | ||||||
|  |          | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,6 +32,7 @@ import com.cloud.host.Host; | |||||||
| import com.cloud.host.HostVO; | import com.cloud.host.HostVO; | ||||||
| import com.cloud.offering.ServiceOffering; | import com.cloud.offering.ServiceOffering; | ||||||
| import com.cloud.server.StatsCollector; | import com.cloud.server.StatsCollector; | ||||||
|  | import com.cloud.storage.Storage.StoragePoolType; | ||||||
| import com.cloud.storage.StorageManager; | import com.cloud.storage.StorageManager; | ||||||
| import com.cloud.storage.StoragePool; | import com.cloud.storage.StoragePool; | ||||||
| import com.cloud.storage.StoragePoolVO; | import com.cloud.storage.StoragePoolVO; | ||||||
| @ -39,9 +40,8 @@ import com.cloud.storage.StorageStats; | |||||||
| import com.cloud.storage.VMTemplateHostVO; | import com.cloud.storage.VMTemplateHostVO; | ||||||
| import com.cloud.storage.VMTemplateStoragePoolVO; | import com.cloud.storage.VMTemplateStoragePoolVO; | ||||||
| import com.cloud.storage.VMTemplateStorageResourceAssoc; | import com.cloud.storage.VMTemplateStorageResourceAssoc; | ||||||
| import com.cloud.storage.VMTemplateVO; |  | ||||||
| import com.cloud.storage.Storage.StoragePoolType; |  | ||||||
| import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; | import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; | ||||||
|  | import com.cloud.storage.VMTemplateVO; | ||||||
| import com.cloud.storage.Volume.VolumeType; | import com.cloud.storage.Volume.VolumeType; | ||||||
| import com.cloud.storage.dao.StoragePoolDao; | import com.cloud.storage.dao.StoragePoolDao; | ||||||
| import com.cloud.storage.dao.StoragePoolHostDao; | import com.cloud.storage.dao.StoragePoolHostDao; | ||||||
| @ -166,7 +166,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement | |||||||
| 
 | 
 | ||||||
| 		Pair<Long, Long> sizes = _volumeDao.getCountAndTotalByPool(pool.getId()); | 		Pair<Long, Long> sizes = _volumeDao.getCountAndTotalByPool(pool.getId()); | ||||||
| 		 | 		 | ||||||
| 		long totalAllocatedSize = sizes.second() + (long)sizes.first() * _extraBytesPerVolume; | 		long totalAllocatedSize = sizes.second() + sizes.first() * _extraBytesPerVolume; | ||||||
| 
 | 
 | ||||||
| 		// Iterate through all templates on this storage pool | 		// Iterate through all templates on this storage pool | ||||||
| 		boolean tmpinstalled = false; | 		boolean tmpinstalled = false; | ||||||
| @ -179,11 +179,10 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement | |||||||
| 
 | 
 | ||||||
| 		for (VMTemplateStoragePoolVO templatePoolVO : templatePoolVOs) { | 		for (VMTemplateStoragePoolVO templatePoolVO : templatePoolVOs) { | ||||||
| 			VMTemplateVO templateInPool = _templateDao.findById(templatePoolVO.getTemplateId()); | 			VMTemplateVO templateInPool = _templateDao.findById(templatePoolVO.getTemplateId()); | ||||||
| 			int templateSizeMultiplier = 2; | 			int templateSizeMultiplier = pool.getPoolType() == StoragePoolType.NetworkFilesystem ? 1 : 2; | ||||||
| 
 | 
 | ||||||
| 			if ((template != null) && !tmpinstalled && (templateInPool.getId() == template.getId())) { | 			if ((template != null) && !tmpinstalled && (templateInPool.getId() == template.getId())) { | ||||||
| 				tmpinstalled = true; | 				tmpinstalled = true; | ||||||
| 				templateSizeMultiplier = 3; |  | ||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
| 			s_logger.debug("For template: " + templateInPool.getName() + ", using template size multiplier: " + templateSizeMultiplier); | 			s_logger.debug("For template: " + templateInPool.getName() + ", using template size multiplier: " + templateSizeMultiplier); | ||||||
| @ -203,9 +202,9 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement | |||||||
| 				if (templateHostVO == null) { | 				if (templateHostVO == null) { | ||||||
| 					return false; | 					return false; | ||||||
| 				} else { | 				} else { | ||||||
| 					s_logger.debug("For template: " + template.getName() + ", using template size multiplier: " + 3); | 					s_logger.debug("For template: " + template.getName() + ", using template size multiplier: " + 2); | ||||||
| 					long templateSize = templateHostVO.getSize(); | 					long templateSize = templateHostVO.getSize(); | ||||||
| 					totalAllocatedSize += 3 * (templateSize + _extraBytesPerVolume); | 					totalAllocatedSize += 2 * (templateSize + _extraBytesPerVolume); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -17,50 +17,109 @@ | |||||||
|  */ |  */ | ||||||
| package com.cloud.vm; | package com.cloud.vm; | ||||||
| 
 | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import javax.ejb.Local; | import javax.ejb.Local; | ||||||
| import javax.naming.ConfigurationException; | import javax.naming.ConfigurationException; | ||||||
| 
 | 
 | ||||||
|  | import org.apache.log4j.Logger; | ||||||
|  | 
 | ||||||
|  | import com.cloud.agent.AgentManager; | ||||||
|  | import com.cloud.configuration.Config; | ||||||
|  | import com.cloud.configuration.dao.ConfigurationDao; | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
|  | import com.cloud.exception.AgentUnavailableException; | ||||||
|  | import com.cloud.exception.InsufficientCapacityException; | ||||||
| import com.cloud.network.NetworkManager; | import com.cloud.network.NetworkManager; | ||||||
| import com.cloud.offerings.NetworkOfferingVO; | import com.cloud.network.NetworkProfileVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.storage.DiskOfferingVO; | import com.cloud.storage.DiskOfferingVO; | ||||||
|  | import com.cloud.storage.Storage.ImageFormat; | ||||||
| import com.cloud.storage.StorageManager; | import com.cloud.storage.StorageManager; | ||||||
|  | import com.cloud.storage.VMTemplateVO; | ||||||
|  | import com.cloud.storage.Volume.VolumeType; | ||||||
|  | import com.cloud.storage.VolumeVO; | ||||||
| import com.cloud.user.AccountVO; | import com.cloud.user.AccountVO; | ||||||
|  | import com.cloud.utils.Journal; | ||||||
|  | import com.cloud.utils.NumbersUtil; | ||||||
|  | import com.cloud.utils.Pair; | ||||||
|  | import com.cloud.utils.component.ComponentLocator; | ||||||
| import com.cloud.utils.component.Inject; | import com.cloud.utils.component.Inject; | ||||||
|  | import com.cloud.utils.db.DB; | ||||||
|  | import com.cloud.utils.db.Transaction; | ||||||
|  | import com.cloud.vm.dao.VMInstanceDao; | ||||||
| 
 | 
 | ||||||
| @Local(value=VmManager.class) | @Local(value=VmManager.class) | ||||||
| public class MauriceMoss implements VmManager { | public class MauriceMoss implements VmManager { | ||||||
|  |     private static final Logger s_logger = Logger.getLogger(MauriceMoss.class); | ||||||
|  |      | ||||||
|     String _name; |     String _name; | ||||||
|     @Inject private StorageManager _storageMgr; |     @Inject private StorageManager _storageMgr; | ||||||
|     @Inject private NetworkManager _networkMgr; |     @Inject private NetworkManager _networkMgr; | ||||||
|  |     @Inject private AgentManager _agentMgr; | ||||||
|  |     @Inject private VMInstanceDao _vmDao; | ||||||
|  |     private int _retry; | ||||||
|  | 
 | ||||||
|  |     @Override @DB | ||||||
|  |     public <T extends VMInstanceVO> T allocate(T vm, | ||||||
|  |             VMTemplateVO template, | ||||||
|  |             ServiceOfferingVO serviceOffering, | ||||||
|  |             Pair<? extends DiskOfferingVO, Long> rootDiskOffering, | ||||||
|  |             List<Pair<DiskOfferingVO, Long>> dataDiskOfferings, | ||||||
|  |             List<Pair<NetworkProfileVO, NicVO>> networks,  | ||||||
|  |             DataCenterVO dc, | ||||||
|  |             AccountVO owner) throws InsufficientCapacityException { | ||||||
|  |         if (s_logger.isDebugEnabled()) { | ||||||
|  |             s_logger.debug("Allocating entries for VM: " + vm); | ||||||
|  |         } | ||||||
|  |         Transaction txn = Transaction.currentTxn(); | ||||||
|  |         txn.start(); | ||||||
|  |         List<NicVO> nics = _networkMgr.allocate(vm, networks); | ||||||
|  |          | ||||||
|  |         VolumeVO volume = _storageMgr.allocate(VolumeType.ROOT, rootDiskOffering.first(), "ROOT-" + vm.getId(), rootDiskOffering.second(), template.getFormat() != ImageFormat.ISO ? template : null, vm, owner); | ||||||
|  |         for (Pair<DiskOfferingVO, Long> offering : dataDiskOfferings) { | ||||||
|  |             volume = _storageMgr.allocate(VolumeType.DATADISK, offering.first(), "DATA-" + vm.getId(), offering.second(), null, vm, owner); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         txn.commit(); | ||||||
|  |         if (s_logger.isDebugEnabled()) { | ||||||
|  |             s_logger.debug("Allocation completed for VM: " + vm); | ||||||
|  |         } | ||||||
|  |         return vm; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public VMInstanceVO allocate(VMInstanceVO vm,  |     public <T extends VMInstanceVO> T allocate(T vm, | ||||||
|  |             VMTemplateVO template, | ||||||
|             ServiceOfferingVO serviceOffering, |             ServiceOfferingVO serviceOffering, | ||||||
|             Long rootSize, |             Long rootSize, | ||||||
|             List<NetworkOfferingVO> networkOfferings,  |             Pair<DiskOfferingVO, Long> dataDiskOffering, | ||||||
|             Map<DiskOfferingVO, Long> diskOfferings, |             List<Pair<NetworkProfileVO, NicVO>> networks, | ||||||
|             DataCenterVO dc, |             DataCenterVO dc, | ||||||
|             AccountVO owner) { |             AccountVO owner) throws InsufficientCapacityException { | ||||||
|         return null; |         List<Pair<DiskOfferingVO, Long>> diskOfferings = new ArrayList<Pair<DiskOfferingVO, Long>>(1); | ||||||
|  |         if (dataDiskOffering != null) { | ||||||
|  |             diskOfferings.add(dataDiskOffering); | ||||||
|  |         } | ||||||
|  |         return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, rootSize), diskOfferings, networks, dc, owner); | ||||||
|     } |     } | ||||||
| 
 |      | ||||||
|     @Override |     @Override | ||||||
|     public VMInstanceVO allocate(VMInstanceVO vm, |     public <T extends VMInstanceVO> T allocate(T vm, | ||||||
|     ServiceOfferingVO serviceOffering, |             VMTemplateVO template, | ||||||
|     Long rootSize, |             ServiceOfferingVO serviceOffering, | ||||||
|     List<NetworkOfferingVO> networkOfferings, |             List<NetworkProfileVO> networkProfiles, | ||||||
|     DiskOfferingVO dataOffering, |             DataCenterVO dc, AccountVO owner) throws InsufficientCapacityException { | ||||||
|     Long dataSize, |         List<Pair<NetworkProfileVO, NicVO>> networks = new ArrayList<Pair<NetworkProfileVO, NicVO>>(networkProfiles.size()); | ||||||
|     DataCenterVO dc, |         for (NetworkProfileVO profile : networkProfiles) { | ||||||
|     AccountVO owner) { |             networks.add(new Pair<NetworkProfileVO, NicVO>(profile, null)); | ||||||
|         return null; |         } | ||||||
|  |         return allocate(vm, template, serviceOffering, new Pair<DiskOfferingVO, Long>(serviceOffering, null), null, networks, dc, owner); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |      | ||||||
|     @Override |     @Override | ||||||
|     public void create(VmCharacteristics vm, List<DiskCharacteristics> disks, List<NetworkCharacteristics> networks) { |     public void create(VmCharacteristics vm, List<DiskCharacteristics> disks, List<NetworkCharacteristics> networks) { | ||||||
|         // TODO Auto-generated method stub |         // TODO Auto-generated method stub | ||||||
| @ -84,8 +143,14 @@ public class MauriceMoss implements VmManager { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
|     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { |     public boolean configure(String name, Map<String, Object> xmlParams) throws ConfigurationException { | ||||||
|         _name = name; |         _name = name; | ||||||
|  |          | ||||||
|  |         ComponentLocator locator = ComponentLocator.getCurrentLocator(); | ||||||
|  |         ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); | ||||||
|  |         Map<String, String> params = configDao.getConfiguration(xmlParams); | ||||||
|  |          | ||||||
|  |         _retry = NumbersUtil.parseInt(params.get(Config.StartRetry.key()), 2); | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @ -96,5 +161,39 @@ public class MauriceMoss implements VmManager { | |||||||
|      |      | ||||||
|     protected MauriceMoss() { |     protected MauriceMoss() { | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> T create(T v) { | ||||||
|  |         if (s_logger.isDebugEnabled()) { | ||||||
|  |             s_logger.debug("Creating actual resources for VM " + v); | ||||||
|  |         } | ||||||
|  |         Journal journal = new Journal.LogJournal("Creating " + v, s_logger); | ||||||
|  |          | ||||||
|  |         VMInstanceVO vm = _vmDao.findById(v.getId()); | ||||||
|  | 
 | ||||||
|  |         int retry = _retry; | ||||||
|  |         while (_retry-- > 0) { | ||||||
|  | //            Pod pod = _agentMgr.findPod(f); | ||||||
|  |         } | ||||||
|  |         _networkMgr.create(vm); | ||||||
|  |         _storageMgr.create(vm); | ||||||
|  |          | ||||||
|  |         if (s_logger.isDebugEnabled()) { | ||||||
|  |             s_logger.debug("Creation complete for VM " + vm); | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> T start(T vm) { | ||||||
|  |         // TODO Auto-generated method stub | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public <T extends VMInstanceVO> T stop(T vm) throws AgentUnavailableException { | ||||||
|  |         // TODO Auto-generated method stub | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|      |      | ||||||
| } | } | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ import com.cloud.network.Network.Mode; | |||||||
| import com.cloud.network.Network.TrafficType; | import com.cloud.network.Network.TrafficType; | ||||||
| 
 | 
 | ||||||
| @Entity | @Entity | ||||||
| @Table(name="network") | @Table(name="nics") | ||||||
| public class NicVO implements Nic { | public class NicVO implements Nic { | ||||||
|     protected NicVO() { |     protected NicVO() { | ||||||
|     } |     } | ||||||
| @ -79,6 +79,13 @@ public class NicVO implements Nic { | |||||||
|     @Column(name="device_id") |     @Column(name="device_id") | ||||||
|     int deviceId; |     int deviceId; | ||||||
| 
 | 
 | ||||||
|  |     public NicVO(String conciergeName, long instanceId, long profileId) { | ||||||
|  |         this.conciergeName = conciergeName; | ||||||
|  |         this.instanceId = instanceId; | ||||||
|  |         this.networkProfileId = profileId; | ||||||
|  |         this.state = State.Allocated; | ||||||
|  |     } | ||||||
|  |      | ||||||
|     @Override |     @Override | ||||||
|     public String getIp4Address() { |     public String getIp4Address() { | ||||||
|         return ip4Address; |         return ip4Address; | ||||||
| @ -92,11 +99,19 @@ public class NicVO implements Nic { | |||||||
|     public String getMacAddress() { |     public String getMacAddress() { | ||||||
|         return macAddress; |         return macAddress; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public void setMacAddress(String macAddress) { | ||||||
|  |         this.macAddress = macAddress; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public State getState() { |     public State getState() { | ||||||
|         return state; |         return state; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public void setState(State state) { | ||||||
|  |         this.state = state; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public long getId() { |     public long getId() { | ||||||
| @ -137,4 +152,13 @@ public class NicVO implements Nic { | |||||||
|     public void setDeviceId(int deviceId) { |     public void setDeviceId(int deviceId) { | ||||||
|         this.deviceId = deviceId; |         this.deviceId = deviceId; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public Mode getMode() { | ||||||
|  |         return mode; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public void setMode(Mode mode) { | ||||||
|  |         this.mode = mode; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -18,13 +18,18 @@ | |||||||
| package com.cloud.vm; | package com.cloud.vm; | ||||||
| 
 | 
 | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; |  | ||||||
| 
 | 
 | ||||||
| import com.cloud.dc.DataCenterVO; | import com.cloud.dc.DataCenterVO; | ||||||
| import com.cloud.offerings.NetworkOfferingVO; | import com.cloud.exception.AgentUnavailableException; | ||||||
|  | import com.cloud.exception.ConcurrentOperationException; | ||||||
|  | import com.cloud.exception.InsufficientCapacityException; | ||||||
|  | import com.cloud.exception.StorageUnavailableException; | ||||||
|  | import com.cloud.network.NetworkProfileVO; | ||||||
| import com.cloud.service.ServiceOfferingVO; | import com.cloud.service.ServiceOfferingVO; | ||||||
| import com.cloud.storage.DiskOfferingVO; | import com.cloud.storage.DiskOfferingVO; | ||||||
|  | import com.cloud.storage.VMTemplateVO; | ||||||
| import com.cloud.user.AccountVO; | import com.cloud.user.AccountVO; | ||||||
|  | import com.cloud.utils.Pair; | ||||||
| import com.cloud.utils.component.Manager; | import com.cloud.utils.component.Manager; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -32,23 +37,36 @@ import com.cloud.utils.component.Manager; | |||||||
|  */ |  */ | ||||||
| public interface VmManager extends Manager { | public interface VmManager extends Manager { | ||||||
|      |      | ||||||
|     VMInstanceVO allocate(VMInstanceVO vm,  |     <T extends VMInstanceVO> T allocate(T vm, | ||||||
|                           ServiceOfferingVO serviceOffering, |             VMTemplateVO template, | ||||||
|                           Long rootSize, |             ServiceOfferingVO serviceOffering, | ||||||
|                           List<NetworkOfferingVO> networkOfferings,  |             Pair<? extends DiskOfferingVO, Long> rootDiskOffering, | ||||||
|                           Map<DiskOfferingVO, Long> diskOfferings, |             List<Pair<DiskOfferingVO, Long>> dataDiskOfferings, | ||||||
|                           DataCenterVO dc, |             List<Pair<NetworkProfileVO, NicVO>> networks,  | ||||||
|                           AccountVO owner); |             DataCenterVO dc, | ||||||
|  |             AccountVO owner) throws InsufficientCapacityException; | ||||||
|      |      | ||||||
|     VMInstanceVO allocate(VMInstanceVO vm, |     <T extends VMInstanceVO> T allocate(T vm, | ||||||
|  |             VMTemplateVO template, | ||||||
|             ServiceOfferingVO serviceOffering, |             ServiceOfferingVO serviceOffering, | ||||||
|             Long rootSize, |             Long rootSize, | ||||||
|             List<NetworkOfferingVO> networkOfferings, |             Pair<DiskOfferingVO, Long> dataDiskOffering, | ||||||
|             DiskOfferingVO dataOffering, |             List<Pair<NetworkProfileVO, NicVO>> networks, | ||||||
|             Long dataSize, |  | ||||||
|             DataCenterVO dc, |             DataCenterVO dc, | ||||||
|             AccountVO owner); |             AccountVO owner) throws InsufficientCapacityException; | ||||||
|              |      | ||||||
|  |     <T extends VMInstanceVO> T allocate(T vm, | ||||||
|  |             VMTemplateVO template, | ||||||
|  |             ServiceOfferingVO serviceOffering, | ||||||
|  |             List<NetworkProfileVO> networkProfiles, | ||||||
|  |             DataCenterVO dc, | ||||||
|  |             AccountVO owner) throws InsufficientCapacityException; | ||||||
|  |      | ||||||
|  |     <T extends VMInstanceVO> T create(T vm) throws InsufficientCapacityException, StorageUnavailableException; | ||||||
|  |      | ||||||
|  |     <T extends VMInstanceVO> T start(T vm) throws InsufficientCapacityException, StorageUnavailableException, ConcurrentOperationException; | ||||||
|  |      | ||||||
|  |     <T extends VMInstanceVO> T stop(T vm) throws AgentUnavailableException, ConcurrentOperationException; | ||||||
|      |      | ||||||
|     void create(VmCharacteristics vm, List<DiskCharacteristics> disks, List<NetworkCharacteristics> networks); |     void create(VmCharacteristics vm, List<DiskCharacteristics> disks, List<NetworkCharacteristics> networks); | ||||||
|      |      | ||||||
|  | |||||||
| @ -78,6 +78,7 @@ DROP TABLE IF EXISTS `cloud`.`network_profiles`; | |||||||
| DROP TABLE IF EXISTS `cloud`.`network_offerings`; | DROP TABLE IF EXISTS `cloud`.`network_offerings`; | ||||||
| DROP TABLE IF EXISTS `cloud`.`host_master`; | DROP TABLE IF EXISTS `cloud`.`host_master`; | ||||||
| DROP TABLE IF EXISTS `cloud`.`hypervisor_properties`; | DROP TABLE IF EXISTS `cloud`.`hypervisor_properties`; | ||||||
|  | DROP TABLE IF EXISTS `cloud`.`account_network_ref`; | ||||||
| 
 | 
 | ||||||
| CREATE TABLE `cloud`.`hypervsior_properties` ( | CREATE TABLE `cloud`.`hypervsior_properties` ( | ||||||
|   `hypervisor` varchar(32) NOT NULL UNIQUE COMMENT 'hypervisor type', |   `hypervisor` varchar(32) NOT NULL UNIQUE COMMENT 'hypervisor type', | ||||||
| @ -96,6 +97,14 @@ CREATE TABLE `cloud`.`network_profiles` ( | |||||||
|   `cidr` varchar(32) NOT NULL COMMENT 'network cidr', |   `cidr` varchar(32) NOT NULL COMMENT 'network cidr', | ||||||
|   `mode` varchar(32) NOT NULL COMMENT 'How to retrieve ip address in this network', |   `mode` varchar(32) NOT NULL COMMENT 'How to retrieve ip address in this network', | ||||||
|   `vlan_id` bigint unsigned NULL COMMENT 'vlan id if the broadcast_domain_type is the vlan', |   `vlan_id` bigint unsigned NULL COMMENT 'vlan id if the broadcast_domain_type is the vlan', | ||||||
|  |   `network_offering_id` bigint unsigned NOT NULL COMMENT 'network offering id that this profile is created from', | ||||||
|  |   PRIMARY KEY (`id`) | ||||||
|  | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||||
|  | 
 | ||||||
|  | CREATE TABLE `cloud`.`account_network_ref` ( | ||||||
|  |   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', | ||||||
|  |   `account_id` bigint unsigned NOT NULL COMMENT 'account id', | ||||||
|  |   `network_profile_id` bigint unsigned NOT NULL COMMENT `network profile_id', | ||||||
|   PRIMARY KEY (`id`) |   PRIMARY KEY (`id`) | ||||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||||
| 
 | 
 | ||||||
| @ -122,9 +131,10 @@ CREATE TABLE `cloud`.`network_offerings` ( | |||||||
|   `mc_rate` smallint unsigned COMMENT 'mcast rate throttle mbits/s', |   `mc_rate` smallint unsigned COMMENT 'mcast rate throttle mbits/s', | ||||||
|   `concurrent_connections` int(10) unsigned COMMENT 'concurrent connections supported on this network', |   `concurrent_connections` int(10) unsigned COMMENT 'concurrent connections supported on this network', | ||||||
|   `traffic_type` varchar(32) NOT NULL COMMENT 'traffic type carried on this network', |   `traffic_type` varchar(32) NOT NULL COMMENT 'traffic type carried on this network', | ||||||
|  |   `tags` varchar(4096) NOT NULL COMMENT 'tags supported by this offering', | ||||||
|  |   `system_only` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering for system use only', | ||||||
|   `created` datetime NOT NULL COMMENT 'time the entry was created', |   `created` datetime NOT NULL COMMENT 'time the entry was created', | ||||||
|   `removed` datetime DEFAULT NULL COMMENT 'time the entry was removed', |   `removed` datetime DEFAULT NULL COMMENT 'time the entry was removed', | ||||||
|   `system_only` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering for system use only', |  | ||||||
|   PRIMARY KEY (`id`) |   PRIMARY KEY (`id`) | ||||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user