mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
63 lines
2.2 KiB
Plaintext
63 lines
2.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * virt/virtual_machines/virtual_disks/virt-configuring-shared-volumes-for-vms.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="virt-configuring-vm-disk-sharing_{context}"]
|
|
= Configuring disk sharing by using virtual machine disks
|
|
|
|
[role="_abstract"]
|
|
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 `VirtualMachine` manifest for your VM to set the required values, as shown in the following example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: kubevirt.io/v1
|
|
kind: VirtualMachine
|
|
metadata:
|
|
name: <vm_name>
|
|
spec:
|
|
template:
|
|
# ...
|
|
spec:
|
|
domain:
|
|
devices:
|
|
disks:
|
|
- disk:
|
|
bus: virtio
|
|
name: rootdisk
|
|
errorPolicy: report <1>
|
|
- disk:
|
|
bus: virtio
|
|
name: cluster
|
|
shareable: true <2>
|
|
interfaces:
|
|
- masquerade: {}
|
|
name: default
|
|
----
|
|
<1> Identifies the error policy.
|
|
<2> Identifies a shared disk.
|
|
|
|
. Save the `VirtualMachine` manifest file to apply your changes.
|