mirror of https://github.com/apache/cloudstack.git
allocation complete. Moving on to actual create and deploy
This commit is contained in:
parent
54bd0c71a2
commit
131e487c32
|
|
@ -42,6 +42,8 @@ public interface Volume extends PartOf, OwnedBy, BasedOn {
|
||||||
enum SourceType {
|
enum SourceType {
|
||||||
Snapshot,DiskOffering,Template,Blank
|
Snapshot,DiskOffering,Template,Blank
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getId();
|
||||||
/**
|
/**
|
||||||
* @return the volume name
|
* @return the volume name
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package com.cloud.vm;
|
package com.cloud.vm;
|
||||||
|
|
||||||
|
import com.cloud.offering.DiskOffering;
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,6 +36,8 @@ public class DiskProfile {
|
||||||
private long diskOfferingId;
|
private long diskOfferingId;
|
||||||
private Long templateId;
|
private Long templateId;
|
||||||
private long volumeId;
|
private long volumeId;
|
||||||
|
private Volume vol;
|
||||||
|
private DiskOffering offering;
|
||||||
|
|
||||||
protected DiskProfile() {
|
protected DiskProfile() {
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +53,13 @@ public class DiskProfile {
|
||||||
this.templateId = templateId;
|
this.templateId = templateId;
|
||||||
this.volumeId = volumeId;
|
this.volumeId = volumeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DiskProfile(Volume vol, DiskOffering offering) {
|
||||||
|
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.getUseLocalStorage(), vol.getSize());
|
||||||
|
this.vol = vol;
|
||||||
|
this.offering = offering;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return size of the disk requested in bytes.
|
* @return size of the disk requested in bytes.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public interface Nic extends Resource {
|
||||||
/**
|
/**
|
||||||
* @return network profile id that this
|
* @return network profile id that this
|
||||||
*/
|
*/
|
||||||
long getNetworkProfileId();
|
long getNetworkConfigurationId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the vm instance id that this nic belongs to.
|
* @return the vm instance id that this nic belongs to.
|
||||||
|
|
|
||||||
|
|
@ -39,31 +39,10 @@ import com.cloud.user.AccountVO;
|
||||||
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.utils.exception.ExecutionException;
|
import com.cloud.utils.exception.ExecutionException;
|
||||||
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
|
||||||
public interface StorageManager extends Manager {
|
public interface StorageManager extends Manager {
|
||||||
/**
|
|
||||||
* Convenience method for creating a VM with a data disk based on a template.
|
|
||||||
* @param vm VM to create disks for.
|
|
||||||
* @param template Template to based the root disk on.
|
|
||||||
* @param rootOffering Disk offering for the root disk.
|
|
||||||
* @param dataOffering Disk offering for the data disk.
|
|
||||||
* @param size size of the data disk if the data disk offering has variable size.
|
|
||||||
* @param dc data center to deploy in.
|
|
||||||
* @param account owner.
|
|
||||||
* @return List<VolumeVO> where the first disk is the root disk.
|
|
||||||
*/
|
|
||||||
List<VolumeVO> allocateTemplatedVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DiskOfferingVO dataOffering, Long size, DataCenterVO dc, AccountVO account);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience method for allocating system VMs in the database.
|
|
||||||
* @param vm VM to create disks for.
|
|
||||||
* @param template template the root disk should be based on.
|
|
||||||
* @param rootOffering Disk offering for the root disk.
|
|
||||||
* @param dc data center to deploy in.
|
|
||||||
* @return VolumeVO volume allocated.
|
|
||||||
*/
|
|
||||||
VolumeVO allocateSystemVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DataCenterVO dc);
|
|
||||||
|
|
||||||
|
|
||||||
VolumeVO allocateIsoInstalledVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, Long size, DataCenterVO dc, AccountVO account);
|
VolumeVO allocateIsoInstalledVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, Long size, DataCenterVO dc, AccountVO account);
|
||||||
|
|
@ -328,7 +307,8 @@ public interface StorageManager extends Manager {
|
||||||
* @param account
|
* @param account
|
||||||
* @return VolumeVO a persisted volume.
|
* @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> DiskProfile allocateRawVolume(VolumeType type, String name, DiskOfferingVO offering, Long size, T vm, AccountVO owner);
|
||||||
|
<T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(VolumeType type, String name, DiskOfferingVO offering, VMTemplateVO template, T vm, AccountVO owner);
|
||||||
|
|
||||||
<T extends VMInstanceVO> void create(T vm);
|
<T extends VMInstanceVO> void create(T vm);
|
||||||
Long findHostIdForStoragePool(StoragePoolVO pool);
|
Long findHostIdForStoragePool(StoragePoolVO pool);
|
||||||
|
|
|
||||||
|
|
@ -553,5 +553,5 @@ public class VolumeVO implements Volume {
|
||||||
public void setAttached(Date attached){
|
public void setAttached(Date attached){
|
||||||
this.attached = attached;
|
this.attached = attached;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1009,7 +1009,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
|
||||||
protected Map<String, Object> createProxyInstance2(long dataCenterId) {
|
protected Map<String, Object> createProxyInstance2(long dataCenterId) {
|
||||||
|
|
||||||
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
long id = _consoleProxyDao.getNextInSequence(Long.class, "id");
|
||||||
|
|
|
||||||
|
|
@ -2413,6 +2413,8 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
|
|
||||||
|
int deviceId = 0;
|
||||||
|
|
||||||
for (Pair<NetworkConfigurationVO, NicProfile> network : networks) {
|
for (Pair<NetworkConfigurationVO, NicProfile> network : networks) {
|
||||||
for (NetworkConcierge concierge : _networkConcierges) {
|
for (NetworkConcierge concierge : _networkConcierges) {
|
||||||
NicProfile profile = concierge.allocate(vm, network.first(), network.second());
|
NicProfile profile = concierge.allocate(vm, network.first(), network.second());
|
||||||
|
|
@ -2420,7 +2422,8 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NicVO vo = new NicVO(concierge.getUniqueName(), vm.getId(), network.first().getId());
|
NicVO vo = new NicVO(concierge.getUniqueName(), vm.getId(), network.first().getId());
|
||||||
|
vo.setDeviceId(deviceId++);
|
||||||
|
vo.setMode(network.first().getMode());
|
||||||
if (profile.getIp4Address() != null) {
|
if (profile.getIp4Address() != null) {
|
||||||
vo.setIp4Address(profile.getIp4Address());
|
vo.setIp4Address(profile.getIp4Address());
|
||||||
vo.setState(NicVO.State.Reserved);
|
vo.setState(NicVO.State.Reserved);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
@Local(value=NetworkProfiler.class)
|
@Local(value={NetworkProfiler.class, NetworkConcierge.class})
|
||||||
public class ControlNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
public class ControlNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
||||||
private static final Logger s_logger = Logger.getLogger(ControlNetworkProfiler.class);
|
private static final Logger s_logger = Logger.getLogger(ControlNetworkProfiler.class);
|
||||||
@Inject DataCenterDao _dcDao;
|
@Inject DataCenterDao _dcDao;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
@Local(value=NetworkProfiler.class)
|
@Local(value={NetworkProfiler.class, NetworkConcierge.class})
|
||||||
public class PodBasedNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
public class PodBasedNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
||||||
private static final Logger s_logger = Logger.getLogger(PodBasedNetworkProfiler.class);
|
private static final Logger s_logger = Logger.getLogger(PodBasedNetworkProfiler.class);
|
||||||
@Inject DataCenterDao _dcDao;
|
@Inject DataCenterDao _dcDao;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import com.cloud.vm.Nic;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|
||||||
@Local(value=NetworkProfiler.class)
|
@Local(value={NetworkProfiler.class, NetworkConcierge.class})
|
||||||
public class PublicNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
public class PublicNetworkProfiler extends AdapterBase implements NetworkProfiler, NetworkConcierge {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -256,24 +256,6 @@ public class StorageManagerImpl implements StorageManager {
|
||||||
return vols;
|
return vols;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VolumeVO> allocateTemplatedVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DiskOfferingVO diskOffering, Long size, DataCenterVO dc, AccountVO account) {
|
|
||||||
assert (template.getFormat() != ImageFormat.ISO) : "You can't create user vm based on ISO with this format";
|
|
||||||
|
|
||||||
DiskProfile rootDisk = null;
|
|
||||||
List<DiskProfile> dataDisks = new ArrayList<DiskProfile>(diskOffering != null ? 1 : 0);
|
|
||||||
|
|
||||||
long rootId = _volsDao.getNextInSequence(Long.class, "volume_seq");
|
|
||||||
|
|
||||||
rootDisk = new DiskProfile(rootId, VolumeType.ROOT, "ROOT-" + vm.getId() + " rootId", rootOffering.getId(), 0, rootOffering.getTagsArray(), rootOffering.getUseLocalStorage(), rootOffering.isRecreatable(), template.getId());
|
|
||||||
if (diskOffering != null) {
|
|
||||||
long dataId = _volsDao.getNextInSequence(Long.class, "volume_seq");
|
|
||||||
dataDisks.add(new DiskProfile(dataId, VolumeType.DATADISK, "DATA-" + vm.getId() + "-" + dataId, diskOffering.getId(), size != null ? size : diskOffering.getDiskSizeInBytes(), diskOffering.getTagsArray(), diskOffering.getUseLocalStorage(), diskOffering.isRecreatable(), null));
|
|
||||||
}
|
|
||||||
|
|
||||||
return allocate(rootDisk, dataDisks, vm, dc, account);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VolumeVO allocateIsoInstalledVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, Long size, DataCenterVO dc, AccountVO account) {
|
public VolumeVO allocateIsoInstalledVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, Long size, DataCenterVO dc, AccountVO account) {
|
||||||
assert (template.getFormat() == ImageFormat.ISO) : "The template has to be ISO";
|
assert (template.getFormat() == ImageFormat.ISO) : "The template has to be ISO";
|
||||||
|
|
@ -285,12 +267,6 @@ public class StorageManagerImpl implements StorageManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VolumeVO allocateSystemVm(VMInstanceVO vm, VMTemplateVO template, DiskOfferingVO rootOffering, DataCenterVO dc) {
|
|
||||||
List<VolumeVO> vols = allocateTemplatedVm(vm, template, rootOffering, null, null, dc, _accountMgr.getSystemAccount());
|
|
||||||
return vols.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@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());
|
||||||
|
|
@ -2292,19 +2268,49 @@ public class StorageManagerImpl implements StorageManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DiskProfile toDiskProfile(VolumeVO vol, DiskOfferingVO offering) {
|
||||||
|
return new DiskProfile(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isRecreatable(), vol.getTemplateId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends VMInstanceVO> VolumeVO allocate(VolumeType type, DiskOfferingVO offering, String name, Long size, VMTemplateVO template, T vm, AccountVO account) {
|
public <T extends VMInstanceVO> DiskProfile allocateRawVolume(VolumeType type, String name, DiskOfferingVO offering, Long size, T vm, AccountVO owner) {
|
||||||
VolumeVO vol = new VolumeVO(VolumeType.ROOT, name, vm.getDataCenterId(), account.getDomainId(), account.getId(), offering.getId(), size);
|
if (size == null) {
|
||||||
|
size = offering.getDiskSizeInBytes();
|
||||||
|
}
|
||||||
|
VolumeVO vol = new VolumeVO(type, name, vm.getDataCenterId(), owner.getDomainId(), owner.getId(), offering.getId(), size);
|
||||||
if (vm != null) {
|
if (vm != null) {
|
||||||
vol.setInstanceId(vm.getId());
|
vol.setInstanceId(vm.getId());
|
||||||
}
|
}
|
||||||
if (template != null && template.getFormat() != ImageFormat.ISO) {
|
|
||||||
vol.setTemplateId(template.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
vol = _volsDao.persist(vol);
|
vol = _volsDao.persist(vol);
|
||||||
|
|
||||||
return vol;
|
return toDiskProfile(vol, offering);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(VolumeType type, String name, DiskOfferingVO offering, VMTemplateVO template, T vm, AccountVO owner) {
|
||||||
|
assert (template.getFormat() != ImageFormat.ISO) : "ISO is not a template really....";
|
||||||
|
|
||||||
|
SearchCriteria<VMTemplateHostVO> sc = HostTemplateStatesSearch.create();
|
||||||
|
sc.setParameters("id", template.getId());
|
||||||
|
sc.setParameters("state", com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
|
||||||
|
sc.setJoinParameters("host", "dcId", vm.getDataCenterId());
|
||||||
|
|
||||||
|
List<VMTemplateHostVO> sss = _vmTemplateHostDao.search(sc, null);
|
||||||
|
if (sss.size() == 0) {
|
||||||
|
throw new CloudRuntimeException("Template " + template.getName() + " has not been completely downloaded to zone " + vm.getDataCenterId());
|
||||||
|
}
|
||||||
|
VMTemplateHostVO ss = sss.get(0);
|
||||||
|
|
||||||
|
VolumeVO vol = new VolumeVO(type, name, vm.getDataCenterId(), owner.getDomainId(), owner.getId(), offering.getId(), ss.getSize());
|
||||||
|
if (vm != null) {
|
||||||
|
vol.setInstanceId(vm.getId());
|
||||||
|
}
|
||||||
|
vol.setTemplateId(template.getId());
|
||||||
|
|
||||||
|
vol = _volsDao.persist(vol);
|
||||||
|
|
||||||
|
return toDiskProfile(vol, offering);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected DiskProfile createDiskCharacteristics(VolumeVO volume, DiskOfferingVO offering) {
|
final protected DiskProfile createDiskCharacteristics(VolumeVO volume, DiskOfferingVO offering) {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ 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.VMTemplateVO;
|
||||||
import com.cloud.storage.Volume.VolumeType;
|
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.Journal;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
|
|
@ -86,19 +85,31 @@ public class MauriceMoss implements VmManager {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Allocating entries for VM: " + vm);
|
s_logger.debug("Allocating entries for VM: " + vm);
|
||||||
}
|
}
|
||||||
VirtualMachineProfile vmProfile = new VirtualMachineProfile(vm, serviceOffering);
|
VMInstanceVO instance = _vmDao.findById(vm.getId());
|
||||||
|
VirtualMachineProfile vmProfile = new VirtualMachineProfile(instance, serviceOffering);
|
||||||
|
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
List<NicProfile> nics = _networkMgr.allocate(vm, networks);
|
instance.setDataCenterId(plan.getDataCenterId());
|
||||||
|
_vmDao.update(instance.getId(), instance);
|
||||||
|
List<NicProfile> nics = _networkMgr.allocate(instance, networks);
|
||||||
vmProfile.setNics(nics);
|
vmProfile.setNics(nics);
|
||||||
|
|
||||||
List<DiskProfile> disks = new ArrayList<DiskProfile>(dataDiskOfferings.size() + 1);
|
if (dataDiskOfferings == null) {
|
||||||
VolumeVO volume = _storageMgr.allocate(VolumeType.ROOT, rootDiskOffering.first(), "ROOT-" + vm.getId(), rootDiskOffering.second(), template.getFormat() != ImageFormat.ISO ? template : null, vm, owner);
|
dataDiskOfferings = new ArrayList<Pair<DiskOfferingVO, Long>>(0);
|
||||||
for (Pair<DiskOfferingVO, Long> offering : dataDiskOfferings) {
|
|
||||||
volume = _storageMgr.allocate(VolumeType.DATADISK, offering.first(), "DATA-" + vm.getId(), offering.second(), null, vm, owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DiskProfile> disks = new ArrayList<DiskProfile>(dataDiskOfferings.size() + 1);
|
||||||
|
if (template.getFormat() == ImageFormat.ISO) {
|
||||||
|
disks.add(_storageMgr.allocateRawVolume(VolumeType.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), rootDiskOffering.second(), instance, owner));
|
||||||
|
} else {
|
||||||
|
disks.add(_storageMgr.allocateTemplatedVolume(VolumeType.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), template, instance, owner));
|
||||||
|
}
|
||||||
|
for (Pair<DiskOfferingVO, Long> offering : dataDiskOfferings) {
|
||||||
|
disks.add(_storageMgr.allocateRawVolume(VolumeType.DATADISK, "DATA-" + vm.getId(), offering.first(), offering.second(), instance, owner));
|
||||||
|
}
|
||||||
|
vmProfile.setDisks(disks);
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Allocation completed for VM: " + vm);
|
s_logger.debug("Allocation completed for VM: " + vm);
|
||||||
|
|
@ -118,7 +129,7 @@ public class MauriceMoss implements VmManager {
|
||||||
|
|
||||||
return vmProfile;
|
return vmProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends VMInstanceVO> VirtualMachineProfile allocate(T vm,
|
public <T extends VMInstanceVO> VirtualMachineProfile allocate(T vm,
|
||||||
VMTemplateVO template,
|
VMTemplateVO template,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.cloud.network.Network.Mode;
|
import com.cloud.network.Network.Mode;
|
||||||
import com.cloud.network.Network.TrafficType;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="nics")
|
@Table(name="nics")
|
||||||
|
|
@ -45,34 +44,24 @@ public class NicVO implements Nic {
|
||||||
@Column(name="instance_id")
|
@Column(name="instance_id")
|
||||||
long instanceId;
|
long instanceId;
|
||||||
|
|
||||||
@Column(name="type")
|
|
||||||
@Enumerated(value=EnumType.STRING)
|
|
||||||
TrafficType trafficType;
|
|
||||||
|
|
||||||
@Column(name="ip4_address")
|
@Column(name="ip4_address")
|
||||||
String ip4Address;
|
String ip4Address;
|
||||||
|
|
||||||
@Column(name="mac_address")
|
@Column(name="mac_address")
|
||||||
String macAddress;
|
String macAddress;
|
||||||
|
|
||||||
@Column(name="netmask")
|
|
||||||
String netMask;
|
|
||||||
|
|
||||||
@Column(name="mode")
|
@Column(name="mode")
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
Mode mode;
|
Mode mode;
|
||||||
|
|
||||||
@Column(name="network_profile_id")
|
@Column(name="network_configuration_id")
|
||||||
long networkProfileId;
|
long networkConfigurationId;
|
||||||
|
|
||||||
@Column(name="String")
|
|
||||||
String vlan;
|
|
||||||
|
|
||||||
@Column(name="state")
|
@Column(name="state")
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
State state;
|
State state;
|
||||||
|
|
||||||
@Column(name="name")
|
@Column(name="reserver_name")
|
||||||
String reserver;
|
String reserver;
|
||||||
|
|
||||||
@Column(name="reservation_id")
|
@Column(name="reservation_id")
|
||||||
|
|
@ -84,10 +73,10 @@ public class NicVO implements Nic {
|
||||||
@Column(name="update_time")
|
@Column(name="update_time")
|
||||||
Date updateTime;
|
Date updateTime;
|
||||||
|
|
||||||
public NicVO(String reserver, long instanceId, long profileId) {
|
public NicVO(String reserver, long instanceId, long configurationId) {
|
||||||
this.reserver = reserver;
|
this.reserver = reserver;
|
||||||
this.instanceId = instanceId;
|
this.instanceId = instanceId;
|
||||||
this.networkProfileId = profileId;
|
this.networkConfigurationId = configurationId;
|
||||||
this.state = State.Allocated;
|
this.state = State.Allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,8 +118,8 @@ public class NicVO implements Nic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getNetworkProfileId() {
|
public long getNetworkConfigurationId() {
|
||||||
return networkProfileId;
|
return networkConfigurationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -116,10 +116,10 @@ CREATE TABLE `cloud`.`nics` (
|
||||||
`instance_id` bigint unsigned NOT NULL COMMENT 'vm instance id',
|
`instance_id` bigint unsigned NOT NULL COMMENT 'vm instance id',
|
||||||
`ip4_address` varchar(15) COMMENT 'ip4 address',
|
`ip4_address` varchar(15) COMMENT 'ip4 address',
|
||||||
`mac_address` varchar(17) COMMENT 'mac address',
|
`mac_address` varchar(17) COMMENT 'mac address',
|
||||||
`network_configuration_id` bigint unsigned NOT NULL COMMENT 'network configuration id',
|
`network_configuration_id` bigint unsigned NOT NULL COMMENT 'network configuration id',
|
||||||
`vlan` varchar(64) COMMENT 'Virtualized network identifier',
|
`mode` varchar(32) COMMENT 'mode of getting ip address',
|
||||||
`state` varchar(32) NOT NULL COMMENT 'state of the creation',
|
`state` varchar(32) NOT NULL COMMENT 'state of the creation',
|
||||||
`name` varchar(64) COMMENT 'Name of the component that reserved the ip address',
|
`reserver_name` varchar(255) COMMENT 'Name of the component that reserved the ip address',
|
||||||
`reservation_id` varchar(64) COMMENT 'id for the reservation',
|
`reservation_id` varchar(64) COMMENT 'id for the reservation',
|
||||||
`device_id` int(10) COMMENT 'device id for the network when plugged into the virtual machine',
|
`device_id` int(10) COMMENT 'device id for the network when plugged into the virtual machine',
|
||||||
`update_time` timestamp NOT NULL COMMENT 'time the state was changed',
|
`update_time` timestamp NOT NULL COMMENT 'time the state was changed',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue