Merge remote-tracking branch 'origin/4.12'

This commit is contained in:
Rohit Yadav 2019-05-31 12:32:11 +05:30
commit 4ba67b4c59
3 changed files with 21 additions and 8 deletions

View File

@ -3698,9 +3698,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
boolean isDomainSpecific = false;
List<DomainVlanMapVO> domainVln = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanRange.getId());
List<DomainVlanMapVO> domainVlan = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanRange.getId());
// Check for domain wide pool. It will have an entry for domain_vlan_map.
if (domainVln != null && !domainVln.isEmpty()) {
if (domainVlan != null && !domainVlan.isEmpty()) {
isDomainSpecific = true;
}
@ -3857,10 +3857,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
forSystemVms = ip.isForSystemVms();
final Long allocatedToAccountId = ip.getAllocatedToAccountId();
if (allocatedToAccountId != null) {
final Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
if (!accountAllocatedTo.getAccountName().equalsIgnoreCase(accountName)) {
if (vlanOwner != null && allocatedToAccountId != vlanOwner.getId()) {
throw new InvalidParameterValueException(ip.getAddress() + " Public IP address in range is allocated to another account ");
}
final Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
if (vlanOwner == null && domain != null && domain.getId() != accountAllocatedTo.getDomainId()){
throw new InvalidParameterValueException(ip.getAddress()
+ " Public IP address in range is allocated to another domain/account ");
@ -3921,9 +3921,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
boolean isDomainSpecific = false;
final List<DomainVlanMapVO> domainVln = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanDbId);
final List<DomainVlanMapVO> domainVlan = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanDbId);
// Check for domain wide pool. It will have an entry for domain_vlan_map.
if (domainVln != null && !domainVln.isEmpty()) {
if (domainVlan != null && !domainVlan.isEmpty()) {
isDomainSpecific = true;
}
@ -3976,7 +3976,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
// decrement resource count for dedicated public ip's
_resourceLimitMgr.decrementResourceCount(acctVln.get(0).getAccountId(), ResourceType.public_ip, new Long(ips.size()));
return true;
} else if (isDomainSpecific && _domainVlanMapDao.remove(domainVln.get(0).getId())) {
} else if (isDomainSpecific && _domainVlanMapDao.remove(domainVlan.get(0).getId())) {
s_logger.debug("Remove the vlan from domain_vlan_map successfully.");
return true;
} else {

View File

@ -1460,6 +1460,19 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
newNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
oldNicIdString, oldNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
if (vmInstance.getState() != State.Stopped) {
try {
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
ReservationContext context = new ReservationContextImpl(null, null, callerUser, caller);
DeployDestination dest = new DeployDestination(dc, null, null, null);
_networkMgr.prepare(vmProfile, dest, context);
} catch (final Exception e) {
s_logger.info("Got exception: ", e);
}
}
return _vmDao.findById(vmInstance.getId());
}

View File

@ -3298,7 +3298,7 @@ public class VirtualMachineMO extends BaseMO {
virtualHardwareVersion = getVirtualHardwareVersion();
// Check if guest operating system supports memory hotadd
if (guestOsDescriptor.isSupportsMemoryHotAdd()) {
if (guestOsDescriptor != null && guestOsDescriptor.isSupportsMemoryHotAdd()) {
guestOsSupportsMemoryHotAdd = true;
}
// Check if virtual machine is using hardware version 7 or later.