Maybe it is just me but I believe to have found an error in the book. On page 81, there are instructions for symlinking the /var/lib/libvirt/images directory to a folder /home/user/KVM, which I have done. Then following the order of the book, I'm seeing a screen shot showing root user using virt-install, however, when I replicate this, I get an error message:
[root@srv ~]# virt-install --prompt
What is the name of your virtual machine?
server1.example.com
How much RAM should be allocated (in megabytes)?
1024
What would you like to use as the disk (file path)?
/home/mhillsman/KVM/server1.example.com.img
How large would you like the disk (/home/mhillsman/KVM/server1.example.com.img) to be (in gigabytes)?
16
What is the install CD-ROM/ISO or URL?
ftp://75.148.181.193/pub/inst/one
Starting install...
Retrieving file .treeinfo... | 674 B 00:00 ...
Retrieving file vmlinuz... | 7.6 MB 00:00 ...
Retrieving file initrd.img... | 60 MB 00:00 ...
Creating storage file server1.example.com.img | 16 GB 00:00
ERROR internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu-kvm: -drive file=/home/mhillsman/KVM/server1.example.com.img,if=none,id=drive-virtio-disk0,format=raw,cache=none: could not open disk image /home/mhillsman/KVM/server1.example.com.img: Permission denied
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start server1.example.com
otherwise, please restart your installation.
[root@srv ~]# su - mhillsman
[mhillsman@srv ~]$ virt-install --prompt
What is the name of your virtual machine?
server2.example.com
How much RAM should be allocated (in megabytes)?
1024
What would you like to use as the disk (file path)?
/home/mhillsman/KVM/server2.example.com.img
How large would you like the disk (/home/mhillsman/KVM/server2.example.com.img) to be (in gigabytes)?
16
What is the install CD-ROM/ISO or URL?
ftp://75.148.181.193/pub/inst/one
Starting install...
Retrieving file .treeinfo... | 674 B 00:00 ...
Retrieving file vmlinuz... | 7.6 MB 00:00 ...
Retrieving file initrd.img... | 60 MB 00:00 ...
Creating storage file server2.example.com.img | 16 GB 00:00
Creating domain... | 0 B 00:00
Connected to domain server2.example.com
Escape character is ^]
gPXE (
http://etherboot.org) - 00:03.0 C100 PCI2.10 PnP BBS PMM3FE0@10 C100
Probing EDD (edd=off to disable)... ok
However as you can see, running virt-install --prompt as normal user, throws no errors.
Here are the permissions and SELinux contexts for the /var/lib/libvirt/images symlink and /home/user/KVM:
Before requested changes,
[root@srv ~]# ls -lZh /var/lib/libvirt/ /home/mhillsman
/home/user:
...
/var/lib/libvirt/:
...
drwx--x--x. root root system_u
bject_r:virt_image_t:s0 images
...
[root@srv ~]# su - mhillsman
[mhillsman@srv ~]$ mkdir /home/mhillsman/KVM
[mhillsman@srv ~]$ logout
[root@srv ~]# chcon -R --reference=/var/lib/libvirt/images /home/mhillsman/KVM
[root@srv ~]# su - mhillsman
[mhillsman@srv ~]$ rmdir /var/lib/libvirt/images
rmdir: failed to remove `/var/lib/libvirt/images': Permission denied
[mhillsman@srv ~]$ logout
[root@srv ~]# rmdir /var/lib/libvirt/images
[root@srv ~]# su - mhillsman
[mhillsman@srv ~]$ ln -s /home/mhillsman/KVM /var/lib/libvirt/images
ln: creating symbolic link `/var/lib/libvirt/images': Permission denied
[mhillsman@srv ~]$ ls -lZh /var/lib/libvirt/ /home/mhillsman/
/home/mhillsman/:
...
drwxrwxr-x. mhillsman mhillsman system_u
bject_r:virt_image_t:s0 KVM
...
/var/lib/libvirt/:
...
[mhillsman@srv ~]$ logout
[root@srv ~]# ln -s /home/mhillsman/KVM /var/lib/libvirt/images
[root@srv ~]# ls -lZh /var/lib/libvirt/ /home/mhillsman
/home/mhillsman:
...
drwxrwxr-x. mhillsman mhillsman system_u
bject_r:virt_image_t:s0 KVM
...
/var/lib/libvirt/:
...
lrwxrwxrwx. root root unconfined_u
bject_r:virt_var_lib_t:s0 images -> /home/mhillsman/KVM
...