oVirt is a free and open-source virtualization solution fit for running critical enterprise Workloads. oVirt / RHEV uses a centralized storage system for virtual machine disk images, ISO files and Snapshots. Network File System (NFS) is one of the supported Storage networking which you can implement among other storage solutions such as:
- GlusterFS exports
- Internet Small Computer System Interface (iSCSI)
- Local storage attached directly to the virtualization hosts
- Fibre Channel Protocol (FCP)
- Parallel NFS (pNFS)
When deploying a new oVirt Virtualization environment, setting up storage is a prerequisite for a new data center since a data center cannot be initialized unless storage domains are attached and activated. Here is the explanation of the three oVirt storage domains:
- Data Domain: A data domain holds the virtual hard disks, OVF files and snapshots of all the virtual machines and templates in a data center.
- ISO Domain: ISO domains store ISO files (or logical CDs) used to install and boot operating systems and applications for the virtual machines. It can be shared across different data centers.
- Export Domain: Export domains are temporary storage repositories that are used to copy and move images between data centers and oVirt environments. Export domains can be used to backup virtual machines.
There are standard steps for preparing an NFS storage server for use in oVirt / RHEV environment.
Step 1: Create required group / user account
Login to your NFS server and create a system user account required by oVirt when mounting NFS exports.
- Create a system group called kvm on NFS server if it doesn’t exist already:
$ getent group kvm || sudo groupadd kvm -g 36
- Create the user
vdsm
in the groupkvm
getent passwd vdsm || sudo useradd vdsm -u 36 -g 36
Step 2: Configure NFS Server
This guide assumes you have NFS Server already installed. You can check our guides below.
I have a Raid 0 device that will use for this purpose. It is mounted under /nfs.
$ df -hT /dev/md127
Filesystem Type Size Used Avail Use% Mounted on
/dev/md127 xfs 5.4T 34M 5.4T 1% /nfs
I’ll create NFS exports directories for oVirt.
sudo mkdir -p /nfs/exports/ovirt/{data,iso,export}
Set the ownership of your exported directories to 36:36, which gives vdsm:kvm ownership:
sudo chown -R 36:36 /nfs/exports/ovirt/data
sudo chown -R 36:36 /nfs/exports/ovirt/iso
sudo chown -R 36:36 /nfs/exports/ovirt/export
Change the mode of the directories to grant owner read and write access:
sudo chmod 0755 /nfs/exports/ovirt/data
sudo chmod 0755 /nfs/exports/ovirt/iso
sudo chmod 0755 /nfs/exports/ovirt/export
Configure NFS exports file like below.
$ sudo vim /etc/exports
/nfs/exports/ovirt/data *(rw,anonuid=36,anongid=36,all_squash)
/nfs/exports/ovirt/iso *(rw,anonuid=36,anongid=36,all_squash)
/nfs/exports/ovirt/export *(rw,anonuid=36,anongid=36,all_squash)
Start and enable NFS server service.
sudo systemctl enable --now nfs-server
Confirm status:
$ systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Fri 2020-01-10 15:47:13 EAT; 2s ago
Process: 8563 ExecStartPost=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Process: 8546 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 8543 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 8546 (code=exited, status=0/SUCCESS)
Tasks: 0
CGroup: /system.slice/nfs-server.service
Update NFS exports table.
$ sudo exportfs -rvv
exporting *:/nfs/exports/ovirt/export
exporting *:/nfs/exports/ovirt/iso
exporting *:/nfs/exports/ovirt/data
If you have a running Firewalld service, allow nfs services:
sudo firewall-cmd --add-service={nfs,nfs3,rpc-bind} --permanent
sudo firewall-cmd --reload
Step 3: Attaching NFS Storage to ovirt / RHEV
You can now attach an NFS storage domain to the data center in your oVirt / RHEV environment.
- In the Administration Portal, click Storage → Domains.
- Click New Domain – Fill all required details: Name, Storage type and Export Path.
Example:
A task will start executing to add Storage Domain to oVirt.
- Do the same for other Storage Domain function.
- Confirm storage domains
You can now enjoy running your Virtual Machines in oVirt / RHEV virtualization environment.