-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Create Instance from backup on another Zone (DRaaS use case) #11560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2588ee4
draas initial changes
abh1sar 8f0ce46
Fix UT failure in UserVmManagerImplTest
abh1sar 4eac151
Added option to enable disaster recovery on a backup respository. Add…
abh1sar 090c222
Added timeout for mount operation in backup restore configurable via …
abh1sar b6b8a0f
Merge remote-tracking branch 'upstream/main' into draas
abh1sar 6c03978
Addressed review comments
abh1sar a58f6d4
fix for simulator test failures
abh1sar dae4f3b
Added UT for coverage
abh1sar 7449646
Fix create instance from backup ui for other providers
abh1sar 0df7f8d
Added events to add/update backup repository
abh1sar 9dd75f2
Fix race in fetchZones
abh1sar 5941150
One more fix in fetchZones in DeployVMFromBackup.vue
abh1sar 0910dfe
Fix zone selection in createNetwork via Create Instance from backup f…
abh1sar 1aa08b0
Allow template/iso selection in create instance from backup ui
abh1sar bc7055d
rename draasenabled to crosszoneinstancecreation
abh1sar 6f39390
Added Cross-zone instance creation in test_backup_recovery_nas.py
abh1sar def5f8f
Added UT in BackupManagerTest and UserVmManagerImplTest
abh1sar faebe18
Integration test added for Cross-zone instance creation in test_backu…
abh1sar bdbfe54
Merge remote-tracking branch 'origin/draas' into draas
abh1sar ea8d8d6
Merge branch 'main' into draas
abh1sar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
...a/org/apache/cloudstack/api/command/user/backup/repository/UpdateBackupRepositoryCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| // 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.repository; | ||
|
|
||
| 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.BackupRepositoryResponse; | ||
| import org.apache.cloudstack.backup.BackupRepository; | ||
| import org.apache.cloudstack.backup.BackupRepositoryService; | ||
| import org.apache.cloudstack.context.CallContext; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| @APICommand(name = "updateBackupRepository", | ||
| description = "Update a backup repository", | ||
| responseObject = BackupRepositoryResponse.class, since = "4.22.0", | ||
| authorized = {RoleType.Admin}) | ||
| public class UpdateBackupRepositoryCmd extends BaseCmd { | ||
|
|
||
| @Inject | ||
| private BackupRepositoryService backupRepositoryService; | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| //////////////// API parameters ///////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BackupRepositoryResponse.class, description = "ID of the backup repository") | ||
| private Long id; | ||
|
|
||
| @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the backup repository") | ||
| private String name; | ||
|
|
||
| @Parameter(name = ApiConstants.ADDRESS, type = CommandType.STRING, required = true, description = "address of the backup repository") | ||
| private String address; | ||
|
|
||
| @Parameter(name = ApiConstants.MOUNT_OPTIONS, type = CommandType.STRING, description = "shared storage mount options") | ||
| private String mountOptions; | ||
|
|
||
| @Parameter(name = ApiConstants.DRAAS_ENABLED, type = CommandType.BOOLEAN, description = "the backup repository is configured to be used for disaster recovery on other Zones") | ||
| private Boolean draasEnabled; | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////////// Accessors /////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| public BackupRepositoryService getBackupRepositoryService() { | ||
| return backupRepositoryService; | ||
| } | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getAddress() { | ||
| return address; | ||
| } | ||
|
|
||
| public String getMountOptions() { | ||
| return mountOptions == null ? "" : mountOptions; | ||
| } | ||
|
|
||
| public Boolean isDraasEnabled() { | ||
| return draasEnabled; | ||
| } | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
| /////////////////// Accessors /////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| try { | ||
| BackupRepository result = backupRepositoryService.updateBackupRepository(this); | ||
| if (result != null) { | ||
| BackupRepositoryResponse response = _responseGenerator.createBackupRepositoryResponse(result); | ||
| response.setResponseName(getCommandName()); | ||
| this.setResponseObject(response); | ||
| } else { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add backup repository"); | ||
| } | ||
| } catch (Exception ex4) { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex4.getMessage()); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public long getEntityOwnerId() { | ||
| return CallContext.current().getCallingAccount().getId(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.