Skip to content

Commit c599011

Browse files
committed
Merge remote-tracking branch 'apache/4.18'
2 parents 9773ba3 + f42feb1 commit c599011

7 files changed

Lines changed: 65 additions & 43 deletions

File tree

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*/
1515
package com.cloud.agent.properties;
1616

17+
import org.apache.cloudstack.utils.security.KeyStoreUtils;
18+
1719
/**
1820
* Class of constant agent's properties available to configure on
1921
* "agent.properties".
@@ -779,6 +781,13 @@ public Property<Integer> getWorkers() {
779781
*/
780782
public static final Property<Long> KVM_HEARTBEAT_CHECKER_TIMEOUT = new Property<>("kvm.heartbeat.checker.timeout", 360000L);
781783

784+
/**
785+
* Keystore passphrase
786+
* Data type: String.<br>
787+
* Default value: <code>null</code>
788+
*/
789+
public static final Property<String> KEYSTORE_PASSPHRASE = new Property<>(KeyStoreUtils.KS_PASSPHRASE_PROPERTY, null, String.class);
790+
782791
public static class Property <T>{
783792
private String name;
784793
private T defaultValue;

engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,8 @@ public AsyncCallFuture<VolumeApiResult> createManagedStorageVolumeFromTemplateAs
14781478
createManagedVolumeCloneTemplateAsync(volumeInfo, templateOnPrimary, destPrimaryDataStore, future);
14791479
} else {
14801480
// We have a template on PowerFlex primary storage. Create new volume and copy to it.
1481-
s_logger.debug("Copying the template to the volume on primary storage");
1482-
createManagedVolumeCopyManagedTemplateAsync(volumeInfo, destPrimaryDataStore, templateOnPrimary, destHost, future);
1481+
createManagedVolumeCopyManagedTemplateAsyncWithLock(volumeInfo, destPrimaryDataStore, templateOnPrimary,
1482+
destHost, future, destDataStoreId, srcTemplateInfo.getId());
14831483
}
14841484
} else {
14851485
s_logger.debug("Primary storage does not support cloning or no support for UUID resigning on the host side; copying the template normally");
@@ -1490,6 +1490,32 @@ public AsyncCallFuture<VolumeApiResult> createManagedStorageVolumeFromTemplateAs
14901490
return future;
14911491
}
14921492

1493+
private void createManagedVolumeCopyManagedTemplateAsyncWithLock(VolumeInfo volumeInfo, PrimaryDataStore destPrimaryDataStore, TemplateInfo templateOnPrimary,
1494+
Host destHost, AsyncCallFuture<VolumeApiResult> future, long destDataStoreId, long srcTemplateId) {
1495+
GlobalLock lock = null;
1496+
try {
1497+
String tmplIdManagedPoolIdDestinationHostLockString = "tmplId:" + srcTemplateId + "managedPoolId:" + destDataStoreId + "destinationHostId:" + destHost.getId();
1498+
lock = GlobalLock.getInternLock(tmplIdManagedPoolIdDestinationHostLockString);
1499+
if (lock == null) {
1500+
throw new CloudRuntimeException("Unable to create volume from template, couldn't get global lock on " + tmplIdManagedPoolIdDestinationHostLockString);
1501+
}
1502+
1503+
int storagePoolMaxWaitSeconds = NumbersUtil.parseInt(configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()), 3600);
1504+
if (!lock.lock(storagePoolMaxWaitSeconds)) {
1505+
s_logger.debug("Unable to create volume from template, couldn't lock on " + tmplIdManagedPoolIdDestinationHostLockString);
1506+
throw new CloudRuntimeException("Unable to create volume from template, couldn't lock on " + tmplIdManagedPoolIdDestinationHostLockString);
1507+
}
1508+
1509+
s_logger.debug("Copying the template to the volume on primary storage");
1510+
createManagedVolumeCopyManagedTemplateAsync(volumeInfo, destPrimaryDataStore, templateOnPrimary, destHost, future);
1511+
} finally {
1512+
if (lock != null) {
1513+
lock.unlock();
1514+
lock.releaseRef();
1515+
}
1516+
}
1517+
}
1518+
14931519
private boolean computeSupportsVolumeClone(long zoneId, HypervisorType hypervisorType) {
14941520
if (HypervisorType.VMware.equals(hypervisorType) || HypervisorType.KVM.equals(hypervisorType)) {
14951521
return true;

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
10441044
}
10451045
}
10461046

1047-
enableSSLForKvmAgent(params);
1047+
enableSSLForKvmAgent();
10481048
configureLocalStorage();
10491049

10501050
/* Directory to use for Qemu sockets like for the Qemu Guest Agent */
@@ -1353,13 +1353,13 @@ protected void setupMemoryBalloonStatsPeriod(Connect conn) {
13531353
}
13541354
}
13551355

