18.08.2013 Views

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Virtual</strong> <strong>Disk</strong> <strong>Programming</strong> <strong>Guide</strong><br />

To summarize: when creating a virtual machine in which to restore virtual disk:<br />

Exclude default devices, and <strong>Virtual</strong>Controller.device, from the <strong>Virtual</strong>MachineConfigSpec.<br />

Set the parent virtual disk backing information (<strong>Virtual</strong><strong>Disk</strong>.FlatVer2BackingInfo) to null.<br />

Convert HostCpuIdInfo array entries to ArrayUpdateSpec, insert ArrayUpdateOperation::add, and<br />

copy the HostCpuIdInfo array from cpuFeatureMask into <strong>Virtual</strong>MachineConfigInfo.<br />

Editing or Deleting a Device<br />

If backup clients want to edit or delete a device, they must use the server‐provided key when referring to an<br />

existing device. For the definition of key, see “Creating a <strong>Virtual</strong> Machine” on page 73. For example, see the<br />

key and controllerKey for CDROM in the source code on page 75. The key uniquely identifies a device,<br />

while the controllerKey uniquely identifies the controller where it is connected.<br />

Restoring <strong>Virtual</strong> <strong>Disk</strong> Data<br />

As in the section “Low Level Restore Procedures” on page 73, Vix<strong>Disk</strong>Lib functions provide interfaces for<br />

writing the data to virtual disk, either locally or remotely.<br />

Raw Device Mapping (RDM) <strong>Disk</strong>s<br />

To create an RDM disk using CreateVM_Task, use a LUN that is not occupied and thus is still available.<br />

Developers sometimes use the same LUN uuid that is available in the configInfo object, which can cause<br />

errors because the LUN uuid is datastore specific.<br />

Call QueryConfigTarget to fetch the ConfigTarget.Scsi<strong>Disk</strong>.<strong>Disk</strong>.CanonicalName property, set in<br />

<strong>Virtual</strong><strong>Disk</strong>Raw<strong>Disk</strong>MappingVer1BackInfo.deviceName. Also call QueryConfigTarget to fetch<br />

ConfigTarget.Scsi<strong>Disk</strong>.<strong>Disk</strong>.uuid, set in <strong>Virtual</strong><strong>Disk</strong>Raw<strong>Disk</strong>MappingVer1BackInfo.lunUuid.<br />

When creating the virtual machine, avoid host‐specific properties of configInfo, which should be set<br />

according to host configuration where the virtual machine is restored.<br />

Restore of Incremental Backup Data<br />

At some point you might need to restore a virtual disk from the backup data that you gathered as described<br />

in “Changed Block Tracking on <strong>Virtual</strong> <strong>Disk</strong>s” on page 70. The essential procedure is as follows:<br />

1 Power off the virtual machine, if powered on.<br />

2 Using <strong>Virtual</strong>MachineConfigInfo that corresponds to the last known good state of the guest operating<br />

system, re‐create the virtual machine as described in “Using the <strong>Virtual</strong>MachineConfigInfo” on page 79.<br />

3 Completely reload the base virtual disk using the full backup that started the most recent series of<br />

incremental backups.<br />

4 Create a snapshot. This is mandatory for SAN mode restore.<br />

5 For SAN mode restore, disable changed block tracking. SAN writes are not possible with it enabled.<br />

6 Sequentially restore the incremental backup data. You can do this either forwards or backwards. If you<br />

work forwards, the restore might write some sectors more than once. If you work backwards, you must<br />

keep track of which sectors were restored so as to avoid restoring them again from older data.<br />

a From your backup records, get the change ID of the incremental backup to be restored. Your software<br />

must also store the changed‐block information, so it knows which sectors of virtual disk to restore.<br />

Once you start restoring virtual disk, the change tracking mechanism will misreport.<br />

b Restore only changed areas to the virtual disks referred to by the snapshot. This ensures that you do<br />

not write the data to the redo log created by the snapshot. When restoring a thin provisioned (sparse)<br />

disk, use the star "*" change ID to avoid writing zeroes to the unallocated blocks.<br />

c Repeat Step a and Step b as necessary by applying incremental backup data sets in order.<br />

7 If applicable, revert to the base virtual disk, thus eliminating the snapshot.<br />

80 <strong>VMware</strong>, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!