On 04/18/2012 03:44 PM, Miroslav Rezanina wrote:
Hi Lin,
there's missing check for --machine type support as this option is not support 
with older virt-install version (RHEL5).

+        def add_machine_type(help, machine_type):
+            if has_option(help, "machine"):
+                return " --machine %s" % machine_type
+            else:
+                return ""
+

Regards,
Mirek

You 're right.It's my neglencting,Thanks Mirek.:-)
----- Original Message -----
From: "Lin Qing"<[email protected]>
To: [email protected], [email protected]
Sent: Wednesday, April 18, 2012 8:46:55 AM
Subject: [Autotest] [PATCH] virt: add "--machine ?" parameter in libvirt 
command line wrappers

--machine MACHINE :set the machine type to emulate.
add libvirt command line parameter "--machine ?" wrapper in
libvirt_vm.py.

Signed-off-by: Qing Lin<[email protected]>
---
   client/virt/libvirt_vm.py |    7 +++++++
   1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 355ac5e..f66eca5 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -663,6 +663,9 @@ class VM(virt_vm.BaseVM):
           def add_name(help, name):
               return " --name '%s'" % name

+        def add_machine_type(help, machine_type):
+            return " --machine %s" % machine_type
+
           def add_hvm_or_pv(help, hvm_or_pv):
               if hvm_or_pv == "hvm":
                   return " --hvm --accelerate"
@@ -846,6 +849,10 @@ class VM(virt_vm.BaseVM):
           # Add the VM's name
           virt_install_cmd += add_name(help, name)

+        machine_type = params.get("machine_type")
+        if machine_type:
+            virt_install_cmd += add_machine_type(help, machine_type)
+
           mem = params.get("mem")
           if mem:
               virt_install_cmd += add_mem(help, mem)

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


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

Reply via email to