1356-
private void enableSSLForKvmAgent(final Map<String, Object> params) {
1356+
private void enableSSLForKvmAgent() {
13571357
final File keyStoreFile = PropertiesUtil.findConfigFile(KeyStoreUtils.KS_FILENAME);
13581358
if (keyStoreFile == null) {
13591359
s_logger.info("Failed to find keystore file: " + KeyStoreUtils.KS_FILENAME);
13601360
return;
13611361
}
1362-
String keystorePass = (String)params.get(KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
1362+
String keystorePass = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.KEYSTORE_PASSPHRASE);
13631363
if (StringUtils.isBlank(keystorePass)) {
13641364
s_logger.info("Failed to find passphrase for keystore: " + KeyStoreUtils.KS_FILENAME);
13651365
return;

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

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -493,39 +493,8 @@ public KVMPhysicalDisk createTemplateFromDirectDownloadFile(String templateFileP
493493
}
494494

495495
public long getCapacity(LinstorStoragePool pool) {
496-
DevelopersApi linstorApi = getLinstorAPI(pool);
497496
final String rscGroupName = pool.getResourceGroup();
498-
try {
499-
List<ResourceGroup> rscGrps = linstorApi.resourceGroupList(
500-
Collections.singletonList(rscGroupName),
501-
null,
502-
null,
503-
null);
504-
505-
if (rscGrps.isEmpty()) {
506-
final String errMsg = String.format("Linstor: Resource group '%s' not found", rscGroupName);
507-
s_logger.error(errMsg);
508-
throw new CloudRuntimeException(errMsg);
509-
}
510-
511-
List<StoragePool> storagePools = linstorApi.viewStoragePools(
512-
Collections.emptyList(),
513-
rscGrps.get(0).getSelectFilter().getStoragePoolList(),
514-
null,
515-
null,
516-
null
517-
);
518-
519-
final long capacity = storagePools.stream()
520-
.filter(sp -> sp.getProviderKind() != ProviderKind.DISKLESS)
521-
.mapToLong(sp -> sp.getTotalCapacity() != null ? sp.getTotalCapacity() : 0)
522-
.sum() * 1024; // linstor uses kiB
523-
s_logger.debug("Linstor: GetCapacity() -> " + capacity);
524-
return capacity;
525-
} catch (ApiException apiEx) {
526-
s_logger.error(apiEx.getMessage());
527-
throw new CloudRuntimeException(apiEx.getBestMessage(), apiEx);
528-
}
497+
return LinstorUtil.getCapacityBytes(pool.getSourceHost(), rscGroupName);
529498
}
530499

531500
public long getAvailable(LinstorStoragePool pool) {
@@ -554,7 +523,7 @@ public long getAvailable(LinstorStoragePool pool) {
554523

555524
final long free = storagePools.stream()
556525
.filter(sp -> sp.getProviderKind() != ProviderKind.DISKLESS)
557-
.mapToLong(StoragePool::getFreeCapacity).sum() * 1024; // linstor uses KiB
526+
.mapToLong(sp -> sp.getFreeCapacity() != null ? sp.getFreeCapacity() : 0L).sum() * 1024; // linstor uses KiB
558527

559528
s_logger.debug("Linstor: getAvailable() -> " + free);
560529
return free;
@@ -590,7 +559,9 @@ public long getUsed(LinstorStoragePool pool) {
590559

591560
final long used = storagePools.stream()
592561
.filter(sp -> sp.getProviderKind() != ProviderKind.DISKLESS)
593-
.mapToLong(sp -> sp.getTotalCapacity() - sp.getFreeCapacity()).sum() * 1024; // linstor uses Kib
562+
.mapToLong(sp -> sp.getTotalCapacity() != null && sp.getFreeCapacity() != null ?
563+
sp.getTotalCapacity() - sp.getFreeCapacity() : 0L)
564+
.sum() * 1024; // linstor uses Kib
594565
s_logger.debug("Linstor: getUsed() -> " + used);
595566
return used;
596567
} catch (ApiException apiEx) {

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/util/LinstorUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ public static long getCapacityBytes(String linstorUrl, String rscGroupName) {
161161

162162
return storagePools.stream()
163163
.filter(sp -> sp.getProviderKind() != ProviderKind.DISKLESS)
164-
.mapToLong(StoragePool::getTotalCapacity).sum() * 1024; // linstor uses kiB
164+
.mapToLong(sp -> sp.getTotalCapacity() != null ? sp.getTotalCapacity() : 0L)
165+
.sum() * 1024; // linstor uses kiB
165166
} catch (ApiException apiEx) {
166167
s_logger.error(apiEx.getMessage());
167168
throw new CloudRuntimeException(apiEx);

scripts/util/create-kubernetes-binaries-iso.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ if [ -z "${kubeadm_file_permissions}" ]; then
145145
fi
146146
chmod ${kubeadm_file_permissions} "${working_dir}/k8s/kubeadm"
147147

148+
echo "Updating imagePullPolicy to IfNotPresent in yaml files..."
149+
sed -i "s/imagePullPolicy:.*/imagePullPolicy: IfNotPresent/g" ${working_dir}/*.yaml
150+
148151
mkisofs -o "${output_dir}/${build_name}" -J -R -l "${iso_dir}"
149152

150153
rm -rf "${iso_dir}"

tools/marvin/marvin/config/test_data.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,11 +2260,23 @@
22602260
"url": "http://download.cloudstack.org/cks/setup-1.26.0.iso",
22612261
"mincpunumber": 2,
22622262
"minmemory": 2048
2263+
},
2264+
"1.27.8": {
2265+
"semanticversion": "1.27.8",
2266+
"url": "http://download.cloudstack.org/cks/setup-1.27.8.iso",
2267+
"mincpunumber": 2,
2268+
"minmemory": 2048
2269+
},
2270+
"1.28.4": {
2271+
"semanticversion": "1.28.4",
2272+
"url": "http://download.cloudstack.org/cks/setup-1.28.4.iso",
2273+
"mincpunumber": 2,
2274+
"minmemory": 2048
22632275
}
22642276
},
2265-
"cks_kubernetes_version": "1.26.0",
2266-
"cks_kubernetes_version_upgrade_from": "1.25.0",
2267-
"cks_kubernetes_version_upgrade_to": "1.26.0",
2277+
"cks_kubernetes_version": "1.28.4",
2278+
"cks_kubernetes_version_upgrade_from": "1.27.8",
2279+
"cks_kubernetes_version_upgrade_to": "1.28.4",
22682280
"cks_service_offering": {
22692281
"name": "CKS-Instance",
22702282
"displaytext": "CKS Instance",

0 commit comments

Comments
 (0)