Copilot commented on code in PR #12956:
URL: https://github.com/apache/cloudstack/pull/12956#discussion_r3050578045
##########
api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java:
##########
@@ -37,7 +37,7 @@ public interface VolumeImportUnmanageService extends
PluggableService, Configura
Arrays.asList(Hypervisor.HypervisorType.KVM,
Hypervisor.HypervisorType.VMware);
List<Storage.StoragePoolType> SUPPORTED_STORAGE_POOL_TYPES_FOR_KVM =
Arrays.asList(Storage.StoragePoolType.NetworkFilesystem,
- Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD);
+ Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD,
Storage.StoragePoolType.SharedMountPoint);
Review Comment:
Same immutability concern here: `Arrays.asList(...)` produces a list that
can still be mutated via `set(...)`. Since this is an interface constant used
for validation, it’s safer to expose an immutable list (e.g., `List.of(...)` or
`Collections.unmodifiableList(Arrays.asList(...))`) to avoid unexpected
behavior if any caller modifies it.
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVolumesOnStorageCommandWrapper.java:
##########
@@ -52,7 +52,7 @@
public final class LibvirtGetVolumesOnStorageCommandWrapper extends
CommandWrapper<GetVolumesOnStorageCommand, Answer, LibvirtComputingResource> {
static final List<StoragePoolType>
STORAGE_POOL_TYPES_SUPPORTED_BY_QEMU_IMG =
Arrays.asList(StoragePoolType.NetworkFilesystem,
- StoragePoolType.Filesystem, StoragePoolType.RBD);
+ StoragePoolType.Filesystem, StoragePoolType.RBD,
StoragePoolType.SharedMountPoint);
Review Comment:
`Arrays.asList(...)` returns a fixed-size but still mutable list (elements
can be replaced via `set(...)`). Since this is a shared `static final`
constant, consider making it truly immutable (e.g., `List.of(...)` if available
in your Java baseline, or wrap with `Collections.unmodifiableList(...)`) to
prevent accidental runtime mutation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]