-
Notifications
You must be signed in to change notification settings - Fork 1.3k
resolve merge problems in the backup framework #10457
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aeb0710
resolve merge problems in the backup framework
DaanHoogland f50dbd0
some cleanups while waiting for compile
DaanHoogland daeb86c
re-remove sync method (and do some warning cleanups)
DaanHoogland 2cc0ecd
revert plugins/backup/veeam/src/main/java/org/apache/cloudstack/backu…
DaanHoogland 6da5db5
Veeam: set backed_volumes for each backup (#9898)
weizhouapache 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |
| package org.apache.cloudstack.backup; | ||
|
|
||
| import com.cloud.agent.AgentManager; | ||
| import com.cloud.dc.dao.ClusterDao; | ||
| import com.cloud.exception.AgentUnavailableException; | ||
| import com.cloud.exception.OperationTimedoutException; | ||
| import com.cloud.host.Host; | ||
|
|
@@ -36,8 +35,8 @@ | |
| import com.cloud.utils.exception.CloudRuntimeException; | ||
| import com.cloud.vm.VirtualMachine; | ||
| import com.cloud.vm.dao.VMInstanceDao; | ||
|
|
||
| import org.apache.cloudstack.backup.dao.BackupDao; | ||
| import org.apache.cloudstack.backup.dao.BackupOfferingDao; | ||
| import org.apache.cloudstack.backup.dao.BackupRepositoryDao; | ||
| import org.apache.cloudstack.framework.config.ConfigKey; | ||
| import org.apache.cloudstack.framework.config.Configurable; | ||
|
|
@@ -70,15 +69,9 @@ public class NASBackupProvider extends AdapterBase implements BackupProvider, Co | |
| @Inject | ||
| private BackupRepositoryDao backupRepositoryDao; | ||
|
|
||
| @Inject | ||
| private BackupOfferingDao backupOfferingDao; | ||
|
|
||
| @Inject | ||
| private HostDao hostDao; | ||
|
|
||
| @Inject | ||
| private ClusterDao clusterDao; | ||
|
|
||
| @Inject | ||
| private VolumeDao volumeDao; | ||
|
|
||
|
|
@@ -166,7 +159,7 @@ public Pair<Boolean, Backup> takeBackup(final VirtualMachine vm) { | |
| command.setVolumePaths(volumePaths); | ||
| } | ||
|
|
||
| BackupAnswer answer = null; | ||
| BackupAnswer answer; | ||
| try { | ||
| answer = (BackupAnswer) agentManager.send(host.getId(), command); | ||
| } catch (AgentUnavailableException e) { | ||
|
|
@@ -204,7 +197,7 @@ private BackupVO createBackupObject(VirtualMachine vm, String backupPath) { | |
| virtualSize += volume.getSize(); | ||
| } | ||
| } | ||
| backup.setProtectedSize(Long.valueOf(virtualSize)); | ||
| backup.setProtectedSize(virtualSize); | ||
| backup.setStatus(Backup.Status.BackingUp); | ||
| backup.setBackupOfferingId(vm.getBackupOfferingId()); | ||
| backup.setAccountId(vm.getAccountId()); | ||
|
|
@@ -231,7 +224,7 @@ public boolean restoreVMFromBackup(VirtualMachine vm, Backup backup) { | |
| restoreCommand.setVmExists(vm.getRemoved() == null); | ||
| restoreCommand.setVmState(vm.getState()); | ||
|
|
||
| BackupAnswer answer = null; | ||
| BackupAnswer answer; | ||
| try { | ||
| answer = (BackupAnswer) agentManager.send(host.getId(), restoreCommand); | ||
| } catch (AgentUnavailableException e) { | ||
|
|
@@ -298,7 +291,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, String volumeU | |
| restoreCommand.setVmState(vmNameAndState.second()); | ||
| restoreCommand.setRestoreVolumeUUID(volumeUuid); | ||
|
|
||
| BackupAnswer answer = null; | ||
| BackupAnswer answer; | ||
| try { | ||
| answer = (BackupAnswer) agentManager.send(hostVO.getId(), restoreCommand); | ||
| } catch (AgentUnavailableException e) { | ||
|
|
@@ -350,7 +343,7 @@ public boolean deleteBackup(Backup backup, boolean forced) { | |
| DeleteBackupCommand command = new DeleteBackupCommand(backup.getExternalId(), backupRepository.getType(), | ||
| backupRepository.getAddress(), backupRepository.getMountOptions()); | ||
|
|
||
| BackupAnswer answer = null; | ||
| BackupAnswer answer; | ||
| try { | ||
| answer = (BackupAnswer) agentManager.send(host.getId(), command); | ||
| } catch (AgentUnavailableException e) { | ||
|
|
@@ -363,7 +356,7 @@ public boolean deleteBackup(Backup backup, boolean forced) { | |
| return backupDao.remove(backup.getId()); | ||
| } | ||
|
|
||
| logger.debug("There was an error removing the backup with id " + backup.getId()); | ||
| logger.debug("There was an error removing the backup with id {}", backup.getId()); | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -414,6 +407,11 @@ public boolean willDeleteBackupsOnOfferingRemoval() { | |
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public void syncBackups(VirtualMachine vm, Backup.Metric metric) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. syncBackups has been moved to BackupManagerImpl. Need to remove syncBackups from all providers. |
||
| // TODO: check and sum/return backups metrics on per VM basis | ||
| } | ||
|
|
||
| @Override | ||
| public List<BackupOffering> listBackupOfferings(Long zoneId) { | ||
| final List<BackupRepository> repositories = backupRepositoryDao.listByZoneAndProvider(zoneId, getName()); | ||
|
|
||
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.