mirror of https://github.com/apache/cloudstack.git
new refactor and simplifications, add veeam plugin skeleton/stub
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
a31de6cf36
commit
68eb42b83c
|
|
@ -58,7 +58,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup-and-recovery</artifactId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -719,10 +719,6 @@ public class ApiConstants {
|
|||
public static final String LAST_ANNOTATED = "lastannotated";
|
||||
public static final String LDAP_DOMAIN = "ldapdomain";
|
||||
|
||||
// Backup and Recovery
|
||||
public static final String BR_PROVIDER_ID = "providerid";
|
||||
public static final String BR_POLICY_ID = "policyid";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.br.policy;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.br.BRProviderDriver;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = AssignBRPolicyCmd.APINAME,
|
||||
description = "Assigns a VM to an existing backup policy",
|
||||
responseObject = SuccessResponse.class, since = "4.12.0")
|
||||
public class AssignBRPolicyCmd extends BaseCmd {
|
||||
|
||||
public static final String APINAME = "assignBRPolicy";
|
||||
|
||||
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = UserVmResponse.class,
|
||||
required = true,
|
||||
description = "id of the VM to be moved")
|
||||
private String virtualMachineId;
|
||||
|
||||
@Parameter(name = ApiConstants.BR_POLICY_ID,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
private String policyId;
|
||||
|
||||
public String getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public String getPolicyId() {
|
||||
return policyId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
try {
|
||||
BRProviderDriver provider = brManager.getBRProviderFromPolicy(getPolicyId());
|
||||
boolean result = provider.assignVMToBackupPolicy(getPolicyId(), getVirtualMachineId());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign VM to backup policy");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return AssignBRPolicyCmd.APINAME + RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.br.policy;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.api.response.BRPolicyResponse;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = ListBRPoliciesCmd.APINAME,
|
||||
description = "Lists mapped Backup policies",
|
||||
responseObject = BRPolicyResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class ListBRPoliciesCmd extends BaseListCmd {
|
||||
|
||||
public static final String APINAME = "listBRPolicies";
|
||||
|
||||
@Parameter(name = ApiConstants.BR_PROVIDER_ID,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
private String providerId;
|
||||
|
||||
public String getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
|
||||
@Override
|
||||
public void execute() throws ServerApiException, ConcurrentOperationException {
|
||||
try {
|
||||
ListResponse<BRPolicyResponse> response = new ListResponse<BRPolicyResponse>();
|
||||
List<BRPolicyResponse> responses = new ArrayList<>();
|
||||
List<BRPolicy> policies = brManager.listBRPolicies(providerId);
|
||||
if (CollectionUtils.isNotEmpty(policies)) {
|
||||
for (BRPolicy policy : policies) {
|
||||
responses.add(brManager.createBackupPolicyResponse(policy));
|
||||
}
|
||||
}
|
||||
response.setResponses(responses, responses.size());
|
||||
response.setObjectName("brpolicies");
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
||||
} catch (CloudRuntimeException e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.br.provider;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.api.response.BRProviderResponse;
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = AddBRProviderCmd.APINAME,
|
||||
description = "Adds a Backup and Recovery provider on a zone",
|
||||
responseObject = BRProviderResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class AddBRProviderCmd extends BaseCmd {
|
||||
|
||||
public static final String APINAME = "addBRProvider";
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(AddBRProviderCmd.class);
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=BaseCmd.CommandType.UUID, entityType = ZoneResponse.class,
|
||||
required=true, description="the ID of the zone you wish to register the Backup and Recovery provider to.")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the Backup and Recovery provider")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, description = "the URL of the Backup and Recovery provider portal")
|
||||
private String url;
|
||||
|
||||
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "the username for the Backup and Recovery provider")
|
||||
private String username;
|
||||
|
||||
@Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the password for the Backup and Recovery provider")
|
||||
private String password;
|
||||
|
||||
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true, description = "the Backup and Recovery provider type")
|
||||
private String provider;
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
BRProvider providerVO = brManager.addBRProvider(name, url, username, password, zoneId, provider);
|
||||
if (providerVO != null) {
|
||||
BRProviderResponse response = brManager.createBRProviderResponse(providerVO);
|
||||
response.setObjectName("brprovider");
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add a Backup and Recovery Provider");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.br.provider;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.api.response.BRProviderResponse;
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = ListBRProvidersCmd.APINAME,
|
||||
description = "Lists Backup and Recovery providers",
|
||||
responseObject = BRProviderResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class ListBRProvidersCmd extends BaseListCmd {
|
||||
|
||||
public static final String APINAME = "listBRProviders";
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
|
||||
@Override
|
||||
public void execute() throws ServerApiException, ConcurrentOperationException {
|
||||
try {
|
||||
List<BRProvider> providers = brManager.listBRProviders();
|
||||
ListResponse<BRProviderResponse> response = new ListResponse<BRProviderResponse>();
|
||||
List<BRProviderResponse> providersResponse = new ArrayList<BRProviderResponse>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(providers)) {
|
||||
for (BRProvider providerVO : providers) {
|
||||
BRProviderResponse providerResponse = brManager.createBRProviderResponse(providerVO);
|
||||
providersResponse.add(providerResponse);
|
||||
}
|
||||
}
|
||||
|
||||
response.setResponses(providersResponse, providersResponse.size());
|
||||
response.setObjectName("brproviders");
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
||||
} catch (CloudRuntimeException e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + RESPONSE_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
|
@ -14,71 +14,77 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.br.provider;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = DeleteBRProviderCmd.APINAME,
|
||||
description = "Deletes a Backup and Recovery provider",
|
||||
responseObject = SuccessResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class DeleteBRProviderCmd extends BaseCmd {
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.backup.BackupManager;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
public static final String APINAME = "deleteBRProvider";
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
@APICommand(name = AssignBackupPolicyCmd.APINAME,
|
||||
description = "Assigns a VM to an existing backup policy",
|
||||
responseObject = SuccessResponse.class, since = "4.12.0")
|
||||
public class AssignBackupPolicyCmd extends BaseCmd {
|
||||
public static final String APINAME = "assignBackupPolicy";
|
||||
|
||||
@Parameter(name = ApiConstants.BR_PROVIDER_ID,
|
||||
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = UserVmResponse.class,
|
||||
required = true,
|
||||
description = "id of the VM to be moved")
|
||||
private String virtualMachineId;
|
||||
|
||||
@Parameter(name = ApiConstants.POLICY_ID,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
private String providerId;
|
||||
private String policyId;
|
||||
|
||||
public String getProviderId() {
|
||||
return providerId;
|
||||
public String getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public String getPolicyId() {
|
||||
return policyId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
BackupManager backupManager;
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
try {
|
||||
boolean result = brManager.deleteBRProvider(providerId);
|
||||
;
|
||||
boolean result = backupManager.assignVMToBackupPolicy();
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Backup and Recovery Provider");
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign VM to backup policy");
|
||||
}
|
||||
} catch (InvalidParameterValueException e) {
|
||||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
|
||||
} catch (CloudRuntimeException e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + RESPONSE_SUFFIX;
|
||||
return AssignBackupPolicyCmd.APINAME + RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
public class CreateBackupCmd {
|
||||
}
|
||||
|
|
@ -14,8 +14,21 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.br.policy;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.BackupPolicyResponse;
|
||||
import org.apache.cloudstack.backup.BackupManager;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
@ -24,41 +37,27 @@ import com.cloud.exception.NetworkRuleConflictException;
|
|||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.api.response.BRPolicyResponse;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = AddBRPolicyCmd.APINAME,
|
||||
description = "Adds a Backup policy",
|
||||
responseObject = BRPolicyResponse.class, since = "4.12.0",
|
||||
@APICommand(name = CreateBackupPolicyCmd.APINAME,
|
||||
description = "Creates a backup policy",
|
||||
responseObject = BackupPolicyResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class AddBRPolicyCmd extends BaseCmd {
|
||||
|
||||
public static final String APINAME = "addBRPolicy";
|
||||
public class CreateBackupPolicyCmd extends BaseCmd {
|
||||
public static final String APINAME = "createBackupPolicy";
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
BackupManager backupManager;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the policy")
|
||||
private String policyName;
|
||||
|
||||
@Parameter(name = ApiConstants.BR_POLICY_ID,
|
||||
@Parameter(name = ApiConstants.POLICY_ID,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
private String policyId;
|
||||
|
||||
@Parameter(name = ApiConstants.BR_PROVIDER_ID,
|
||||
@Parameter(name = ApiConstants.PROVIDER,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
|
|
@ -79,10 +78,13 @@ public class AddBRPolicyCmd extends BaseCmd {
|
|||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
try {
|
||||
BRPolicy policy = brManager.addBRPolicy(policyId, policyName, providerId);
|
||||
BackupPolicy policy = backupManager.addBackupPolicy(policyId, policyName, providerId);
|
||||
if (policy != null) {
|
||||
BRPolicyResponse response = brManager.createBackupPolicyResponse(policy);
|
||||
response.setObjectName("brpolicy");
|
||||
BackupPolicyResponse response = new BackupPolicyResponse();
|
||||
response.setId(policy.getUuid());
|
||||
response.setPolicyId(policy.getPolicyUuid());
|
||||
response.setName(policy.getName());
|
||||
response.setObjectName("policy");
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
public class DeleteBackupCmd {
|
||||
}
|
||||
|
|
@ -15,11 +15,7 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.framework.br;
|
||||
|
||||
/**
|
||||
* Backup and Recovery Services
|
||||
*/
|
||||
public interface BRService extends BRProviderService, BRPolicyService {
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
public class DeleteBackupPolicyCmd {
|
||||
}
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.br.provider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -28,28 +28,28 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.BackupPolicyResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.br.BRManager;
|
||||
import org.apache.cloudstack.br.BRProviderDriver;
|
||||
import org.apache.cloudstack.api.response.BRPolicyResponse;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.cloudstack.backup.BackupManager;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@APICommand(name = ListBRProviderPoliciesCmd.APINAME,
|
||||
description = "Lists Backup policies existing on the Backup and Recovery provider side",
|
||||
responseObject = BRPolicyResponse.class, since = "4.12.0",
|
||||
@APICommand(name = ListBackupPoliciesCmd.APINAME,
|
||||
description = "Lists backup policies existing on the Backup and Recovery provider side",
|
||||
responseObject = BackupPolicyResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class ListBRProviderPoliciesCmd extends BaseListCmd {
|
||||
public class ListBackupPoliciesCmd extends BaseListCmd {
|
||||
|
||||
public static final String APINAME = "listBRProviderPolicies";
|
||||
public static final String APINAME = "listBackupPolicies";
|
||||
|
||||
@Inject
|
||||
BRManager brManager;
|
||||
BackupManager backupManager;
|
||||
|
||||
@Parameter(name = ApiConstants.BR_PROVIDER_ID,
|
||||
@Parameter(name = ApiConstants.PROVIDER,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Backup Recovery Provider ID")
|
||||
|
|
@ -61,19 +61,18 @@ public class ListBRProviderPoliciesCmd extends BaseListCmd {
|
|||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, ServerApiException, ConcurrentOperationException {
|
||||
List<BRPolicyResponse> responses = new ArrayList<>();
|
||||
ListResponse<BRPolicyResponse> response = new ListResponse<BRPolicyResponse>();
|
||||
List<BackupPolicyResponse> responses = new ArrayList<>();
|
||||
ListResponse<BackupPolicyResponse> response = new ListResponse<BackupPolicyResponse>();
|
||||
try {
|
||||
BRProviderDriver provider = brManager.getBRProviderFromProvider(providerId);
|
||||
List<BRPolicy> policies = provider.listBackupPolicies(brManager.getProviderId(providerId));
|
||||
List<BackupPolicy> policies = backupManager.listBackupPolicies();
|
||||
if (policies == null) {
|
||||
throw new CloudRuntimeException("Error while retrieving backup provider policies");
|
||||
}
|
||||
for (BRPolicy policy : policies) {
|
||||
responses.add(brManager.createBackupPolicyResponse(policy));
|
||||
for (BackupPolicy policy : policies) {
|
||||
responses.add(backupManager.createBackupPolicyResponse(policy));
|
||||
}
|
||||
response.setResponses(responses, responses.size());
|
||||
response.setObjectName("brproviderpolicies");
|
||||
response.setObjectName("policy");
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.BackupProviderResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.backup.BackupManager;
|
||||
import org.apache.cloudstack.framework.backup.BackupProvider;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = ListBackupProvidersCmd.APINAME,
|
||||
description = "Lists Backup and Recovery providers",
|
||||
responseObject = BackupProviderResponse.class, since = "4.12.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class ListBackupProvidersCmd extends BaseListCmd {
|
||||
public static final String APINAME = "listBackupProviders";
|
||||
|
||||
@Inject
|
||||
private BackupManager backupManager;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List CA service provider by name")
|
||||
private String name;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
private void setupResponse(final List<BackupProvider> providers) {
|
||||
final ListResponse<BackupProviderResponse> response = new ListResponse<>();
|
||||
final List<BackupProviderResponse> responses = new ArrayList<>();
|
||||
for (final BackupProvider provider : providers) {
|
||||
if (provider == null || (getName() != null && !provider.getName().equals(getName()))) {
|
||||
continue;
|
||||
}
|
||||
final BackupProviderResponse backupProviderResponse = new BackupProviderResponse();
|
||||
backupProviderResponse.setName(provider.getName());
|
||||
backupProviderResponse.setDescription(provider.getDescription());
|
||||
backupProviderResponse.setObjectName("provider");
|
||||
responses.add(backupProviderResponse);
|
||||
}
|
||||
response.setResponses(responses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
List<BackupProvider> providers = backupManager.listBackupProviders();
|
||||
setupResponse(providers);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,15 +14,8 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.br.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.br.BRProviderVO;
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BRProviderDao extends GenericDao<BRProviderVO, Long> {
|
||||
|
||||
List<BRProviderVO> listByZone(long zoneId);
|
||||
List<BRProviderVO> listByZoneAndProvider(long zoneId, String provider);
|
||||
public class ListBackupsCmd {
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.api.command.user.backup;
|
||||
|
||||
public class RestoreBackupCmd {
|
||||
}
|
||||
|
|
@ -14,18 +14,18 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
@EntityReference(value = BRPolicy.class)
|
||||
public class BRPolicyResponse extends BaseResponse {
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value = BackupPolicy.class)
|
||||
public class BackupPolicyResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "internal id of the backup policy")
|
||||
|
|
@ -39,11 +39,11 @@ public class BRPolicyResponse extends BaseResponse {
|
|||
@Param(description = "internal name for the backup policy")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.BR_POLICY_ID)
|
||||
@SerializedName(ApiConstants.POLICY_ID)
|
||||
@Param(description = "policy id on the provider side")
|
||||
private String policyId;
|
||||
|
||||
@SerializedName(ApiConstants.BR_PROVIDER_ID)
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "id of the backup and Recovery provider")
|
||||
private String providerId;
|
||||
|
||||
|
|
@ -17,53 +17,37 @@
|
|||
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
import org.apache.cloudstack.framework.backup.BackupProvider;
|
||||
|
||||
@EntityReference(BRProvider.class)
|
||||
public class BRProviderResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.BR_PROVIDER_ID)
|
||||
@Param(description = "id of the Backup and Recovery provider")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "name of the provider")
|
||||
private String providerName;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(BackupProvider.class)
|
||||
public class BackupProviderResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "internal name for the Backup and Recovery provider")
|
||||
@Param(description = "the CA service provider name")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID)
|
||||
@Param(description = "id of the zone")
|
||||
private String zoneId;
|
||||
@SerializedName(ApiConstants.DESCRIPTION)
|
||||
@Param(description = "the description of the CA service provider")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.HOST_ID)
|
||||
@Param(description = "id of the host")
|
||||
private String hostId;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setHostId(String hostId) {
|
||||
this.hostId = hostId;
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.response.BackupPolicyResponse;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
import org.apache.cloudstack.framework.backup.BackupService;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
/**
|
||||
* Backup and Recover Manager Interface
|
||||
*/
|
||||
public interface BackupManager extends BackupService, Configurable, PluggableService, Manager {
|
||||
|
||||
ConfigKey<Boolean> BackupFrameworkEnabled = new ConfigKey<>("Advanced", Boolean.class,
|
||||
"backup.framework.enabled",
|
||||
"false",
|
||||
"Is backup and recovery framework enabled.", true, ConfigKey.Scope.Zone);
|
||||
|
||||
ConfigKey<String> BackupProviderPlugin = new ConfigKey<>("Advanced", String.class,
|
||||
"backup.framework.provider.plugin",
|
||||
"",
|
||||
"The backup and recovery provider plugin.", true, ConfigKey.Scope.Zone);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a response from the Backup Policy VO
|
||||
*/
|
||||
BackupPolicyResponse createBackupPolicyResponse(BackupPolicy policyVO);
|
||||
|
||||
/**
|
||||
* Add a new Backup and Recovery policy
|
||||
*/
|
||||
BackupPolicy addBackupPolicy(String policyId, String policyName, String providerId);
|
||||
|
||||
boolean assignVMToBackupPolicy();
|
||||
|
||||
List<BackupPolicy> listBackupPolicies();
|
||||
}
|
||||
|
|
@ -15,17 +15,18 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
* Backup and Recovery Provider
|
||||
*/
|
||||
public interface BRProviderDriver extends Adapter {
|
||||
public interface BackupProviderDriver extends Adapter {
|
||||
|
||||
/**
|
||||
* Register Backup and Recovery Provider
|
||||
|
|
@ -40,7 +41,7 @@ public interface BRProviderDriver extends Adapter {
|
|||
/**
|
||||
* List existing Backup Policies on the provider
|
||||
*/
|
||||
List<BRPolicy> listBackupPolicies(long providerId);
|
||||
List<BackupPolicy> listBackupPolicies(long providerId);
|
||||
|
||||
/**
|
||||
* Assign a VM to an existing backup policy
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import org.apache.cloudstack.api.response.BRPolicyResponse;
|
||||
import org.apache.cloudstack.api.response.BRProviderResponse;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
import org.apache.cloudstack.framework.br.BRService;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
|
||||
/**
|
||||
* Backup and Recover Manager Interface
|
||||
*/
|
||||
public interface BRManager extends BRService, Configurable, PluggableService, Manager {
|
||||
|
||||
/**
|
||||
* Get the Backup and Recovery Provider for the policy id, null if not registered
|
||||
*/
|
||||
BRProviderDriver getBRProviderFromPolicy(String policyId);
|
||||
|
||||
/**
|
||||
* Get the Backup and Recovery Provider for the provider id, null if not registered
|
||||
*/
|
||||
BRProviderDriver getBRProviderFromProvider(String providerId);
|
||||
|
||||
/**
|
||||
* Generate a response from the Backup and Recovery Provider VO
|
||||
*/
|
||||
BRProviderResponse createBRProviderResponse(BRProvider backupRecoveryProviderVO);
|
||||
|
||||
/**
|
||||
* Generate a response from the Backup Policy VO
|
||||
*/
|
||||
BRPolicyResponse createBackupPolicyResponse(BRPolicy policyVO);
|
||||
|
||||
/**
|
||||
* Return Backup and Recovery id from provider uuid
|
||||
*/
|
||||
long getProviderId(String providerId);
|
||||
}
|
||||
|
|
@ -475,12 +475,17 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup-and-recovery</artifactId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-backup-and-recovery-dummy</artifactId>
|
||||
<artifactId>cloud-plugin-backup-dummy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-backup-veeam</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
name=backup-and-recovery
|
||||
parent=backend
|
||||
name=backup
|
||||
parent=backend
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
>
|
||||
|
||||
<bean class="org.apache.cloudstack.spring.lifecycle.registry.RegistryLifecycle">
|
||||
<property name="registry" ref="backupRecoveryRegistry" />
|
||||
<property name="typeClass" value="org.apache.cloudstack.br.BRProviderDriver" />
|
||||
<property name="registry" ref="backupProvidersRegistry" />
|
||||
<property name="typeClass" value="org.apache.cloudstack.framework.backup.BackupProvider" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
|
@ -323,7 +323,7 @@
|
|||
class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
|
||||
</bean>
|
||||
|
||||
<bean id="backupRecoveryRegistry"
|
||||
<bean id="backupProvidersRegistry"
|
||||
class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
|
||||
</bean>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,24 +17,22 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
public class BRPolicyTO implements BRPolicy {
|
||||
public class BackupPolicyTO implements BackupPolicy {
|
||||
|
||||
private long id;
|
||||
private String uuid;
|
||||
private String name;
|
||||
private String policyUuid;
|
||||
private long providerId;
|
||||
|
||||
public BRPolicyTO(final long id, final String uuid, final String name, final String policyUuid, final long providerId) {
|
||||
public BackupPolicyTO(final long id, final String uuid, final String name, final String policyUuid) {
|
||||
this.name = name;
|
||||
this.uuid = uuid;
|
||||
this.id = id;
|
||||
this.policyUuid = policyUuid;
|
||||
this.providerId = providerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,11 +44,6 @@ public class BRPolicyTO implements BRPolicy {
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
|
|
@ -15,9 +15,9 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
|
@ -25,19 +25,19 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
|
||||
@Entity
|
||||
@Table(name = "br_policies")
|
||||
public class BRPolicyVO implements BRPolicy {
|
||||
@Table(name = "backup_policy")
|
||||
public class BackupPolicyVO implements BackupPolicy {
|
||||
|
||||
public BRPolicyVO() {
|
||||
public BackupPolicyVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public BRPolicyVO(final long providerId, final String name, final String policyUuid) {
|
||||
public BackupPolicyVO(final String name, final String policyUuid) {
|
||||
this();
|
||||
this.providerId = providerId;
|
||||
this.name = name;
|
||||
this.policyUuid = policyUuid;
|
||||
}
|
||||
|
|
@ -49,9 +49,6 @@ public class BRPolicyVO implements BRPolicy {
|
|||
@Column(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "provider_id")
|
||||
private long providerId;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
|
|
@ -89,12 +86,4 @@ public class BRPolicyVO implements BRPolicy {
|
|||
public void setPolicyUuid(String policyUuid) {
|
||||
this.policyUuid = policyUuid;
|
||||
}
|
||||
|
||||
public long getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public void setProviderId(long providerId) {
|
||||
this.providerId = providerId;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,15 +15,12 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br.dao;
|
||||
package org.apache.cloudstack.backup.dao;
|
||||
|
||||
import org.apache.cloudstack.backup.BackupPolicyVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.br.BRPolicyVO;
|
||||
|
||||
import java.util.List;
|
||||
public interface BackupPolicyDao extends GenericDao<BackupPolicyVO, Long> {
|
||||
|
||||
public interface BRPoliciesDao extends GenericDao<BRPolicyVO, Long> {
|
||||
|
||||
List<BRPolicyVO> listByProvider(long providerId);
|
||||
void removeByProvider(long providerId);
|
||||
}
|
||||
|
|
@ -15,45 +15,27 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br.dao;
|
||||
package org.apache.cloudstack.backup.dao;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.apache.cloudstack.backup.BackupPolicyVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import org.apache.cloudstack.br.BRPolicyVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class BRPoliciesDaoImpl extends GenericDaoBase<BRPolicyVO, Long> implements BRPoliciesDao {
|
||||
public class BackupPolicyDaoImpl extends GenericDaoBase<BackupPolicyVO, Long> implements BackupPolicyDao {
|
||||
|
||||
protected SearchBuilder<BRPolicyVO> backupPoliciesSearch;
|
||||
protected SearchBuilder<BackupPolicyVO> backupPoliciesSearch;
|
||||
|
||||
public BRPoliciesDaoImpl() {
|
||||
public BackupPolicyDaoImpl() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
backupPoliciesSearch = createSearchBuilder();
|
||||
backupPoliciesSearch.and("provider", backupPoliciesSearch.entity().getProviderId(), SearchCriteria.Op.EQ);
|
||||
backupPoliciesSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRPolicyVO> listByProvider(long providerId) {
|
||||
SearchCriteria<BRPolicyVO> sc = backupPoliciesSearch.create();
|
||||
sc.setParameters("provider", providerId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeByProvider(long providerId) {
|
||||
SearchCriteria<BRPolicyVO> sc = backupPoliciesSearch.create();
|
||||
sc.setParameters("provider", providerId);
|
||||
expunge(sc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "br_provider_details")
|
||||
public class BRProviderDetailVO implements InternalIdentity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private long id;
|
||||
|
||||
@Column(name = "provider_id")
|
||||
private long providerId;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Encrypt
|
||||
@Column(name = "value")
|
||||
private String value;
|
||||
|
||||
public BRProviderDetailVO() {
|
||||
}
|
||||
|
||||
public BRProviderDetailVO(long providerId, String name, String value) {
|
||||
this.providerId = providerId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public long getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public long getResourceId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GenerationType;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "br_provider")
|
||||
public class BRProviderVO implements BRProvider {
|
||||
|
||||
public BRProviderVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public BRProviderVO(final String name, final long zoneId, final String url, final String provider) {
|
||||
this();
|
||||
this.name = name;
|
||||
this.zoneId = zoneId;
|
||||
this.provider = provider;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@Column(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "url", length = 2048)
|
||||
private String url;
|
||||
|
||||
@Column(name = "zone_id")
|
||||
private long zoneId;
|
||||
|
||||
@Column(name = "provider")
|
||||
private String provider;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProviderName(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.br.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import org.apache.cloudstack.br.BRProviderVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class BRProviderDaoImpl extends GenericDaoBase<BRProviderVO, Long> implements BRProviderDao {
|
||||
|
||||
protected SearchBuilder<BRProviderVO> brProviderSearch;
|
||||
|
||||
public BRProviderDaoImpl() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
brProviderSearch = createSearchBuilder();
|
||||
brProviderSearch.and("zoneid", brProviderSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
|
||||
brProviderSearch.and("provider", brProviderSearch.entity().getProviderName(), SearchCriteria.Op.EQ);
|
||||
brProviderSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRProviderVO> listByZone(long zoneId) {
|
||||
SearchCriteria<BRProviderVO> sc = brProviderSearch.create();
|
||||
sc.setParameters("zoneid", zoneId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRProviderVO> listByZoneAndProvider(long zoneId, String provider) {
|
||||
SearchCriteria<BRProviderVO> sc = brProviderSearch.create();
|
||||
sc.setParameters("zoneid", zoneId);
|
||||
sc.setParameters("provider", provider);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package org.apache.cloudstack.br.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.br.BRProviderDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BRProviderDetailsDao extends GenericDao<BRProviderDetailVO, Long> {
|
||||
|
||||
void addDetails(List<BRProviderDetailVO> details);
|
||||
void removeDetails(long providerId);
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br.dao;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import org.apache.cloudstack.br.BRProviderDetailVO;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
public class BRProviderDetailsDaoImpl extends GenericDaoBase<BRProviderDetailVO, Long> implements BRProviderDetailsDao {
|
||||
|
||||
protected SearchBuilder<BRProviderDetailVO> detailsSearch;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
detailsSearch = createSearchBuilder();
|
||||
detailsSearch.and("provider", detailsSearch.entity().getProviderId(), SearchCriteria.Op.EQ);
|
||||
detailsSearch.done();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addDetails(List<BRProviderDetailVO> details) {
|
||||
for (BRProviderDetailVO detail : details) {
|
||||
persist(detail);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDetails(long providerId) {
|
||||
SearchCriteria<BRProviderDetailVO> sc = detailsSearch.create();
|
||||
sc.setParameters("provider", providerId);
|
||||
remove(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -356,7 +356,5 @@
|
|||
<bean id="outOfBandManagementDaoImpl" class="org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDaoImpl" />
|
||||
<bean id="GuestOsDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.GuestOsDetailsDaoImpl" />
|
||||
<bean id="annotationDaoImpl" class="org.apache.cloudstack.annotation.dao.AnnotationDaoImpl" />
|
||||
<bean id="brProviderDaoImpl" class="org.apache.cloudstack.br.dao.BRProviderDaoImpl" />
|
||||
<bean id="brProviderDetailsDaoImpl" class="org.apache.cloudstack.br.dao.BRProviderDetailsDaoImpl" />
|
||||
<bean id="brPoliciesDaoImpl" class="org.apache.cloudstack.br.dao.BRPoliciesDaoImpl" />
|
||||
<bean id="brPoliciesDaoImpl" class="org.apache.cloudstack.backup.dao.BackupPolicyDaoImpl" />
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -36,36 +36,11 @@ INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`,
|
|||
|
||||
-- Backup and Recovery
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cloud`.`br_provider` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uuid` varchar(40),
|
||||
`name` varchar(255) COMMENT 'name for the backup and recovery provider',
|
||||
`url` varchar(255) DEFAULT NULL COMMENT 'the url of the backup and recovery provider',
|
||||
`zone_id` bigint unsigned NOT NULL COMMENT 'foreign key to zone id',
|
||||
`provider` varchar(255) DEFAULT NULL COMMENT 'the backup and recovery provider',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uuid` (`uuid`),
|
||||
CONSTRAINT `fk_backup_and_recovery_providers__zone_id` FOREIGN KEY (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cloud`.`br_provider_details` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`provider_id` bigint(20) unsigned NOT NULL COMMENT 'backup and recovery provider id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_provider_id_name` (`provider_id`,`name`),
|
||||
KEY `fk_br_provider_details__provider_id` (`provider_id`),
|
||||
CONSTRAINT `fk_br_provider_details__provider_id` FOREIGN KEY (`provider_id`) REFERENCES `br_provider` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=496 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cloud`.`br_policies` (
|
||||
CREATE TABLE IF NOT EXISTS `cloud`.`backup_policy` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uuid` varchar(40) NOT NULL,
|
||||
`provider_id` bigint(20) unsigned NOT NULL COMMENT 'backup and recovery provider id',
|
||||
`name` varchar(255) NOT NULL COMMENT 'backup policy name',
|
||||
`policy_uuid` varchar(40) NOT NULL COMMENT 'backup policy ID on provider side',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uuid` (`uuid`),
|
||||
CONSTRAINT `fk_br_policies__provider_id` FOREIGN KEY (`provider_id`) REFERENCES `br_provider` (`id`) ON DELETE CASCADE
|
||||
UNIQUE KEY `uuid` (`uuid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cloudstack.framework.br;
|
||||
|
||||
public interface BRPolicy {
|
||||
|
||||
long getId();
|
||||
String getUuid();
|
||||
String getPolicyUuid();
|
||||
String getName();
|
||||
long getProviderId();
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package org.apache.cloudstack.framework.br;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Backup and Recovery Policies Services
|
||||
*/
|
||||
public interface BRPolicyService {
|
||||
|
||||
/**
|
||||
* Add a new Backup and Recovery policy
|
||||
*/
|
||||
BRPolicy addBRPolicy(String policyId, String policyName, String providerId);
|
||||
|
||||
/**
|
||||
* List Backup policies
|
||||
*/
|
||||
List<BRPolicy> listBRPolicies(String providerId);
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package org.apache.cloudstack.framework.br;
|
||||
|
||||
public interface BRProvider {
|
||||
long getId();
|
||||
String getUuid();
|
||||
String getName();
|
||||
String getUrl();
|
||||
long getZoneId();
|
||||
String getProviderName();
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package org.apache.cloudstack.framework.br;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Backup and Recovery Provider Services
|
||||
*/
|
||||
public interface BRProviderService {
|
||||
|
||||
/**
|
||||
* Add a new Backup and Recovery provider
|
||||
*/
|
||||
BRProvider addBRProvider(String name, String url, String username, String password, Long zoneId, String providerName);
|
||||
|
||||
/**
|
||||
* List existing Backup and Recovery providers
|
||||
*/
|
||||
List<BRProvider> listBRProviders();
|
||||
|
||||
/**
|
||||
* Delete existing Backup and Recovery provider
|
||||
*/
|
||||
boolean deleteBRProvider(String providerId);
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cloud-framework-backup-and-recovery</artifactId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<name>Apache CloudStack Framework - Backup and Recovery</name>
|
||||
<parent>
|
||||
<artifactId>cloudstack-framework</artifactId>
|
||||
|
|
@ -29,4 +29,4 @@
|
|||
</parent>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//Licensed to the Apache Software Foundation (ASF) under one
|
||||
//or more contributor license agreements. See the NOTICE file
|
||||
//distributed with this work for additional information
|
||||
//regarding copyright ownership. The ASF licenses this file
|
||||
//to you under the Apache License, Version 2.0 (the
|
||||
//"License"); you may not use this file except in compliance
|
||||
//the License. You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing,
|
||||
//software distributed under the License is distributed on an
|
||||
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
//KIND, either express or implied. See the License for the
|
||||
//specific language governing permissions and limitations
|
||||
//under the License.
|
||||
package org.apache.cloudstack.framework.backup;
|
||||
|
||||
public interface BackupPolicy {
|
||||
long getId();
|
||||
String getUuid();
|
||||
String getPolicyUuid();
|
||||
String getName();
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//Licensed to the Apache Software Foundation (ASF) under one
|
||||
//or more contributor license agreements. See the NOTICE file
|
||||
//distributed with this work for additional information
|
||||
//regarding copyright ownership. The ASF licenses this file
|
||||
//to you under the Apache License, Version 2.0 (the
|
||||
//"License"); you may not use this file except in compliance
|
||||
//the License. You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing,
|
||||
//software distributed under the License is distributed on an
|
||||
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
//KIND, either express or implied. See the License for the
|
||||
//specific language governing permissions and limitations
|
||||
//under the License.
|
||||
package org.apache.cloudstack.framework.backup;
|
||||
|
||||
public interface BackupProvider {
|
||||
|
||||
/**
|
||||
* Returns the unique name of the provider
|
||||
* @return returns provider name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Returns description about the backup and recovery provider plugin
|
||||
* @return returns description
|
||||
*/
|
||||
String getDescription();
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//Licensed to the Apache Software Foundation (ASF) under one
|
||||
//or more contributor license agreements. See the NOTICE file
|
||||
//distributed with this work for additional information
|
||||
//regarding copyright ownership. The ASF licenses this file
|
||||
//to you under the Apache License, Version 2.0 (the
|
||||
//"License"); you may not use this file except in compliance
|
||||
//the License. You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing,
|
||||
//software distributed under the License is distributed on an
|
||||
//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
//KIND, either express or implied. See the License for the
|
||||
//specific language governing permissions and limitations
|
||||
//under the License.
|
||||
package org.apache.cloudstack.framework.backup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Backup and Recovery Services
|
||||
*/
|
||||
public interface BackupService {
|
||||
/**
|
||||
* Lists backup and recovery provider plugins
|
||||
* @return list of providers
|
||||
*/
|
||||
List<BackupProvider> listBackupProviders();
|
||||
|
||||
/**
|
||||
* Find backup provider by name and zone ID
|
||||
* When null is provided as name, the configured provider is returned
|
||||
* @param providerName
|
||||
* @param zoneId
|
||||
* @return backup provider
|
||||
*/
|
||||
BackupProvider getBackupProvider(final String providerName, final Long zoneId);
|
||||
}
|
||||
|
|
@ -58,6 +58,6 @@
|
|||
<module>security</module>
|
||||
<module>agent-lb</module>
|
||||
<module>direct-download</module>
|
||||
<module>backup-and-recovery</module>
|
||||
<module>backup</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DummyBRProvider extends AdapterBase implements BRProviderDriver {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(DummyBRProvider.class);
|
||||
|
||||
@Override
|
||||
public boolean registerProvider(long zoneId, String name, String url, String username, String password) {
|
||||
s_logger.debug("Registering Dummy Backup and Recovery provider");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRPolicy> listBackupPolicies(long providerId) {
|
||||
s_logger.debug("Listing Dummy Backup policies");
|
||||
BRPolicy policy1 = new BRPolicyTO(1l, UUID.randomUUID().toString(), "Golden Policy", "aaaa-aaaa", providerId);
|
||||
BRPolicy policy2 = new BRPolicyTO(1l, UUID.randomUUID().toString(), "Silver Policy", "bbbb-bbbb", providerId);
|
||||
return Arrays.asList(policy1, policy2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean policyExists(String policyId, String policyName) {
|
||||
s_logger.debug("Checking if policy " + policyId + " " + policyName + " exists");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean assignVMToBackupPolicy(String policyId, String vmId) {
|
||||
s_logger.debug("Assigning VM " + vmId+ " to the policy " + policyId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unregisterProvider() {
|
||||
s_logger.debug("Unregistering Dummy Backup and Recovery provider");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreVMFromBackup() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreAndAttachVolumeToVM() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cloud-plugin-backup-and-recovery-dummy</artifactId>
|
||||
<name>Apache CloudStack Plugin - Backup and Recovery Dummy Plugin</name>
|
||||
<artifactId>cloud-plugin-backup-dummy</artifactId>
|
||||
<name>Apache CloudStack Plugin - Dummy Backup and Recovery Plugin</name>
|
||||
<parent>
|
||||
<artifactId>cloudstack-plugins</artifactId>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup-and-recovery</artifactId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import org.apache.cloudstack.framework.backup.BackupProvider;
|
||||
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
|
||||
public class DummyBackupProvider extends AdapterBase implements BackupProvider {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "dummy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Dummy B&R Provider";
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,5 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
name=dummy-backup-recovery
|
||||
parent=backup-and-recovery
|
||||
name=dummy-backup
|
||||
parent=backup
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
|
||||
>
|
||||
<bean id="dummyBackupRecoveryDriver" class="org.apache.cloudstack.br.DummyBRProvider">
|
||||
<property name="name" value="Dummy" />
|
||||
<bean id="dummyBackupRecoveryDriver" class="org.apache.cloudstack.backup.DummyBackupProvider">
|
||||
<property name="name" value="dummy" />
|
||||
</bean>
|
||||
</beans>
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cloud-plugin-backup-veeam</artifactId>
|
||||
<name>Apache CloudStack Plugin - Veeam Backup and Recovery Plugin</name>
|
||||
<parent>
|
||||
<artifactId>cloudstack-plugins</artifactId>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<version>4.12.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import org.apache.cloudstack.framework.backup.BackupProvider;
|
||||
import org.apache.cloudstack.framework.backup.BackupService;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
|
||||
public class VeeamBackupProvider extends AdapterBase implements BackupProvider, Configurable {
|
||||
private static final Logger LOG = Logger.getLogger(VeeamBackupProvider.class);
|
||||
|
||||
private ConfigKey<String> VeeamUrl = new ConfigKey<>("Advanced", String.class,
|
||||
"backup.plugin.veeam.url",
|
||||
"",
|
||||
"The Veeam backup and recovery URL.", true, ConfigKey.Scope.Zone);
|
||||
|
||||
private ConfigKey<String> VeeamUsername = new ConfigKey<>("Advanced", String.class,
|
||||
"backup.plugin.veeam.username",
|
||||
"",
|
||||
"The Veeam backup and recovery username.", true, ConfigKey.Scope.Zone);
|
||||
|
||||
private ConfigKey<String> VeeamPassword = new ConfigKey<>("Advanced", String.class,
|
||||
"backup.plugin.veeam.password",
|
||||
"",
|
||||
"The Veeam backup and recovery password.", true, ConfigKey.Scope.Zone);
|
||||
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return BackupService.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey[]{
|
||||
VeeamUrl,
|
||||
VeeamUsername,
|
||||
VeeamPassword
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "veeam";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Veeam B&R Plugin";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
name=veeam
|
||||
parent=backup
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
|
||||
<bean id="veeamBackupProvider" class="org.apache.cloudstack.backup.VeeamBackupProvider">
|
||||
<property name="name" value="veeam" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
|
@ -110,7 +110,8 @@
|
|||
<module>database/quota</module>
|
||||
<module>integrations/cloudian</module>
|
||||
<module>integrations/prometheus</module>
|
||||
<module>backup-and-recovery/dummy</module>
|
||||
<module>backup/dummy</module>
|
||||
<module>backup/veeam</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -146,16 +146,16 @@
|
|||
<artifactId>cloud-engine-storage-configdrive</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
<version>${cs.opensaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-backup-and-recovery</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,139 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.backup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.backup.CreateBackupPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.backup.ListBackupPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.backup.ListBackupProvidersCmd;
|
||||
import org.apache.cloudstack.api.response.BackupPolicyResponse;
|
||||
import org.apache.cloudstack.backup.dao.BackupPolicyDao;
|
||||
import org.apache.cloudstack.framework.backup.BackupPolicy;
|
||||
import org.apache.cloudstack.framework.backup.BackupProvider;
|
||||
import org.apache.cloudstack.framework.backup.BackupService;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
@Component
|
||||
public class BackupManagerImpl extends ManagerBase implements BackupManager {
|
||||
private static final Logger LOG = Logger.getLogger(BackupManagerImpl.class);
|
||||
|
||||
@Inject
|
||||
BackupPolicyDao backupPolicyDao;
|
||||
|
||||
@Inject
|
||||
DataCenterDao dataCenterDao;
|
||||
|
||||
private static Map<String, BackupProvider> backupProvidersMap = new HashMap<>();
|
||||
private List<BackupProvider> backupProviders;
|
||||
|
||||
@Override
|
||||
public BackupPolicy addBackupPolicy(String policyId, String policyName, String providerId) {
|
||||
BackupProvider provider = getBackupProvider(null, null);
|
||||
boolean exists = false; //provider.policyExists(policyId, policyName);
|
||||
if (!exists) {
|
||||
throw new CloudRuntimeException("Policy " + policyId + " does not exist on provider " + provider.getName());
|
||||
}
|
||||
|
||||
BackupPolicyVO policy = new BackupPolicyVO(policyName, policyId);
|
||||
return backupPolicyDao.persist(policy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean assignVMToBackupPolicy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BackupPolicy> listBackupPolicies() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackupPolicyResponse createBackupPolicyResponse(BackupPolicy policyVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEnabled(final Long zoneId) {
|
||||
return BackupFrameworkEnabled.valueIn(zoneId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BackupProvider> listBackupProviders() {
|
||||
return backupProviders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackupProvider getBackupProvider(final String providerName, final Long zoneId) {
|
||||
String name = providerName;
|
||||
if (Strings.isNullOrEmpty(name)) {
|
||||
name = BackupProviderPlugin.valueIn(zoneId);
|
||||
}
|
||||
return backupProvidersMap.getOrDefault(name, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Class<?>> getCommands() {
|
||||
final List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(ListBackupProvidersCmd.class);
|
||||
cmdList.add(ListBackupPoliciesCmd.class);
|
||||
cmdList.add(CreateBackupPolicyCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return BackupService.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey[]{BackupFrameworkEnabled, BackupProviderPlugin};
|
||||
}
|
||||
|
||||
public void setBackupProviders(final List<BackupProvider> backupProviders) {
|
||||
this.backupProviders = backupProviders;
|
||||
initializeBackupProviderMap();
|
||||
}
|
||||
|
||||
private void initializeBackupProviderMap() {
|
||||
if (backupProviders != null && backupProviders.size() != backupProviders.size()) {
|
||||
for (final BackupProvider backupProvider : backupProviders) {
|
||||
backupProvidersMap.put(backupProvider.getName().toLowerCase(), backupProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.br;
|
||||
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.br.dao.BRProviderDetailsDao;
|
||||
import org.apache.cloudstack.framework.br.BRPolicy;
|
||||
import org.apache.cloudstack.framework.br.BRProvider;
|
||||
import org.apache.cloudstack.api.command.admin.br.policy.AddBRPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.admin.br.provider.AddBRProviderCmd;
|
||||
import org.apache.cloudstack.api.command.admin.br.provider.DeleteBRProviderCmd;
|
||||
import org.apache.cloudstack.api.command.admin.br.policy.ListBRPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.br.provider.ListBRProviderPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.br.provider.ListBRProvidersCmd;
|
||||
import org.apache.cloudstack.api.response.BRPolicyResponse;
|
||||
import org.apache.cloudstack.api.response.BRProviderResponse;
|
||||
import org.apache.cloudstack.br.dao.BRPoliciesDao;
|
||||
import org.apache.cloudstack.br.dao.BRProviderDao;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Component
|
||||
public class BRManagerImpl extends ManagerBase implements BRManager {
|
||||
|
||||
@Inject
|
||||
BRProviderDao brProviderDao;
|
||||
@Inject
|
||||
BRProviderDetailsDao brProviderDetailsDao;
|
||||
@Inject
|
||||
BRPoliciesDao brPoliciesDao;
|
||||
@Inject
|
||||
DataCenterDao dataCenterDao;
|
||||
|
||||
private List<BRProviderDriver> brProviders = new ArrayList<>();
|
||||
private Map<String, BRProviderDriver> brProvidersMap = new HashMap<>();
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(BRManagerImpl.class);
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
public BRProviderDriver getBRProvider(String provider) {
|
||||
return brProvidersMap.getOrDefault(provider, null);
|
||||
}
|
||||
|
||||
public BRProviderDriver getBRProviderFromPolicy(String policyId) {
|
||||
BRPolicyVO policy = brPoliciesDao.findByUuid(policyId);
|
||||
BRProviderVO provider = brProviderDao.findById(policy.getProviderId());
|
||||
return getBRProvider(provider.getProviderName());
|
||||
}
|
||||
|
||||
public BRProviderDriver getBRProviderFromProvider(String providerId) {
|
||||
BRProviderVO provider = brProviderDao.findByUuid(providerId);
|
||||
return brProvidersMap.getOrDefault(provider.getProviderName(), null);
|
||||
}
|
||||
|
||||
public List<BRProviderDriver> getBackupRecoveryProviders() {
|
||||
return brProviders;
|
||||
}
|
||||
|
||||
public void setBackupRecoveryProviders(List<BRProviderDriver> backupRecoveryProviders) {
|
||||
this.brProviders = backupRecoveryProviders;
|
||||
}
|
||||
|
||||
private void initializeDriversMap() {
|
||||
if (brProvidersMap.isEmpty() && brProviders != null && brProviders.size() > 0) {
|
||||
for (final BRProviderDriver driver : brProviders) {
|
||||
brProvidersMap.put(driver.getName().toLowerCase(), driver);
|
||||
}
|
||||
s_logger.debug("Discovered Backup and Recovery providers configured in the BRManager");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean start() {
|
||||
initializeDriversMap();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Backup Provider provider services
|
||||
*/
|
||||
|
||||
List<BRProviderDetailVO> createProviderDetails(long providerId, String url, String username, String password) {
|
||||
BRProviderDetailVO detail1 = new BRProviderDetailVO(providerId, "url", url);
|
||||
BRProviderDetailVO detail2 = new BRProviderDetailVO(providerId, "username", username);
|
||||
BRProviderDetailVO detail3 = new BRProviderDetailVO(providerId, "password", password);
|
||||
return Arrays.asList(detail1, detail2, detail3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BRProviderVO addBRProvider(String name, String url, String username, String password, Long zoneId, String providerName) {
|
||||
if (!brProvidersMap.containsKey(providerName)) {
|
||||
throw new InvalidParameterException("Unsopported provider: " + providerName);
|
||||
}
|
||||
|
||||
s_logger.debug("Registering a new Backup and Recovery provider on zone: " + zoneId + " - url: " + url + " - name: " + name
|
||||
+ " - provider: " + providerName);
|
||||
BRProviderDriver provider = brProvidersMap.get(providerName);
|
||||
boolean result = provider.registerProvider(zoneId, name, url, username, password);
|
||||
|
||||
if (!result) {
|
||||
throw new CloudRuntimeException("Could not register backup and recovery provider " + name);
|
||||
}
|
||||
|
||||
try {
|
||||
BRProviderVO providerVO = new BRProviderVO(name, zoneId, url, providerName);
|
||||
providerVO = brProviderDao.persist(providerVO);
|
||||
|
||||
brProviderDetailsDao.addDetails(createProviderDetails(providerVO.getId(), url, username, password));
|
||||
return providerVO;
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException("Error persisting Backup and recovery provider after succesfull registration: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRProvider> listBRProviders() {
|
||||
return new ArrayList<BRProvider>(brProviderDao.listAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteBRProvider(String providerUuid) {
|
||||
BRProviderVO providerVO = brProviderDao.findByUuid(providerUuid);
|
||||
long providerId = providerVO.getId();
|
||||
if (providerVO == null) {
|
||||
throw new InvalidParameterValueException("Could not find a Backup and Recovery provider with id: " + providerId);
|
||||
}
|
||||
BRProviderDriver provider = brProvidersMap.get(providerVO.getProviderName());
|
||||
boolean result = provider.unregisterProvider();
|
||||
|
||||
if (!result) {
|
||||
throw new CloudRuntimeException("Unable to unregister provider: " + providerVO.getProviderName() + " id: " +providerId);
|
||||
}
|
||||
|
||||
clearBRPolicies(providerId);
|
||||
clearBRProviderDetails(providerId);
|
||||
|
||||
brProviderDao.remove(providerId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Backup Provider policies services
|
||||
*/
|
||||
@Override
|
||||
public BRPolicy addBRPolicy(String policyId, String policyName, String providerId) {
|
||||
BRProviderVO providerVO = brProviderDao.findByUuid(providerId);
|
||||
BRProviderDriver provider = getBRProvider(providerVO.getProviderName());
|
||||
boolean exists = provider.policyExists(policyId, policyName);
|
||||
if (!exists) {
|
||||
throw new CloudRuntimeException("Policy " + policyId + " does not exist on provider " + providerVO.getName());
|
||||
}
|
||||
|
||||
BRPolicyVO policy = new BRPolicyVO(providerVO.getId(), policyName, policyId);
|
||||
return brPoliciesDao.persist(policy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BRPolicy> listBRPolicies(String providerId) {
|
||||
BRProviderVO provider = brProviderDao.findByUuid(providerId);
|
||||
return new ArrayList<BRPolicy>(brPoliciesDao.listByProvider(provider.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a Backup and Recovery Provider mapped policies
|
||||
*/
|
||||
private void clearBRPolicies(long providerId) {
|
||||
brPoliciesDao.removeByProvider(providerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a Backup and Recovery Provider details
|
||||
*/
|
||||
private void clearBRProviderDetails(Long providerId) {
|
||||
brProviderDetailsDao.removeDetails(providerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BRProviderResponse createBRProviderResponse(BRProvider vo) {
|
||||
DataCenterVO dc = dataCenterDao.findById(vo.getZoneId());
|
||||
|
||||
BRProviderResponse response = new BRProviderResponse();
|
||||
response.setId(vo.getUuid());
|
||||
response.setName(vo.getName());
|
||||
response.setProviderName(vo.getProviderName());
|
||||
response.setZoneId(dc.getUuid());
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BRPolicyResponse createBackupPolicyResponse(BRPolicy policyVO) {
|
||||
BRProviderVO provider = brProviderDao.findById(policyVO.getProviderId());
|
||||
|
||||
BRPolicyResponse response = new BRPolicyResponse();
|
||||
response.setId(policyVO.getUuid());
|
||||
response.setPolicyId(policyVO.getPolicyUuid());
|
||||
response.setName(policyVO.getName());
|
||||
response.setProviderId(provider.getUuid());
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getProviderId(String providerId) {
|
||||
BRProviderVO provider = brProviderDao.findByUuid(providerId);
|
||||
return provider.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Class<?>> getCommands() {
|
||||
final List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(AddBRProviderCmd.class);
|
||||
cmdList.add(DeleteBRProviderCmd.class);
|
||||
cmdList.add(ListBRProvidersCmd.class);
|
||||
cmdList.add(ListBRPoliciesCmd.class);
|
||||
cmdList.add(ListBRProviderPoliciesCmd.class);
|
||||
cmdList.add(AddBRPolicyCmd.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -299,7 +299,7 @@
|
|||
|
||||
<bean id="directDownloadManager" class="org.apache.cloudstack.direct.download.DirectDownloadManagerImpl" />
|
||||
|
||||
<bean id="backupRecoveryManagerImpl" class="org.apache.cloudstack.br.BRManagerImpl" >
|
||||
<property name="backupRecoveryProviders" value="#{backupRecoveryRegistry.registered}" />
|
||||
<bean id="backupManager" class="org.apache.cloudstack.backup.BackupManagerImpl">
|
||||
<property name="backupProviders" value="#{backupProvidersRegistry.registered}" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ known_categories = {
|
|||
'listElastistorInterface': 'Misc',
|
||||
'cloudian': 'Cloudian',
|
||||
'Sioc' : 'Sioc',
|
||||
'BR' : 'BackupRecovery'
|
||||
'Backup' : 'Backup'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue