mirror of
https://github.com/apache/cloudstack
synced 2026-08-03 05:43:12 +00:00
This PR introduces the initial implementation of Veeam integration support for KVM in CloudStack by adding a UHAPI-compatible server and image server components.
Veeam Backup & Replication interacts with virtualization platforms using its Universal Hypervisor API (UHAPI). To enable backup and restore workflows for CloudStack-managed KVM environments, this change introduces a UHAPI server that exposes CloudStack resources through a UHAPI-compatible interface.
In addition to the control plane APIs, an image server component is introduced to handle the data transfer operations required during backup and restore workflows.
The integration consists of two main components:
1. UHAPI Server (Control Plane) named CloudStack Veeam Control Service
A lightweight UHAPI server runs inside the CloudStack management server and exposes endpoints under:
/ovirt-engine
- /api - For APIs
- /sso - For authentication
- /services/pki-resource - For certificates
This server provides inventory discovery APIs required by Veeam and translates CloudStack resources into the structures expected by UHAPI.
The server:
- exposes infrastructure inventory
- handles authentication and session tokens
- maps CloudStack resources to UHAPI-compatible representations
2. Image Server (Data Plane) named CloudStack Image Service
A separate image server component is introduced to handle backup and restore data transfer operations.
This component:
- serves disk image data during backup
- receives image data during restore operations
- exposes endpoints used by Veeam worker components
- integrates with CloudStack storage to read and write VM disk data
The separation between both these components server ensures that:
- metadata APIs and control operations remain lightweight
- bulk image transfer operations are handled independently
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
Co-authored-by: abh1sar <abhisar.sinha@gmail.com>
Co-authored-by: Wei Zhou <weizhou@apache.org>
189 lines
7.3 KiB
Java
189 lines
7.3 KiB
Java
// 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 com.cloud.user;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import com.cloud.utils.Pair;
|
|
import org.apache.cloudstack.acl.ControlledEntity;
|
|
import org.apache.cloudstack.acl.RolePermissionEntity;
|
|
import org.apache.cloudstack.acl.RoleType;
|
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
|
import org.apache.cloudstack.acl.apikeypair.ApiKeyPair;
|
|
import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission;
|
|
import org.apache.cloudstack.api.BaseCmd;
|
|
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
|
|
|
|
import com.cloud.dc.DataCenter;
|
|
import com.cloud.domain.Domain;
|
|
import com.cloud.exception.PermissionDeniedException;
|
|
import com.cloud.network.vpc.VpcOffering;
|
|
import com.cloud.offering.DiskOffering;
|
|
import com.cloud.offering.NetworkOffering;
|
|
import com.cloud.offering.ServiceOffering;
|
|
import org.apache.cloudstack.api.command.admin.user.DeleteUserKeysCmd;
|
|
import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
|
import org.apache.cloudstack.api.command.admin.user.ListUserKeyRulesCmd;
|
|
import org.apache.cloudstack.api.command.admin.user.ListUserKeysCmd;
|
|
import org.apache.cloudstack.api.command.admin.user.RegisterUserKeysCmd;
|
|
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
|
import org.apache.cloudstack.api.response.ApiKeyPairResponse;
|
|
import org.apache.cloudstack.api.response.ListResponse;
|
|
import org.apache.cloudstack.auth.UserTwoFactorAuthenticator;
|
|
import org.apache.cloudstack.backup.BackupOffering;
|
|
|
|
public interface AccountService {
|
|
|
|
/**
|
|
* Creates a new user and account, stores the password as is so encrypted passwords are recommended.
|
|
* @return the user if created successfully, null otherwise
|
|
*/
|
|
UserAccount createUserAccount(CreateAccountCmd accountCmd);
|
|
|
|
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, Account.Type accountType,
|
|
Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source);
|
|
|
|
/**
|
|
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
|
|
* allocated/etc.
|
|
*/
|
|
UserAccount lockUser(long userId);
|
|
|
|
Account getSystemAccount();
|
|
|
|
User getSystemUser();
|
|
|
|
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone,
|
|
String accountName, Long domainId, String userUUID, boolean isPasswordChangeRequired);
|
|
|
|
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID,
|
|
User.Source source);
|
|
|
|
boolean isAdmin(Long accountId);
|
|
|
|
Account finalizeOwner(Account caller, String accountName, Long domainId, Long projectId);
|
|
|
|
Account getActiveAccountByName(String accountName, Long domainId);
|
|
|
|
UserAccount getActiveUserAccount(String username, Long domainId);
|
|
|
|
List<UserAccount> getActiveUserAccountByEmail(String email, Long domainId);
|
|
|
|
UserAccount updateUser(UpdateUserCmd updateUserCmd);
|
|
|
|
Account getActiveAccountById(long accountId);
|
|
|
|
Account getActiveAccountByUuid(String accountUuid);
|
|
|
|
Account getAccount(long accountId);
|
|
|
|
Account getAccountByUuid(String accountUuid);
|
|
|
|
User getActiveUser(long userId);
|
|
|
|
User getOneActiveUserForAccount(Account account);
|
|
|
|
User getUserIncludingRemoved(long userId);
|
|
|
|
boolean isRootAdmin(Long accountId);
|
|
|
|
boolean isDomainAdmin(Long accountId);
|
|
|
|
boolean isResourceDomainAdmin(Long accountId);
|
|
|
|
boolean isNormalUser(long accountId);
|
|
|
|
User getActiveUserByRegistrationToken(String registrationToken);
|
|
|
|
void markUserRegistered(long userId);
|
|
|
|
ApiKeyPair createApiKeyAndSecretKey(RegisterUserKeysCmd cmd);
|
|
|
|
public String[] createApiKeyAndSecretKey(final long userId);
|
|
|
|
UserAccount getUserByApiKey(String apiKey);
|
|
|
|
RoleType getRoleType(Account account);
|
|
|
|
void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, ServiceOffering so, DataCenter zone) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, DiskOffering dof, DataCenter zone) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, NetworkOffering nof, DataCenter zone) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException;
|
|
|
|
void checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException;
|
|
|
|
void checkAccess(User user, ControlledEntity entity);
|
|
|
|
void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName, ControlledEntity... entities) throws PermissionDeniedException;
|
|
|
|
void validateAccountHasAccessToResource(Account account, AccessType accessType, Object resource);
|
|
|
|
void validateCallingUserHasAccessToDesiredUser(Long userId);
|
|
|
|
Long finalizeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
|
|
|
|
Long finalizeAccountId(Long accountId, String accountName, Long domainId, Long projectId);
|
|
|
|
/**
|
|
* returns the user account object for a given user id
|
|
* @param userId user id
|
|
* @return {@link UserAccount} object if it exists else null
|
|
*/
|
|
UserAccount getUserAccountById(Long userId);
|
|
|
|
Pair<Boolean, Map<String, String>> getKeys(GetUserKeysCmd cmd);
|
|
|
|
ListResponse<ApiKeyPairResponse> listKeys(ListUserKeysCmd cmd);
|
|
|
|
List<ApiKeyPairPermission> listKeyRules(ListUserKeyRulesCmd cmd);
|
|
|
|
void deleteApiKey(DeleteUserKeysCmd cmd);
|
|
|
|
void deleteApiKey(ApiKeyPair id);
|
|
|
|
/**
|
|
* Lists user two-factor authentication provider plugins
|
|
* @return list of providers
|
|
*/
|
|
List<UserTwoFactorAuthenticator> listUserTwoFactorAuthenticationProviders();
|
|
|
|
/**
|
|
* Finds user two factor authenticator provider by domain ID
|
|
* @param domainId domain id
|
|
* @return backup provider
|
|
*/
|
|
UserTwoFactorAuthenticator getUserTwoFactorAuthenticationProvider(final Long domainId);
|
|
|
|
ApiKeyPair getLatestUserKeyPair(Long userId);
|
|
|
|
ApiKeyPair getKeyPairById(Long id);
|
|
|
|
ApiKeyPair getKeyPairByApiKey(String apiKey);
|
|
|
|
String getAccessingApiKey(BaseCmd cmd);
|
|
|
|
List<RolePermissionEntity> getAllKeypairPermissions(String apiKey);
|
|
}
|