Skip to content

Commit 82d6edd

Browse files
committed
make setting non-dynamic & fix test
1 parent 7a11626 commit 82d6edd

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public boolean hostConnect(long hostId, long poolId) throws StorageConflictExcep
141141

142142
Optional.ofNullable(nfsMountOpts).ifPresent(detailsMap::putAll);
143143

144+
// Propagate CLVM secure zero-fill setting to the host
145+
// Note: This is done during host connection (agent start, MS restart, host reconnection)
146+
// so the setting is non-dynamic. Changes require host reconnection to take effect.
144147
if (pool.getPoolType() == Storage.StoragePoolType.CLVM) {
145148
Boolean clvmSecureZeroFill = VolumeApiServiceImpl.CLVMSecureZeroFill.valueIn(poolId);
146149
if (clvmSecureZeroFill != null) {

plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,8 +2728,11 @@ public void testCreateStoragePoolCommand() {
27282728

27292729
@Test
27302730
public void testModifyStoragePoolCommand() {
2731-
final StoragePool pool = Mockito.mock(StoragePool.class);;
2731+
final StoragePool pool = Mockito.mock(StoragePool.class);
27322732
final ModifyStoragePoolCommand command = new ModifyStoragePoolCommand(true, pool);
2733+
Map<String, String> details = new HashMap<>();
2734+
details.put(KVMStoragePool.CLVM_SECURE_ZERO_FILL, "false");
2735+
command.setDetails(details);
27332736

27342737
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
27352738
final KVMStoragePool kvmStoragePool = Mockito.mock(KVMStoragePool.class);
@@ -2753,8 +2756,11 @@ public void testModifyStoragePoolCommand() {
27532756

27542757
@Test
27552758
public void testModifyStoragePoolCommandFailure() {
2756-
final StoragePool pool = Mockito.mock(StoragePool.class);;
2759+
final StoragePool pool = Mockito.mock(StoragePool.class);
27572760
final ModifyStoragePoolCommand command = new ModifyStoragePoolCommand(true, pool);
2761+
Map<String, String> details = new HashMap<>();
2762+
details.put(KVMStoragePool.CLVM_SECURE_ZERO_FILL, "false");
2763+
command.setDetails(details);
27582764

27592765
final KVMStoragePoolManager storagePoolMgr = Mockito.mock(KVMStoragePoolManager.class);
27602766

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
413413
"To check and repair the volume if it has any leaks before performing volume attach or VM start operations", true, ConfigKey.Scope.StoragePool);
414414

415415
public static final ConfigKey<Boolean> CLVMSecureZeroFill = new ConfigKey<>("Advanced", Boolean.class, "clvm.secure.zero.fill", "false",
416-
"When enabled, CLVM volumes to be zero-filled at the time of deletion to prevent data from being recovered by VMs reusing the space, as thick LVM volumes write data linearly", true, ConfigKey.Scope.StoragePool);
416+
"When enabled, CLVM volumes to be zero-filled at the time of deletion to prevent data from being recovered by VMs reusing the space, as thick LVM volumes write data linearly. Note: This setting is propagated to hosts when they connect to the storage pool. Changing this setting requires disconnecting and reconnecting hosts or restarting the KVM agent for it to take effect.", false, ConfigKey.Scope.StoragePool);
417417

418418
private final StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
419419

0 commit comments

Comments
 (0)