For details about SFVDDK APIs, please refer to the header file include/sf_disk_lib.h included in the sfvddk.x.x.x.tar.gz package. The following section outlines the recommended workflow for using SFVDDK when developing backup apps.
Initialization and Cleanup
The initialization and cleanup APIs manage the allocation and release of global resources used by SFVDDK:
sfdisklib_init(): Initialization API. This API must be called once after the app starts and before other SFVDDK APIs are used.
sfdisklib_exit(): Cleanup API. This API must be called once after all other SFVDDK APIs have been used and before the app exits.
Read Virtual Disk Data
In backup scenarios, virtual disk snapshot data must be read from a virtual snapshot. The general workflow for calling SFVDDK APIs is as follows:
Step 1.sfdisklib_list_transport_modes(): Obtains the data transfer modes supported by SFVDDK. Currently, only NBD and NBDSSL are supported. This is an optional step.
Step 2.sfdisklib_cleanup(): Clears any residual VM connections. This is an optional step.
Step 3.sfdisklib_connect(): Establishes a connection to the target VM. This requires specifying SCP and HCI access information, the data transfer mode, and the VM snapshot ID (which identifies the specific snapshot from which data will be read).
Step 4.sfdisklib_open(): Opens the virtual disk and prepares it for data access.
Step 5.sfdisklib_get_transport_mode(): Obtains the data transfer mode currently used by the virtual disk.
Step 6.sfdisklib_read(): Reads data from a specified offset in the virtual disk snapshot.
Step 7.sfdisklib_close(): Closes the virtual disk.
Step 8.sfdisklib_disconnect(): Disconnects from the VM.
Step 9.sfdisklib_cleanup(): Clears any residual VM connections. This is an optional step.
Write Data to Virtual Disk
In recovery scenarios, backup data stored by third-party backup apps must be written back to the virtual disk. The general workflow for calling SFVDDK APIs is as follows:
Step 1.sfdisklib_list_transport_modes(): Obtains the data transfer modes supported by SFVDDK. Currently, only NBD and NBDSSL are supported. This is an optional step.
Step 2.sfdisklib_cleanup(): Clears any residual VM connections. This is an optional step.
Step 3.sfdisklib_connect(): Establishes a connection to the target VM. This requires specifying SCP and HCI access information and the data transfer mode. Note: The VM snapshot ID is not required because data will be written directly to the virtual disk.
Step 4.sfdisklib_open(): Opens the virtual disk and prepares it for data access.
Step 5.sfdisklib_get_transport_mode(): Obtains the data transfer mode currently used by the virtual disk.
Step 6.sfdisklib_write(): Writes backup data to a specified offset within the virtual disk.
Step 7.sfdisklib_close(): Closes the virtual disk.
Step 8.sfdisklib_disconnect(): Disconnects from the VM.
Step 9.sfdisklib_cleanup(): Clears any residual VM connections. This is an optional step.