Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ protected synchronized void attachOrDetachDisk(final Connect conn, final boolean
throws LibvirtException, InternalErrorException {
attachOrDetachDisk(conn, attach, vmName, attachingDisk, devId, serial, bytesReadRate, bytesReadRateMax, bytesReadRateMaxLength,
bytesWriteRate, bytesWriteRateMax, bytesWriteRateMaxLength, iopsReadRate, iopsReadRateMax, iopsReadRateMaxLength, iopsWriteRate,
iopsWriteRateMax, iopsWriteRateMaxLength, cacheMode, encryptDetails, provider, krbdpath, shareable, kvdoEnable, details, controllerInfo);
iopsWriteRateMax, iopsWriteRateMaxLength, cacheMode, encryptDetails, provider, krbdpath, shareable, kvdoEnable, 0l, details, controllerInfo);
}

/**
Expand Down
41 changes: 8 additions & 33 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -9891,11 +9891,6 @@ public UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws Insufficien
throw new CloudRuntimeException("Create instance from backup is not supported for this provider.");
}

BackupProvider backupProvider = backupManager.getBackupProviderForOffering(backup.getBackupOfferingId());
if (backupProvider != null && "bx".equalsIgnoreCase(backupProvider.getName())) {
throw new CloudRuntimeException("Create instance from backup is not supported for this provider.");
}

DataCenter targetZone = _dcDao.findById(cmd.getZoneId());
if (targetZone == null) {
throw new InvalidParameterValueException("Unable to find zone by id=" + cmd.getZoneId());
Expand Down Expand Up @@ -10046,13 +10041,6 @@ public UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws ResourceUnav
additonalParams.put(VirtualMachineProfile.Param.ReturnAfterVolumePrepare, true);

try {
BackupVO backup = backupDao.findById(cmd.getBackupId());
BackupProvider backupProvider = backupManager.getBackupProviderForOffering(backup.getBackupOfferingId());
if (backupProvider != null && "bx".equalsIgnoreCase(backupProvider.getName())) {
vm = _vmDao.findById(vmId);
return vm;
}

Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = null;
vmParamPair = startVirtualMachine(vmId, null, null, null, additonalParams, null);
vm = vmParamPair.first();
Expand Down Expand Up @@ -11032,27 +11020,14 @@ public Pair<Boolean, String> restoreVMFromBxBackup(CreateVMFromBxBackupCmd cmd)
}

BackupProvider backupProvider = backupManager.getBackupProviderForOffering(backup.getBackupOfferingId());
if (backupProvider != null && "bx".equalsIgnoreCase(backupProvider.getName())) {
Pair<Boolean, String> result = backupProvider.restoreBackupToVM(cmd.getBackupId(), cmd.getName());
logger.debug(">>>restoreVMFromBxBackup result: {}", result);
if (result == null || !Boolean.TRUE.equals(result.first())) {
if (result != null && StringUtils.isNotEmpty(result.second())) {
throw new CloudRuntimeException(String.format("Failed to create Instance from backup %s using bx provider. Error: %s", backup.getUuid(), result.second()));
}
throw new CloudRuntimeException(String.format("Failed to create Instance from backup %s using bx provider.", backup.getUuid()));
}

// logger.debug(">>>allocateVMFromBackup cmd.getName: {}", cmd.getName());
// VMInstanceVO vmInstance = _vmInstanceDao.findVMByInstanceName(cmd.getName());
// logger.debug(">>>allocateVMFromBackup vmInstance: {}", vmInstance);
// UserVm vm = (UserVm) vmInstance;
// logger.debug(">>>allocateVMFromBackup vm: {}", vm);
// if (vm == null) {
// throw new CloudRuntimeException(String.format("Unable to find restored Instance created from backup %s using bx provider.", backup.getUuid()));
// }
return result;
} else {
throw new CloudRuntimeException("Create instance from backup is not supported for this provider.");
Pair<Boolean, String> result = backupProvider.restoreBackupToVM(cmd.getBackupId(), cmd.getName());
if (result == null || !Boolean.TRUE.equals(result.first())) {
if (result != null && StringUtils.isNotEmpty(result.second())) {
throw new CloudRuntimeException(String.format("Failed to create Instance from backup %s using bx provider. Error: %s", backup.getUuid(), result.second()));
}
throw new CloudRuntimeException(String.format("Failed to create Instance from backup %s using bx provider.", backup.getUuid()));
}

return result;
}
}
Loading