Skip to content

Commit 74bae56

Browse files
committed
Merge remote-tracking branch 'origin/4.14' into 4.15
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents 7ba0374 + 182cea7 commit 74bae56

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ protected void init() {
274274

275275
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
276276
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
277+
nicSearch.and("removedNic", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
277278

278279
DistinctHostNameSearch = createSearchBuilder(String.class);
279280
DistinctHostNameSearch.selectFields(DistinctHostNameSearch.entity().getHostName());

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,8 @@ public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationE
10651065
// Check that the specified service offering ID is valid
10661066
_itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering);
10671067

1068+
resizeRootVolumeOfVmWithNewOffering(vmInstance, newServiceOffering);
1069+
10681070
_itMgr.upgradeVmDb(vmId, newServiceOffering, currentServiceOffering);
10691071

10701072
// Increment or decrement CPU and Memory count accordingly.
@@ -1327,17 +1329,14 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV
13271329
throw new CloudRuntimeException(vmInstance + " is in zone:" + vmInstance.getDataCenterId() + " but " + network + " is in zone:" + network.getDataCenterId());
13281330
}
13291331

1330-
// Get all vms hostNames in the network
1331-
List<String> hostNames = _vmInstanceDao.listDistinctHostNames(network.getId());
1332-
// verify that there are no duplicates, listDistictHostNames could return hostNames even if the NIC
1333-
//in the network is removed, so also check if the NIC is present and then throw an exception.
1334-
//This will also check if there are multiple nics of same vm in the network
1335-
if (hostNames.contains(vmInstance.getHostName())) {
1336-
for (String hostName : hostNames) {
1337-
VMInstanceVO vm = _vmInstanceDao.findVMByHostName(hostName);
1338-
if (_networkModel.getNicInNetwork(vm.getId(), network.getId()) != null && vm.getHostName().equals(vmInstance.getHostName())) {
1339-
throw new CloudRuntimeException(network + " already has a vm with host name: " + vmInstance.getHostName());
1340-
}
1332+
if(_networkModel.getNicInNetwork(vmInstance.getId(),network.getId()) != null){
1333+
s_logger.debug("VM " + vmInstance.getHostName() + " already in network " + network.getName() + " going to add another NIC");
1334+
} else {
1335+
//* get all vms hostNames in the network
1336+
List<String> hostNames = _vmInstanceDao.listDistinctHostNames(network.getId());
1337+
//* verify that there are no duplicates
1338+
if (hostNames.contains(vmInstance.getHostName())) {
1339+
throw new CloudRuntimeException("Network " + network.getName() + " already has a vm with host name: " + vmInstance.getHostName());
13411340
}
13421341
}
13431342

systemvm/test/runtests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pycodestyle --max-line-length=179 *py
2626
pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
2727
if [ $? -gt 0 ]
2828
then
29-
echo "Pylint failed, please check your code"
29+
echo "pycodestyle failed, please check your code"
3030
exit 1
3131
fi
3232

@@ -35,7 +35,7 @@ pylint --disable=R,C,W *.py
3535
pylint --disable=R,C,W `find ../debian -name \*.py`
3636
if [ $? -gt 0 ]
3737
then
38-
echo "Pylint failed, please check your code"
38+
echo "pylint failed, please check your code"
3939
exit 1
4040
fi
4141

0 commit comments

Comments
 (0)