From: Vaclav Ehrlich <vehrl...@redhat.com>

Add openssl support required for spice ssl testing.
It creates command line options for remote-viewer, then
launches it.

Signed-off-by: Vaclav Ehrlich <vehrl...@redhat.com>
---
 client/virt/tests/rv_connect.py |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/client/virt/tests/rv_connect.py b/client/virt/tests/rv_connect.py
index 376d570..5f827fd 100644
--- a/client/virt/tests/rv_connect.py
+++ b/client/virt/tests/rv_connect.py
@@ -126,7 +126,30 @@ def launch_rv(client_vm, guest_vm, params):
         ticket = guest_vm.get_spice_var("spice_password")
 
         if guest_vm.get_spice_var("spice_ssl") == "yes":
-            raise NotImplementedError("spice-ssl")
+            host_port = guest_vm.get_spice_var("spice_tls_port")
+            cacert = "%s/%s" % (guest_vm.get_spice_var("spice_x509_prefix"),
+                               
guest_vm.get_spice_var("spice_x509_cacert_file"))
+            #cacert subj is in format for create certificate(with '/' 
delimiter)
+            #remote-viewer needs ',' delimiter. And also is needed to remove
+            #first character (it's '/')
+            host_subj = guest_vm.get_spice_var("spice_x509_server_subj")
+            host_subj = host_subj.replace('/',',')[1:]
+
+            cmd += " spice://%s?tls-port=%s" % (host_ip, host_port)
+            cmd += " --spice-ca-file=%s" % cacert
+
+            if params.get("spice_client_host_subject") == "yes":
+                cmd += " --spice-host-subject=\"%s\"" % host_subj
+
+            #client needs cacert file
+            client_session.cmd("rm -rf %s && mkdir -p %s" % (
+                               guest_vm.get_spice_var("spice_x509_prefix"),
+                               guest_vm.get_spice_var("spice_x509_prefix")))
+            virt_utils.copy_files_to(client_vm.get_address(), 'scp',
+                                     params.get("username"),
+                                     params.get("password"),
+                                     params.get("shell_port"),
+                                     cacert, cacert)
         else:
             host_port = guest_vm.get_spice_var("spice_port")
             cmd += " spice://%s?port=%s" % (host_ip, host_port)
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to