hide kvm backup export service apis behind a global config

This commit is contained in:
abh1sar 2026-03-28 15:47:04 +05:30 committed by Abhishek Kumar
parent 8d42d5f186
commit b6d480cfb1
9 changed files with 27 additions and 22 deletions

View File

@ -35,9 +35,9 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.utils.EnumUtils;
@APICommand(name = "createImageTransfer",
description = "Create image transfer for a disk in backup",
description = "Create image transfer for a disk in backup. This API is intended for testing only and is disabled by default.",
responseObject = ImageTransferResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class CreateImageTransferCmd extends BaseCmd implements AdminCmd {

View File

@ -31,9 +31,9 @@ import org.apache.cloudstack.backup.KVMBackupExportService;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "deleteVirtualMachineCheckpoint",
description = "Delete a VM checkpoint",
description = "Delete a VM checkpoint. This API is intended for testing only and is disabled by default.",
responseObject = SuccessResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class DeleteVmCheckpointCmd extends BaseCmd implements AdminCmd {

View File

@ -37,9 +37,9 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
@APICommand(name = "finalizeBackup",
description = "Finalize a VM backup session",
description = "Finalize a VM backup session. This API is intended for testing only and is disabled by default.",
responseObject = BackupResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class FinalizeBackupCmd extends BaseAsyncCmd implements AdminCmd {

View File

@ -31,9 +31,9 @@ import org.apache.cloudstack.backup.KVMBackupExportService;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "finalizeImageTransfer",
description = "Finalize an image transfer",
description = "Finalize an image transfe. This API is intended for testing only and is disabled by default.r",
responseObject = SuccessResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class FinalizeImageTransferCmd extends BaseCmd implements AdminCmd {

View File

@ -34,9 +34,9 @@ import org.apache.cloudstack.backup.KVMBackupExportService;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "listImageTransfers",
description = "List image transfers for a backup",
description = "List image transfers for a backup. This API is intended for testing only and is disabled by default.",
responseObject = ImageTransferResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class ListImageTransfersCmd extends BaseListCmd implements AdminCmd {

View File

@ -33,9 +33,9 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.backup.KVMBackupExportService;
@APICommand(name = "listVirtualMachineCheckpoints",
description = "List checkpoints for a VM",
description = "List checkpoints for a VM. This API is intended for testing only and is disabled by default.",
responseObject = CheckpointResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class ListVmCheckpointsCmd extends BaseListCmd implements AdminCmd {

View File

@ -37,9 +37,9 @@ import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
@APICommand(name = "startBackup",
description = "Start a VM backup session (oVirt-style incremental backup)",
description = "Start a VM backup session. This API is intended for testing only and is disabled by default.",
responseObject = BackupResponse.class,
since = "4.22.0",
since = "4.23.0",
authorized = {RoleType.Admin})
public class StartBackupCmd extends BaseAsyncCreateCmd implements AdminCmd {

View File

@ -43,6 +43,10 @@ public interface KVMBackupExportService extends Configurable, PluggableService {
"10",
"The image transfer progress polling interval in seconds.", true, ConfigKey.Scope.Global);
ConfigKey<Boolean> ExposeKVMBackupExportServiceApis = new ConfigKey<>("Hidden", Boolean.class,
"expose.kvm.backup.export.service.apis",
"false",
"Enable to expose APIs for testing the KVM Backup Export Service.", false, ConfigKey.Scope.Global);
/**
* Creates a backup session for a VM
*/

View File

@ -123,7 +123,6 @@ public class KVMBackupExportServiceImpl extends ManagerBase implements KVMBackup
@Override
public Backup createBackup(StartBackupCmd cmd) {
//ToDo: add config check, access check, resource count check, etc.
Long vmId = cmd.getVmId();
VMInstanceVO vm = vmInstanceDao.findById(vmId);
@ -705,13 +704,15 @@ public class KVMBackupExportServiceImpl extends ManagerBase implements KVMBackup
@Override
public List<Class<?>> getCommands() {
List<Class<?>> cmdList = new ArrayList<>();
cmdList.add(StartBackupCmd.class);
cmdList.add(FinalizeBackupCmd.class);
cmdList.add(CreateImageTransferCmd.class);
cmdList.add(FinalizeImageTransferCmd.class);
cmdList.add(ListImageTransfersCmd.class);
cmdList.add(ListVmCheckpointsCmd.class);
cmdList.add(DeleteVmCheckpointCmd.class);
if (ExposeKVMBackupExportServiceApis.value()) {
cmdList.add(StartBackupCmd.class);
cmdList.add(FinalizeBackupCmd.class);
cmdList.add(CreateImageTransferCmd.class);
cmdList.add(FinalizeImageTransferCmd.class);
cmdList.add(ListImageTransfersCmd.class);
cmdList.add(ListVmCheckpointsCmd.class);
cmdList.add(DeleteVmCheckpointCmd.class);
}
return cmdList;
}