Skip to content

Commit

Permalink
Merge LTS branch '4.19' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanHoogland committed Apr 18, 2024
2 parents 38ca11f + cadbb56 commit 7de8a6d
Show file tree
Hide file tree
Showing 9 changed files with 489 additions and 625 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import javax.persistence.TableGenerator;

import com.amazonaws.util.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;

import com.cloud.utils.DateUtil;
import com.cloud.utils.NumbersUtil;
Expand Down Expand Up @@ -2194,6 +2195,9 @@ public Integer countAll() {

@Override
public List<T> findByUuids(String... uuidArray) {
if (ArrayUtils.isEmpty(uuidArray)) {
return new ArrayList<T>();
}
SearchCriteria<T> sc = createSearchCriteria();
sc.addAnd("uuid", SearchCriteria.Op.IN, uuidArray);
return search(sc, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.linbit.linstor.api.model.ApiCallRcList;
import com.linbit.linstor.api.model.Properties;
import com.linbit.linstor.api.model.ProviderKind;
import com.linbit.linstor.api.model.Resource;
import com.linbit.linstor.api.model.ResourceDefinition;
import com.linbit.linstor.api.model.ResourceDefinitionModify;
import com.linbit.linstor.api.model.ResourceGroupSpawn;
Expand Down Expand Up @@ -285,8 +286,8 @@ public boolean connectPhysicalDisk(String volumePath, KVMStoragePool pool, Map<S
@Override
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool)
{
logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
return true;
logger.debug("Linstor: disconnectPhysicalDisk {}:{}", pool.getUuid(), volumePath);
return false;
}

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

try
{
Optional<ResourceWithVolumes> optRsc;
try {
List<ResourceWithVolumes> resources = api.viewResources(
Collections.singletonList(localNodeName),
null,
null,
null,
null,
null);

Optional<ResourceWithVolumes> rsc = getResourceByPath(resources, localPath);
Collections.singletonList(localNodeName),
null,
null,
null,
null,
null);

optRsc = getResourceByPath(resources, localPath);
} catch (ApiException apiEx) {
// couldn't query linstor controller
logger.error(apiEx.getBestMessage());
return false;
}

if (rsc.isPresent())
{
if (optRsc.isPresent()) {
try {
Resource rsc = optRsc.get();
ResourceDefinitionModify rdm = new ResourceDefinitionModify();
rdm.deleteProps(Collections.singletonList("DrbdOptions/Net/allow-two-primaries"));
ApiCallRcList answers = api.resourceDefinitionModify(rsc.get().getName(), rdm);
ApiCallRcList answers = api.resourceDefinitionModify(rsc.getName(), rdm);
if (answers.hasError()) {
logger.error(
String.format("Failed to remove 'allow-two-primaries' on %s: %s",
rsc.get().getName(), LinstorUtil.getBestErrorMessage(answers)));
rsc.getName(), LinstorUtil.getBestErrorMessage(answers)));
// do not fail here as removing allow-two-primaries property isn't fatal
}

} catch(ApiException apiEx){
logger.error(apiEx.getBestMessage());
// do not fail here as removing allow-two-primaries property isn't fatal
return true;
}
logger.warn("Linstor: Couldn't find resource for this path: " + localPath);
} catch (ApiException apiEx) {
logger.error(apiEx.getBestMessage());
// do not fail here as removing allow-two-primaries property isn't fatal
}
}
return true;
logger.info("Linstor: Couldn't find resource for this path: {}", localPath);
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public boolean implement(final Network network, final NetworkOffering offering,
return false;
}

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

if (network.isRollingRestart()) {
Expand Down Expand Up @@ -262,27 +262,13 @@ public boolean prepare(final Network network, final NicProfile nic, final Virtua
return false;
}

final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
if (offering.isSystemOnly()) {
return false;
}
if (!_networkMdl.isProviderEnabledInPhysicalNetwork(_networkMdl.getPhysicalNetworkId(network), getProvider().getName())) {
return false;
}

final RouterDeploymentDefinition routerDeploymentDefinition =
routerDeploymentDefinitionBuilder.create()
.setGuestNetwork(network)
.setDeployDestination(dest)
.setAccountOwner(_accountMgr.getAccount(network.getAccountId()))
.setParams(vm.getParameters())
.build();

final List<DomainRouterVO> routers = routerDeploymentDefinition.deployVirtualRouter();
final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
implement(network, offering, dest, context);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,8 @@ private Pair<String, String> handleCheckAndRepairVolumeJob(Long vmId, Long volum
} else if (jobResult instanceof ResourceAllocationException) {
throw (ResourceAllocationException)jobResult;
} else if (jobResult instanceof Throwable) {
throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
Throwable throwable = (Throwable) jobResult;
throw new RuntimeException(String.format("Unexpected exception: %s", throwable.getMessage()), throwable);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ A modern role-based progressive CloudStack UI based on Vue.js and Ant Design.

Install node: (Debian/Ubuntu)

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

Install node: (CentOS/Fedora/RHEL)

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

Install node: (Mac OS)
Expand Down
Loading

0 comments on commit 7de8a6d

Please sign in to comment.