From: Madhuri Appana <[email protected]>

Signed-off-by: Madhuri Appana <[email protected]>
---
 client/tests/kvm/guest-hw.cfg.sample |   13 +++++++++++++
 client/virt/kvm_vm.py                |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/guest-hw.cfg.sample 
b/client/tests/kvm/guest-hw.cfg.sample
index 0f8bb15..9d26033 100644
--- a/client/tests/kvm/guest-hw.cfg.sample
+++ b/client/tests/kvm/guest-hw.cfg.sample
@@ -103,3 +103,16 @@ variants:
     - hugepages:
         setup_hugepages = yes
         extra_params += " -mem-path /mnt/kvm_hugepage"
+
+variants:
+    - @no_9p_export:
+    - 9p_export:
+         # 9p_fs_driver support include local, handle, proxy
+         9p_fs_driver = local
+         9p_export_dir = /mnt/
+         # 9p_security_model support include passthrough, mapped, none
+         9p_security_model = passthrough
+         9p_immediate_writeout = yes
+         9p_readonly = no
+         # Only used in case of proxy fs driver
+         #9p_socket_name = /tmp/virtfs-9p-socket
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 109290c..6004a70 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -684,6 +684,40 @@ class VM(virt_vm.BaseVM):
         if extra_params:
             qemu_cmd += " %s" % extra_params
 
+        p9_export_dir = params.get("9p_export_dir")
+        if p9_export_dir:
+            qemu_cmd += "-fsdev"
+            p9_fs_driver = params.get("9p_fs_driver")
+            if p9_fs_driver == "handle":
+                qemu_cmd += " handle,id=local1,path=" + p9_export_dir
+            elif p9_fs_driver == "proxy":
+                qemu_cmd += " proxy"
+            else:
+                p9_fs_driver = "local"
+                qemu_cmd += " local,id=local1,path=" + p9_export_dir
+
+            # security model is needed only for local fs driver
+            if p9_fs_driver == "local":
+                p9_security_model = params.get("9p_security_model")
+                if not p9_security_model:
+                    p9_security_model = "none"
+                qemu_cmd += ",security_model=" + p9_security_model
+            elif p9_fs_driver == "proxy":
+                p9_socket_name = params.get("9p_socket_name")
+                if not p9_socket_name:
+                    raise virt_vm.VMImageMissingError("Socket name not 
defined")
+                qemu_cmd += p9_socket_name
+
+            p9_immediate_writeout = params.get("9p_immediate_writeout")
+            if p9_immediate_writeout == "yes":
+                qemu_cmd += ",writeout=immediate"
+
+            p9_readonly = params.get("9p_readonly")
+            if p9_readonly == "yes":
+                qemu_cmd += ",readonly"
+
+            qemu_cmd += " -device 
virtio-9p-pci,fsdev=local1,mount_tag=autotest_tag"
+
         guest_kernel = params.get("guest_kernel_kernel_path")
         if guest_kernel:
             if not os.path.exists(guest_kernel):
-- 
1.7.6.4

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to