When we create the initial configuration, all VMs are created in the /var/lib/libvirt/images path by default. Here is the procedure to change the default path to an NFS storage path.
List pools
[root@rhev-03 ~]# virsh pool-list
Name State Autostart
---------------------------
default active yes
Destroy the default pool from GUI or CLI
root@rhev-02 ~]# virsh pool-destroy default
Pool default destroyed
Undefine pool
[root@rhev-02 ~]# virsh pool-undefine default
Pool default has been undefined
Defining a new pool with the name “Default”
[root@rhev-02 /]# virsh pool-define-as --name default --type dir --target /nfsdata/datavol02
Pool default defined
Set pool to be started when libvirt daemons starts
[root@rhev-02 /]# virsh pool-autostart default
Pool default marked as autostarted
Start pool
[root@rhev-02 /]# virsh pool-start default
Pool default started
Checking pool state
[root@rhev-02 /]# virsh pool-list
Name State Autostart
-------------------------------
default active yes
Verify if the pool default is set to the correct path
root@rhev-02 /]# virsh pool-edit default
Run a test deployment
[root@rhev-02 /]# virt-install --name demo-guest3 --memory 2048 --disk path=/nfsdata/datavol03/guest03/disk.qcow2,size=8 --vcpus 2 --os-type linux --network bridge=virbr0 --location /nfsdata/datavol01/ubuntu-18.04.6-live-server-amd64.iso --extra-args 'console=ttyS0,115200n8 serial'
WARNING --os-type is deprecated and does nothing. Please stop using it.
WARNING Graphics requested but DISPLAY is not set. Not running virt-viewer.
WARNING No console to launch for the guest, defaulting to --wait -1
Starting install...
Retrieving 'vmlinuz' | 8.1 MB 00:00:00
Retrieving 'initrd' | 58 MB 00:00:00
Allocating 'disk.qcow2' | 8.0 GB 00:00:00
Creating domain... | 00:00:00
Domain is still running. Installation may be in progress.
Waiting for the installation to complete.
(Visited 25 times, 1 visits today)