Skip to content

Commit a9c3332

Browse files
committed
move configkey into VolumeImportUnmanageService
1 parent e3bc8f5 commit a9c3332

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,29 @@
2525
import org.apache.cloudstack.api.response.ListResponse;
2626
import org.apache.cloudstack.api.response.VolumeForImportResponse;
2727
import org.apache.cloudstack.api.response.VolumeResponse;
28+
import org.apache.cloudstack.framework.config.ConfigKey;
29+
import org.apache.cloudstack.framework.config.Configurable;
2830

2931
import java.util.Arrays;
3032
import java.util.List;
3133

32-
public interface VolumeImportUnmanageService extends PluggableService {
34+
public interface VolumeImportUnmanageService extends PluggableService, Configurable {
3335

3436
List<Hypervisor.HypervisorType> SUPPORTED_HYPERVISORS =
3537
Arrays.asList(Hypervisor.HypervisorType.KVM, Hypervisor.HypervisorType.VMware);
3638

3739
List<Storage.StoragePoolType> SUPPORTED_STORAGE_POOL_TYPES_FOR_KVM = Arrays.asList(Storage.StoragePoolType.NetworkFilesystem,
3840
Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD);
3941

42+
ConfigKey<Boolean> AllowImportVolumeWithBackingFile = new ConfigKey<>(Boolean.class,
43+
"allow.import.volume.with.backing.file",
44+
"Advanced",
45+
"false",
46+
"If enabled, allows QCOW2 volumes with backing files to be imported or unmanaged",
47+
true,
48+
ConfigKey.Scope.Global,
49+
null);
50+
4051
ListResponse<VolumeForImportResponse> listVolumesForImport(ListVolumesForImportCmd cmd);
4152

4253
VolumeResponse importVolume(ImportVolumeCmd cmd);

api/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManager.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ public interface UnmanagedVMsManager extends VmImportService, UnmanageVMService,
7070
ConfigKey.Scope.Global,
7171
null);
7272

73-
ConfigKey<Boolean> AllowImportVolumeWithBackingFile = new ConfigKey<>(Boolean.class,
74-
"allow.import.volume.with.backing.file",
75-
"Advanced",
76-
"false",
77-
"If enabled, allows QCOW2 volumes with backing files to be imported or unmanaged",
78-
true,
79-
ConfigKey.Scope.Global,
80-
null);
81-
8273
static boolean isSupported(Hypervisor.HypervisorType hypervisorType) {
8374
return hypervisorType == VMware || hypervisorType == KVM;
8475
}

server/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageManagerImpl.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.cloudstack.storage.volume;
1919

20-
import static org.apache.cloudstack.vm.UnmanagedVMsManager.AllowImportVolumeWithBackingFile;
21-
2220
import com.cloud.agent.AgentManager;
2321
import com.cloud.agent.api.Answer;
2422
import com.cloud.agent.api.GetVolumesOnStorageAnswer;
@@ -70,6 +68,7 @@
7068
import org.apache.cloudstack.api.response.VolumeResponse;
7169
import org.apache.cloudstack.context.CallContext;
7270
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
71+
import org.apache.cloudstack.framework.config.ConfigKey;
7372
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
7473
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
7574
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
@@ -515,4 +514,16 @@ private void unmanageVolumeFromDatabase(VolumeVO volume) {
515514
volume.setRemoved(new Date());
516515
volumeDao.update(volume.getId(), volume);
517516
}
517+
518+
@Override
519+
public String getConfigComponentName() {
520+
return VolumeImportUnmanageManagerImpl.class.getSimpleName();
521+
}
522+
523+
@Override
524+
public ConfigKey<?>[] getConfigKeys() {
525+
return new ConfigKey<?>[]{
526+
AllowImportVolumeWithBackingFile
527+
};
528+
}
518529
}

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195

196196
import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS;
197197
import static org.apache.cloudstack.api.ApiConstants.MIN_IOPS;
198+
import static org.apache.cloudstack.storage.volume.VolumeImportUnmanageService.AllowImportVolumeWithBackingFile;
198199
import static org.apache.cloudstack.vm.ImportVmTask.Step.CloningInstance;
199200
import static org.apache.cloudstack.vm.ImportVmTask.Step.Completed;
200201
import static org.apache.cloudstack.vm.ImportVmTask.Step.ConvertingInstance;
@@ -3037,8 +3038,7 @@ public ConfigKey<?>[] getConfigKeys() {
30373038
ThreadsOnMSToImportVMwareVMFiles,
30383039
ThreadsOnKVMHostToImportVMwareVMFiles,
30393040
ConvertVmwareInstanceToKvmExtraParamsAllowed,
3040-
ConvertVmwareInstanceToKvmExtraParamsAllowedList,
3041-
AllowImportVolumeWithBackingFile
3041+
ConvertVmwareInstanceToKvmExtraParamsAllowedList
30423042
};
30433043
}
30443044
}

0 commit comments

Comments
 (0)