Backup Plugin: Need to add custom fields on a backup creation form

Hello,

I am creating a Backup plugin to extend VMWare backups for instances.
I was successfully able to register my plugin with Morpheus.
I have also added the integration for my plugin under “Backups > Integration” tab

Next, when I navigate to “Backups > Backups” and click on the “ADD” button to create a new backup, I am getting the default form with default options.
I want to render a form which has the custom options for my use case.

Do I have to create a new form “Library > Forms” and then somehow add this form to the Backups tab?

Can someone please provide some guidance on what the steps should be to create a Backup Plugin where I can render a custom form to create backups?

Thanks

To customize the backup form you will add OptionTypes by implementing the backupOptionTypes() method on the BackupProvider. See our Rubrik backup provider for an example: https://github.com/gomorpheus/morpheus-rubrik-plugin/blob/7c1c17be24e84dee9456f62b30324507e7fdef8a/src/main/groovy/com/morpheusdata/rubrik/RubrikBackupProvider.groovy#L148

The available fields on an OptionType are available in the plugin API documentation: OptionType (Morpheus Plugin API)

Thanks @ddeyoung for your quick response!

I am referring to the Rubrik repo and I have implemented the method getBackupOptionsTypes() in my code.
I have also created a test form under “Library > Options > Forms” menu and verified that the function is working as expected.

My problem is that I don’t know where to find this field in the Backup form.
Currently, when I am trying create a new Backup from “Backups > Backups” menu, I don’t see the field on the form.
I see the default form with Backup Type dropdown options:

  • File Backup
  • Directory Backup

Is there something that I am doing wrong or is this custom field is supposed to be displayed somewhere else?

1 Like

Here is my code:

@Override
	Collection<OptionType> getBackupOptionTypes() {
		Collection<OptionType> optionTypes = new ArrayList()

		log.info("********* Inside getBackupOptionTypes() function *******")

		optionTypes <<  new OptionType(
				name: "backup.testBackupType",
				code: "backup.testBackupType",
				fieldName: "backup.testBackupType",
				optionSource: 'getTestBackupTypeOptions',
				displayOrder: 1,
				fieldLabel: 'backup.testBackupType',
				required: true,
				inputType: OptionType.InputType.SELECT,
				fieldContext: 'backup.config'
		)

		return optionTypes;
	}

I am little doubtful about the fieldContext value. Does this look right?

It doesn’t look like you have your plugin provider fully setup. Once you can select your backup provider type from the list the associated option types will load into that form. Library forms are not used for backups.

Make sure you’ve added your provider for the desired provision type:

 addScopedProvider(vmwareBackupProvider, "vmware", null)

full code context: https://github.com/gomorpheus/morpheus-rubrik-plugin/blob/7c1c17be24e84dee9456f62b30324507e7fdef8a/src/main/groovy/com/morpheusdata/rubrik/RubrikBackupProvider.groovy#L44

2 Likes

Thanks @ddeyoung

Yes, I have added the addScopedProvider... code.
I can now see the Backup Option Types when provisioning a new instance :slight_smile:

I am still not able to get the options and backup types loaded on the Backup Creation screen

I have selected by plugin as “Backup Type” for the VMWare cloud provider.

Is there any other setting that I need to enable for selecting the Backup Provider when creating a backup?

That should be all that is required. When creating a backup from the backups section the existing instance chosen must be compatible with the backup provider.