Skip to content

Commit

Permalink
Enable Backup and Recovery for Shared Filesystems (#9676)
Browse files Browse the repository at this point in the history
  • Loading branch information
abh1sar committed Sep 18, 2024
1 parent 1d37ff2 commit 7d95952
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import com.amazonaws.util.CollectionUtils;
import com.cloud.storage.VolumeApiService;
import com.cloud.utils.fsm.NoTransitionException;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineManager;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
Expand Down Expand Up @@ -296,13 +294,6 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
throw new CloudRuntimeException("VM is not in running or stopped state");
}

if (vm.getType().equals(VirtualMachine.Type.User)) {
UserVmVO userVm = userVmDao.findById(vmId);
if (userVm != null && UserVmManager.SHAREDFSVM.equals(userVm.getUserVmType())) {
throw new InvalidParameterValueException("Operation not supported on Shared FileSystem Instance");
}
}

validateForZone(vm.getDataCenterId());

accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);
Expand Down Expand Up @@ -431,12 +422,6 @@ public BackupSchedule configureBackupSchedule(CreateBackupScheduleCmd cmd) {
}

final VMInstanceVO vm = findVmById(vmId);
if (vm.getType().equals(VirtualMachine.Type.User)) {
UserVmVO userVm = userVmDao.findById(vmId);
if (userVm != null && UserVmManager.SHAREDFSVM.equals(userVm.getUserVmType())) {
throw new InvalidParameterValueException("Operation not supported on Shared FileSystem Instance");
}
}
validateForZone(vm.getDataCenterId());
accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);

Expand Down Expand Up @@ -504,13 +489,6 @@ public boolean createBackup(final Long vmId) {
validateForZone(vm.getDataCenterId());
accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);

if (vm.getType().equals(VirtualMachine.Type.User)) {
UserVmVO userVm = userVmDao.findById(vmId);
if (userVm != null && UserVmManager.SHAREDFSVM.equals(userVm.getUserVmType())) {
throw new InvalidParameterValueException("Operation not supported on Shared FileSystem Instance");
}
}

if (vm.getBackupOfferingId() == null) {
throw new CloudRuntimeException("VM has not backup offering configured, cannot create backup before assigning it to a backup offering");
}
Expand Down Expand Up @@ -784,12 +762,6 @@ public boolean restoreBackupVolumeAndAttachToVM(final String backedUpVolumeUuid,
validateForZone(backup.getZoneId());

final VMInstanceVO vm = findVmById(vmId);
if (vm.getType().equals(VirtualMachine.Type.User)) {
UserVmVO userVm = userVmDao.findById(vmId);
if (userVm != null && UserVmManager.SHAREDFSVM.equals(userVm.getUserVmType())) {
throw new InvalidParameterValueException("Operation not supported on Shared FileSystem Instance");
}
}
accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);

if (vm.getBackupOfferingId() != null && !BackupEnableAttachDetachVolumes.value()) {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/config/section/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default {
docHelp: 'adminguide/virtual_machines.html#backup-offerings',
dataView: true,
args: ['virtualmachineid', 'backupofferingid'],
show: (record) => { return !record.backupofferingid && record.vmtype !== 'sharedfsvm' },
show: (record) => { return !record.backupofferingid },
mapping: {
virtualmachineid: {
value: (record, params) => { return record.id }
Expand All @@ -237,7 +237,7 @@ export default {
docHelp: 'adminguide/virtual_machines.html#creating-vm-backups',
dataView: true,
args: ['virtualmachineid'],
show: (record) => { return record.backupofferingid && record.vmtype !== 'sharedfsvm' },
show: (record) => { return record.backupofferingid },
mapping: {
virtualmachineid: {
value: (record, params) => { return record.id }
Expand All @@ -251,7 +251,7 @@ export default {
docHelp: 'adminguide/virtual_machines.html#creating-vm-backups',
dataView: true,
popup: true,
show: (record) => { return record.backupofferingid && record.vmtype !== 'sharedfsvm' },
show: (record) => { return record.backupofferingid },
component: shallowRef(defineAsyncComponent(() => import('@/views/compute/BackupScheduleWizard.vue'))),
mapping: {
virtualmachineid: {
Expand All @@ -270,7 +270,7 @@ export default {
docHelp: 'adminguide/virtual_machines.html#restoring-vm-backups',
dataView: true,
args: ['virtualmachineid', 'forced'],
show: (record) => { return record.backupofferingid && record.vmtype !== 'sharedfsvm' },
show: (record) => { return record.backupofferingid },
mapping: {
virtualmachineid: {
value: (record, params) => { return record.id }
Expand Down

0 comments on commit 7d95952

Please sign in to comment.