Getting the content of a VM backup per backup Job id

Last post 08-27-2018, 1:30 PM by ckubik. 2 replies.
Sort Posts: Previous Next
  • Getting the content of a VM backup per backup Job id
    Posted: 07-06-2018, 4:22 AM

    Hi all,

    I want to share my research about backing up and restoring a VM via API.

    before, I use the full restore VM but there is an issue with NSX mapping because the moREF of the VM changes after restoration.

    see my old thread here.

    https://forum.commvault.com/forums/thread/58008.aspx

     

    I have used another method, restore only the vmdk of the VM and keep the moref

    Actually, I am able to restore vmdk of a VM in any date, I am able to get the list of backup jobs (Jobid) for each VM. after that, I send the restore job with the specified jobid and disknames like this :

    I am looking for a solution to find the backup content of a VM (to list all vmdk from the backup jobid) and  put the content to the restore call.

    I also read the thread of Stephanie and try the call DoBrowse
    http://forum.commvault.com/forums/thread/53148.aspx

    I don't find the why to specifiy the backup jobID and get the content for this jobID.

    bellow :

    - the call I used to restore a VM

    - the call I try to use to get the COntent of the VM per JobID

    - the response of this call

     

    here is the call I use to restore the VM form any jobid > the tag is "browseJobId": 6339

    the browseJobId is not documented in api.commvault.com, I have used the save as script by browsing the backup jobs for a VM, select the backup job, click on browse, select the vmdk, save as script :)


    {
      "taskInfo": {
        "associations": [
          {
            "type": 0,
            "clientName": "vCenter",
            "clientSidePackage": true,
            "subclientName": "Test_Monthly_63",
            "backupsetName": "Test_API",
            "instanceName": "VCENTERTEST",
            "appName": "Virtual Server",
            "consumeLicense": true
          }
        ],
        "task": {
          "taskType": 1,
          "initiatedFrom": 2,
          "policyType": 0,
          "taskFlags": {
            "disabled": false
          }
        },
        "subTasks": [
          {
            "subTask": {
              "subTaskName": "",
              "subTaskType": "RESTORE",
              "operationType": "RESTORE"
            },
            "options": {
              "adminOpts": {
                "updateOption": {
                  "invokeLevel": 0
                }
              },
              "restoreOptions": {
                "restoreACLsType": 3,
                "virtualServerRstOption": {
                  "isDiskBrowse": true,
                  "viewType": 0,
                  "userPassword": {
                    "userName": "testcv@vsphere.local"
                  },
                  "diskLevelVMRestoreOption": {
                    "passUnconditionalOverride": true,
                    "powerOnVmAfterRestore": true,
                    "esxServerName": "myvcenterfqdn",
                    "advancedRestoreOptions": [
                      {
                        "esxHost": "esxNameWhereVmisRestored",
                        "resourcePoolPath": "/",
                        "newName": "cvrestore01",
                        "Datastore": "myDatastore",
                        "name": "cvrestore01",
                        "guid": "5016b19a-314b-ff72-613c-4f331aecd672",
                        "disks": [
                          {
                            "Datastore": "myDatastore",
                            "name": "cvrestore01.vmdk"
                          }                      
                        ]
                      }
                    ]
                  }
                },
                "volumeRstOption": {
                  "volumeLeveRestore": false,
                  "volumeLevelRestoreType": 1
                },
                "browseOption": {

                  "listMedia": false,
                  "browseJobId": 6339,   >> geting this job number with a call against a VM !
                  "browseJobCommCellId":2,
                  "useExactIndex": false,
                  "noImage": true,
                  "fromTime": 0,
                  "commCellId": 2,
                  "toTime": 0,
                  "mediaOption": {
                    "copyPrecedence": {
                      "copyPrecedence": 0
                    }
                  },
                  "backupset": {
                    "clientName": "vCenter",
                    "instanceName": "VCENTERTEST",
                    "appName": "Virtual Server",
                    "backupsetName": "Test_API"
                  }
                },
                "commonOptions": {
                  "clusterDBBackedup": false,
                  "isFromBrowseBackup": true,
                  "preserveLevel": 1,
                  "stripLevelType": 0,
                  "restoreACLs": true,
                  "stripLevel": 0,
                  "overwriteFiles": true,
                  "unconditionalOverwrite": true,
                  "detectRegularExpression": true
                },
                "destination": {
                  "isLegalHold": false,
                  "inPlace": true,
                  "destClient": {
                    "clientName": "MyMEdiaAgent",
                    "commCellName": "{CSName}"
                  }
                },
                "fileOption": {
                  "sourceItem": [
                    "\\5016b19a-314b-ff72-613c-4f331aecd672"
                  ]
                }
              }
            }
          }
        ]
      }
    }

     

    Here is the call I used to get the content of the VM backup but how can I get the content per jobID ?

    I am stuck in my developpement and any help would be appreciated.

    <?xml version="1.0" encoding="UTF-8"?><databrowse_BrowseRequest opType="0">
        <entity subclientId="63" applicationId="106"/>
        <paths path="\5016b19a-314b-ff72-613c-4f331aecd672"/>
        <options showDeletedFiles="0" restoreIndex="1" vsDiskBrowse="1" skipIndexRestore="0" fetchFileProperties="0"/>
        <mode mode="6"/>
        <advOptions/>
        <queries type="0" queryId="0">
            <dataParam>
                <paging firstNode="0" skipNode="0" pageSize="100000"/>
                <sortParam ascending="1">
                    <sortBy val="38"/>
                    <sortBy val="0"/>
                </sortParam>
            </dataParam>
       </queries>
        <queries type="1" queryId="1">
            <aggrParam aggrType="4" field="0"/>
        </queries>
    </databrowse_BrowseRequest>

     

    and the response :

    {
        "browseResponses": [
            {
                "respType": 0,
                "workerId": "59",
                "session": {
                    "sessionId": "1530863634-59"
                },
                "browseResult": {
                    "dataResultSet": [
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\catalog",
                            "size": 831,
                            "modificationTime": 1530793047,
                            "displayName": "catalog",
                            "name": "catalog",
                            "displayPath": "\\cvrestore01\\catalog",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 0,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "catalog",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 831,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 831,
                                        "diskMaxSize": 831
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\cvrestore01.nvram",
                            "size": 8684,
                            "modificationTime": 1530793055,
                            "displayName": "cvrestore01.nvram",
                            "name": "cvrestore01.nvram",
                            "displayPath": "\\cvrestore01\\cvrestore01.nvram",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 1281,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "cvrestore01.nvram",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 8684,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 8684,
                                        "diskMaxSize": 8684
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\cvrestore01.vmx",
                            "size": 2482,
                            "modificationTime": 1530793047,
                            "displayName": "cvrestore01.vmx",
                            "name": "cvrestore01.vmx",
                            "displayPath": "\\cvrestore01\\cvrestore01.vmx",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 4772,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "cvrestore01.vmx",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 2482,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 2482,
                                        "diskMaxSize": 2482
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\scsi0-0-cvrestore01.vmdk",
                            "size": 15287506905,
                            "modificationTime": 1530793246,
                            "displayName": "cvrestore01.vmdk",
                            "name": "scsi0-0-cvrestore01.vmdk",
                            "displayPath": "\\cvrestore01\\scsi0-0-cvrestore01.vmdk",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 1309051080,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "cvrestore01.vmdk",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "proxyName": "cvrestore01.vmdk",
                                        "datastore": "mydatastore",
                                        "changeId": "52 b4 4c 24 b1 07 bd e3-a8 b2 07 d5 3d 11 67 f0/4",
                                        "isActive": true,
                                        "diskSize": 15287506905,
                                        "diskType": 18,
                                        "logicalSectorSize": 512,
                                        "productType": 1,
                                        "extentSize": 2048,
                                        "diskLabel": "Hard disk 1",
                                        "diskMaxSize": 17179869184
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\VMTags.xml",
                            "size": 137,
                            "modificationTime": 1530793263,
                            "displayName": "VMTags.xml",
                            "name": "VMTags.xml",
                            "displayPath": "\\cvrestore01\\VMTags.xml",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 7120,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "VMTags.xml",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 137,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 137,
                                        "diskMaxSize": 137
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\vmware-1.log",
                            "size": 227570,
                            "modificationTime": 1530610910,
                            "displayName": "vmware-1.log",
                            "name": "vmware-1.log",
                            "displayPath": "\\cvrestore01\\vmware-1.log",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 OUT 6401 IN ",
                                "referenceTime": 1530793427,
                                "offset": 8191,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "vmware-1.log",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 227570,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 227570,
                                        "diskMaxSize": 227570
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\vmware-2.log",
                            "size": 243556,
                            "modificationTime": 1530777600,
                            "displayName": "vmware-2.log",
                            "name": "vmware-2.log",
                            "displayPath": "\\cvrestore01\\vmware-2.log",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 OUT 6401 IN ",
                                "referenceTime": 1530793427,
                                "offset": 52180,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "vmware-2.log",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 243556,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 243556,
                                        "diskMaxSize": 243556
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\vmware-3.log",
                            "size": 194355,
                            "modificationTime": 1530777794,
                            "displayName": "vmware-3.log",
                            "name": "vmware-3.log",
                            "displayPath": "\\cvrestore01\\vmware-3.log",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 OUT 6401 IN ",
                                "referenceTime": 1530793427,
                                "offset": 100830,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "vmware-3.log",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 194355,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 194355,
                                        "diskMaxSize": 194355
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\vmware-4.log",
                            "size": 377409,
                            "modificationTime": 1530782126,
                            "displayName": "vmware-4.log",
                            "name": "vmware-4.log",
                            "displayPath": "\\cvrestore01\\vmware-4.log",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 OUT 6401 IN ",
                                "referenceTime": 1530793427,
                                "offset": 138509,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "vmware-4.log",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 377409,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 377409,
                                        "diskMaxSize": 377409
                                    }
                                }
                            }
                        },
                        {
                            "path": "\\5016b19a-314b-ff72-613c-4f331aecd672\\vmware.log",
                            "size": 210411,
                            "modificationTime": 1530793085,
                            "displayName": "vmware.log",
                            "name": "vmware.log",
                            "displayPath": "\\cvrestore01\\vmware.log",
                            "version": 1,
                            "flags": {
                                "isPseudo": false,
                                "file": true,
                                "isFake": false,
                                "snap": false
                            },
                            "advancedData": {
                                "imageMap": "6387 IN ",
                                "referenceTime": 1530793427,
                                "offset": 213343,
                                "archiveGroupId": 19,
                                "backupTime": 1530793427,
                                "archiveFileId": 21173,
                                "subclient": {
                                    "type": 0,
                                    "_type_": 7,
                                    "applicationId": 63
                                },
                                "sourceCommServer": {
                                    "_type_": 1,
                                    "commCellId": 2,
                                    "type": 0
                                },
                                "browseMetaData": {
                                    "indexing": {
                                        "displayName": "vmware.log",
                                        "disableSuperBrowseMerge": 1
                                    },
                                    "virtualServerMetaData": {
                                        "isOSDisk": false,
                                        "isActive": true,
                                        "diskSize": 210411,
                                        "diskType": 0,
                                        "productType": 0,
                                        "extentSize": 210411,
                                        "diskMaxSize": 210411
                                    }
                                }
                            }
                        }
                    ]
                }
            },
            {
                "respType": 0,
                "workerId": "59",
                "session": {
                    "sessionId": "1530863634-59"
                },
                "browseResult": {
                    "queryId": "1",
                    "aggrResultSet": [
                        {
                            "result": 0
                        }
                    ]
                }
            },
            {
                "respType": 5,
                "workerId": "59",
                "session": {
                    "sessionId": "1530863634-59"
                }
            }
        ]
    }

     

    Thanks to all !

  • Re: Getting the content of a VM backup per backup Job id
    Posted: 08-27-2018, 1:03 PM
    Don't shoot the messenger, but for a "Browse a Job" kind of function you will need to determine start and end time of your job and then use this in your browserequest:

    <timeRange>

    <toTime>2018-08-23 12:24:10</toTime>
    <fromTime>2018-08-23 11:50:24</fromTime>
    </timeRange>

    With the "fromTime" being the start time of your job and the "endTime" being the end time of your job.

    A complete Browse Request may look like this:

    <?xml version="1.0" encoding="UTF-8"?><databrowse_BrowseRequest opType="0">
    <entity subclientId="63" applicationId="106"/>
    <paths path="\5016b19a-314b-ff72-613c-4f331aecd672"/>
    <options showDeletedFiles="0" restoreIndex="1" vsDiskBrowse="1" skipIndexRestore="0" fetchFileProperties="0"/>
    <mode mode="6"/>
    <advOptions/>
    <timeRange toTime="2018-08-23 12:24:10" fromTime="2018-08-23 11:50:24"/>

    <queries type="0" queryId="0">
    <dataParam>
    <paging firstNode="0" skipNode="0" pageSize="100000"/>
    <sortParam ascending="1">
    <sortBy val="38"/>
    <sortBy val="0"/>
    </sortParam>
    </dataParam>
    </queries>
    <queries type="1" queryId="1">
    <aggrParam aggrType="4" field="0"/>
    </queries>
    </databrowse_BrowseRequest>

    Where did you get the "mode=6" part from in your example? Documentation states this needs to be "mode=2" (although it probably doesn't make a difference)

    Did you know, that you don't need to add an aggregation query (type=1) to your browse request? This is shown in the examples, but it is not needed if all you need is a list of files

    Why do you need to browse by Job?
  • Re: Getting the content of a VM backup per backup Job id
    Posted: 08-27-2018, 1:30 PM

    Ahh darn, I forgot.. this is REST API: You will need to provide fromTime and toTime as epoch time values - sorry about that... 

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2018 Commvault | All Rights Reserved. | Legal | Privacy Policy