Module: FFI::VixDiskLib::API
- Extended by:
- Library
- Included in:
- FFI::VixDiskLib, ApiWrapper, DiskInfo, SafeCreateParams
- Defined in:
- lib/ffi-vix_disk_lib/api.rb,
lib/ffi-vix_disk_lib/enum.rb,
lib/ffi-vix_disk_lib/const.rb,
lib/ffi-vix_disk_lib/struct.rb,
lib/ffi-vix_disk_lib/exceptions.rb
Defined Under Namespace
Classes: ConnectParam, ConnectParams_1_0_0, ConnectParams_6_5_0, CreateParams, Creds, Geometry, HandleStruct, Info, SessionIdCreds, TicketIdCreds, UidPasswdCreds, VixDiskLibError
Constant Summary collapse
- LOADED_LIBRARY =
ffi_lib(candidate_libraries)
- VERSION =
LOADED_LIBRARY.first.name.chomp(".dylib").split(".").last(3).join(".")
- ConnectParams =
evaluate_versioned_connect_params
- VixErrorType =
The error codes are returned by all public VIX routines.
enum( :VIX_OK, 0, # General errors :VIX_E_FAIL, 1, :VIX_E_OUT_OF_MEMORY, 2, :VIX_E_INVALID_ARG, 3, :VIX_E_FILE_NOT_FOUND, 4, :VIX_E_OBJECT_IS_BUSY, 5, :VIX_E_NOT_SUPPORTED, 6, :VIX_E_FILE_ERROR, 7, :VIX_E_DISK_FULL, 8, :VIX_E_INCORRECT_FILE_TYPE, 9, :VIX_E_CANCELLED, 10, :VIX_E_FILE_READ_ONLY, 11, :VIX_E_FILE_ALREADY_EXISTS, 12, :VIX_E_FILE_ACCESS_ERROR, 13, :VIX_E_REQUIRES_LARGE_FILES, 14, :VIX_E_FILE_ALREADY_LOCKED, 15, :VIX_E_VMDB, 16, :VIX_E_NOT_SUPPORTED_ON_REMOTE_OBJECT, 20, :VIX_E_FILE_TOO_BIG, 21, :VIX_E_FILE_NAME_INVALID, 22, :VIX_E_ALREADY_EXISTS, 23, :VIX_E_BUFFER_TOOSMALL, 24, :VIX_E_OBJECT_NOT_FOUND, 25, :VIX_E_HOST_NOT_CONNECTED, 26, :VIX_E_INVALID_UTF8_STRING, 27, :VIX_E_OPERATION_ALREADY_IN_PROGRESS, 31, :VIX_E_UNFINISHED_JOB, 29, :VIX_E_NEED_KEY, 30, :VIX_E_LICENSE, 32, :VIX_E_VM_HOST_DISCONNECTED, 34, :VIX_E_AUTHENTICATION_FAIL, 35, :VIX_E_HOST_CONNECTION_LOST, 36, :VIX_E_DUPLICATE_NAME, 41, # Handle Errors :VIX_E_INVALID_HANDLE, 1000, :VIX_E_NOT_SUPPORTED_ON_HANDLE_TYPE, 1001, :VIX_E_TOO_MANY_HANDLES, 1002, # XML errors :VIX_E_NOT_FOUND, 2000, :VIX_E_TYPE_MISMATCH, 2001, :VIX_E_INVALID_XML, 2002, # VM Control Errors :VIX_E_TIMEOUT_WAITING_FOR_TOOLS, 3000, :VIX_E_UNRECOGNIZED_COMMAND, 3001, :VIX_E_OP_NOT_SUPPORTED_ON_GUEST, 3003, :VIX_E_PROGRAM_NOT_STARTED, 3004, :VIX_E_CANNOT_START_READ_ONLY_VM, 3005, :VIX_E_VM_NOT_RUNNING, 3006, :VIX_E_VM_IS_RUNNING, 3007, :VIX_E_CANNOT_CONNECT_TO_VM, 3008, :VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE, 3009, :VIX_E_NO_GUEST_OS_INSTALLED, 3010, :VIX_E_VM_INSUFFICIENT_HOST_MEMORY, 3011, :VIX_E_SUSPEND_ERROR, 3012, :VIX_E_VM_NOT_ENOUGH_CPUS, 3013, :VIX_E_HOST_USER_PERMISSIONS, 3014, :VIX_E_GUEST_USER_PERMISSIONS, 3015, :VIX_E_TOOLS_NOT_RUNNING, 3016, :VIX_E_GUEST_OPERATIONS_PROHIBITED, 3017, :VIX_E_ANON_GUEST_OPERATIONS_PROHIBITED, 3018, :VIX_E_ROOT_GUEST_OPERATIONS_PROHIBITED, 3019, :VIX_E_MISSING_ANON_GUEST_ACCOUNT, 3023, :VIX_E_CANNOT_AUTHENTICATE_WITH_GUEST, 3024, :VIX_E_UNRECOGNIZED_COMMAND_IN_GUEST, 3025, :VIX_E_CONSOLE_GUEST_OPERATIONS_PROHIBITED, 3026, :VIX_E_MUST_BE_CONSOLE_USER, 3027, :VIX_E_VMX_MSG_DIALOG_AND_NO_UI, 3028, # VIX_E_NOT_ALLOWED_DURING_VM_RECORDING, 3029, Removed in version 1.11 # VIX_E_NOT_ALLOWED_DURING_VM_REPLAY, 3030, Removed in version 1.11 :VIX_E_OPERATION_NOT_ALLOWED_FOR_LOGIN_TYPE, 3031, :VIX_E_LOGIN_TYPE_NOT_SUPPORTED, 3032, :VIX_E_EMPTY_PASSWORD_NOT_ALLOWED_IN_GUEST, 3033, :VIX_E_INTERACTIVE_SESSION_NOT_PRESENT, 3034, :VIX_E_INTERACTIVE_SESSION_USER_MISMATCH, 3035, # VIX_E_UNABLE_TO_REPLAY_VM, 3039, Removed in version 1.11 :VIX_E_CANNOT_POWER_ON_VM, 3041, :VIX_E_NO_DISPLAY_SERVER, 3043, # VIX_E_VM_NOT_RECORDING, 3044, Removed in version 1.11 # VIX_E_VM_NOT_REPLAYING, 3045, Removed in version 1.11 :VIX_E_TOO_MANY_LOGONS, 3046, :VIX_E_INVALID_AUTHENTICATION_SESSION, 3047, # VM Errors :VIX_E_VM_NOT_FOUND, 4000, :VIX_E_NOT_SUPPORTED_FOR_VM_VERSION, 4001, :VIX_E_CANNOT_READ_VM_CONFIG, 4002, :VIX_E_TEMPLATE_VM, 4003, :VIX_E_VM_ALREADY_LOADED, 4004, :VIX_E_VM_ALREADY_UP_TO_DATE, 4006, :VIX_E_VM_UNSUPPORTED_GUEST, 4011, # Property Errors :VIX_E_UNRECOGNIZED_PROPERTY, 6000, :VIX_E_INVALID_PROPERTY_VALUE, 6001, :VIX_E_READ_ONLY_PROPERTY, 6002, :VIX_E_MISSING_REQUIRED_PROPERTY, 6003, :VIX_E_INVALID_SERIALIZED_DATA, 6004, :VIX_E_PROPERTY_TYPE_MISMATCH, 6005, # Completion Errors :VIX_E_BAD_VM_INDEX, 8000, # Message errors :VIX_E_INVALID_MESSAGE_HEADER, 10_000, :VIX_E_INVALID_MESSAGE_BODY, 10_001, # Snapshot errors :VIX_E_SNAPSHOT_INVAL, 13_000, :VIX_E_SNAPSHOT_DUMPER, 13_001, :VIX_E_SNAPSHOT_DISKLIB, 13_002, :VIX_E_SNAPSHOT_NOTFOUND, 13_003, :VIX_E_SNAPSHOT_EXISTS, 13_004, :VIX_E_SNAPSHOT_VERSION, 13_005, :VIX_E_SNAPSHOT_NOPERM, 13_006, :VIX_E_SNAPSHOT_CONFIG, 13_007, :VIX_E_SNAPSHOT_NOCHANGE, 13_008, :VIX_E_SNAPSHOT_CHECKPOINT, 13_009, :VIX_E_SNAPSHOT_LOCKED, 13_010, :VIX_E_SNAPSHOT_INCONSISTENT, 13_011, :VIX_E_SNAPSHOT_NAMETOOLONG, 13_012, :VIX_E_SNAPSHOT_VIXFILE, 13_013, :VIX_E_SNAPSHOT_DISKLOCKED, 13_014, :VIX_E_SNAPSHOT_DUPLICATEDDISK, 13_015, :VIX_E_SNAPSHOT_INDEPENDENTDISK, 13_016, :VIX_E_SNAPSHOT_NONUNIQUE_NAME, 13_017, :VIX_E_SNAPSHOT_MEMORY_ON_INDEPENDENT_DISK, 13_018, :VIX_E_SNAPSHOT_MAXSNAPSHOTS, 13_019, :VIX_E_SNAPSHOT_MIN_FREE_SPACE, 13_020, :VIX_E_SNAPSHOT_HIERARCHY_TOODEEP, 13_021, :VIX_E_SNAPSHOT_RRSUSPEND, 13_022, :VIX_E_SNAPSHOT_NOT_REVERTABLE, 13_024, # Host Errors :VIX_E_HOST_DISK_INVALID_VALUE, 14_003, :VIX_E_HOST_DISK_SECTORSIZE, 14_004, :VIX_E_HOST_FILE_ERROR_EOF, 14_005, :VIX_E_HOST_NETBLKDEV_HANDSHAKE, 14_006, :VIX_E_HOST_SOCKET_CREATION_ERROR, 14_007, :VIX_E_HOST_SERVER_NOT_FOUND, 14_008, :VIX_E_HOST_NETWORK_CONN_REFUSED, 14_009, :VIX_E_HOST_TCP_SOCKET_ERROR, 14_010, :VIX_E_HOST_TCP_CONN_LOST, 14_011, :VIX_E_HOST_NBD_HASHFILE_VOLUME, 14_012, :VIX_E_HOST_NBD_HASHFILE_INIT, 14_013, # Disklib errors :VIX_E_DISK_INVAL, 16_000, :VIX_E_DISK_NOINIT, 16_001, :VIX_E_DISK_NOIO, 16_002, :VIX_E_DISK_PARTIALCHAIN, 16_003, :VIX_E_DISK_NEEDSREPAIR, 16_006, :VIX_E_DISK_OUTOFRANGE, 16_007, :VIX_E_DISK_CID_MISMATCH, 16_008, :VIX_E_DISK_CANTSHRINK, 16_009, :VIX_E_DISK_PARTMISMATCH, 16_010, :VIX_E_DISK_UNSUPPORTEDDISKVERSION, 16_011, :VIX_E_DISK_OPENPARENT, 16_012, :VIX_E_DISK_NOTSUPPORTED, 16_013, :VIX_E_DISK_NEEDKEY, 16_014, :VIX_E_DISK_NOKEYOVERRIDE, 16_015, :VIX_E_DISK_NOTENCRYPTED, 16_016, :VIX_E_DISK_NOKEY, 16_017, :VIX_E_DISK_INVALIDPARTITIONTABLE, 16_018, :VIX_E_DISK_NOTNORMAL, 16_019, :VIX_E_DISK_NOTENCDESC, 16_020, :VIX_E_DISK_NEEDVMFS, 16_022, :VIX_E_DISK_RAWTOOBIG, 16_024, :VIX_E_DISK_TOOMANYOPENFILES, 16_027, :VIX_E_DISK_TOOMANYREDO, 16_028, :VIX_E_DISK_RAWTOOSMALL, 16_029, :VIX_E_DISK_INVALIDCHAIN, 16_030, :VIX_E_DISK_KEY_NOTFOUND, 16_052, # metadata key is not found :VIX_E_DISK_SUBSYSTEM_INIT_FAIL, 16_053, :VIX_E_DISK_INVALID_CONNECTION, 16_054, :VIX_E_DISK_ENCODING, 16_061, :VIX_E_DISK_CANTREPAIR, 16_062, :VIX_E_DISK_INVALIDDISK, 16_063, :VIX_E_DISK_NOLICENSE, 16_064, :VIX_E_DISK_NODEVICE, 16_065, :VIX_E_DISK_UNSUPPORTEDDEVICE, 16_066, :VIX_E_DISK_CAPACITY_MISMATCH, 16_067, :VIX_E_DISK_PARENT_NOTALLOWED, 16_068, :VIX_E_DISK_ATTACH_ROOTLINK, 16_069, # Crypto Library Errors :VIX_E_CRYPTO_UNKNOWN_ALGORITHM, 17_000, :VIX_E_CRYPTO_BAD_BUFFER_SIZE, 17_001, :VIX_E_CRYPTO_INVALID_OPERATION, 17_002, :VIX_E_CRYPTO_RANDOM_DEVICE, 17_003, :VIX_E_CRYPTO_NEED_PASSWORD, 17_004, :VIX_E_CRYPTO_BAD_PASSWORD, 17_005, :VIX_E_CRYPTO_NOT_IN_DICTIONARY, 17_006, :VIX_E_CRYPTO_NO_CRYPTO, 17_007, :VIX_E_CRYPTO_ERROR, 17_008, :VIX_E_CRYPTO_BAD_FORMAT, 17_009, :VIX_E_CRYPTO_LOCKED, 17_010, :VIX_E_CRYPTO_EMPTY, 17_011, :VIX_E_CRYPTO_KEYSAFE_LOCATOR, 17_012, # Remoting Errors. :VIX_E_CANNOT_CONNECT_TO_HOST, 18_000, :VIX_E_NOT_FOR_REMOTE_HOST, 18_001, :VIX_E_INVALID_HOSTNAME_SPECIFICATION, 18_002, # Screen Capture Errors. :VIX_E_SCREEN_CAPTURE_ERROR, 19_000, :VIX_E_SCREEN_CAPTURE_BAD_FORMAT, 19_001, :VIX_E_SCREEN_CAPTURE_COMPRESSION_FAIL, 19_002, :VIX_E_SCREEN_CAPTURE_LARGE_DATA, 19_003, # Guest Errors :VIX_E_GUEST_VOLUMES_NOT_FROZEN, 20_000, :VIX_E_NOT_A_FILE, 20_001, :VIX_E_NOT_A_DIRECTORY, 20_002, :VIX_E_NO_SUCH_PROCESS, 20_003, :VIX_E_FILE_NAME_TOO_LONG, 20_004, :VIX_E_OPERATION_DISABLED, 20_005, # Tools install errors :VIX_E_TOOLS_INSTALL_NO_IMAGE, 21_000, :VIX_E_TOOLS_INSTALL_IMAGE_INACCESIBLE, 21_001, :VIX_E_TOOLS_INSTALL_NO_DEVICE, 21_002, :VIX_E_TOOLS_INSTALL_DEVICE_NOT_CONNECTED, 21_003, :VIX_E_TOOLS_INSTALL_CANCELLED, 21_004, :VIX_E_TOOLS_INSTALL_INIT_FAILED, 21_005, :VIX_E_TOOLS_INSTALL_AUTO_NOT_SUPPORTED, 21_006, :VIX_E_TOOLS_INSTALL_GUEST_NOT_READY, 21_007, :VIX_E_TOOLS_INSTALL_SIG_CHECK_FAILED, 21_008, :VIX_E_TOOLS_INSTALL_ERROR, 21_009, :VIX_E_TOOLS_INSTALL_ALREADY_UP_TO_DATE, 21_010, :VIX_E_TOOLS_INSTALL_IN_PROGRESS, 21_011, :VIX_E_TOOLS_INSTALL_IMAGE_COPY_FAILED, 21_012, # Wrapper Errors :VIX_E_WRAPPER_WORKSTATION_NOT_INSTALLED, 22_001, :VIX_E_WRAPPER_VERSION_NOT_FOUND, 22_002, :VIX_E_WRAPPER_SERVICEPROVIDER_NOT_FOUND, 22_003, :VIX_E_WRAPPER_PLAYER_NOT_INSTALLED, 22_004, :VIX_E_WRAPPER_RUNTIME_NOT_INSTALLED, 22_005, :VIX_E_WRAPPER_MULTIPLE_SERVICEPROVIDERS, 22_006, # FuseMnt errors :VIX_E_MNTAPI_MOUNTPT_NOT_FOUND, 24_000, :VIX_E_MNTAPI_MOUNTPT_IN_USE, 24_001, :VIX_E_MNTAPI_DISK_NOT_FOUND, 24_002, :VIX_E_MNTAPI_DISK_NOT_MOUNTED, 24_003, :VIX_E_MNTAPI_DISK_IS_MOUNTED, 24_004, :VIX_E_MNTAPI_DISK_NOT_SAFE, 24_005, :VIX_E_MNTAPI_DISK_CANT_OPEN, 24_006, :VIX_E_MNTAPI_CANT_READ_PARTS, 24_007, :VIX_E_MNTAPI_UMOUNT_APP_NOT_FOUND, 24_008, :VIX_E_MNTAPI_UMOUNT, 24_009, :VIX_E_MNTAPI_NO_MOUNTABLE_PARTITONS, 24_010, :VIX_E_MNTAPI_PARTITION_RANGE, 24_011, :VIX_E_MNTAPI_PERM, 24_012, :VIX_E_MNTAPI_DICT, 24_013, :VIX_E_MNTAPI_DICT_LOCKED, 24_014, :VIX_E_MNTAPI_OPEN_HANDLES, 24_015, :VIX_E_MNTAPI_CANT_MAKE_VAR_DIR, 24_016, :VIX_E_MNTAPI_NO_ROOT, 24_017, :VIX_E_MNTAPI_LOOP_FAILED, 24_018, :VIX_E_MNTAPI_DAEMON, 24_019, :VIX_E_MNTAPI_INTERNAL, 24_020, :VIX_E_MNTAPI_SYSTEM, 24_021, :VIX_E_MNTAPI_NO_CONNECTION_DETAILS, 24_022, # FuseMnt errors: Do not exceed 24299 # VixMntapi errors :VIX_E_MNTAPI_INCOMPATIBLE_VERSION, 24_300, :VIX_E_MNTAPI_OS_ERROR, 24_301, :VIX_E_MNTAPI_DRIVE_LETTER_IN_USE, 24_302, :VIX_E_MNTAPI_DRIVE_LETTER_ALREADY_ASSIGNED, 24_303, :VIX_E_MNTAPI_VOLUME_NOT_MOUNTED, 24_304, :VIX_E_MNTAPI_VOLUME_ALREADY_MOUNTED, 24_305, :VIX_E_MNTAPI_FORMAT_FAILURE, 24_306, :VIX_E_MNTAPI_NO_DRIVER, 24_307, :VIX_E_MNTAPI_ALREADY_OPENED, 24_308, :VIX_E_MNTAPI_ITEM_NOT_FOUND, 24_309, :VIX_E_MNTAPI_UNSUPPROTED_BOOT_LOADER, 24_310, :VIX_E_MNTAPI_UNSUPPROTED_OS, 24_311, :VIX_E_MNTAPI_CODECONVERSION, 24_312, :VIX_E_MNTAPI_REGWRITE_ERROR, 24_313, :VIX_E_MNTAPI_UNSUPPORTED_FT_VOLUME, 24_314, :VIX_E_MNTAPI_PARTITION_NOT_FOUND, 24_315, :VIX_E_MNTAPI_PUTFILE_ERROR, 24_316, :VIX_E_MNTAPI_GETFILE_ERROR, 24_317, :VIX_E_MNTAPI_REG_NOT_OPENED, 24_318, :VIX_E_MNTAPI_REGDELKEY_ERROR, 24_319, :VIX_E_MNTAPI_CREATE_PARTITIONTABLE_ERROR, 24_320, :VIX_E_MNTAPI_OPEN_FAILURE, 24_321, :VIX_E_MNTAPI_VOLUME_NOT_WRITABLE, 24_322, # Network Errors :VIX_E_NET_HTTP_UNSUPPORTED_PROTOCOL, 30_001, :VIX_E_NET_HTTP_URL_MALFORMAT, 30_003, :VIX_E_NET_HTTP_COULDNT_RESOLVE_PROXY, 30_005, :VIX_E_NET_HTTP_COULDNT_RESOLVE_HOST, 30_006, :VIX_E_NET_HTTP_COULDNT_CONNECT, 30_007, :VIX_E_NET_HTTP_HTTP_RETURNED_ERROR, 30_022, :VIX_E_NET_HTTP_OPERATION_TIMEDOUT, 30_028, :VIX_E_NET_HTTP_SSL_CONNECT_ERROR, 30_035, :VIX_E_NET_HTTP_TOO_MANY_REDIRECTS, 30_047, :VIX_E_NET_HTTP_TRANSFER, 30_200, :VIX_E_NET_HTTP_SSL_SECURITY, 30_201, :VIX_E_NET_HTTP_GENERIC, 30_202 )
- DiskType =
Disk types
enum( :DISK_MONOLITHIC_SPARSE, 1, # monolithic file, sparse :DISK_MONOLITHIC_FLAT, 2, # monolithic file, all space pre-allocated :DISK_SPLIT_SPARSE, 3, # disk split into 2GB extents, sparse :DISK_SPLIT_FLAT, 4, # disk split into 2GB extents, pre-allocated :DISK_VMFS_FLAT, 5, # ESX 3.0 and above flat disks :DISK_STREAM_OPTIMIZED, 6, # compressed monolithic sparse :DISK_VMFS_THIN, 7, # ESX 3.0 and above thin provisioned :DISK_VMFS_SPARSE, 8, # ESX 3.0 and above sparse disks :DISK_UNKNOWN, 256 # unknown type )
- AdapterType =
Disk adapter types
enum( :ADAPTER_IDE, 1, :ADAPTER_SCSI_BUSLOGIC, 2, :ADAPTER_SCSI_LSILOGIC, 3, :ADAPTER_UNKNOWN, 256 )
- CredType =
Credential Type - SessionId not yet supported
enum( :VIXDISKLIB_CRED_UID, 1, # use userid password :VIXDISKLIB_CRED_SESSIONID, 2, # http session id :VIXDISKLIB_CRED_TICKETID, 3, # vim ticket id :VIXDISKLIB_CRED_SSPI, 4, # Windows only - use current thread credentials. :VIXDISKLIB_CRED_UNKNOWN, 256 )
- VIXDISKLIB_SECTOR_SIZE =
512
- HWVERSION_WORKSTATION_4 =
VMware Workstation 4.x and GSX Server 3.x
3
- HWVERSION_WORKSTATION_5 =
VMware Workstation 5.x and Server 1.x
4
- HWVERSION_ESX30 =
VMware ESX Server 3.0
HWVERSION_WORKSTATION_5
- HWVERSION_WORKSTATION_6 =
VMware Workstation 6.x
6
- HWVERSION_CURRENT =
Defines the state of the art hardware version. Be careful using this as it will change from time to time.
HWVERSION_WORKSTATION_6
- VIXDISKLIB_FLAG_OPEN_UNBUFFERED =
Flags for open
(1 << 0)
- VIXDISKLIB_FLAG_OPEN_SINGLE_LINK =
don’t open parent disk(s)
(1 << 1)
- VIXDISKLIB_FLAG_OPEN_READ_ONLY =
open read-only
(1 << 2)
Class Method Summary collapse
-
.attach ⇒ Object
Attaches the child disk chain to the parent disk chain.
- .attach_function(*args) ⇒ Object
-
.check_repair ⇒ Object
Check a sparse disk for internal consistency.
-
.cleanup ⇒ Object
Perform a cleanup after an unclean shutdown of an application using VixDiskLib.
-
.clone ⇒ Object
Copies a disk with proper conversion.
-
.close ⇒ Object
Closes the disk.
-
.connect ⇒ Object
Connects to a local / remote server.
-
.connect_ex ⇒ Object
Create a transport context to access disks belonging to a particular snapshot of a particular virtual machine.
-
.create ⇒ Object
Creates a local disk.
-
.create_child ⇒ Object
Creates a redo log from a parent disk.
-
.defragment ⇒ Object
Defragments an existing disk.
-
.disconnect ⇒ Object
Breaks an existing connection.
-
.end_access ⇒ Object
This function is used to notify the host of a virtual machine that the virtual machine disks are closed and that the operations which rely on the virtual machine disks to be closed can now be allowed.
- .enum(*args) ⇒ Object
- .evaluate_versioned_connect_params ⇒ Object
-
.exit ⇒ nil
Cleans up VixDiskLib.
-
.free_connect_params ⇒ Object
Free the connection details structure allocated during VixDiskLib_GetConnectParams.
-
.free_error_text(errMsg) ⇒ nil
Free the error message returned by get_error_text.
-
.get_connect_params ⇒ Object
Return the details for the connection.
-
.get_error_text(err, locale) ⇒ String
Returns the textual description of an error.
-
.get_info ⇒ Object
Retrieves information about a disk.
-
.get_metadata_keys ⇒ Object
Retrieves the list of keys in the metadata table.
-
.get_transport_mode ⇒ Object
Returns a pointer to a static string identifying the transport mode that is used to access the virtual disk’s data.
-
.grow ⇒ Object
Grows an existing disk, only local disks are grown.
-
.init(majorVersion, minorVersion, log, warn, panic, libDir) ⇒ VixError
Initializes VixDiskLib - deprecated, please use initEx.
-
.initEx(majorVersion, minorVersion, log, warn, panic, libDir, configFile) ⇒ VixError
Initializes VixDiskLib.
-
.is_attach_possible ⇒ Object
Checks if the child disk chain can be attached to the parent disk chain.
-
.list_transport_modes ⇒ Object
Get a list of transport modes known to VixDiskLib.
-
.load_error ⇒ Object
Maintain backwards compatibility with the previous method of loading libvixDiskLib.
-
.open ⇒ Object
Opens a local or remote virtual disk.
-
.prepare_for_access ⇒ Object
This function is used to notify the host of the virtual machine that the disks of the virtual machine will be opened.
-
.ProgressFunc(progress_data, percent_completed) ⇒ Boolean
Prototype for the progress function called by VixDiskLib.
-
.read ⇒ Object
Reads a sector range.
-
.read_metadata ⇒ Object
Retrieves the value of a metadata entry corresponding to the supplied key.
-
.rename ⇒ Object
Renames a virtual disk.
-
.shrink ⇒ Object
Shrinks an existing disk, only local disks are shrunk.
-
.space_needed_for_clone ⇒ Object
Compute the space (in bytes) required to copy a disk chain.
-
.unlink ⇒ Object
Deletes all extents of the specified disk link.
-
.vix_error_code(err) ⇒ Object
An error is a 64-bit value.
- .vix_failed?(err) ⇒ Boolean
- .vix_succeeded?(err) ⇒ Boolean
-
.write ⇒ Object
Writes a sector range.
-
.write_metadata ⇒ Object
Creates or modifies a metadata table entry.
Class Method Details
.attach ⇒ Object
Attaches the child disk chain to the parent disk chain. Parent handle is invalid after attaching and child represents the combined disk chain.
655 656 657 658 659 660 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 655 attach_function :attach, :VixDiskLib_Attach, [ :pointer, # parent, :pointer # child ], :VixError |
.attach_function(*args) ⇒ Object
8 9 10 11 12 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 8 def self.attach_function(*args) super rescue FFI::NotFoundError warn "unable to attach #{args.first}" end |
.check_repair ⇒ Object
Check a sparse disk for internal consistency.
685 686 687 688 689 690 691 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 685 attach_function :check_repair, :VixDiskLib_CheckRepair, [ :pointer, # connection, :pointer, # filename, :bool # repair ], :VixError |
.cleanup ⇒ Object
Perform a cleanup after an unclean shutdown of an application using VixDiskLib.
When using VixDiskLib_ConnectEx, some state might have not been cleaned up if the resulting connection was not shut down cleanly. Use VixDiskLib_Cleanup to remove this extra state.
99 100 101 102 103 104 105 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 99 attach_function :cleanup, :VixDiskLib_Cleanup, [ ConnectParams, # connectParams, :pointer, # numCleanedUp, :pointer # numRemaining ], :VixError |
.clone ⇒ Object
Copies a disk with proper conversion.
580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 580 attach_function :clone, :VixDiskLib_Clone, [ :Connection, # dstConnection, :pointer, # dstPath, :Connection, # srcConnection, :pointer, # srcPath, CreateParams, # createParams, :ProgressFunc, # progressFunc, :pointer, # progressCallbackData :bool # overWrite ], :VixError |
.close ⇒ Object
Closes the disk.
111 112 113 114 115 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 111 attach_function :close, :VixDiskLib_Close, [ :pointer # disk handle ], :VixError |
.connect ⇒ Object
Connects to a local / remote server.
124 125 126 127 128 129 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 124 attach_function :connect, :VixDiskLib_Connect, [ ConnectParams, # connectParams, :Connection # connection ], :VixError |
.connect_ex ⇒ Object
Create a transport context to access disks belonging to a particular snapshot of a particular virtual machine. Using this transport context will enable callers to open virtual disks using the most efficient data acces protocol available for managed virtual machines, hence getting better I/O performance.
If this call is used instead of VixDiskLib_Connect, the additional information passed in will be used in order to optimize the I/O access path, to maximize I/O throughput.
Note: For local virtual machines/disks, this call is equivalent
to VixDiskLib_Connect.
168 169 170 171 172 173 174 175 176 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 168 attach_function :connect_ex, :VixDiskLib_ConnectEx, [ ConnectParams, # connectParams, :bool, # readOnly flag :pointer, # snapshotRef string :pointer, # transportModes string :Connection # connection ], :VixError |
.create ⇒ Object
Creates a local disk. Remote disk creation is not supported.
187 188 189 190 191 192 193 194 195 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 187 attach_function :create, :VixDiskLib_Create, [ :Connection, # connection, :pointer, # path, CreateParams, # createParams, :ProgressFunc, # progressFunc, :pointer # progressCallbackData ], :VixError |
.create_child ⇒ Object
Creates a redo log from a parent disk.
207 208 209 210 211 212 213 214 215 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 207 attach_function :create_child, :VixDiskLib_CreateChild, [ :pointer, # diskHandle, :pointer, # childPath, :int, # diskType, :ProgressFunc, # progressFunc, :pointer # progressCallbackData ], :VixError |
.defragment ⇒ Object
Defragments an existing disk.
542 543 544 545 546 547 548 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 542 attach_function :defragment, :VixDiskLib_Defragment, [ :pointer, # diskHandle, :ProgressFunc, # progressFunc, :pointer # progressCallbackData ], :VixError |
.disconnect ⇒ Object
Breaks an existing connection.
221 222 223 224 225 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 221 attach_function :disconnect, :VixDiskLib_Disconnect, [ :Connection # connection ], :VixError |
.end_access ⇒ Object
This function is used to notify the host of a virtual machine that the virtual machine disks are closed and that the operations which rely on the virtual machine disks to be closed can now be allowed.
236 237 238 239 240 241 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 236 attach_function :end_access, :VixDiskLib_EndAccess, [ ConnectParams, # connectParams, :pointer # identity string ], :VixError |
.enum(*args) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/ffi-vix_disk_lib/enum.rb', line 8 def self.enum(*args) s = super # Expose enums as constants s.symbols.each { |sym| const_set(sym, s[sym]) } s end |
.evaluate_versioned_connect_params ⇒ Object
59 60 61 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 59 def self.evaluate_versioned_connect_params Gem::Version.new(VERSION) >= Gem::Version.new("6.5.0") ? ConnectParams_6_5_0 : ConnectParams_1_0_0 end |
.exit ⇒ nil
Cleans up VixDiskLib.
248 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 248 attach_function :exit, :VixDiskLib_Exit, [], :void |
.free_connect_params ⇒ Object
Free the connection details structure allocated during VixDiskLib_GetConnectParams.
631 632 633 634 635 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 631 attach_function :free_connect_params, :VixDiskLib_FreeConnectParams, [ :pointer # connectParams ], :void |
.free_error_text(errMsg) ⇒ nil
Free the error message returned by get_error_text.
It is OK to call this function with nil.
257 258 259 260 261 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 257 attach_function :free_error_text, :VixDiskLib_FreeErrorText, [ :pointer # errMsg to free ], :void |
.get_connect_params ⇒ Object
Return the details for the connection.
619 620 621 622 623 624 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 619 attach_function :get_connect_params, :VixDiskLib_GetConnectParams, [ :pointer, # connection, :pointer # connectParams ], :VixError |
.get_error_text(err, locale) ⇒ String
Returns the textual description of an error.
by free_error_text. Returns NULL if there is an error in retrieving text.
272 273 274 275 276 277 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 272 attach_function :get_error_text, :VixDiskLib_GetErrorText, [ :VixError, # err :pointer # locale ], :pointer |
.get_info ⇒ Object
Retrieves information about a disk.
598 599 600 601 602 603 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 598 attach_function :get_info, :VixDiskLib_GetInfo, [ :pointer, # disk handle :pointer # disk info ], :VixError |
.get_metadata_keys ⇒ Object
Retrieves the list of keys in the metadata table. Key names are returned as list of null-terminated strings, followed by an additional NULL character.
289 290 291 292 293 294 295 296 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 289 attach_function :get_metadata_keys, :VixDiskLib_GetMetadataKeys, [ :pointer, # diskHandle, :pointer, # keys, :uint64, # size_t maxLen, :pointer, # requiredLen ], :VixError |
.get_transport_mode ⇒ Object
Returns a pointer to a static string identifying the transport mode that is used to access the virtual disk’s data.
If a disk was opened through a connection obtained by VixDiskLib_Connect, the return value will be “file” for a local disk and “nbd” or “nbdssl” for a managed disk.
The pointer to this string is static and must not be deallocated by the caller.
311 312 313 314 315 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 311 attach_function :get_transport_mode, :VixDiskLib_GetTransportMode, [ :pointer # diskHandle ], :pointer |
.grow ⇒ Object
Grows an existing disk, only local disks are grown.
509 510 511 512 513 514 515 516 517 518 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 509 attach_function :grow, :VixDiskLib_Grow, [ :Connection, # connection, :pointer, # path, :SectorType, # capacity, :bool, # updateGeometry, :ProgressFunc, # progressFunc, :pointer # progressCallbackData ], :VixError |
.init(majorVersion, minorVersion, log, warn, panic, libDir) ⇒ VixError
Initializes VixDiskLib - deprecated, please use initEx.
328 329 330 331 332 333 334 335 336 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 328 attach_function :init, :VixDiskLib_Init, [ :uint32, # majorVersion :uint32, # minorVersion :GenericLogFunc, # log :GenericLogFunc, # warn :GenericLogFunc, # panic :string, # libDir ], :VixError |
.initEx(majorVersion, minorVersion, log, warn, panic, libDir, configFile) ⇒ VixError
Initializes VixDiskLib.
355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 355 attach_function :init_ex, :VixDiskLib_InitEx, [ :uint32, # majorVersion :uint32, # minorVersion :GenericLogFunc, # log :GenericLogFunc, # warn :GenericLogFunc, # panic :string, # libDir :string, # configFile ], :VixError |
.is_attach_possible ⇒ Object
Checks if the child disk chain can be attached to the parent disk chain.
642 643 644 645 646 647 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 642 attach_function :is_attach_possible, :VixDiskLib_IsAttachPossible, [ :pointer, # parent, :pointer # child ], :VixError |
.list_transport_modes ⇒ Object
Get a list of transport modes known to VixDiskLib. This list is also the default used if VixDiskLib_ConnectEx is called with transportModes set to NULL.
The string is a list of transport modes separated by colons. For example: “file:san:hotadd:nbd”. See VixDiskLib_ConnectEx for more details.
392 393 394 395 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 392 attach_function :list_transport_modes, :VixDiskLib_ListTransportModes, [ ], :pointer |
.load_error ⇒ Object
Maintain backwards compatibility with the previous method of loading libvixDiskLib
18 19 20 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 18 def self.load_error nil end |
.open ⇒ Object
Opens a local or remote virtual disk.
408 409 410 411 412 413 414 415 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 408 attach_function :open, :VixDiskLib_Open, [ :Connection, # connection :pointer, # path :uint32, # flags :pointer # disk handle ], :VixError |
.prepare_for_access ⇒ Object
This function is used to notify the host of the virtual machine that the disks of the virtual machine will be opened. The host disables operations on the virtual machine that may be adversely affected if they are performed while the disks are open by a third party application.
376 377 378 379 380 381 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 376 attach_function :prepare_for_access, :VixDiskLib_PrepareForAccess, [ ConnectParams, # connectParams, :pointer # identity ], :VixError |
.ProgressFunc(progress_data, percent_completed) ⇒ Boolean
Prototype for the progress function called by VixDiskLib.
This function may be called with the same percentage completion multiple times.
76 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 76 callback :ProgressFunc, [:pointer, :int], :bool |
.read ⇒ Object
Reads a sector range.
424 425 426 427 428 429 430 431 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 424 attach_function :read, :VixDiskLib_Read, [ :pointer, # disk handle :SectorType, # start sector :SectorType, # number of sectors :pointer # read buffer ], :VixError |
.read_metadata ⇒ Object
Retrieves the value of a metadata entry corresponding to the supplied key.
460 461 462 463 464 465 466 467 468 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 460 attach_function :read_metadata, :VixDiskLib_ReadMetadata, [ :pointer, # diskHandle, :pointer, # key, :pointer, # buf, :uint64, # size_t bufLen, :pointer, # size_t *requiredLen ], :VixError |
.rename ⇒ Object
Renames a virtual disk.
555 556 557 558 559 560 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 555 attach_function :rename, :VixDiskLib_Rename, [ :pointer, # srcFileName, :pointer # dstFileName ], :VixError |
.shrink ⇒ Object
Shrinks an existing disk, only local disks are shrunk.
527 528 529 530 531 532 533 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 527 attach_function :shrink, :VixDiskLib_Shrink, [ :pointer, # diskHandle, :ProgressFunc, # progressFunc, :pointer # progressCallbackData ], :VixError |
.space_needed_for_clone ⇒ Object
Compute the space (in bytes) required to copy a disk chain.
670 671 672 673 674 675 676 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 670 attach_function :space_needed_for_clone, :VixDiskLib_SpaceNeededForClone, [ :pointer, # diskHandle, :int, # cloneDiskType, :pointer # spaceNeeded ], :VixError |
.unlink ⇒ Object
Deletes all extents of the specified disk link. If the path refers to a parent disk, the child (redo log) will be orphaned. Unlinking the child does not affect the parent.
491 492 493 494 495 496 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 491 attach_function :unlink, :VixDiskLib_Unlink, [ :Connection, # connection, :pointer # const char *path ], :VixError |
.vix_error_code(err) ⇒ Object
An error is a 64-bit value. If there is no error, then the value is set to VIX_OK. If there is an error, then the least significant bits will be set to one of the integer error codes defined below. The more significant bits may or may not be set to various values, depending on the errors.
47 48 49 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 47 def self.vix_error_code(err) err & 0xFFFF end |
.vix_failed?(err) ⇒ Boolean
55 56 57 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 55 def self.vix_failed?(err) err != VixErrorType[:VIX_OK] end |
.vix_succeeded?(err) ⇒ Boolean
51 52 53 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 51 def self.vix_succeeded?(err) err == VixErrorType[:VIX_OK] end |
.write ⇒ Object
Writes a sector range.
440 441 442 443 444 445 446 447 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 440 attach_function :write, :VixDiskLib_Write, [ :pointer, # disk handle :SectorType, # start sector :SectorType, # number of sectors :pointer # write buffer ], :VixError |
.write_metadata ⇒ Object
Creates or modifies a metadata table entry.
476 477 478 479 480 481 482 |
# File 'lib/ffi-vix_disk_lib/api.rb', line 476 attach_function :write_metadata, :VixDiskLib_WriteMetadata, [ :pointer, # diskHandle, :pointer, # key, :pointer # val ], :VixError |