Categories
CentOS Linux Random Storage

NFS Setup for RHV and Ovirt

Today I will detail how to configure a NFS server to be used as a storage domain provider for Red Hat Virtualization (RHV) or Ovirt. I will be using CentOS as my NFS OS but this will also work with RHEL.

After we have our base OS installed we want to go ahead and update to the latest verison. Followed by installing nfs-utils for get our NFS server up and going.

sudo yum update -y
sudo yum install nfs-utils -y
sudo reboot #if needed

Now let’s enable our nfs service and open our firewall ports.

sudo systemctl enable --now nfs-server
sudo systemctl enable --now rpcbind
sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --add-service=rpc-bind --permanent
sudo firewall-cmd --add-service=mountd --permanent
sudo firewall-cmd --reload

From here we will want to create our directories we want to export. Normally there are 3 different domains you need; export, iso, and data. I will be making these in my users home directory to make it easy since the OS installer provisions more free space to /home.

mkdir ~/{export,iso,data}
chmod 0755 ~/{export,iso,data}
sudo chown 36:36 /home/<username>/{export,iso,data}

Because we are using the home directory for NFS we need to edit our SE Linux boolean value to allow this behavior.

sudo setsebool -P use_nfs_home_dirs 1

From here we just need to configure our exports and restart the nfs server and we are off to the races!

sudo vi /etc/exports

Add the following lines to the exports file, save the file, and restart the nfs service.

/home/<username>/export *(rw,sync)
/home/<username>/data *(rw,sync)
/home/<username>/iso *(rw,sync)


sudo systemctl restart nfs-server

Note you can replace the * in the above file with the IP of the server or even the subnet to only allow access to certain IPs/networks. See exports man page for more details.

Now because I don’t like typing long paths for my NFS server let’s create some symlinks for the directories we created above.

sudo ln -s /home/<username>/data /data
sudo ln -s /home/<username>/export /export
sudo ln -s /home/<username>/iso /iso

Tada your NFS server is ready to serve data for your virtualization platform!

-Mike

Categories
Linux RHEL Virtualization

Nested Virtualization on RHV 4.3

While diving into Red Hat virtualization, I wanted to do some nested virtualization on my Intel NUC. In order to do nested virtualization on RHV 4.3 there are a few things you must configure. Please note that this feature is in tech preview currently.

First we need to check to make sure that nested virtualization is enabled on our host node. The Fedora docs have a great page for this. https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/

In order to enable nested virtualization in RHV. You will need to pin the VM that you want to use it on to a particular host and disallow migration of that VM using live migration features. For me since this is a single NUC.

When building a new virtual machine or editing an existing one you will be looking at a screen that looks like the one below. Click on the ‘Host’ tab.

After you click on the host tab you will be looking at a screen similar to the screenshot below. You will want to pin the VM to a particular host, set the migration mode to Allow manual migration only. Once this is completed the Pass-Through Host CPU button will be enabled for use.

Now you will be able to do nested virtualization inside that particular VM. Repeat for any additional VMs you would like to have nested virtualization enabled.

Happy Nesting! – Mike