9.16.3. Configure shared volumes for virtual machines
Enable high-availability scenarios like Windows Failover Clustering by configuring shared disks to allow multiple virtual machines to access the same storage volume. A shared disk’s volume must be block mode.
You configure disk sharing by exposing the storage as either of these types:
- An ordinary VM disk
- A logical unit number (LUN) disk with an SCSI connection and raw device mapping, as required for Windows Failover Clustering for shared volumes
In addition to configuring disk sharing, you can also set an error policy for each ordinary VM disk or LUN disk. The error policy controls how the hypervisor behaves when an input/output error occurs on a disk Read or Write.
9.16.3.1. Configuring disk sharing by using virtual machine disks 링크 복사링크가 클립보드에 복사되었습니다!
You can configure block volumes so that multiple virtual machines (VMs) can share storage.
The application running on the guest operating system determines the storage option you must configure for the VM. A disk of type disk exposes the volume as an ordinary disk to the VM.
You can set an error policy for each disk. The error policy controls how the hypervisor behaves when an input/output error occurs while a disk is being written to or read. The default behavior stops the VM and generates a Kubernetes event.
You can accept the default behavior, or you can set the error policy to one of the following options:
-
report, which reports the error in the guest. -
ignore, which ignores the error. The Read or Write failure is undetected. -
enospace, which produces an error indicating that there is not enough disk space.
Prerequisites
The volume access mode must be
ReadWriteMany(RWX) if the VMs that are sharing disks are running on different nodes.If the VMs that are sharing disks are running on the same node,
ReadWriteOnce(RWO) volume access mode is sufficient.- The storage provider must support the required Container Storage Interface (CSI) driver.
Procedure
Create the
VirtualMachinemanifest for your VM to set the required values, as shown in the following example:apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: name: <vm_name> spec: template: # ... spec: domain: devices: disks: - disk: bus: virtio name: rootdisk errorPolicy: report - disk: bus: virtio name: cluster shareable: true interfaces: - masquerade: {} name: default-
spec.template.spec.domain.devices.disks.errorPolicydefines how the hypervisor should behave when an IO error occurs. -
spec.template.spec.domain.devices.disks.shareabledefines whether multiple virtual machines (VMs) can use the same underlying disk.
-
-
Save the
VirtualMachinemanifest file to apply your changes.