The information about sockets having different label than the one on the file
and the way it needs to be set is very difficult to find for those who did not
come across it before.  Let's describe what needs to happen in order for the
migration to go through rather than rely on general knowledge of others.

Signed-off-by: Martin Kletzander <mklet...@redhat.com>
---
 docs/manpages/virsh.rst | 9 ++++++++-
 docs/migration.html.in  | 9 +++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 1ae6d1a0d450..f0836b14defa 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3340,7 +3340,14 @@ migrating disks.  This can be *tcp://address:port* to 
specify a listen address
 UNIX socket with that specified path.  In this case you need to make sure the
 same socket path is accessible to both source and destination hypervisors and
 connecting to the socket on the source (after hypervisor creates it on the
-destination) will actually connect to the destination.
+destination) will actually connect to the destination.  If you are using 
SELinux
+(at least on the source host) you need to make sure the socket on the source is
+accessible to libvirtd/QEMU for connection.  That is because libvirt cannot
+change the context of the socket because it is different from the file
+representation of the socket and because the context is chosen by its creator
+(usually by using *setsockcreatecon{,_raw}()* functions).  Generally
+*system_r:system_u:svirt_socket_t:s0* should do the trick, but check the 
SELinux
+rules and settings of your system.
 
 
 migrate-compcache
diff --git a/docs/migration.html.in b/docs/migration.html.in
index 77731eeb373e..79ceed62747f 100644
--- a/docs/migration.html.in
+++ b/docs/migration.html.in
@@ -658,6 +658,15 @@ virsh migrate --p2p --tunnelled web1 
qemu+ssh://desthost/system qemu+ssh://10.0.
 virsh migrate web1 [--p2p] --copy-storage-all 
'qemu+unix:///system?socket=/tmp/migdir/test-sock-driver' 
'unix:///tmp/migdir/test-sock-qemu' --disks-uri unix:///tmp/migdir/test-sock-nbd
     </pre>
 
+    <p>
+      One caveat is that on SELinux-enabled systems all the sockets that the
+      hypervisor is going to connect to needs to have the proper context and
+      that is chosen before its creation by the process that creates it.  That
+      is usually done by using <code>setsockcreatecon{,raw}()</code> functions.
+      Generally *system_r:system_u:svirt_socket_t:s0* should do the trick, but
+      check the SELinux rules and settings of your system.
+    </p>
+
     <p>
       Supported by QEMU driver
     </p>
-- 
2.29.2

Reply via email to