Skip to content

Commit 7de8a6d

Browse files
committed
Merge LTS branch '4.19' into main
2 parents 38ca11f + cadbb56 commit 7de8a6d

9 files changed

Lines changed: 489 additions & 625 deletions

File tree

framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import javax.persistence.TableGenerator;
6161

6262
import com.amazonaws.util.CollectionUtils;
63+
import org.apache.commons.lang3.ArrayUtils;
6364

6465
import com.cloud.utils.DateUtil;
6566
import com.cloud.utils.NumbersUtil;
@@ -2194,6 +2195,9 @@ public Integer countAll() {
21942195

21952196
@Override
21962197
public List<T> findByUuids(String... uuidArray) {
2198+
if (ArrayUtils.isEmpty(uuidArray)) {
2199+
return new ArrayList<T>();
2200+
}
21972201
SearchCriteria<T> sc = createSearchCriteria();
21982202
sc.addAnd("uuid", SearchCriteria.Op.IN, uuidArray);
21992203
return search(sc, null);

plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.linbit.linstor.api.model.ApiCallRcList;
4343
import com.linbit.linstor.api.model.Properties;
4444
import com.linbit.linstor.api.model.ProviderKind;
45+
import com.linbit.linstor.api.model.Resource;
4546
import com.linbit.linstor.api.model.ResourceDefinition;
4647
import com.linbit.linstor.api.model.ResourceDefinitionModify;
4748
import com.linbit.linstor.api.model.ResourceGroupSpawn;
@@ -285,8 +286,8 @@ public boolean connectPhysicalDisk(String volumePath, KVMStoragePool pool, Map<S
285286
@Override
286287
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool)
287288
{
288-
logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
289-
return true;
289+
logger.debug("Linstor: disconnectPhysicalDisk {}:{}", pool.getUuid(), volumePath);
290+
return false;
290291
}
291292

292293
@Override
@@ -322,39 +323,44 @@ public boolean disconnectPhysicalDiskByPath(String localPath)
322323
logger.debug("Linstor: Using storpool: " + pool.getUuid());
323324
final DevelopersApi api = getLinstorAPI(pool);
324325

325-
try
326-
{
326+
Optional<ResourceWithVolumes> optRsc;
327+
try {
327328
List<ResourceWithVolumes> resources = api.viewResources(
328-
Collections.singletonList(localNodeName),
329-
null,
330-
null,
331-
null,
332-
null,
333-
null);
334-
335-
Optional<ResourceWithVolumes> rsc = getResourceByPath(resources, localPath);
329+
Collections.singletonList(localNodeName),
330+
null,
331+
null,
332+
null,
333+
null,
334+
null);
335+
336+
optRsc = getResourceByPath(resources, localPath);
337+
} catch (ApiException apiEx) {
338+
// couldn't query linstor controller
339+
logger.error(apiEx.getBestMessage());
340+
return false;
341+
}
336342

337-
if (rsc.isPresent())
338-
{
343+
if (optRsc.isPresent()) {
344+
try {
345+
Resource rsc = optRsc.get();
339346
ResourceDefinitionModify rdm = new ResourceDefinitionModify();
340347
rdm.deleteProps(Collections.singletonList("DrbdOptions/Net/allow-two-primaries"));
341-
ApiCallRcList answers = api.resourceDefinitionModify(rsc.get().getName(), rdm);
348+
ApiCallRcList answers = api.resourceDefinitionModify(rsc.getName(), rdm);
342349
if (answers.hasError()) {
343350
logger.error(
344351
String.format("Failed to remove 'allow-two-primaries' on %s: %s",
345-
rsc.get().getName(), LinstorUtil.getBestErrorMessage(answers)));
352+
rsc.getName(), LinstorUtil.getBestErrorMessage(answers)));
346353
// do not fail here as removing allow-two-primaries property isn't fatal
347354
}
348-
355+
} catch(ApiException apiEx){
356+
logger.error(apiEx.getBestMessage());
357+
// do not fail here as removing allow-two-primaries property isn't fatal
349358
return true;
350359
}
351-
logger.warn("Linstor: Couldn't find resource for this path: " + localPath);
352-
} catch (ApiException apiEx) {
353-
logger.error(apiEx.getBestMessage());
354-
// do not fail here as removing allow-two-primaries property isn't fatal
355360
}
356361
}
357-
return true;
362+
logger.info("Linstor: Couldn't find resource for this path: {}", localPath);
363+
return false;
358364
}
359365

360366
@Override

server/src/main/java/com/cloud/network/element/VirtualRouterElement.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public boolean implement(final Network network, final NetworkOffering offering,
217217
return false;
218218
}
219219

220-
final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
220+
final Map<VirtualMachineProfile.Param, Object> params = new HashMap<>(1);
221221
params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
222222

223223
if (network.isRollingRestart()) {
@@ -262,27 +262,13 @@ public boolean prepare(final Network network, final NicProfile nic, final Virtua
262262
return false;
263263
}
264264

265-
final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
266-
if (offering.isSystemOnly()) {
267-
return false;
268-
}
269265
if (!_networkMdl.isProviderEnabledInPhysicalNetwork(_networkMdl.getPhysicalNetworkId(network), getProvider().getName())) {
270266
return false;
271267
}
272268

273-
final RouterDeploymentDefinition routerDeploymentDefinition =
274-
routerDeploymentDefinitionBuilder.create()
275-
.setGuestNetwork(network)
276-
.setDeployDestination(dest)
277-
.setAccountOwner(_accountMgr.getAccount(network.getAccountId()))
278-
.setParams(vm.getParameters())
279-
.build();
280-
281-
final List<DomainRouterVO> routers = routerDeploymentDefinition.deployVirtualRouter();
269+
final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
270+
implement(network, offering, dest, context);
282271

283-
if (routers == null || routers.size() == 0) {
284-
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
285-
}
286272
return true;
287273
}
288274

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,8 @@ private Pair<String, String> handleCheckAndRepairVolumeJob(Long vmId, Long volum
18941894
} else if (jobResult instanceof ResourceAllocationException) {
18951895
throw (ResourceAllocationException)jobResult;
18961896
} else if (jobResult instanceof Throwable) {
1897-
throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
1897+
Throwable throwable = (Throwable) jobResult;
1898+
throw new RuntimeException(String.format("Unexpected exception: %s", throwable.getMessage()), throwable);
18981899
}
18991900
}
19001901

ui/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ A modern role-based progressive CloudStack UI based on Vue.js and Ant Design.
88

99
Install node: (Debian/Ubuntu)
1010

11-
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
11+
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
1212
sudo apt-get install -y nodejs
1313
# Or use distro provided: sudo apt-get install npm nodejs
1414

1515
Install node: (CentOS/Fedora/RHEL)
1616

17-
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
17+
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
1818
sudo yum install nodejs
1919

2020
Install node: (Mac OS)

0 commit comments

Comments
 (0)