mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.14' into 4.15
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
commit
74bae56642
@ -274,6 +274,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
|||||||
|
|
||||||
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
|
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
|
||||||
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
|
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
|
||||||
|
nicSearch.and("removedNic", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
|
||||||
|
|
||||||
DistinctHostNameSearch = createSearchBuilder(String.class);
|
DistinctHostNameSearch = createSearchBuilder(String.class);
|
||||||
DistinctHostNameSearch.selectFields(DistinctHostNameSearch.entity().getHostName());
|
DistinctHostNameSearch.selectFields(DistinctHostNameSearch.entity().getHostName());
|
||||||
|
|||||||
@ -1065,6 +1065,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
// Check that the specified service offering ID is valid
|
// Check that the specified service offering ID is valid
|
||||||
_itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering);
|
_itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering);
|
||||||
|
|
||||||
|
resizeRootVolumeOfVmWithNewOffering(vmInstance, newServiceOffering);
|
||||||
|
|
||||||
_itMgr.upgradeVmDb(vmId, newServiceOffering, currentServiceOffering);
|
_itMgr.upgradeVmDb(vmId, newServiceOffering, currentServiceOffering);
|
||||||
|
|
||||||
// Increment or decrement CPU and Memory count accordingly.
|
// Increment or decrement CPU and Memory count accordingly.
|
||||||
@ -1327,17 +1329,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
throw new CloudRuntimeException(vmInstance + " is in zone:" + vmInstance.getDataCenterId() + " but " + network + " is in zone:" + network.getDataCenterId());
|
throw new CloudRuntimeException(vmInstance + " is in zone:" + vmInstance.getDataCenterId() + " but " + network + " is in zone:" + network.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all vms hostNames in the network
|
if(_networkModel.getNicInNetwork(vmInstance.getId(),network.getId()) != null){
|
||||||
List<String> hostNames = _vmInstanceDao.listDistinctHostNames(network.getId());
|
s_logger.debug("VM " + vmInstance.getHostName() + " already in network " + network.getName() + " going to add another NIC");
|
||||||
// verify that there are no duplicates, listDistictHostNames could return hostNames even if the NIC
|
} else {
|
||||||
//in the network is removed, so also check if the NIC is present and then throw an exception.
|
//* get all vms hostNames in the network
|
||||||
//This will also check if there are multiple nics of same vm in the network
|
List<String> hostNames = _vmInstanceDao.listDistinctHostNames(network.getId());
|
||||||
if (hostNames.contains(vmInstance.getHostName())) {
|
//* verify that there are no duplicates
|
||||||
for (String hostName : hostNames) {
|
if (hostNames.contains(vmInstance.getHostName())) {
|
||||||
VMInstanceVO vm = _vmInstanceDao.findVMByHostName(hostName);
|
throw new CloudRuntimeException("Network " + network.getName() + " already has a vm with host name: " + vmInstance.getHostName());
|
||||||
if (_networkModel.getNicInNetwork(vm.getId(), network.getId()) != null && vm.getHostName().equals(vmInstance.getHostName())) {
|
|
||||||
throw new CloudRuntimeException(network + " already has a vm with host name: " + vmInstance.getHostName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ pycodestyle --max-line-length=179 *py
|
|||||||
pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
|
pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
echo "Pylint failed, please check your code"
|
echo "pycodestyle failed, please check your code"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ pylint --disable=R,C,W *.py
|
|||||||
pylint --disable=R,C,W `find ../debian -name \*.py`
|
pylint --disable=R,C,W `find ../debian -name \*.py`
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
echo "Pylint failed, please check your code"
|
echo "pylint failed, please check your code"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user