Starting an ad hoc backup job

There are two scenarios to start a backup job for VMware and Microsoft Hyper-V instances:

  1. Associate an SLA policy with virtualized system instances (for example, VMware virtual machines) so that the backup job can be started automatically or manually.

  2. Start an ad hoc backup job.

The ad hoc backup does not have to include all instances that are associated with the SLA policies.

A single ad hoc backup job can process multiple virtual machines of the same type of virtualized system: VMware vCenter, Microsoft Hyper-V, or Amazon EC2. You cannot specify folders or datacenters even if they are associated with the specific SLA policy. You cannot specify virtual machines hosted on VMware and Microsoft Hyper-V at the same time.

_images/refmanageprotection_vmware_adhoc01.png

Figure 8 The same action can be taken in the IBM Spectrum Protect Plus web user interface: In the VMware pane or the Hyper-V pane, click Create job.

_images/refmanageprotection_vmware_adhoc03backup.png

Figure 9 In the Ad hoc backup section, click Select.

_images/refmanageprotection_vmware_adhoc04backup.png

Figure 10 Select an SLA policy.

_images/refmanageprotection_vmware_adhoc05backup.png

Figure 11 Select the virtual machines that you want to protect. You cannot select entire folders or datacenters.

_images/refmanageprotection_vmware_adhoc06backup.png

Figure 12 Review the configuration and click Submit.

_images/refmanageprotection_vmware_adhoc07backup.png

Figure 13 Go to the Jobs and Operations pane and you will see the ad hoc backup job running.

Method and URI

To start an ad hoc backup, use a POST method and a URI:

POST    https://{hostname|IP}/ngp/hypervisor

Parameters

Parameter 1: action

Start an ad hoc job.

  • Value: adhoc

  • Type: System string. Required. Available in the web user interface.

Data

Data 1: slaPolicyName

The name of the SLA policy.

  • Example value: Gold

  • Type: String. Required. Available in the web user interface.

Data 2: subtype

The type of the virtualized system, database, file system, cloud management, or containers.

  • Example value: vmware

  • Type: System string. Required. Available in the web user interface.

Tip

To get an {applicationName} value based on the name of the application name, follow the instructions in Getting an {applicationName}.

Data 3: resource:

The URLs of the instances to protect in the ad hoc backup job.

  • Value:

A URL of a virtual machine uses the following syntax:

https://{hostname|IP}/api/hypervisor/{hypervisorHypervisorId}
↪/vm/{hypervisorVmId}

Tip

To get a {hypervisorVmId} by the virtual machine name, follow the instructions in Getting a {hypervisorVmId}.

A URL of a database uses the following syntax:

https://{hostname|IP}/api/application/{applicationName}
↪/instance/{applicationServerId}/database/{applicationDatabaseId}?from=flo

Example: Start an ad hoc backup for virtual machines

Assume that you have the following virtual machines hosted on different VMware vCenter servers:

  • sales-americas.

    • Virtualized system: VMware - Dallas. Gold.

    • SLA policy: Gold

    • {hypervisorHypervisorId}: 1001

    • {hypervisorVmId}: ec44616651cda8b66fec4f7fd0daf554

  • sales-apac

    • Virtualized system: VMware - Singapore

    • SLA policies: Gold and Diamond

    • {hypervisorHypervisorId}: 1002

    • {hypervisorVmId}: 2648550a670c6d383cba0d369ae4f91c

A Python snippet that is similar to the following example can be used to start an ad hoc backup job for these two virtual machines:

hypervisor_hypervisor_id_vm1 = "1001"    # VMware - Dallas
hypervisor_vm_id1 = "ec44616651cda8b66fec4f7fd0daf554"    # sales-americas
uri_vm1 = 'https://' + spp_ipv4 + '/api' \
    + '/hypervisor/' + hypervisor_hypervisor_id1 \
    + '/vm/' + hypervisor_vm_id1 \
    + '?from=hlo'

hypervisor_hypervisor_id_vm2 = "1002"    # VMware - Singapore
hypervisor_vm_id2 = "2648550a670c6d383cba0d369ae4f91c"    # sales-apac
uri_vm2 = 'https://' + spp_ipv4 + '/api' \
    + '/hypervisor/' + hypervisor_hypervisor_id2 \
    + '/vm/' + hypervisor_vm_id2 \
    + '?from=hlo'

_params = {"action": "adhoc"}

_data = f'''{{
    "slaPolicyName": "Gold",
    "subtype":       "vmware",
    "resource":      ["{uri_vm1}", "{uri_vm2}"]
}}'''

requests.post('https://' + spp_ipv4 + '/ngp/hypervisor/'
    headers={...}, params=_params, data=_data, verify=...)

