Skip to content

Commit 3737b41

Browse files
committed
Merge remote-tracking branch 'origin/4.11' into 4.12
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents 7ef921d + b8522c9 commit 3737b41

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,9 +3652,9 @@ public boolean deleteVlanAndPublicIpRange(final long userId, final long vlanDbId
36523652
}
36533653

36543654
boolean isDomainSpecific = false;
3655-
List<DomainVlanMapVO> domainVln = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanRange.getId());
3655+
List<DomainVlanMapVO> domainVlan = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanRange.getId());
36563656
// Check for domain wide pool. It will have an entry for domain_vlan_map.
3657-
if (domainVln != null && !domainVln.isEmpty()) {
3657+
if (domainVlan != null && !domainVlan.isEmpty()) {
36583658
isDomainSpecific = true;
36593659
}
36603660

@@ -3811,10 +3811,10 @@ public Vlan dedicatePublicIpRange(final DedicatePublicIpRangeCmd cmd) throws Res
38113811
forSystemVms = ip.isForSystemVms();
38123812
final Long allocatedToAccountId = ip.getAllocatedToAccountId();
38133813
if (allocatedToAccountId != null) {
3814-
final Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
3815-
if (!accountAllocatedTo.getAccountName().equalsIgnoreCase(accountName)) {
3814+
if (vlanOwner != null && allocatedToAccountId != vlanOwner.getId()) {
38163815
throw new InvalidParameterValueException(ip.getAddress() + " Public IP address in range is allocated to another account ");
38173816
}
3817+
final Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
38183818
if (vlanOwner == null && domain != null && domain.getId() != accountAllocatedTo.getDomainId()){
38193819
throw new InvalidParameterValueException(ip.getAddress()
38203820
+ " Public IP address in range is allocated to another domain/account ");
@@ -3875,9 +3875,9 @@ public boolean releasePublicIpRange(final long vlanDbId, final long userId, fina
38753875
}
38763876

38773877
boolean isDomainSpecific = false;
3878-
final List<DomainVlanMapVO> domainVln = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanDbId);
3878+
final List<DomainVlanMapVO> domainVlan = _domainVlanMapDao.listDomainVlanMapsByVlan(vlanDbId);
38793879
// Check for domain wide pool. It will have an entry for domain_vlan_map.
3880-
if (domainVln != null && !domainVln.isEmpty()) {
3880+
if (domainVlan != null && !domainVlan.isEmpty()) {
38813881
isDomainSpecific = true;
38823882
}
38833883

@@ -3930,7 +3930,7 @@ public boolean releasePublicIpRange(final long vlanDbId, final long userId, fina
39303930
// decrement resource count for dedicated public ip's
39313931
_resourceLimitMgr.decrementResourceCount(acctVln.get(0).getAccountId(), ResourceType.public_ip, new Long(ips.size()));
39323932
return true;
3933-
} else if (isDomainSpecific && _domainVlanMapDao.remove(domainVln.get(0).getId())) {
3933+
} else if (isDomainSpecific && _domainVlanMapDao.remove(domainVlan.get(0).getId())) {
39343934
s_logger.debug("Remove the vlan from domain_vlan_map successfully.");
39353935
return true;
39363936
} else {

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,19 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
14511451
newNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
14521452
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
14531453
oldNicIdString, oldNetworkOfferingId, null, 0L, VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
1454+
1455+
if (vmInstance.getState() != State.Stopped) {
1456+
try {
1457+
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
1458+
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
1459+
ReservationContext context = new ReservationContextImpl(null, null, callerUser, caller);
1460+
DeployDestination dest = new DeployDestination(dc, null, null, null);
1461+
_networkMgr.prepare(vmProfile, dest, context);
1462+
} catch (final Exception e) {
1463+
s_logger.info("Got exception: ", e);
1464+
}
1465+
}
1466+
14541467
return _vmDao.findById(vmInstance.getId());
14551468
}
14561469

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3298,7 +3298,7 @@ public boolean isMemoryHotAddSupported(String guestOsId) throws Exception {
32983298
virtualHardwareVersion = getVirtualHardwareVersion();
32993299

33003300
// Check if guest operating system supports memory hotadd
3301-
if (guestOsDescriptor.isSupportsMemoryHotAdd()) {
3301+
if (guestOsDescriptor != null && guestOsDescriptor.isSupportsMemoryHotAdd()) {
33023302
guestOsSupportsMemoryHotAdd = true;
33033303
}
33043304
// Check if virtual machine is using hardware version 7 or later.

0 commit comments

Comments
 (0)