Contents

init(fileHandle:readOnly:synchronizationMode:)

Creates a new block storage device attachment from a file handle and with the specified access mode, synchronization mode, and error object that you provide.

Declaration

init(fileHandle: FileHandle, readOnly: Bool, synchronizationMode: VZDiskSynchronizationMode) throws

Parameters

  • fileHandle:

    The Filehandle to a block device to attach to this VM.

  • readOnly:

    A Boolean value that indicates whether this disk attachment is read-only; otherwise, if the file handle allows writes, the device can write data into it.

  • synchronizationMode:

    The Vzdisksynchronizationmode value that defines how the disk synchronizes with the underlying storage when the guest operating system flushes data.

Discussion

The readOnly parameter affects how the Virtualization framework exposes the disk to the guest operating system by the storage controller. If you intend to use the disk in read-only mode, it’s also a best practice to open the file handle as read-only.