The request prompts a response that is structured as shown, with the HTTP status of 200 (OK). Review the response to ensure that the backup job is running.

{
    "links": {...},
    "name": "vmware_Gold",
    "description": "Auto-generated job for Policy vmware_Gold",
    "policyId": "1045",
    "policyName": "vmware_Gold",
    "type": "protection",
    "typeDisplayName": "Protection",
    "subType": "vmware",
    "subTypeDisplayName": "VMware",
    "serviceId": "serviceprovider.protection.hypervisor",
    "displayName": "Hypervisor Backup",
    "status": "RESOURCE ACTIVE",
    "statusDisplayName": "Resource active",
    "lastSessionStatus": "FAILED",
    "lastSessionStatusDisplayName": "Failed",
    "triggerIds": [
        "1036"
    ],
    "triggerData": [
        {
            "triggerId": "1036",
            "triggerInfo": {
                "subpolicy_id": "VADP Backup(2000)"
            }
        }
    ],
    "lastRunTime": 1580775121325,
    "nextFireTime": 1580775979000,
    "lastSessionDuration": 74949,
    "tenantId": 1000,
    "actions": null,
    "statistics": null,
    "policy": {
        "links": {...},
        "name": "vmware_Gold",
        "type": "protection",
        "subType": "vmware",
        "serviceId": "serviceprovider.protection.hypervisor",
        "description": "",
        "version": "3.0",
        "rbacPath": "root:0/policy:0/policytype:serviceprovider.protection.hyper
↪visor/policy:1045",
        "tenantId": 1000,
        "creationTime": 1577725511302,
        "lastUpdated": 0,
        "spec": {
            "source": [],
            "storageworkflow": [
                {
                    "id": "2000",
                    "name": "Gold",
                    "href": "http://localhost:8082/api/spec/storageprofile/2000"
                }
            ],
            "option": {
                "maxtasks": 0,
                "vmsnapshot": {
                    "takesnapshot": false,
                    "concurrentsnapshotsonesx": 3,
                    "includememory": false,
                    "consistency": false,
                    "consistencyvms": [],
                    "scriptvms": [],
                    "truncateapplicationlogs": false
                },
                "skipreadonlydatastores": true
            },
            "notification": []
        },
        "logicalDelete": false,
        "script": {
            "preScript": null,
            "postScript": null,
            "preSnap": null,
            "postSnap": null,
            "preGuest": null,
            "postGuest": null,
            "preGuestSnap": null,
            "postGuestSnap": null,
            "continueScriptsOnError": false
        },
        "id": "1045"
    },
    "triggers": [
        {
            "links": {...},
            "name": "1038__VADP Backup(2000)",
            "type": "Schedule",
            "category": "INTERNAL",
            "triggerInfo": {
                "id": 1036,
                "name": "1036:1038",
                "comment": null,
                "creatorId": 0,
                "creationTime": 1577725512115,
                "type": null,
                "flags": 0,
                "pk": null,
                "triggerId": "1036",
                "jobId": "1038",
                "triggerInfo": {
                    "subpolicy_id": "VADP Backup(2000)"
                },
                "category": "INTERNAL"
            },
            "properties": {
                "activateDate": 1564604779173,
                "deactivateDate": null,
                "timezone": null,
                "frequency": 4,
                "type": "HOURLY",
                "dowList": [
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false
                ],
                "domList": [
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false,
                    false
                ]
            },
            "rbacPath": "trigger:0/trigger:1036",
            "onHold": false,
            "id": "1036"
        }
    ],
    "lastrun": {
        "sessionId": "1580775119061",
        "jobName": "vmware_Gold",
        "type": "protection",
        "subType": "vmware",
        "serviceId": "serviceprovider.protection.hypervisor",
        "start": 1580775121325,
        "end": 1580775196274,
        "duration": 74949,
        "status": "FAILED",
        "results": null,
        "properties": {
            "statistics": [
                {
                    "resourceType": "vm",
                    "total": 2,
                    "success": 0,
                    "failed": 2,
                    "skipped": 0,
                    "names": null,
                    "jobSessionId": 0,
                    "policyId": null,
                    "startTime": 0
                },
                {
                    "resourceType": "datastore",
                    "total": 1,
                    "success": 0,
                    "failed": 0,
                    "skipped": null,
                    "names": null,
                    "jobSessionId": 0,
                    "policyId": null,
                    "startTime": 0
                }
            ]
        },
        "numTasks": 2,
        "previousLastTask": 0,
        "lastUpdate": 1580775196299,
        "percent": 60,
        "policySnapshot": null
    },
    "id": "1038"
}